1*fff57c55Syamt /* $OpenBSD: if.h,v 1.91 2007/06/25 16:37:58 henning Exp $ */ 2*fff57c55Syamt /* $NetBSD: if_compat.h,v 1.2 2008/06/18 09:06:27 yamt Exp $ */ 3*fff57c55Syamt 4*fff57c55Syamt /* 5*fff57c55Syamt * Copyright (c) 1982, 1986, 1989, 1993 6*fff57c55Syamt * The Regents of the University of California. All rights reserved. 7*fff57c55Syamt * 8*fff57c55Syamt * Redistribution and use in source and binary forms, with or without 9*fff57c55Syamt * modification, are permitted provided that the following conditions 10*fff57c55Syamt * are met: 11*fff57c55Syamt * 1. Redistributions of source code must retain the above copyright 12*fff57c55Syamt * notice, this list of conditions and the following disclaimer. 13*fff57c55Syamt * 2. Redistributions in binary form must reproduce the above copyright 14*fff57c55Syamt * notice, this list of conditions and the following disclaimer in the 15*fff57c55Syamt * documentation and/or other materials provided with the distribution. 16*fff57c55Syamt * 3. Neither the name of the University nor the names of its contributors 17*fff57c55Syamt * may be used to endorse or promote products derived from this software 18*fff57c55Syamt * without specific prior written permission. 19*fff57c55Syamt * 20*fff57c55Syamt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21*fff57c55Syamt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22*fff57c55Syamt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23*fff57c55Syamt * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24*fff57c55Syamt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25*fff57c55Syamt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26*fff57c55Syamt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27*fff57c55Syamt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28*fff57c55Syamt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29*fff57c55Syamt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30*fff57c55Syamt * SUCH DAMAGE. 31*fff57c55Syamt * 32*fff57c55Syamt * @(#)if.h 8.1 (Berkeley) 6/10/93 33*fff57c55Syamt */ 34*fff57c55Syamt 35*fff57c55Syamt #ifndef _NET_IF_COMPAT_H_ 36*fff57c55Syamt #define _NET_IF_COMPAT_H_ 37*fff57c55Syamt 38*fff57c55Syamt #include <sys/queue.h> 39*fff57c55Syamt 40*fff57c55Syamt /* 41*fff57c55Syamt * interface groups 42*fff57c55Syamt */ 43*fff57c55Syamt 44*fff57c55Syamt #define IFG_ALL "all" /* group contains all interfaces */ 45*fff57c55Syamt #define IFG_EGRESS "egress" /* if(s) default route(s) point to */ 46*fff57c55Syamt 47*fff57c55Syamt struct ifg_group { 48*fff57c55Syamt char ifg_group[IFNAMSIZ]; 49*fff57c55Syamt u_int ifg_refcnt; 50*fff57c55Syamt void *ifg_pf_kif; 51*fff57c55Syamt int ifg_carp_demoted; 52*fff57c55Syamt TAILQ_HEAD(, ifg_member) ifg_members; 53*fff57c55Syamt TAILQ_ENTRY(ifg_group) ifg_next; 54*fff57c55Syamt }; 55*fff57c55Syamt 56*fff57c55Syamt struct ifg_member { 57*fff57c55Syamt TAILQ_ENTRY(ifg_member) ifgm_next; 58*fff57c55Syamt struct ifnet *ifgm_ifp; 59*fff57c55Syamt }; 60*fff57c55Syamt 61*fff57c55Syamt struct ifg_list { 62*fff57c55Syamt struct ifg_group *ifgl_group; 63*fff57c55Syamt TAILQ_ENTRY(ifg_list) ifgl_next; 64*fff57c55Syamt }; 65*fff57c55Syamt 66*fff57c55Syamt TAILQ_HEAD(ifg_list_head, ifg_list); 67*fff57c55Syamt 68*fff57c55Syamt struct ifg_req { 69*fff57c55Syamt union { 70*fff57c55Syamt char ifgrqu_group[IFNAMSIZ]; 71*fff57c55Syamt char ifgrqu_member[IFNAMSIZ]; 72*fff57c55Syamt } ifgrq_ifgrqu; 73*fff57c55Syamt #define ifgrq_group ifgrq_ifgrqu.ifgrqu_group 74*fff57c55Syamt #define ifgrq_member ifgrq_ifgrqu.ifgrqu_member 75*fff57c55Syamt }; 76*fff57c55Syamt 77*fff57c55Syamt struct ifg_attrib { 78*fff57c55Syamt int ifg_carp_demoted; 79*fff57c55Syamt }; 80*fff57c55Syamt 81*fff57c55Syamt /* 82*fff57c55Syamt * Used to lookup groups for an interface 83*fff57c55Syamt */ 84*fff57c55Syamt struct ifgroupreq { 85*fff57c55Syamt char ifgr_name[IFNAMSIZ]; 86*fff57c55Syamt u_int ifgr_len; 87*fff57c55Syamt union { 88*fff57c55Syamt char ifgru_group[IFNAMSIZ]; 89*fff57c55Syamt struct ifg_req *ifgru_groups; 90*fff57c55Syamt struct ifg_attrib ifgru_attrib; 91*fff57c55Syamt } ifgr_ifgru; 92*fff57c55Syamt #define ifgr_group ifgr_ifgru.ifgru_group 93*fff57c55Syamt #define ifgr_groups ifgr_ifgru.ifgru_groups 94*fff57c55Syamt #define ifgr_attrib ifgr_ifgru.ifgru_attrib 95*fff57c55Syamt }; 96*fff57c55Syamt 97*fff57c55Syamt #ifdef _KERNEL 98*fff57c55Syamt void if_init_groups(struct ifnet *); 99*fff57c55Syamt void if_destroy_groups(struct ifnet *); 100*fff57c55Syamt struct ifg_list_head *if_get_groups(struct ifnet *); 101*fff57c55Syamt 102*fff57c55Syamt struct ifg_group *if_creategroup(const char *); 103*fff57c55Syamt int if_addgroup(struct ifnet *, const char *); 104*fff57c55Syamt int if_delgroup(struct ifnet *, const char *); 105*fff57c55Syamt void if_group_routechange(struct sockaddr *, struct sockaddr *); 106*fff57c55Syamt #endif /* _KERNEL */ 107*fff57c55Syamt 108*fff57c55Syamt #endif /* !_NET_IF_COMPAT_H_ */ 109