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