if.h revision 1.1.2.2 1 1.1.2.2 christos /* $NetBSD: if.h,v 1.1.2.2 2008/12/28 01:29:23 christos Exp $ */
2 1.1.2.1 christos
3 1.1.2.1 christos /*-
4 1.1.2.1 christos * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
5 1.1.2.1 christos * All rights reserved.
6 1.1.2.1 christos *
7 1.1.2.1 christos * This code is derived from software contributed to The NetBSD Foundation
8 1.1.2.1 christos * by William Studenmund and Jason R. Thorpe.
9 1.1.2.1 christos *
10 1.1.2.1 christos * Redistribution and use in source and binary forms, with or without
11 1.1.2.1 christos * modification, are permitted provided that the following conditions
12 1.1.2.1 christos * are met:
13 1.1.2.1 christos * 1. Redistributions of source code must retain the above copyright
14 1.1.2.1 christos * notice, this list of conditions and the following disclaimer.
15 1.1.2.1 christos * 2. Redistributions in binary form must reproduce the above copyright
16 1.1.2.1 christos * notice, this list of conditions and the following disclaimer in the
17 1.1.2.1 christos * documentation and/or other materials provided with the distribution.
18 1.1.2.1 christos * 3. All advertising materials mentioning features or use of this software
19 1.1.2.1 christos * must display the following acknowledgement:
20 1.1.2.1 christos * This product includes software developed by the NetBSD
21 1.1.2.1 christos * Foundation, Inc. and its contributors.
22 1.1.2.1 christos * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.1.2.1 christos * contributors may be used to endorse or promote products derived
24 1.1.2.1 christos * from this software without specific prior written permission.
25 1.1.2.1 christos *
26 1.1.2.1 christos * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.1.2.1 christos * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.1.2.1 christos * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.1.2.1 christos * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.1.2.1 christos * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.1.2.1 christos * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.1.2.1 christos * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.1.2.1 christos * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.1.2.1 christos * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.1.2.1 christos * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.1.2.1 christos * POSSIBILITY OF SUCH DAMAGE.
37 1.1.2.1 christos */
38 1.1.2.1 christos
39 1.1.2.1 christos /*
40 1.1.2.1 christos * Copyright (c) 1982, 1986, 1989, 1993
41 1.1.2.1 christos * The Regents of the University of California. All rights reserved.
42 1.1.2.1 christos *
43 1.1.2.1 christos * Redistribution and use in source and binary forms, with or without
44 1.1.2.1 christos * modification, are permitted provided that the following conditions
45 1.1.2.1 christos * are met:
46 1.1.2.1 christos * 1. Redistributions of source code must retain the above copyright
47 1.1.2.1 christos * notice, this list of conditions and the following disclaimer.
48 1.1.2.1 christos * 2. Redistributions in binary form must reproduce the above copyright
49 1.1.2.1 christos * notice, this list of conditions and the following disclaimer in the
50 1.1.2.1 christos * documentation and/or other materials provided with the distribution.
51 1.1.2.1 christos * 3. Neither the name of the University nor the names of its contributors
52 1.1.2.1 christos * may be used to endorse or promote products derived from this software
53 1.1.2.1 christos * without specific prior written permission.
54 1.1.2.1 christos *
55 1.1.2.1 christos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
56 1.1.2.1 christos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57 1.1.2.1 christos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
58 1.1.2.1 christos * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
59 1.1.2.1 christos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
60 1.1.2.1 christos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
61 1.1.2.1 christos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
62 1.1.2.1 christos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
63 1.1.2.1 christos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
64 1.1.2.1 christos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
65 1.1.2.1 christos * SUCH DAMAGE.
66 1.1.2.1 christos *
67 1.1.2.1 christos * @(#)if.h 8.3 (Berkeley) 2/9/95
68 1.1.2.1 christos */
69 1.1.2.1 christos
70 1.1.2.1 christos #ifndef _COMPAT_NET_IF_H_
71 1.1.2.1 christos #define _COMPAT_NET_IF_H_
72 1.1.2.1 christos
73 1.1.2.1 christos #include <compat/sys/time.h>
74 1.1.2.1 christos
75 1.1.2.1 christos /* Pre-1.5 if_data struct */
76 1.1.2.1 christos struct if_data14 {
77 1.1.2.1 christos /* generic interface information */
78 1.1.2.1 christos u_char ifi_type; /* ethernet, tokenring, etc. */
79 1.1.2.1 christos u_char ifi_addrlen; /* media address length */
80 1.1.2.1 christos u_char ifi_hdrlen; /* media header length */
81 1.1.2.1 christos u_long ifi_mtu; /* maximum transmission unit */
82 1.1.2.1 christos u_long ifi_metric; /* routing metric (external only) */
83 1.1.2.1 christos u_long ifi_baudrate; /* linespeed */
84 1.1.2.1 christos /* volatile statistics */
85 1.1.2.1 christos u_long ifi_ipackets; /* packets received on interface */
86 1.1.2.1 christos u_long ifi_ierrors; /* input errors on interface */
87 1.1.2.1 christos u_long ifi_opackets; /* packets sent on interface */
88 1.1.2.1 christos u_long ifi_oerrors; /* output errors on interface */
89 1.1.2.1 christos u_long ifi_collisions; /* collisions on csma interfaces */
90 1.1.2.1 christos u_long ifi_ibytes; /* total number of octets received */
91 1.1.2.1 christos u_long ifi_obytes; /* total number of octets sent */
92 1.1.2.1 christos u_long ifi_imcasts; /* packets received via multicast */
93 1.1.2.1 christos u_long ifi_omcasts; /* packets sent via multicast */
94 1.1.2.1 christos u_long ifi_iqdrops; /* dropped on input, this interface */
95 1.1.2.1 christos u_long ifi_noproto; /* destined for unsupported protocol */
96 1.1.2.1 christos struct timeval50 ifi_lastchange;/* last operational state change */
97 1.1.2.1 christos };
98 1.1.2.1 christos
99 1.1.2.1 christos /* pre-1.5 if_msghdr (ifm_data changed) */
100 1.1.2.1 christos struct if_msghdr14 {
101 1.1.2.1 christos u_short ifm_msglen; /* to skip over non-understood messages */
102 1.1.2.1 christos u_char ifm_version; /* future binary compatibility */
103 1.1.2.1 christos u_char ifm_type; /* message type */
104 1.1.2.1 christos int ifm_addrs; /* like rtm_addrs */
105 1.1.2.1 christos int ifm_flags; /* value of if_flags */
106 1.1.2.1 christos u_short ifm_index; /* index for associated ifp */
107 1.1.2.1 christos struct if_data14 ifm_data; /* statistics and other data about if */
108 1.1.2.1 christos };
109 1.1.2.1 christos
110 1.1.2.1 christos void compat_14_rt_ifmsg(struct ifnet *, struct if_msghdr *);
111 1.1.2.1 christos int compat_14_iflist(struct ifnet *, struct rt_walkarg *, struct rt_addrinfo *,
112 1.1.2.1 christos size_t);
113 1.1.2.1 christos
114 1.1.2.1 christos /*
115 1.1.2.1 christos * Structure defining statistics and other data kept regarding a network
116 1.1.2.1 christos * interface.
117 1.1.2.1 christos */
118 1.1.2.1 christos struct if_data50 {
119 1.1.2.1 christos /* generic interface information */
120 1.1.2.1 christos u_char ifi_type; /* ethernet, tokenring, etc. */
121 1.1.2.1 christos u_char ifi_addrlen; /* media address length */
122 1.1.2.1 christos u_char ifi_hdrlen; /* media header length */
123 1.1.2.1 christos int ifi_link_state; /* current link state */
124 1.1.2.1 christos u_quad_t ifi_mtu; /* maximum transmission unit */
125 1.1.2.1 christos u_quad_t ifi_metric; /* routing metric (external only) */
126 1.1.2.1 christos u_quad_t ifi_baudrate; /* linespeed */
127 1.1.2.1 christos /* volatile statistics */
128 1.1.2.1 christos u_quad_t ifi_ipackets; /* packets received on interface */
129 1.1.2.1 christos u_quad_t ifi_ierrors; /* input errors on interface */
130 1.1.2.1 christos u_quad_t ifi_opackets; /* packets sent on interface */
131 1.1.2.1 christos u_quad_t ifi_oerrors; /* output errors on interface */
132 1.1.2.1 christos u_quad_t ifi_collisions; /* collisions on csma interfaces */
133 1.1.2.1 christos u_quad_t ifi_ibytes; /* total number of octets received */
134 1.1.2.1 christos u_quad_t ifi_obytes; /* total number of octets sent */
135 1.1.2.1 christos u_quad_t ifi_imcasts; /* packets received via multicast */
136 1.1.2.1 christos u_quad_t ifi_omcasts; /* packets sent via multicast */
137 1.1.2.1 christos u_quad_t ifi_iqdrops; /* dropped on input, this interface */
138 1.1.2.1 christos u_quad_t ifi_noproto; /* destined for unsupported protocol */
139 1.1.2.1 christos struct timeval50 ifi_lastchange;/* last operational state change */
140 1.1.2.1 christos };
141 1.1.2.1 christos
142 1.1.2.1 christos /*
143 1.1.2.1 christos * Message format for use in obtaining information about interfaces
144 1.1.2.1 christos * from sysctl and the routing socket.
145 1.1.2.1 christos */
146 1.1.2.1 christos struct if_msghdr50 {
147 1.1.2.1 christos u_short ifm_msglen; /* to skip over non-understood messages */
148 1.1.2.1 christos u_char ifm_version; /* future binary compatibility */
149 1.1.2.1 christos u_char ifm_type; /* message type */
150 1.1.2.1 christos int ifm_addrs; /* like rtm_addrs */
151 1.1.2.1 christos int ifm_flags; /* value of if_flags */
152 1.1.2.1 christos u_short ifm_index; /* index for associated ifp */
153 1.1.2.1 christos struct if_data50 ifm_data;/* statistics and other data about if */
154 1.1.2.1 christos };
155 1.1.2.1 christos
156 1.1.2.1 christos void compat_50_rt_ifmsg(struct ifnet *, struct if_msghdr *);
157 1.1.2.1 christos int compat_50_iflist(struct ifnet *, struct rt_walkarg *, struct rt_addrinfo *,
158 1.1.2.1 christos size_t);
159 1.1.2.1 christos
160 1.1.2.1 christos #endif /* _COMPAT_NET_IF_H_ */
161