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