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