xref: /xnu-8792.61.2/bsd/net/if_bond_var.h (revision 42e220869062b56f8d7d0726fd4c88954f87902c)
1*42e22086SApple OSS Distributions /*
2*42e22086SApple OSS Distributions  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
3*42e22086SApple OSS Distributions  *
4*42e22086SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*42e22086SApple OSS Distributions  *
6*42e22086SApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*42e22086SApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*42e22086SApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*42e22086SApple OSS Distributions  * compliance with the License. The rights granted to you under the License
10*42e22086SApple OSS Distributions  * may not be used to create, or enable the creation or redistribution of,
11*42e22086SApple OSS Distributions  * unlawful or unlicensed copies of an Apple operating system, or to
12*42e22086SApple OSS Distributions  * circumvent, violate, or enable the circumvention or violation of, any
13*42e22086SApple OSS Distributions  * terms of an Apple operating system software license agreement.
14*42e22086SApple OSS Distributions  *
15*42e22086SApple OSS Distributions  * Please obtain a copy of the License at
16*42e22086SApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*42e22086SApple OSS Distributions  *
18*42e22086SApple OSS Distributions  * The Original Code and all software distributed under the License are
19*42e22086SApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*42e22086SApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*42e22086SApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*42e22086SApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*42e22086SApple OSS Distributions  * Please see the License for the specific language governing rights and
24*42e22086SApple OSS Distributions  * limitations under the License.
25*42e22086SApple OSS Distributions  *
26*42e22086SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*42e22086SApple OSS Distributions  */
28*42e22086SApple OSS Distributions 
29*42e22086SApple OSS Distributions #ifndef _NET_IF_BOND_VAR_H_
30*42e22086SApple OSS Distributions #define _NET_IF_BOND_VAR_H_
31*42e22086SApple OSS Distributions 
32*42e22086SApple OSS Distributions #include <sys/types.h>
33*42e22086SApple OSS Distributions 
34*42e22086SApple OSS Distributions #include <net/lacp.h>
35*42e22086SApple OSS Distributions 
36*42e22086SApple OSS Distributions #pragma pack(4)
37*42e22086SApple OSS Distributions 
38*42e22086SApple OSS Distributions #define IF_BOND_OP_ADD_INTERFACE                1
39*42e22086SApple OSS Distributions #define IF_BOND_OP_REMOVE_INTERFACE             2
40*42e22086SApple OSS Distributions #define IF_BOND_OP_GET_STATUS                   3
41*42e22086SApple OSS Distributions #define IF_BOND_OP_SET_VERBOSE                  4
42*42e22086SApple OSS Distributions #define IF_BOND_OP_SET_MODE                     5
43*42e22086SApple OSS Distributions 
44*42e22086SApple OSS Distributions #define IF_BOND_MODE_LACP                       0
45*42e22086SApple OSS Distributions #define IF_BOND_MODE_STATIC                     1
46*42e22086SApple OSS Distributions 
47*42e22086SApple OSS Distributions struct if_bond_partner_state {
48*42e22086SApple OSS Distributions 	lacp_system                 ibps_system;
49*42e22086SApple OSS Distributions 	lacp_system_priority        ibps_system_priority;
50*42e22086SApple OSS Distributions 	lacp_key                    ibps_key;
51*42e22086SApple OSS Distributions 	lacp_port                   ibps_port;
52*42e22086SApple OSS Distributions 	lacp_port_priority          ibps_port_priority;
53*42e22086SApple OSS Distributions 	lacp_actor_partner_state    ibps_state;
54*42e22086SApple OSS Distributions 	u_char                      ibps_reserved1;
55*42e22086SApple OSS Distributions };
56*42e22086SApple OSS Distributions 
57*42e22086SApple OSS Distributions #define IF_BOND_STATUS_SELECTED_STATE_UNSELECTED        0
58*42e22086SApple OSS Distributions #define IF_BOND_STATUS_SELECTED_STATE_SELECTED          1
59*42e22086SApple OSS Distributions #define IF_BOND_STATUS_SELECTED_STATE_STANDBY           2
60*42e22086SApple OSS Distributions 
61*42e22086SApple OSS Distributions struct if_bond_status {
62*42e22086SApple OSS Distributions 	char                        ibs_if_name[IFNAMSIZ];/* interface name */
63*42e22086SApple OSS Distributions 	lacp_port_priority          ibs_port_priority;
64*42e22086SApple OSS Distributions 	lacp_actor_partner_state    ibs_state;
65*42e22086SApple OSS Distributions 	u_char                      ibs_selected_state;
66*42e22086SApple OSS Distributions 	struct if_bond_partner_state ibs_partner_state;
67*42e22086SApple OSS Distributions 	u_int32_t                   ibs_reserved[8];
68*42e22086SApple OSS Distributions };
69*42e22086SApple OSS Distributions 
70*42e22086SApple OSS Distributions #define IF_BOND_STATUS_REQ_VERSION      1
71*42e22086SApple OSS Distributions 
72*42e22086SApple OSS Distributions struct if_bond_status_req {
73*42e22086SApple OSS Distributions 	int         ibsr_version;/* version */
74*42e22086SApple OSS Distributions 	int         ibsr_total; /* returned number of struct if_bond_status's */
75*42e22086SApple OSS Distributions 	int         ibsr_count; /* number that will fit in ibsr_buffer */
76*42e22086SApple OSS Distributions 	union {                 /* buffer to hold if_bond_status's */
77*42e22086SApple OSS Distributions 		void *          ibsru_buffer;
78*42e22086SApple OSS Distributions 		u_int64_t       ibsru_buffer64;
79*42e22086SApple OSS Distributions 	} ibsr_ibsru;
80*42e22086SApple OSS Distributions 	lacp_key    ibsr_key;   /* returned */
81*42e22086SApple OSS Distributions 	u_int8_t    ibsr_mode;  /* returned (IF_BOND_MODE_{LACP, STATIC}) */
82*42e22086SApple OSS Distributions 	u_int8_t    ibsr_reserved0;/* for future use */
83*42e22086SApple OSS Distributions 	u_int32_t   ibsr_reserved[3];/* for future use */
84*42e22086SApple OSS Distributions };
85*42e22086SApple OSS Distributions #define ibsr_buffer     ibsr_ibsru.ibsru_buffer
86*42e22086SApple OSS Distributions 
87*42e22086SApple OSS Distributions struct if_bond_req {
88*42e22086SApple OSS Distributions 	u_int32_t   ibr_op;                     /* operation */
89*42e22086SApple OSS Distributions 	union {
90*42e22086SApple OSS Distributions 		char    ibru_if_name[IFNAMSIZ]; /* interface name */
91*42e22086SApple OSS Distributions 		struct if_bond_status_req ibru_status; /* status information */
92*42e22086SApple OSS Distributions 		int     ibru_int_val;
93*42e22086SApple OSS Distributions 	} ibr_ibru;
94*42e22086SApple OSS Distributions };
95*42e22086SApple OSS Distributions 
96*42e22086SApple OSS Distributions #pragma pack()
97*42e22086SApple OSS Distributions 
98*42e22086SApple OSS Distributions #include <net/if_bond_internal.h>
99*42e22086SApple OSS Distributions 
100*42e22086SApple OSS Distributions #endif /* _NET_IF_BOND_VAR_H_ */
101