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