//pkgnet/trunk/watt32/inc/net/bpf.h |
---|
0,0 → 1,271 |
/*!\file net/bpf.h |
* Berkeley Packet Filter. |
*/ |
/* |
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 |
* The Regents of the University of California. All rights reserved. |
* |
* This code is derived from the Stanford/CMU enet packet filter, |
* (net/enet.c) distributed as part of 4.3BSD, and code contributed |
* to Berkeley by Steven McCanne and Van Jacobson both of Lawrence |
* Berkeley Laboratory. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
* must display the following acknowledgement: |
* This product includes software developed by the University of |
* California, Berkeley and its contributors. |
* 4. Neither the name of the University nor the names of its contributors |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
* |
* @(#)bpf.h 8.1 (Berkeley) 6/10/93 |
* @(#) Header: bpf.h,v 1.36 97/06/12 14:29:53 leres Exp (LBL) |
*/ |
#ifndef __NET_BPF_H |
#define __NET_BPF_H |
#ifndef __SYS_WTYPES_H |
#include <sys/wtypes.h> |
#endif |
#ifndef __SYS_WTIME_H |
#include <sys/wtime.h> |
#endif |
/* BSD style release date */ |
#define BPF_RELEASE 199606 |
typedef long bpf_int32; |
typedef u_int32_t bpf_u_int32; |
/* |
* Alignment macros. BPF_WORDALIGN rounds up to the next |
* even multiple of BPF_ALIGNMENT. |
*/ |
#define BPF_ALIGNMENT sizeof(long) |
#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1)) & ~(BPF_ALIGNMENT-1)) |
#define BPF_MAXINSNS 512 |
#define BPF_MAXBUFSIZE 0x8000 |
#define BPF_MINBUFSIZE 32 |
/* |
* Structure for BIOCSETF. |
*/ |
struct bpf_program { |
u_int bf_len; |
struct bpf_insn *bf_insns; |
}; |
/* |
* Struct returned by BIOCGSTATS. |
*/ |
struct bpf_stat { |
u_int bs_recv; /* number of packets received */ |
u_int bs_drop; /* number of packets dropped */ |
}; |
/* |
* Struct return by BIOCVERSION. This represents the version number of |
* the filter language described by the instruction encodings below. |
* bpf understands a program iff kernel_major == filter_major && |
* kernel_minor >= filter_minor, that is, if the value returned by the |
* running kernel has the same major number and a minor number equal |
* equal to or less than the filter being downloaded. Otherwise, the |
* results are undefined, meaning an error may be returned or packets |
* may be accepted haphazardly. |
* It has nothing to do with the source code version. |
*/ |
struct bpf_version { |
u_short bv_major; |
u_short bv_minor; |
}; |
/* Current version number of filter architecture. */ |
#define BPF_MAJOR_VERSION 1 |
#define BPF_MINOR_VERSION 1 |
/* |
* BPF ioctls |
* |
* The first set is for compatibility with Sun's pcc style |
* header files. If your using gcc, we assume that you |
* have run fixincludes so the latter set should work. |
*/ |
#if (defined(sun) || defined(ibm032)) && !defined(__GNUC__) |
# define BIOCGBLEN _IOR(B,102, u_int) |
# define BIOCSBLEN _IOWR(B,102, u_int) |
# define BIOCSETF _IOW(B,103, struct bpf_program) |
# define BIOCFLUSH _IO(B,104) |
# define BIOCPROMISC _IO(B,105) |
# define BIOCGDLT _IOR(B,106, u_int) |
# define BIOCGETIF _IOR(B,107, struct ifreq) |
# define BIOCSETIF _IOW(B,108, struct ifreq) |
# define BIOCSRTIMEOUT _IOW(B,109, struct timeval) |
# define BIOCGRTIMEOUT _IOR(B,110, struct timeval) |
# define BIOCGSTATS _IOR(B,111, struct bpf_stat) |
# define BIOCIMMEDIATE _IOW(B,112, u_int) |
# define BIOCVERSION _IOR(B,113, struct bpf_version) |
# define BIOCSTCPF _IOW(B,114, struct bpf_program) |
# define BIOCSUDPF _IOW(B,115, struct bpf_program) |
#else |
# define BIOCGBLEN _IOR('B',102, u_int) |
# define BIOCSBLEN _IOWR('B',102, u_int) |
# define BIOCSETF _IOW('B',103, struct bpf_program) |
# define BIOCFLUSH _IO('B',104) |
# define BIOCPROMISC _IO('B',105) |
# define BIOCGDLT _IOR('B',106, u_int) |
# define BIOCGETIF _IOR('B',107, struct ifreq) |
# define BIOCSETIF _IOW('B',108, struct ifreq) |
# define BIOCSRTIMEOUT _IOW('B',109, struct timeval) |
# define BIOCGRTIMEOUT _IOR('B',110, struct timeval) |
# define BIOCGSTATS _IOR('B',111, struct bpf_stat) |
# define BIOCIMMEDIATE _IOW('B',112, u_int) |
# define BIOCVERSION _IOR('B',113, struct bpf_version) |
# define BIOCSTCPF _IOW('B',114, struct bpf_program) |
# define BIOCSUDPF _IOW('B',115, struct bpf_program) |
#endif |
/* |
* Structure prepended to each packet. |
*/ |
struct bpf_hdr { |
struct timeval bh_tstamp; /* time stamp */ |
u_int32_t bh_caplen; /* length of captured portion */ |
u_int32_t bh_datalen; /* original length of packet */ |
u_int16_t bh_hdrlen; /* length of bpf header (this struct */ |
}; /* plus alignment padding) */ |
/* |
* Because the structure above is not a multiple of 4 bytes, some compilers |
* will insist on inserting padding; hence, sizeof(struct bpf_hdr) won't work. |
* Only the kernel needs to know about it; applications use bh_hdrlen. |
* XXX To save a few bytes on 32-bit machines, we avoid end-of-struct |
* XXX padding by using the size of the header data elements. This is |
* XXX fail-safe: on new machines, we just use the 'safe' sizeof. |
*/ |
#define SIZEOF_BPF_HDR sizeof(struct bpf_hdr) |
/* |
* Data-link level type codes. |
*/ |
#define DLT_NULL 0 /* no link-layer encapsulation */ |
#define DLT_EN10MB 1 /* Ethernet (10Mb) */ |
#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ |
#define DLT_AX25 3 /* Amateur Radio AX.25 */ |
#define DLT_PRONET 4 /* Proteon ProNET Token Ring */ |
#define DLT_CHAOS 5 /* Chaos */ |
#define DLT_IEEE802 6 /* IEEE 802 Networks */ |
#define DLT_ARCNET 7 /* ARCNET */ |
#define DLT_SLIP 8 /* Serial Line IP */ |
#define DLT_PPP 9 /* Point-to-point Protocol */ |
#define DLT_FDDI 10 /* FDDI */ |
#define DLT_ATM_RFC1483 11 /* LLC/SNAP encapsulated atm */ |
#define DLT_RAW 12 /* raw IP */ |
#define DLT_SLIP_BSDOS 13 /* BSD/OS Serial Line IP */ |
#define DLT_PPP_BSDOS 14 /* BSD/OS Point-to-point Protocol */ |
#define DLT_LANE8023 15 /* LANE 802.3(Ethernet) */ |
#define DLT_CIP 16 /* ATM Classical IP */ |
/* |
* The instruction encondings. |
*/ |
/* instruction classes */ |
#define BPF_CLASS(code) ((code) & 0x07) |
#define BPF_LD 0x00 |
#define BPF_LDX 0x01 |
#define BPF_ST 0x02 |
#define BPF_STX 0x03 |
#define BPF_ALU 0x04 |
#define BPF_JMP 0x05 |
#define BPF_RET 0x06 |
#define BPF_MISC 0x07 |
/* ld/ldx fields */ |
#define BPF_SIZE(code) ((code) & 0x18) |
#define BPF_W 0x00 |
#define BPF_H 0x08 |
#define BPF_B 0x10 |
#define BPF_MODE(code) ((code) & 0xe0) |
#define BPF_IMM 0x00 |
#define BPF_ABS 0x20 |
#define BPF_IND 0x40 |
#define BPF_MEM 0x60 |
#define BPF_LEN 0x80 |
#define BPF_MSH 0xa0 |
/* alu/jmp fields */ |
#define BPF_OP(code) ((code) & 0xf0) |
#define BPF_ADD 0x00 |
#define BPF_SUB 0x10 |
#define BPF_MUL 0x20 |
#define BPF_DIV 0x30 |
#define BPF_OR 0x40 |
#define BPF_AND 0x50 |
#define BPF_LSH 0x60 |
#define BPF_RSH 0x70 |
#define BPF_NEG 0x80 |
#define BPF_JA 0x00 |
#define BPF_JEQ 0x10 |
#define BPF_JGT 0x20 |
#define BPF_JGE 0x30 |
#define BPF_JSET 0x40 |
#define BPF_SRC(code) ((code) & 0x08) |
#define BPF_K 0x00 |
#define BPF_X 0x08 |
/* ret - BPF_K and BPF_X also apply */ |
#define BPF_RVAL(code) ((code) & 0x18) |
#define BPF_A 0x10 |
/* misc */ |
#define BPF_MISCOP(code) ((code) & 0xf8) |
#define BPF_TAX 0x00 |
#define BPF_TXA 0x80 |
/* |
* The instruction data structure. |
*/ |
struct bpf_insn { |
u_int16_t code; |
u_char jt; |
u_char jf; |
int32_t k; |
}; |
/* |
* Macros for insn array initializers. |
*/ |
#define BPF_STMT(code, k) { (u_int16_t)(code), 0, 0, k } |
#define BPF_JUMP(code, k, jt, jf) { (u_int16_t)(code), jt, jf, k } |
u_int bpf_filter (struct bpf_insn *, u_char *, u_int, u_int); |
/* |
* Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST). |
*/ |
#define BPF_MEMWORDS 16 |
#endif |
//pkgnet/trunk/watt32/inc/net/bpfdesc.h |
---|
0,0 → 1,107 |
/*!\file net/bpfdesc.h |
* Berkeley Packet Filter definitions. |
*/ |
/* $NetBSD: bpfdesc.h,v 1.13 1997/10/09 18:58:12 christos Exp $ */ |
/* |
* Copyright (c) 1990, 1991, 1993 |
* The Regents of the University of California. All rights reserved. |
* |
* This code is derived from the Stanford/CMU enet packet filter, |
* (net/enet.c) distributed as part of 4.3BSD, and code contributed |
* to Berkeley by Steven McCanne and Van Jacobson both of Lawrence |
* Berkeley Laboratory. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
* must display the following acknowledgement: |
* This product includes software developed by the University of |
* California, Berkeley and its contributors. |
* 4. Neither the name of the University nor the names of its contributors |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
* |
* @(#)bpfdesc.h 8.1 (Berkeley) 6/10/93 |
* |
* @(#) Header: bpfdesc.h,v 1.14 96/06/16 22:28:07 leres Exp (LBL) |
*/ |
#ifndef __NET_BPF_DESC_H |
#define __NET_BPF_DESC_H |
/* |
* Descriptor associated with each open bpf file. |
*/ |
struct bpf_d { |
struct bpf_d *bd_next; /* Linked list of descriptors */ |
/* |
* Buffer slots: two mbuf clusters buffer the incoming packets. |
* The model has three slots. Sbuf is always occupied. |
* sbuf (store) - Receive interrupt puts packets here. |
* hbuf (hold) - When sbuf is full, put cluster here and |
* wakeup read (replace sbuf with fbuf). |
* fbuf (free) - When read is done, put cluster here. |
* On receiving, if sbuf is full and fbuf is 0, packet is dropped. |
*/ |
caddr_t bd_sbuf; /* store slot */ |
caddr_t bd_hbuf; /* hold slot */ |
caddr_t bd_fbuf; /* free slot */ |
int bd_slen; /* current length of store buffer */ |
int bd_hlen; /* current length of hold buffer */ |
int bd_bufsize; /* absolute length of buffers */ |
struct bpf_if * bd_bif; /* interface descriptor */ |
u_long bd_rtout; /* Read timeout in 'ticks' */ |
struct bpf_insn *bd_filter; /* filter code */ |
u_long bd_rcount; /* number of packets received */ |
u_long bd_dcount; /* number of packets dropped */ |
u_char bd_promisc; /* true if listening promiscuously */ |
u_char bd_state; /* idle, waiting, or timed out */ |
u_char bd_immediate; /* true to return on packet arrival */ |
int bd_async; /* non-zero if packet reception should generate signal */ |
int bd_pgid; /* process or group id for signal */ |
#if BSD < 199103 |
u_char bd_selcoll; /* true if selects collide */ |
int bd_timedout; |
struct proc * bd_selproc; /* process that last selected us */ |
#else |
u_char bd_pad; /* explicit alignment */ |
struct selinfo bd_sel; /* bsd select info */ |
#endif |
}; |
/* |
* Descriptor associated with each attached hardware interface. |
*/ |
struct bpf_if { |
struct bpf_if *bif_next; /* list of all interfaces */ |
struct bpf_d *bif_dlist; /* descriptor list */ |
struct bpf_if **bif_driverp; /* pointer into softc */ |
u_int bif_dlt; /* link layer type */ |
u_int bif_hdrlen; /* length of header (with padding) */ |
struct ifnet *bif_ifp; /* correspoding interface */ |
}; |
#endif |
//pkgnet/trunk/watt32/inc/net/ethertyp.h |
---|
0,0 → 1,68 |
/*!\file net/ethertyp.h |
* Ethernet protocol types. |
*/ |
/* $NetBSD: ethertypes.h,v 1.2 1997/03/15 18:12:19 is Exp $ */ |
/* |
* Copyright (c) 1982, 1986, 1993 |
* The Regents of the University of California. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
* must display the following acknowledgement: |
* This product includes software developed by the University of |
* California, Berkeley and its contributors. |
* 4. Neither the name of the University nor the names of its contributors |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
* |
* @(#)if_ether.h 8.1 (Berkeley) 6/10/93 |
*/ |
/* |
* Ethernet protocol types. |
* |
* According to "assigned numbers", the Ethernet protocol numbers are also |
* used as ARP protocol type numbers. |
* |
* I factor them out here to avoid pulling all the Ethernet header file |
* into the hardware independent ARP code. -is |
*/ |
#ifndef __NET_ETHERTYPE_H |
#define __NET_ETHERTYPE_H |
#define ETHERTYPE_PUP 0x0200 /* PUP protocol */ |
#define ETHERTYPE_IP 0x0800 /* IP protocol */ |
#define ETHERTYPE_ARP 0x0806 /* address resolution protocol */ |
#define ETHERTYPE_REVARP 0x8035 /* reverse addr resolution protocol */ |
/* |
* The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have |
* (type-ETHERTYPE_TRAIL)*512 bytes of data followed |
* by an ETHER type (as given above) and then the (variable-length) header. |
*/ |
#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */ |
#define ETHERTYPE_NTRAILER 16 |
#endif |
//pkgnet/trunk/watt32/inc/net/if.h |
---|
0,0 → 1,354 |
/*!\file net/if.h |
* Network interface data. |
*/ |
/* $NetBSD: if.h,v 1.29 1997/10/02 19:41:57 is Exp $ */ |
/* |
* Copyright (c) 1982, 1986, 1989, 1993 |
* The Regents of the University of California. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
* must display the following acknowledgement: |
* This product includes software developed by the University of |
* California, Berkeley and its contributors. |
* 4. Neither the name of the University nor the names of its contributors |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
* |
* @(#)if.h 8.1 (Berkeley) 6/10/93 |
*/ |
#ifndef __NET_IF_H |
#define __NET_IF_H |
#include <sys/queue.h> |
/* |
* Structures defining a network interface, providing a packet |
* transport mechanism (ala level 0 of the PUP protocols). |
* |
* Each interface accepts output datagrams of a specified maximum |
* length, and provides higher level routines with input datagrams |
* received from its medium. |
* |
* Output occurs when the routine if_output is called, with four parameters: |
* (*ifp->if_output)(ifp, m, dst, rt) |
* Here m is the mbuf chain to be sent and dst is the destination address. |
* The output routine encapsulates the supplied datagram if necessary, |
* and then transmits it on its medium. |
* |
* On input, each interface unwraps the data received by it, and either |
* places it on the input queue of a internetwork datagram routine |
* and posts the associated software interrupt, or passes the datagram to a raw |
* packet input routine. |
* |
* Routines exist for locating interfaces by their addresses |
* or for locating a interface on a certain network, as well as more general |
* routing and gateway routines maintaining information used to locate |
* interfaces. These routines live in the files if.c and route.c |
*/ |
#ifndef __SYS_WTIME_H |
#include <sys/wtime.h> |
#endif |
struct mbuf; |
struct rtentry; |
struct ether_header; |
struct proc { int dummy; }; |
struct socket { int dummy; }; |
/* |
* Structure defining statistics and other data kept regarding a network |
* interface. |
*/ |
struct if_data { |
/* generic interface information */ |
u_char ifi_type; /* ethernet, tokenring, etc. */ |
u_char ifi_addrlen; /* media address length */ |
u_char ifi_hdrlen; /* media header length */ |
u_long ifi_mtu; /* maximum transmission unit */ |
u_long ifi_metric; /* routing metric (external only) */ |
u_long ifi_baudrate; /* linespeed */ |
/* volatile statistics */ |
u_long ifi_ipackets; /* packets received on interface */ |
u_long ifi_ierrors; /* input errors on interface */ |
u_long ifi_opackets; /* packets sent on interface */ |
u_long ifi_oerrors; /* output errors on interface */ |
u_long ifi_collisions; /* collisions on csma interfaces */ |
u_long ifi_ibytes; /* total number of octets received */ |
u_long ifi_obytes; /* total number of octets sent */ |
u_long ifi_imcasts; /* packets received via multicast */ |
u_long ifi_omcasts; /* packets sent via multicast */ |
u_long ifi_iqdrops; /* dropped on input, this interface */ |
u_long ifi_noproto; /* destined for unsupported protocol */ |
struct timeval ifi_lastchange; /* last updated */ |
}; |
/* |
* Structure defining a queue for a network interface. |
* |
* (Would like to call this struct ``if'', but C isn't PL/1.) |
*/ |
TAILQ_HEAD(ifnet_head, ifnet); /* the actual queue head */ |
/* |
* Length of interface external name, including terminating '\0'. |
* Note: this is the same size as a generic device's external name. |
*/ |
#define IFNAMSIZ 16 |
#ifndef IF_NAMESIZE |
#define IF_NAMESIZE IFNAMSIZ |
#endif |
struct ifnet { /* and the entries */ |
void *if_softc; /* lower-level data for this if */ |
TAILQ_ENTRY(ifnet) if_list; /* all struct ifnets are chained */ |
TAILQ_HEAD(xx, ifaddr) if_addrlist; /* linked list of addresses per if */ |
char if_xname[IFNAMSIZ]; /* external name (name + unit) */ |
int if_pcount; /* number of promiscuous listeners */ |
caddr_t if_bpf; /* packet filter structure */ |
u_short if_index; /* numeric abbreviation for this if */ |
short if_timer; /* time 'til if_watchdog called */ |
short if_flags; /* up/down, broadcast, etc. */ |
short if__pad1; /* be nice to m68k ports */ |
struct if_data if_data; /* statistics and other data about if */ |
/* procedure handles */ |
int (*if_output) /* output routine (enqueue) */ |
(struct ifnet *, struct mbuf *, struct sockaddr *, |
struct rtentry *); |
void (*if_start) /* initiate output routine */ |
(struct ifnet *); |
int (*if_ioctl) /* ioctl routine */ |
(struct ifnet *, u_long, caddr_t); |
int (*if_reset) /* XXX bus reset routine */ |
(struct ifnet *); |
void (*if_watchdog) /* timer routine */ |
(struct ifnet *); |
struct ifqueue { |
struct mbuf *ifq_head; |
struct mbuf *ifq_tail; |
int ifq_len; |
int ifq_maxlen; |
int ifq_drops; |
} if_snd; /* output queue */ |
struct sockaddr_dl *if_sadl; /* pointer to our sockaddr_dl */ |
u_int8_t *if_broadcastaddr; /* linklevel broadcast bytestring */ |
}; |
#define if_mtu if_data.ifi_mtu |
#define if_type if_data.ifi_type |
#define if_addrlen if_data.ifi_addrlen |
#define if_hdrlen if_data.ifi_hdrlen |
#define if_metric if_data.ifi_metric |
#define if_baudrate if_data.ifi_baudrate |
#define if_ipackets if_data.ifi_ipackets |
#define if_ierrors if_data.ifi_ierrors |
#define if_opackets if_data.ifi_opackets |
#define if_oerrors if_data.ifi_oerrors |
#define if_collisions if_data.ifi_collisions |
#define if_ibytes if_data.ifi_ibytes |
#define if_obytes if_data.ifi_obytes |
#define if_imcasts if_data.ifi_imcasts |
#define if_omcasts if_data.ifi_omcasts |
#define if_iqdrops if_data.ifi_iqdrops |
#define if_noproto if_data.ifi_noproto |
#define if_lastchange if_data.ifi_lastchange |
#define IFF_UP 0x1 /* interface is up */ |
#define IFF_BROADCAST 0x2 /* broadcast address valid */ |
#define IFF_DEBUG 0x4 /* turn on debugging */ |
#define IFF_LOOPBACK 0x8 /* is a loopback net */ |
#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ |
#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ |
#define IFF_RUNNING 0x40 /* resources allocated */ |
#define IFF_NOARP 0x80 /* no address resolution protocol */ |
#define IFF_PROMISC 0x100 /* receive all packets */ |
#define IFF_ALLMULTI 0x200 /* receive all multicast packets */ |
#define IFF_OACTIVE 0x400 /* transmission in progress */ |
#define IFF_SIMPLEX 0x800 /* can't hear own transmissions */ |
#define IFF_LINK0 0x1000 /* per link layer defined bit */ |
#define IFF_LINK1 0x2000 /* per link layer defined bit */ |
#define IFF_LINK2 0x4000 /* per link layer defined bit */ |
#define IFF_MULTICAST 0x8000 /* supports multicast */ |
/* flags set internally only: */ |
#define IFF_CANTCHANGE \ |
(IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\ |
IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI) |
/* |
* Output queues (ifp->if_snd) and internetwork datagram level (pup level 1) |
* input routines have queues of messages stored on ifqueue structures |
* (defined above). Entries are added to and deleted from these structures |
* by these macros, which should be called with ipl raised to splimp(). |
*/ |
#define IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen) |
#define IF_DROP(ifq) ((ifq)->ifq_drops++) |
#define IF_ENQUEUE(ifq, m) { \ |
(m)->m_nextpkt = 0; \ |
if ((ifq)->ifq_tail == 0) \ |
(ifq)->ifq_head = m; \ |
else \ |
(ifq)->ifq_tail->m_nextpkt = m; \ |
(ifq)->ifq_tail = m; \ |
(ifq)->ifq_len++; \ |
} |
#define IF_PREPEND(ifq, m) { \ |
(m)->m_nextpkt = (ifq)->ifq_head; \ |
if ((ifq)->ifq_tail == 0) \ |
(ifq)->ifq_tail = (m); \ |
(ifq)->ifq_head = (m); \ |
(ifq)->ifq_len++; \ |
} |
#define IF_DEQUEUE(ifq, m) { \ |
(m) = (ifq)->ifq_head; \ |
if (m) { \ |
if (((ifq)->ifq_head = (m)->m_nextpkt) == 0) \ |
(ifq)->ifq_tail = 0; \ |
(m)->m_nextpkt = 0; \ |
(ifq)->ifq_len--; \ |
} \ |
} |
#define IFQ_MAXLEN 50 |
#define IFNET_SLOWHZ 1 /* granularity is 1 second */ |
/* |
* The ifaddr structure contains information about one address |
* of an interface. They are maintained by the different address families, |
* are allocated and attached when an address is set, and are linked |
* together so all addresses for an interface can be located. |
*/ |
struct ifaddr { |
struct sockaddr *ifa_addr; /* address of interface */ |
struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */ |
#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ |
struct sockaddr *ifa_netmask; /* used to determine subnet */ |
struct ifnet *ifa_ifp; /* back-pointer to interface */ |
TAILQ_ENTRY(ifaddr) ifa_list; /* list of addresses for interface */ |
void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */ |
(int, struct rtentry *, struct sockaddr *); |
u_short ifa_flags; /* mostly rt_flags for cloning */ |
short ifa_refcnt; /* count of references */ |
int ifa_metric; /* cost of going out this interface */ |
}; |
#define IFA_ROUTE RTF_UP /* route installed */ |
/* |
* Message format for use in obtaining information about interfaces |
* from sysctl and the routing socket. |
*/ |
struct if_msghdr { |
u_short ifm_msglen; /* to skip over non-understood messages */ |
u_char ifm_version; /* future binary compatability */ |
u_char ifm_type; /* message type */ |
int ifm_addrs; /* like rtm_addrs */ |
int ifm_flags; /* value of if_flags */ |
u_short ifm_index; /* index for associated ifp */ |
struct if_data ifm_data;/* statistics and other data about if */ |
}; |
/* |
* Message format for use in obtaining information about interface addresses |
* from sysctl and the routing socket. |
*/ |
struct ifa_msghdr { |
u_short ifam_msglen; /* to skip over non-understood messages */ |
u_char ifam_version; /* future binary compatability */ |
u_char ifam_type; /* message type */ |
int ifam_addrs; /* like rtm_addrs */ |
int ifam_flags; /* value of ifa_flags */ |
u_short ifam_index; /* index for associated ifp */ |
int ifam_metric; /* value of ifa_metric */ |
}; |
/* |
* Interface request structure used for socket |
* ioctl's. All interface ioctl's must have parameter |
* definitions which begin with ifr_name. The |
* remainder may be interface specific. |
*/ |
struct ifreq { |
char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ |
union { |
struct sockaddr ifru_addr; |
struct sockaddr ifru_dstaddr; |
struct sockaddr ifru_hwaddr; |
struct sockaddr ifru_broadaddr; |
short ifru_flags; |
int ifru_metric; |
int ifru_mtu; |
caddr_t ifru_data; |
} ifr_ifru; |
#define ifr_addr ifr_ifru.ifru_addr /* address */ |
#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ |
#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* hardware address */ |
#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ |
#define ifr_flags ifr_ifru.ifru_flags /* flags */ |
#define ifr_metric ifr_ifru.ifru_metric /* metric */ |
#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ |
#define ifr_media ifr_ifru.ifru_metric /* media options (overload) */ |
#define ifr_data ifr_ifru.ifru_data /* for use by interface */ |
}; |
struct ifaliasreq { |
char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ |
struct sockaddr ifra_addr; |
struct sockaddr ifra_dstaddr; |
#define ifra_broadaddr ifra_dstaddr |
struct sockaddr ifra_mask; |
}; |
struct ifmediareq { |
char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */ |
int ifm_current; /* current media options */ |
int ifm_mask; /* don't care mask */ |
int ifm_status; /* media status */ |
int ifm_active; /* active options */ |
int ifm_count; /* # entries in ifm_ulist array */ |
int *ifm_ulist; /* media words */ |
}; |
/* |
* Structure used in SIOCGIFCONF request. |
* Used to retrieve interface configuration |
* for machine (useful for programs which |
* must know all networks accessible). |
*/ |
struct ifconf { |
int ifc_len; /* size of associated buffer */ |
union { |
caddr_t ifcu_buf; |
struct ifreq *ifcu_req; |
} ifc_ifcu; |
#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ |
#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ |
}; |
#ifndef __NET_IF_ARP_H |
#include <net/if_arp.h> |
#endif |
#endif |
//pkgnet/trunk/watt32/inc/net/if_arc.h |
---|
0,0 → 1,123 |
/*!\file net/if_arc.h |
* ARC-net definitions. |
*/ |
/* $NetBSD: if_arc.h,v 1.6 1997/03/15 18:12:30 is Exp $ */ |
/* |
* Copyright (c) 1982, 1986, 1993 |
* The Regents of the University of California. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
* must display the following acknowledgement: |
* This product includes software developed by the University of |
* California, Berkeley and its contributors. |
* 4. Neither the name of the University nor the names of its contributors |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
* |
* from: NetBSD: if_ether.h,v 1.10 1994/06/29 06:37:55 cgd Exp |
* @(#)if_ether.h 8.1 (Berkeley) 6/10/93 |
*/ |
#ifndef __NET_IF_ARC_H |
#define __NET_IF_ARC_H |
#include <sys/packon.h> |
/* |
* Arcnet address - 1 octets |
* don't know who uses this. |
*/ |
struct arc_addr { |
u_int8_t arc_addr_octet[1]; |
}; |
/* |
* Structure of a 2.5MB/s Arcnet header. |
* as given to interface code. |
*/ |
struct arc_header { |
u_int8_t arc_shost; |
u_int8_t arc_dhost; |
u_int8_t arc_type; |
/* |
* only present for newstyle encoding with LL fragmentation. |
* Don't use sizeof(anything), use ARC_HDR{,NEW}LEN instead. |
*/ |
u_int8_t arc_flag; |
u_int16_t arc_seqid; |
/* |
* only present in exception packets (arc_flag == 0xff) |
*/ |
u_int8_t arc_type2; /* same as arc_type */ |
u_int8_t arc_flag2; /* real flag value */ |
u_int16_t arc_seqid2; /* real seqid value */ |
}; |
#define ARC_ADDR_LEN 1 |
#define ARC_HDRLEN 3 |
#define ARC_HDRNEWLEN 6 |
/* these lengths are data link layer length - 2*ARC_ADDR_LEN */ |
#define ARC_MIN_LEN 1 |
#define ARC_MIN_FORBID_LEN 254 |
#define ARC_MAX_FORBID_LEN 256 |
#define ARC_MAX_LEN 508 |
/* RFC 1051 */ |
#define ARCTYPE_IP_OLD 240 /* IP protocol */ |
#define ARCTYPE_ARP_OLD 241 /* address resolution protocol */ |
/* RFC 1201 */ |
#define ARCTYPE_IP 212 /* IP protocol */ |
#define ARCTYPE_ARP 213 /* address resolution protocol */ |
#define ARCTYPE_REVARP 214 /* reverse addr resolution protocol */ |
#define ARCTYPE_ATALK 221 /* Appletalk */ |
#define ARCTYPE_BANIAN 247 /* Banyan Vines */ |
#define ARCTYPE_IPX 250 /* Novell IPX */ |
#define ARCMTU 507 |
#define ARCMIN 0 |
struct arccom { |
struct ifnet ac_if; /* network-visible interface */ |
u_int16_t ac_seqid; /* seq. id used by PHDS encap. */ |
struct ac_frag { |
u_int8_t af_maxflag; /* from first packet */ |
u_int8_t af_lastseen; /* last split flag seen */ |
u_int16_t af_seqid; |
struct mbuf *af_packet; |
} ac_fragtab[256]; /* indexed by sender ll address */ |
}; |
#include <sys/packoff.h> |
#endif |
//pkgnet/trunk/watt32/inc/net/if_arp.h |
---|
0,0 → 1,117 |
/*!\file net/if_arp.h |
* ARP definitions. |
*/ |
/* $NetBSD: if_arp.h,v 1.12 1997/09/08 02:06:30 mikel Exp $ */ |
/* |
* Copyright (c) 1986, 1993 |
* The Regents of the University of California. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
* must display the following acknowledgement: |
* This product includes software developed by the University of |
* California, Berkeley and its contributors. |
* 4. Neither the name of the University nor the names of its contributors |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
* |
* @(#)if_arp.h 8.1 (Berkeley) 6/10/93 |
*/ |
#ifndef __NET_IF_ARP_H |
#define __NET_IF_ARP_H |
/* |
* Address Resolution Protocol. |
* |
* See RFC 826 for protocol description. ARP packets are variable |
* in size; the arphdr structure defines the fixed-length portion. |
* Protocol type values are the same as those for 10 Mb/s Ethernet. |
* It is followed by the variable-sized fields ar_sha, arp_spa, |
* arp_tha and arp_tpa in that order, according to the lengths |
* specified. Field names used correspond to RFC 826. |
*/ |
#include <sys/packon.h> |
struct arphdr { |
u_int16_t ar_hrd; /* format of hardware address */ |
#define ARPHRD_ETHER 1 /* ethernet hardware format */ |
#define ARPHRD_TOKEN 6 /* TokenRing hardware format */ |
#define ARPHRD_ARCNET 7 /* ethernet hardware format */ |
#define ARPHRD_FRELAY 15 /* frame relay hardware format */ |
#define ARPHRD_STRIP 23 /* Ricochet Starmode Radio hardware format */ |
u_int16_t ar_pro; /* format of protocol address */ |
u_int8_t ar_hln; /* length of hardware address */ |
u_int8_t ar_pln; /* length of protocol address */ |
u_int16_t ar_op; /* one of: */ |
#define ARPOP_REQUEST 1 /* request to resolve address */ |
#define ARPOP_REPLY 2 /* response to previous request */ |
#define ARPOP_REVREQUEST 3 /* request protocol address given hardware */ |
#define ARPOP_REVREPLY 4 /* response giving protocol address */ |
#define ARPOP_INVREQUEST 8 /* request to identify peer */ |
#define ARPOP_INVREPLY 9 /* response identifying peer */ |
/* |
* The remaining fields are variable in size, |
* according to the sizes above. |
*/ |
#ifdef COMMENT_ONLY |
u_int8_t ar_sha[]; /* sender hardware address */ |
u_int8_t ar_spa[]; /* sender protocol address */ |
u_int8_t ar_tha[]; /* target hardware address */ |
u_int8_t ar_tpa[]; /* target protocol address */ |
#endif |
#ifdef __GNUC__ /* only GNU C allows zero arrays */ |
u_int8_t ar_remain[0]; /* minimum size, normally bigger */ |
#define ar_sha(ap) (((ap)->ar_remain)+0) |
#define ar_spa(ap) (((ap)->ar_remain)+(ap)->ar_hln) |
#define ar_tha(ap) (((ap)->ar_remain)+(ap)->ar_hln+(ap)->ar_pln) |
#define ar_tpa(ap) (((ap)->ar_remain)+2*(ap)->ar_hln+(ap)->ar_pln) |
#else |
#define ar_sha(ap) (((ap)->ar_op)+2) |
#define ar_spa(ap) (((ap)->ar_op)+2+(ap)->ar_hln) |
#define ar_tha(ap) (((ap)->ar_op)+2+(ap)->ar_hln+(ap)->ar_pln) |
#define ar_tpa(ap) (((ap)->ar_op)+2+2*(ap)->ar_hln+(ap)->ar_pln) |
#endif |
}; |
/* |
* ARP ioctl request |
*/ |
struct arpreq { |
struct sockaddr arp_pa; /* protocol address */ |
struct sockaddr arp_ha; /* hardware address */ |
int arp_flags; /* flags */ |
}; |
#include <sys/packoff.h> |
/* arp_flags and at_flags field values */ |
#define ATF_INUSE 0x01 /* entry in use */ |
#define ATF_COM 0x02 /* completed entry (enaddr valid) */ |
#define ATF_PERM 0x04 /* permanent entry */ |
#define ATF_PUBL 0x08 /* publish entry (respond for other host) */ |
#define ATF_USETRAILERS 0x10 /* has requested trailers */ |
#endif |
//pkgnet/trunk/watt32/inc/net/if_atm.h |
---|
0,0 → 1,110 |
/*!\file net/if_atm.h |
* ATM definitions. |
*/ |
/* $NetBSD: if_atm.h,v 1.7 1996/11/09 23:02:27 chuck Exp $ */ |
/* |
* |
* Copyright (c) 1996 Charles D. Cranor and Washington University. |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
* must display the following acknowledgement: |
* This product includes software developed by Charles D. Cranor and |
* Washington University. |
* 4. The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/* |
* net/if_atm.h |
*/ |
#ifndef __NET_IF_ATM_H |
#define __NET_IF_ATM_H |
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) |
#define RTALLOC1(A,B) rtalloc1((A),(B)) |
#elif defined(__FreeBSD__) |
#define RTALLOC1(A,B) rtalloc1((A),(B),0UL) |
#endif |
#include <sys/packon.h> |
/* |
* pseudo header for packet transmission |
*/ |
struct atm_pseudohdr { |
u_int8_t atm_ph[4]; /* flags+VPI+VCI1(msb)+VCI2(lsb) */ |
}; |
#define ATM_PH_FLAGS(X) ((X)->atm_ph[0]) |
#define ATM_PH_VPI(X) ((X)->atm_ph[1]) |
#define ATM_PH_VCI(X) ((((X)->atm_ph[2]) << 8) | ((X)->atm_ph[3])) |
#define ATM_PH_SETVCI(X,V) { \ |
(X)->atm_ph[2] = ((V) >> 8) & 0xff; \ |
(X)->atm_ph[3] = ((V) & 0xff); \ |
} |
#define ATM_PH_AAL5 0x01 /* use AAL5? (0 == aal0) */ |
#define ATM_PH_LLCSNAP 0x02 /* use the LLC SNAP encoding (iff aal5) */ |
#define ATM_PH_DRIVER7 0x40 /* reserve for driver's use */ |
#define ATM_PH_DRIVER8 0x80 /* reserve for driver's use */ |
#define ATMMTU 9180 /* ATM MTU size for IP */ |
/* XXX: could be 9188 with LLC/SNAP according |
to comer */ |
/* user's ioctl hook for raw atm mode */ |
#define SIOCRAWATM _IOWR('a', 122, int) /* set driver's raw mode */ |
/* atm_pseudoioctl: turns on and off RX VCIs [for internal use only!] */ |
struct atm_pseudoioctl { |
struct atm_pseudohdr aph; |
void *rxhand; |
}; |
#define SIOCATMENA _IOWR('a', 123, struct atm_pseudoioctl) /* enable */ |
#define SIOCATMDIS _IOWR('a', 124, struct atm_pseudoioctl) /* disable */ |
/* |
* XXX forget all the garbage in if_llc.h and do it the easy way |
*/ |
#define ATMLLC_HDR "\252\252\3\0\0\0" |
struct atmllc { |
u_int8_t llchdr[6]; /* aa.aa.03.00.00.00 */ |
u_int8_t type[2]; /* "ethernet" type */ |
}; |
#include <sys/packoff.h> |
/* ATM_LLC macros: note type code in host byte order */ |
#define ATM_LLC_TYPE(X) (((X)->type[0] << 8) | ((X)->type[1])) |
#define ATM_LLC_SETTYPE(X,V) { \ |
(X)->type[1] = ((V) >> 8) & 0xff; \ |
(X)->type[0] = ((V) & 0xff); \ |
} |
#endif |
//pkgnet/trunk/watt32/inc/net/if_dl.h |
---|
0,0 → 1,95 |
/*!\file net/if_dl.h |
* Link-level sockaddr_dl definition. |
*/ |
/* $NetBSD: if_dl.h,v 1.8 1995/03/26 20:30:13 jtc Exp $ */ |
/* |
* Copyright (c) 1990, 1993 |
* The Regents of the University of California. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
* must display the following acknowledgement: |
* This product includes software developed by the University of |
* California, Berkeley and its contributors. |
* 4. Neither the name of the University nor the names of its contributors |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
* |
* @(#)if_dl.h 8.1 (Berkeley) 6/10/93 |
*/ |
#ifndef __NET_IF_DL_H |
#define __NET_IF_DL_H |
#ifndef __SYS_W32API_H |
#include <sys/w32api.h> |
#endif |
#ifndef __SYS_CDEFS_H |
#include <sys/cdefs.h> |
#endif |
/* |
* A Link-Level Sockaddr may specify the interface in one of two |
* ways: either by means of a system-provided index number (computed |
* anew and possibly differently on every reboot), or by a human-readable |
* string such as "il0" (for managerial convenience). |
* |
* Census taking actions, such as something akin to SIOCGCONF would return |
* both the index and the human name. |
* |
* High volume transactions (such as giving a link-level ``from'' address |
* in a recvfrom or recvmsg call) may be likely only to provide the indexed |
* form, (which requires fewer copy operations and less space). |
* |
* The form and interpretation of the link-level address is purely a matter |
* of convention between the device driver and its consumers; however, it is |
* expected that all drivers for an interface of a given if_type will agree. |
*/ |
/* |
* Structure of a Link-Level sockaddr: |
*/ |
struct sockaddr_dl { |
u_char sdl_len; /* Total length of sockaddr */ |
u_char sdl_family; /* AF_DLI */ |
u_int16_t sdl_index; /* if != 0, system given index for interface */ |
u_char sdl_type; /* interface type */ |
u_char sdl_nlen; /* interface name length, no trailing 0 reqd. */ |
u_char sdl_alen; /* link level address length */ |
u_char sdl_slen; /* link layer selector length */ |
char sdl_data[12]; /* minimum work area, can be larger; |
contains both if name and ll address */ |
}; |
#define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen)) |
__BEGIN_DECLS |
W32_FUNC void link_addr (const char *, struct sockaddr_dl *); |
W32_FUNC char *link_ntoa (const struct sockaddr_dl *); |
__END_DECLS |
#endif |
//pkgnet/trunk/watt32/inc/net/if_ether.h |
---|
0,0 → 1,5 |
/*!\file net/if_ether.h |
* Compatability header. |
*/ |
#include <netinet/if_ether.h> |
//pkgnet/trunk/watt32/inc/net/if_fddi.h |
---|
0,0 → 1,4 |
/*!\file inc/net/if_fddi.h |
* Compatability header. |
*/ |
#include <netinet/if_fddi.h> |
//pkgnet/trunk/watt32/inc/net/if_llc.h |
---|
0,0 → 1,164 |
/*!\file net/if_llc.h |
* IEEE 802.2 Link Level Control. |
*/ |
/* $NetBSD: if_llc.h,v 1.9 1997/05/02 21:08:54 christos Exp $ */ |
/* |
* Copyright (c) 1988, 1993 |
* The Regents of the University of California. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
* must display the following acknowledgement: |
* This product includes software developed by the University of |
* California, Berkeley and its contributors. |
* 4. Neither the name of the University nor the names of its contributors |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
* |
* @(#)if_llc.h 8.1 (Berkeley) 6/10/93 |
*/ |
#ifndef __NET_IF_LLC_H |
#define __NET_IF_LLC_H |
/* |
* IEEE 802.2 Link Level Control headers, for use in conjunction with |
* 802.{3,4,5} media access control methods. |
* |
* Headers here do not use bit fields due to shortcommings in many |
* compilers. |
*/ |
#include <sys/packon.h> |
struct llc { |
u_int8_t llc_dsap; |
u_int8_t llc_ssap; |
union { |
struct { |
u_int8_t control; |
u_int8_t format_id; |
u_int8_t class; |
u_int8_t window_x2; |
} type_u; |
struct { |
u_int8_t num_snd_x2; |
u_int8_t num_rcv_x2; |
} type_i; |
struct { |
u_int8_t control; |
u_int8_t num_rcv_x2; |
} type_s; |
struct { |
u_int8_t control; |
/* |
* We cannot put the following fields in a structure because |
* the structure rounding might cause padding. |
*/ |
u_int8_t frmr_rej_pdu0; |
u_int8_t frmr_rej_pdu1; |
u_int8_t frmr_control; |
u_int8_t frmr_control_ext; |
u_int8_t frmr_cause; |
} type_frmr; |
struct { |
u_int8_t control; |
u_int8_t org_code[3]; |
u_int16_t ether_type; |
} type_snap; |
struct { |
u_int8_t control; |
u_int8_t control_ext; |
} type_raw; |
} llc_un; |
}; |
struct frmrinfo { |
u_int8_t frmr_rej_pdu0; |
u_int8_t frmr_rej_pdu1; |
u_int8_t frmr_control; |
u_int8_t frmr_control_ext; |
u_int8_t frmr_cause; |
}; |
#include <sys/packoff.h> |
#define llc_control llc_un.type_u.control |
#define llc_control_ext llc_un.type_raw.control_ext |
#define llc_fid llc_un.type_u.format_id |
#define llc_class llc_un.type_u.class |
#define llc_window llc_un.type_u.window_x2 |
#define llc_frmrinfo llc_un.type_frmr.frmr_rej_pdu0 |
#define llc_frmr_pdu0 llc_un.type_frmr.frmr_rej_pdu0 |
#define llc_frmr_pdu1 llc_un.type_frmr.frmr_rej_pdu1 |
#define llc_frmr_control llc_un.type_frmr.frmr_control |
#define llc_frmr_control_ext llc_un.type_frmr.frmr_control_ext |
#define llc_frmr_cause llc_un.type_frmr.frmr_cause |
/* |
* Don't use sizeof(struct llc_un) for LLC header sizes |
*/ |
#define LLC_ISFRAMELEN 4 |
#define LLC_UFRAMELEN 3 |
#define LLC_FRMRLEN 7 |
/* |
* Unnumbered LLC format commands |
*/ |
#define LLC_UI 0x3 |
#define LLC_UI_P 0x13 |
#define LLC_DISC 0x43 |
#define LLC_DISC_P 0x53 |
#define LLC_UA 0x63 |
#define LLC_UA_P 0x73 |
#define LLC_TEST 0xe3 |
#define LLC_TEST_P 0xf3 |
#define LLC_FRMR 0x87 |
#define LLC_FRMR_P 0x97 |
#define LLC_DM 0x0f |
#define LLC_DM_P 0x1f |
#define LLC_XID 0xaf |
#define LLC_XID_P 0xbf |
#define LLC_SABME 0x6f |
#define LLC_SABME_P 0x7f |
/* |
* Supervisory LLC commands |
*/ |
#define LLC_RR 0x01 |
#define LLC_RNR 0x05 |
#define LLC_REJ 0x09 |
/* |
* Info format - dummy only |
*/ |
#define LLC_INFO 0x00 |
/* |
* ISO PDTR 10178 contains among others |
*/ |
#define LLC_X25_LSAP 0x7e |
#define LLC_SNAP_LSAP 0xaa |
#define LLC_ISO_LSAP 0xfe |
#endif |
//pkgnet/trunk/watt32/inc/net/if_media.h |
---|
0,0 → 1,258 |
/*!\file net/if_media.h |
* Network interface media selection. |
*/ |
/* $NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $ */ |
/* |
* Copyright (c) 1997 |
* Jonathan Stone and Jason R. Thorpe. All rights reserved. |
* |
* This software is derived from information provided by Matt Thomas. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
* must display the following acknowledgement: |
* This product includes software developed by Jonathan Stone |
* and Jason R. Thorpe for the NetBSD Project. |
* 4. The names of the authors may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
*/ |
#ifndef __NET_IF_MEDIA_H |
#define __NET_IF_MEDIA_H |
/* |
* Prototypes and definitions for BSD/OS-compatible network interface |
* media selection. |
* |
* Where it is safe to do so, this code strays slightly from the BSD/OS |
* design. Software which uses the API (device drivers, basically) |
* shouldn't notice any difference. |
* |
* Many thanks to Matt Thomas for providing the information necessary |
* to implement this interface. |
*/ |
/* |
* if_media Options word: |
* Bits Use |
* ---- ------- |
* 0-3 Media variant |
* 4 RFU |
* 5-7 Media type |
* 8-15 Type specific options |
* 16-19 RFU |
* 20-27 Shared (global) options |
* 28-31 Instance |
*/ |
/* |
* Ethernet |
*/ |
#define IFM_ETHER 0x00000020 |
#define IFM_10_T 3 /* 10BaseT - RJ45 */ |
#define IFM_10_2 4 /* 10Base2 - Thinnet */ |
#define IFM_10_5 5 /* 10Base5 - AUI */ |
#define IFM_100_TX 6 /* 100BaseTX - RJ45 */ |
#define IFM_100_FX 7 /* 100BaseFX - Fiber */ |
#define IFM_100_T4 8 /* 100BaseT4 - 4 pair cat 3 */ |
#define IFM_100_VG 9 /* 100VG-AnyLAN */ |
#define IFM_100_T2 10 /* 100BaseT2 */ |
/* |
* Token ring |
*/ |
#define IFM_TOKEN 0x00000040 |
#define IFM_TOK_STP4 3 /* Shielded twisted pair 4m - DB9 */ |
#define IFM_TOK_STP16 4 /* Shielded twisted pair 16m - DB9 */ |
#define IFM_TOK_UTP4 5 /* Unshielded twisted pair 4m - RJ45 */ |
#define IFM_TOK_UTP16 6 /* Unshielded twisted pair 16m - RJ45 */ |
#define IFM_TOK_ETR 0x00000200 /* Early token release */ |
#define IFM_TOK_SRCRT 0x00000400 /* Enable source routing features */ |
#define IFM_TOK_ALLR 0x00000800 /* All routes / Single route bcast */ |
/* |
* FDDI |
*/ |
#define IFM_FDDI 0x00000060 |
#define IFM_FDDI_SMF 3 /* Single-mode fiber */ |
#define IFM_FDDI_MMF 4 /* Multi-mode fiber */ |
#define IFM_FDDI_UTP 5 /* CDDI / UTP */ |
#define IFM_FDDI_DA 0x00000100 /* Dual attach / single attach */ |
/* |
* Shared media sub-types |
*/ |
#define IFM_AUTO 0 /* Autoselect best media */ |
#define IFM_MANUAL 1 /* Jumper/dipswitch selects media */ |
#define IFM_NONE 2 /* Deselect all media */ |
/* |
* Shared options |
*/ |
#define IFM_FDX 0x00100000 /* Force full duplex */ |
#define IFM_HDX 0x00200000 /* Force half duplex */ |
#define IFM_FLAG0 0x01000000 /* Driver defined flag */ |
#define IFM_FLAG1 0x02000000 /* Driver defined flag */ |
#define IFM_FLAG2 0x04000000 /* Driver defined flag */ |
#define IFM_LOOP 0x08000000 /* Put hardware in loopback */ |
/* |
* Masks |
*/ |
#define IFM_NMASK 0x000000e0 /* Network type */ |
#define IFM_TMASK 0x0000000f /* Media sub-type */ |
#define IFM_IMASK 0xf0000000 /* Instance */ |
#define IFM_ISHIFT 28 /* Instance shift */ |
#define IFM_OMASK 0x0000ff00 /* Type specific options */ |
#define IFM_GMASK 0x0ff00000 /* Global options */ |
/* |
* Status bits |
*/ |
#define IFM_AVALID 0x00000001 /* Active bit valid */ |
#define IFM_ACTIVE 0x00000002 /* Interface attached to working net */ |
/* |
* Macros to extract various bits of information from the media word. |
*/ |
#define IFM_TYPE(x) ((x) & IFM_NMASK) |
#define IFM_SUBTYPE(x) ((x) & IFM_TMASK) |
#define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT) |
/* |
* NetBSD extension not defined in the BSDI API. This is used in various |
* places to get the canonical description for a given type/subtype. |
* |
* NOTE: all but the top-level type descriptions must contain NO whitespace! |
* Otherwise, parsing these in ifconfig(8) would be a nightmare. |
*/ |
struct ifmedia_description { |
int ifmt_word; /* word value; may be masked */ |
const char *ifmt_string; /* description */ |
}; |
#define IFM_TYPE_DESCRIPTIONS { \ |
{ IFM_ETHER, "Ethernet" }, \ |
{ IFM_TOKEN, "Token ring" }, \ |
{ IFM_FDDI, "FDDI" }, \ |
{ 0, NULL }, \ |
} |
#define IFM_SUBTYPE_ETHERNET_DESCRIPTIONS { \ |
{ IFM_10_T, "10baseT/UTP" }, \ |
{ IFM_10_2, "10base2/BNC" }, \ |
{ IFM_10_5, "10base5/AUI" }, \ |
{ IFM_100_TX, "100baseTX" }, \ |
{ IFM_100_FX, "100baseFX" }, \ |
{ IFM_100_T4, "100baseT4" }, \ |
{ IFM_100_VG, "100baseVG" }, \ |
{ IFM_100_T2, "100baseT2" }, \ |
{ 0, NULL }, \ |
} |
#define IFM_SUBTYPE_ETHERNET_ALIASES { \ |
{ IFM_10_T, "UTP" }, \ |
{ IFM_10_T, "10UTP" }, \ |
{ IFM_10_2, "BNC" }, \ |
{ IFM_10_2, "10BNC" }, \ |
{ IFM_10_5, "AUI" }, \ |
{ IFM_10_5, "10AUI" }, \ |
{ IFM_100_TX, "100TX" }, \ |
{ IFM_100_FX, "100FX" }, \ |
{ IFM_100_T4, "100T4" }, \ |
{ IFM_100_VG, "100VG" }, \ |
{ IFM_100_T2, "100T2" }, \ |
{ 0, NULL }, \ |
} |
#define IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS { \ |
{ 0, NULL }, \ |
} |
#define IFM_SUBTYPE_TOKENRING_DESCRIPTIONS { \ |
{ IFM_TOK_STP4, "DB9/4Mbit" }, \ |
{ IFM_TOK_STP16, "DB9/16Mbit" }, \ |
{ IFM_TOK_UTP4, "UTP/4Mbit" }, \ |
{ IFM_TOK_UTP16, "UTP/16Mbit" }, \ |
{ 0, NULL }, \ |
} |
#define IFM_SUBTYPE_TOKENRING_ALIASES { \ |
{ IFM_TOK_STP4, "4STP" }, \ |
{ IFM_TOK_STP16, "16STP" }, \ |
{ IFM_TOK_UTP4, "4UTP" }, \ |
{ IFM_TOK_UTP16, "16UTP" }, \ |
{ 0, NULL }, \ |
} |
#define IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS { \ |
{ IFM_TOK_ETR, "EarlyTokenRelease" }, \ |
{ IFM_TOK_SRCRT, "SourceRouting" }, \ |
{ IFM_TOK_ALLR, "AllRoutes" }, \ |
{ 0, NULL }, \ |
} |
#define IFM_SUBTYPE_FDDI_DESCRIPTIONS { \ |
{ IFM_FDDI_SMF, "Single-mode" }, \ |
{ IFM_FDDI_MMF, "Multi-mode" }, \ |
{ IFM_FDDI_UTP, "UTP" }, \ |
{ 0, NULL }, \ |
} |
#define IFM_SUBTYPE_FDDI_ALIASES { \ |
{ IFM_FDDI_SMF, "SMF" }, \ |
{ IFM_FDDI_MMF, "MMF" }, \ |
{ IFM_FDDI_UTP, "CDDI" }, \ |
{ 0, NULL }, \ |
} |
#define IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS { \ |
{ IFM_FDDI_DA, "Dual-attach" }, \ |
{ 0, NULL }, \ |
} |
#define IFM_SUBTYPE_SHARED_DESCRIPTIONS { \ |
{ IFM_AUTO, "autoselect" }, \ |
{ IFM_MANUAL, "manual" }, \ |
{ IFM_NONE, "none" }, \ |
{ 0, NULL }, \ |
} |
#define IFM_SUBTYPE_SHARED_ALIASES { \ |
{ IFM_AUTO, "auto" }, \ |
{ 0, NULL }, \ |
} |
#define IFM_SHARED_OPTION_DESCRIPTIONS { \ |
{ IFM_FDX, "full-duplex" }, \ |
{ IFM_HDX, "half-duplex" }, \ |
{ IFM_FLAG0, "flag0" }, \ |
{ IFM_FLAG1, "flag1" }, \ |
{ IFM_FLAG2, "flag2" }, \ |
{ IFM_LOOP, "hw-loopback" }, \ |
{ 0, NULL }, \ |
} |
#endif |
//pkgnet/trunk/watt32/inc/net/if_packe.h |
---|
0,0 → 1,108 |
/*!\file net/if_packe.h |
* |
* Linux compatability header. |
*/ |
#ifndef __LINUX_IF_PACKET_H |
#define __LINUX_IF_PACKET_H |
struct sockaddr_pkt |
{ |
unsigned short spkt_family; |
unsigned char spkt_device[14]; |
unsigned short spkt_protocol; |
}; |
struct sockaddr_ll |
{ |
unsigned short sll_family; |
unsigned short sll_protocol; |
int sll_ifindex; |
unsigned short sll_hatype; |
unsigned char sll_pkttype; |
unsigned char sll_halen; |
unsigned char sll_addr[8]; |
}; |
/* Packet types */ |
#define PACKET_HOST 0 /* To us */ |
#define PACKET_BROADCAST 1 /* To all */ |
#define PACKET_MULTICAST 2 /* To group */ |
#define PACKET_OTHERHOST 3 /* To someone else */ |
#define PACKET_OUTGOING 4 /* Outgoing of any type */ |
/* These ones are invisible by user level */ |
#define PACKET_LOOPBACK 5 /* MC/BRD frame looped back */ |
#define PACKET_FASTROUTE 6 /* Fastrouted frame */ |
/* Packet socket options */ |
#define PACKET_ADD_MEMBERSHIP 1 |
#define PACKET_DROP_MEMBERSHIP 2 |
#define PACKET_RECV_OUTPUT 3 |
/* Value 4 is still used by obsolete turbo-packet. */ |
#define PACKET_RX_RING 5 |
#define PACKET_STATISTICS 6 |
#define PACKET_COPY_THRESH 7 |
struct tpacket_stats |
{ |
unsigned int tp_packets; |
unsigned int tp_drops; |
}; |
struct tpacket_hdr |
{ |
unsigned long tp_status; |
#define TP_STATUS_KERNEL 0 |
#define TP_STATUS_USER 1 |
#define TP_STATUS_COPY 2 |
#define TP_STATUS_LOSING 4 |
#define TP_STATUS_CSUMNOTREADY 8 |
unsigned int tp_len; |
unsigned int tp_snaplen; |
unsigned short tp_mac; |
unsigned short tp_net; |
unsigned int tp_sec; |
unsigned int tp_usec; |
}; |
#define TPACKET_ALIGNMENT 16 |
#define TPACKET_ALIGN(x) (((x)+TPACKET_ALIGNMENT-1) & ~(TPACKET_ALIGNMENT-1)) |
#define TPACKET_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct sockaddr_ll)) |
/* |
Frame structure: |
- Start. Frame must be aligned to TPACKET_ALIGNMENT=16 |
- struct tpacket_hdr |
- pad to TPACKET_ALIGNMENT=16 |
- struct sockaddr_ll |
- Gap, chosen so that packet data (Start+tp_net) alignes to TPACKET_ALIGNMENT=16 |
- Start+tp_mac: [ Optional MAC header ] |
- Start+tp_net: Packet data, aligned to TPACKET_ALIGNMENT=16. |
- Pad to align to TPACKET_ALIGNMENT=16 |
*/ |
struct tpacket_req |
{ |
unsigned int tp_block_size; /* Minimal size of contiguous block */ |
unsigned int tp_block_nr; /* Number of blocks */ |
unsigned int tp_frame_size; /* Size of frame */ |
unsigned int tp_frame_nr; /* Total number of frames */ |
}; |
struct packet_mreq |
{ |
int mr_ifindex; |
unsigned short mr_type; |
unsigned short mr_alen; |
unsigned char mr_address[8]; |
}; |
#define PACKET_MR_MULTICAST 0 |
#define PACKET_MR_PROMISC 1 |
#define PACKET_MR_ALLMULTI 2 |
#endif |
//pkgnet/trunk/watt32/inc/net/if_ppp.h |
---|
0,0 → 1,133 |
/*!\file net/if_ppp.h |
* PPP definitions. |
*/ |
/* $NetBSD: if_ppp.h,v 1.14 1997/05/17 21:12:02 christos Exp $ */ |
/* Id: if_ppp.h,v 1.16 1997/04/30 05:46:04 paulus Exp */ |
/* |
* if_ppp.h - Point-to-Point Protocol definitions. |
* |
* Copyright (c) 1989 Carnegie Mellon University. |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms are permitted |
* provided that the above copyright notice and this paragraph are |
* duplicated in all such forms and that any documentation, |
* advertising materials, and other materials related to such |
* distribution and use acknowledge that the software was developed |
* by Carnegie Mellon University. The name of the |
* University may not be used to endorse or promote products derived |
* from this software without specific prior written permission. |
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
*/ |
#ifndef __NET_IF_PPP_H |
#define __NET_IF_PPP_H |
/* |
* Bit definitions for flags. |
*/ |
#define SC_COMP_PROT 0x00000001 /* protocol compression (output) */ |
#define SC_COMP_AC 0x00000002 /* header compression (output) */ |
#define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */ |
#define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */ |
#define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */ |
#define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */ |
#define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */ |
#define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */ |
#define SC_DEBUG 0x00010000 /* enable debug messages */ |
#define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */ |
#define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */ |
#define SC_LOG_RAWIN 0x00080000 /* log all chars received */ |
#define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ |
#define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */ |
#define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */ |
#define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */ |
#define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */ |
#define SC_MASK 0x0fff00ff /* bits that user can change */ |
/* |
* State bits in sc_flags, not changeable by user. |
*/ |
#define SC_TIMEOUT 0x00000400 /* timeout is currently pending */ |
#define SC_VJ_RESET 0x00000800 /* need to reset VJ decomp */ |
#define SC_COMP_RUN 0x00001000 /* compressor has been inited */ |
#define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */ |
#define SC_DC_ERROR 0x00004000 /* non-fatal decomp error detected */ |
#define SC_DC_FERROR 0x00008000 /* fatal decomp error detected */ |
#define SC_TBUSY 0x10000000 /* xmitter doesn't need a packet yet */ |
#define SC_PKTLOST 0x20000000 /* have lost or dropped a packet */ |
#define SC_FLUSH 0x40000000 /* flush input until next PPP_FLAG */ |
#define SC_ESCAPED 0x80000000 /* saw a PPP_ESCAPE */ |
/* |
* Ioctl definitions. |
*/ |
struct npioctl { |
int protocol; /* PPP procotol, e.g. PPP_IP */ |
enum NPmode mode; |
}; |
/* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */ |
struct ppp_option_data { |
u_char *ptr; |
u_int length; |
int transmit; |
}; |
struct ifpppstatsreq { |
char ifr_name[IFNAMSIZ]; |
struct ppp_stats stats; |
}; |
struct ifpppcstatsreq { |
char ifr_name[IFNAMSIZ]; |
struct ppp_comp_stats stats; |
}; |
/* |
* Ioctl definitions. |
*/ |
#define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */ |
#define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */ |
#define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */ |
#define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */ |
#define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */ |
#define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */ |
#define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */ |
#define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */ |
#define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */ |
#define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */ |
#define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */ |
#define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */ |
#define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */ |
#define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data) |
#define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */ |
#define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */ |
#define PPPIOCGIDLE _IOR('t', 74, struct ppp_idle) /* get idle time */ |
#ifdef PPP_FILTER |
#define PPPIOCSPASS _IOW('t', 71, struct bpf_program) /* set pass filter */ |
#define PPPIOCSACTIVE _IOW('t', 70, struct bpf_program) /* set active filt */ |
#endif /* PPP_FILTER */ |
/* PPPIOC[GS]MTU are alternatives to SIOC[GS]IFMTU, used under Ultrix */ |
#define PPPIOCGMTU _IOR('t', 73, int) /* get interface MTU */ |
#define PPPIOCSMTU _IOW('t', 72, int) /* set interface MTU */ |
/* |
* These two are interface ioctls so that pppstats can do them on |
* a socket without having to open the serial device. |
*/ |
#define SIOCGPPPSTATS _IOWR('i', 123, struct ifpppstatsreq) |
#define SIOCGPPPCSTATS _IOWR('i', 122, struct ifpppcstatsreq) |
#ifndef ifr_mtu |
#define ifr_mtu ifr_ifru.ifru_metric |
#endif |
#endif |
//pkgnet/trunk/watt32/inc/net/if_pppva.h |
---|
0,0 → 1,110 |
/*!\file net/if_pppva.h |
* PPP structures and declarations. |
*/ |
/* $NetBSD: if_pppvar.h,v 1.7 1997/05/17 21:12:03 christos Exp $ */ |
/* Id: if_pppvar.h,v 1.3 1996/07/01 01:04:37 paulus Exp */ |
/* |
* if_pppvar.h - private structures and declarations for PPP. |
* |
* Copyright (c) 1994 The Australian National University. |
* All rights reserved. |
* |
* Permission to use, copy, modify, and distribute this software and its |
* documentation is hereby granted, provided that the above copyright |
* notice appears in all copies. This software is provided without any |
* warranty, express or implied. The Australian National University |
* makes no representations about the suitability of this software for |
* any purpose. |
* |
* IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY |
* PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF |
* THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY |
* OF SUCH DAMAGE. |
* |
* THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, |
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
* ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO |
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, |
* OR MODIFICATIONS. |
* |
* Copyright (c) 1989 Carnegie Mellon University. |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms are permitted |
* provided that the above copyright notice and this paragraph are |
* duplicated in all such forms and that any documentation, |
* advertising materials, and other materials related to such |
* distribution and use acknowledge that the software was developed |
* by Carnegie Mellon University. The name of the |
* University may not be used to endorse or promote products derived |
* from this software without specific prior written permission. |
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
*/ |
#ifndef __NET_IF_PPPVAR_H |
#define __NET_IF_PPPVAR_H |
/* |
* Supported network protocols. These values are used for |
* indexing sc_npmode. |
*/ |
#define NP_IP 0 /* Internet Protocol */ |
#define NUM_NP 1 /* Number of NPs. */ |
/* |
* Structure describing each ppp unit. |
*/ |
struct ppp_softc { |
struct ifnet sc_if; /* network-visible interface */ |
int sc_unit; /* XXX unit number */ |
u_int sc_flags; /* control/status bits; see if_ppp.h */ |
void *sc_devp; /* pointer to device-dep structure */ |
void (*sc_start) __P((struct ppp_softc *)); /* start output proc */ |
void (*sc_ctlp) __P((struct ppp_softc *)); /* rcvd control pkt */ |
void (*sc_relinq) __P((struct ppp_softc *)); /* relinquish ifunit */ |
u_int16_t sc_mru; /* max receive unit */ |
int sc_xfer; /* used in transferring unit */ |
struct ifqueue sc_rawq; /* received packets */ |
struct ifqueue sc_inq; /* queue of input packets for daemon */ |
struct ifqueue sc_fastq; /* interactive output packet q */ |
struct mbuf *sc_togo; /* output packet ready to go */ |
struct mbuf *sc_npqueue; /* output packets not to be sent yet */ |
struct mbuf **sc_npqtail; /* ptr to last next ptr in npqueue */ |
struct pppstat sc_stats; /* count of bytes/pkts sent/rcvd */ |
caddr_t sc_bpf; /* hook for BPF */ |
enum NPmode sc_npmode[NUM_NP]; /* what to do with each NP */ |
struct compressor *sc_xcomp; /* transmit compressor */ |
void *sc_xc_state; /* transmit compressor state */ |
struct compressor *sc_rcomp; /* receive decompressor */ |
void *sc_rc_state; /* receive decompressor state */ |
time_t sc_last_sent; /* time (secs) last NP pkt sent */ |
time_t sc_last_recv; /* time (secs) last NP pkt rcvd */ |
#ifdef PPP_FILTER |
struct bpf_program sc_pass_filt; /* filter for packets to pass */ |
struct bpf_program sc_active_filt; /* filter for "non-idle" packets */ |
#endif /* PPP_FILTER */ |
#ifdef VJC |
struct slcompress *sc_comp; /* vjc control buffer */ |
#endif |
/* Device-dependent part for async lines. */ |
ext_accm sc_asyncmap; /* async control character map */ |
u_int32_t sc_rasyncmap; /* receive async control char map */ |
struct mbuf *sc_outm; /* mbuf chain currently being output */ |
struct mbuf *sc_m; /* pointer to input mbuf chain */ |
struct mbuf *sc_mc; /* pointer to current input mbuf */ |
char *sc_mp; /* ptr to next char in input mbuf */ |
u_int16_t sc_ilen; /* length of input packet so far */ |
u_int16_t sc_fcs; /* FCS so far (input) */ |
u_int16_t sc_outfcs; /* FCS so far for output packet */ |
u_char sc_rawin[16]; /* chars as received */ |
int sc_rawin_count; /* # in sc_rawin */ |
}; |
#endif |
//pkgnet/trunk/watt32/inc/net/if_slvar.h |
---|
0,0 → 1,85 |
/*!\file net/if_slvar.h |
* SLIP interface structures. |
*/ |
/* $NetBSD: if_slvar.h,v 1.17 1997/03/27 20:36:17 thorpej Exp $ */ |
/*- |
* Copyright (c) 1991, 1993 |
* The Regents of the University of California. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
* must display the following acknowledgement: |
* This product includes software developed by the University of |
* California, Berkeley and its contributors. |
* 4. Neither the name of the University nor the names of its contributors |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
* |
* @(#)if_slvar.h 8.3 (Berkeley) 2/1/94 |
*/ |
#ifndef __NET_IF_SLVAR_H |
#define __NET_IF_SLVAR_H |
/* |
* Definitions for SLIP interface data structures |
* |
* (This exists so programs like slstats can get at the definition |
* of sl_softc.) |
*/ |
struct sl_softc { |
struct ifnet sc_if; /* network-visible interface */ |
int sc_unit; /* XXX unit number */ |
struct ifqueue sc_fastq; /* interactive output queue */ |
struct tty *sc_ttyp; /* pointer to tty structure */ |
u_char *sc_mp; /* pointer to next available buf char */ |
u_char *sc_ep; /* pointer to last available buf char */ |
u_char *sc_buf; /* input buffer */ |
u_char *sc_xxx; /* XXX don't ask... */ |
u_int sc_flags; /* see below */ |
u_int sc_escape; /* =1 if last char input was FRAME_ESCAPE */ |
long sc_lasttime; /* last time a char arrived */ |
long sc_abortcount; /* number of abort esacpe chars */ |
long sc_starttime; /* time of first abort in window */ |
long sc_oqlen; /* previous output queue size */ |
long sc_otimeout; /* number of times output's stalled */ |
#ifdef NetBSD |
int sc_oldbufsize; /* previous output buffer size */ |
int sc_oldbufquot; /* previous output buffer quoting */ |
#endif |
#ifdef INET /* XXX */ |
struct slcompress sc_comp; /* tcp compression data */ |
#endif |
caddr_t sc_bpf; /* BPF data */ |
}; |
/* internal flags */ |
#define SC_ERROR 0x0001 /* had an input error */ |
/* visible flags */ |
#define SC_COMPRESS IFF_LINK0 /* compress TCP traffic */ |
#define SC_NOICMP IFF_LINK1 /* supress ICMP traffic */ |
#define SC_AUTOCOMP IFF_LINK2 /* auto-enable TCP compression */ |
#endif |
//pkgnet/trunk/watt32/inc/net/if_strip.h |
---|
0,0 → 1,60 |
/*!\file net/if_strip.h |
* SLIP interface structures. |
*/ |
/* $NetBSD: if_stripvar.h,v 1.4.8.1 1997/11/17 23:36:16 thorpej Exp $ */ |
/* |
* Definitions for SLIP interface data structures |
* |
* (This exists so programs like slstats can get at the definition |
* of sl_softc.) |
*/ |
#ifndef __NET_IF_STRIP_H |
#define __NET_IF_STRIP_H |
struct strip_softc { |
struct ifnet sc_if; /* network-visible interface */ |
int sc_unit; /* XXX unit number */ |
struct ifqueue sc_fastq; /* interactive output queue */ |
struct tty *sc_ttyp; /* pointer to tty structure */ |
u_char *sc_mp; /* pointer to next available buf char */ |
u_char *sc_ep; /* pointer to last available buf char */ |
u_char *sc_buf; /* input buffer */ |
u_char *sc_rxbuf; /* input destuffing buffer */ |
u_char *sc_txbuf; /* output stuffing buffer */ |
u_char *sc_xxx; /* XXX don't ask... */ |
u_int sc_flags; /* see below */ |
long sc_oqlen; /* previous output queue size */ |
long sc_otimeout; /* number of times output's stalled */ |
#ifdef __NetBSD__ |
int sc_oldbufsize; /* previous output buffer size */ |
int sc_oldbufquot; /* previous output buffer quoting */ |
#endif |
#ifdef INET /* XXX */ |
struct slcompress sc_comp; /* tcp compression data */ |
#endif |
int sc_state; /* Radio reset state-machine */ |
#define ST_ALIVE 0x0 /* answered probe */ |
#define ST_PROBE_SENT 0x1 /* probe sent, answer pending */ |
#define ST_DEAD 0x2 /* no answer to probe; do reset */ |
long sc_statetimo; /* When (secs) current state ends */ |
caddr_t sc_bpf; /* BPF data */ |
}; |
/* Internal flags */ |
#define SC_ERROR 0x0001 /* Incurred error reading current pkt*/ |
#define SC_TIMEOUT 0x00000400 /* timeout is currently pending */ |
/* visible flags */ |
#define SC_COMPRESS IFF_LINK0 /* compress TCP traffic */ |
#define SC_NOICMP IFF_LINK1 /* supress ICMP traffic */ |
#define SC_AUTOCOMP IFF_LINK2 /* auto-enable TCP compression */ |
#endif |
//pkgnet/trunk/watt32/inc/net/if_tun.h |
---|
0,0 → 1,58 |
/*!\file net/if_tun.h |
* Interface tunneling. |
*/ |
/* $NetBSD: if_tun.h,v 1.6 1996/06/25 22:15:18 pk Exp $ */ |
/* |
* Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk> |
* Nottingham University 1987. |
* |
* This source may be freely distributed, however I would be interested |
* in any changes that are made. |
* |
* This driver takes packets off the IP i/f and hands them up to a |
* user process to have it's wicked way with. This driver has it's |
* roots in a similar driver written by Phil Cockcroft (formerly) at |
* UCL. This driver is based much more on read/write/select mode of |
* operation though. |
* |
* : $Header: if_tnreg.h,v 1.1.2.1 1992/07/16 22:39:16 friedl Exp |
*/ |
#ifndef __NET_IF_TUN_H |
#define __NET_IF_TUN_H |
struct tun_softc { |
u_short tun_flags; /* misc flags */ |
#define TUN_OPEN 0x0001 |
#define TUN_INITED 0x0002 |
#define TUN_RCOLL 0x0004 |
#define TUN_IASET 0x0008 |
#define TUN_DSTADDR 0x0010 |
#define TUN_RWAIT 0x0040 |
#define TUN_ASYNC 0x0080 |
#define TUN_NBIO 0x0100 |
#define TUN_PREPADDR 0x0200 |
#define TUN_READY (TUN_OPEN | TUN_INITED | TUN_IASET) |
struct ifnet tun_if; /* the interface */ |
int tun_pgrp; /* the process group - if any */ |
struct selinfo tun_rsel; /* read select */ |
struct selinfo tun_wsel; /* write select (not used) */ |
#if NBPFILTER > 0 |
caddr_t tun_bpf; |
#endif |
}; |
/* Maximum packet size */ |
#define TUNMTU 1500 |
/* ioctl's for get/set debug */ |
#define TUNSDEBUG _IOW('t', 90, int) |
#define TUNGDEBUG _IOR('t', 89, int) |
#define TUNSIFMODE _IOW('t', 88, int) |
#define TUNSLMODE _IOW('t', 87, int) |
#endif |
//pkgnet/trunk/watt32/inc/net/if_types.h |
---|
0,0 → 1,105 |
/*!\file net/if_types.h |
* Network interface types. |
*/ |
/* $NetBSD: if_types.h,v 1.7 1995/02/27 09:10:24 glass Exp $ */ |
/* |
* Copyright (c) 1989, 1993, 1994 |
* The Regents of the University of California. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
* must display the following acknowledgement: |
* This product includes software developed by the University of |
* California, Berkeley and its contributors. |
* 4. Neither the name of the University nor the names of its contributors |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
* |
* @(#)if_types.h 8.2 (Berkeley) 4/20/94 |
*/ |
/* |
* Interface types for benefit of parsing media address headers. |
* This list is derived from the SNMP list of ifTypes, currently |
* documented in RFC1573. |
*/ |
#ifndef __NET_IF_TYPES_H |
#define __NET_IF_TYPES_H |
#define IFT_OTHER 0x1 /* none of the following */ |
#define IFT_1822 0x2 /* old-style arpanet imp */ |
#define IFT_HDH1822 0x3 /* HDH arpanet imp */ |
#define IFT_X25DDN 0x4 /* x25 to imp */ |
#define IFT_X25 0x5 /* PDN X25 interface (RFC877) */ |
#define IFT_ETHER 0x6 /* Ethernet CSMACD */ |
#define IFT_ISO88023 0x7 /* CMSA CD */ |
#define IFT_ISO88024 0x8 /* Token Bus */ |
#define IFT_ISO88025 0x9 /* Token Ring */ |
#define IFT_ISO88026 0xa /* MAN */ |
#define IFT_STARLAN 0xb |
#define IFT_P10 0xc /* Proteon 10MBit ring */ |
#define IFT_P80 0xd /* Proteon 80MBit ring */ |
#define IFT_HY 0xe /* Hyperchannel */ |
#define IFT_FDDI 0xf |
#define IFT_LAPB 0x10 |
#define IFT_SDLC 0x11 |
#define IFT_T1 0x12 |
#define IFT_CEPT 0x13 /* E1 - european T1 */ |
#define IFT_ISDNBASIC 0x14 |
#define IFT_ISDNPRIMARY 0x15 |
#define IFT_PTPSERIAL 0x16 /* Proprietary PTP serial */ |
#define IFT_PPP 0x17 /* RFC 1331 */ |
#define IFT_LOOP 0x18 /* loopback */ |
#define IFT_EON 0x19 /* ISO over IP */ |
#define IFT_XETHER 0x1a /* obsolete 3MB experimental ethernet */ |
#define IFT_NSIP 0x1b /* XNS over IP */ |
#define IFT_SLIP 0x1c /* IP over generic TTY */ |
#define IFT_ULTRA 0x1d /* Ultra Technologies */ |
#define IFT_DS3 0x1e /* Generic T3 */ |
#define IFT_SIP 0x1f /* SMDS */ |
#define IFT_FRELAY 0x20 /* Frame Relay DTE only */ |
#define IFT_RS232 0x21 |
#define IFT_PARA 0x22 /* parallel-port */ |
#define IFT_ARCNET 0x23 |
#define IFT_ARCNETPLUS 0x24 |
#define IFT_ATM 0x25 /* ATM cells */ |
#define IFT_MIOX25 0x26 |
#define IFT_SONET 0x27 /* SONET or SDH */ |
#define IFT_X25PLE 0x28 |
#define IFT_ISO88022LLC 0x29 |
#define IFT_LOCALTALK 0x2a |
#define IFT_SMDSDXI 0x2b |
#define IFT_FRELAYDCE 0x2c /* Frame Relay DCE */ |
#define IFT_V35 0x2d |
#define IFT_HSSI 0x2e |
#define IFT_HIPPI 0x2f |
#define IFT_MODEM 0x30 /* Generic Modem */ |
#define IFT_AAL5 0x31 /* AAL5 over ATM */ |
#define IFT_SONETPATH 0x32 |
#define IFT_SONETVT 0x33 |
#define IFT_SMDSICIP 0x34 /* SMDS InterCarrier Interface */ |
#define IFT_PROPVIRTUAL 0x35 /* Proprietary Virtual/internal */ |
#define IFT_PROPMUX 0x36 /* Proprietary Multiplexing */ |
#endif |
//pkgnet/trunk/watt32/inc/net/netisr.h |
---|
0,0 → 1,78 |
/*!\file net/netisr.h |
* |
*/ |
/* $NetBSD: netisr.h,v 1.15 1997/04/02 21:23:29 christos Exp $ */ |
/* |
* Copyright (c) 1980, 1986, 1989, 1993 |
* The Regents of the University of California. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
* must display the following acknowledgement: |
* This product includes software developed by the University of |
* California, Berkeley and its contributors. |
* 4. Neither the name of the University nor the names of its contributors |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
* |
* @(#)netisr.h 8.1 (Berkeley) 6/10/93 |
*/ |
#ifndef __NET_NETISR_H |
#define __NET_NETISR_H |
/* |
* The networking code runs off software interrupts. |
* |
* You can switch into the network by doing splsoftnet() and return by splx(). |
* The software interrupt level for the network is higher than the software |
* level for the clock (so you can enter the network in routines called |
* at timeout time). |
* |
* The routine to request a network software interrupt, setsoftnet(), |
* is defined in the machine-specific include files. |
*/ |
/* |
* Each ``pup-level-1'' input queue has a bit in a ``netisr'' status |
* word which is used to de-multiplex a single software |
* interrupt used for scheduling the network code to calls |
* on the lowest level routine of each protocol. |
*/ |
#define NETISR_IP 2 /* same as AF_INET */ |
#define NETISR_IMP 3 /* same as AF_IMPLINK */ |
#define NETISR_NS 6 /* same as AF_NS */ |
#define NETISR_ISO 7 /* same as AF_ISO */ |
#define NETISR_CCITT 10 /* same as AF_CCITT */ |
#define NETISR_ATALK 16 /* same as AF_APPLETALK */ |
#define NETISR_ARP 18 /* same as AF_LINK */ |
#define NETISR_ISDN 26 /* same as AF_E164 */ |
#define NETISR_NATM 27 /* same as AF_NATM */ |
#define NETISR_PPP 28 /* for PPP processing */ |
#define schednetisr(anisr) { netisr |= 1<<(anisr); setsoftnet(); } |
extern int netisr; /* scheduling bits for network */ |
#endif |
//pkgnet/trunk/watt32/inc/net/pfil.h |
---|
0,0 → 1,47 |
/*!\file net/pfil.h |
* |
*/ |
/* $NetBSD: pfil.h,v 1.8 1997/10/10 05:40:26 mrg Exp $ */ |
/* |
* Copyright (c) 1996 Matthew R. Green |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
*/ |
#ifndef __NET_PFIL_H |
#define __NET_PFIL_H |
/* note: this file needs <net/if.h> and <sys/mbuf.h> */ |
#if NIPFILTER > 0 |
#ifdef PFIL_HOOKS |
#undef PFIL_HOOKS |
#endif |
#define PFIL_HOOKS |
#endif /* NIPFILTER */ |
#endif |
//pkgnet/trunk/watt32/inc/net/ppp-comp.h |
---|
0,0 → 1,180 |
/*!\file net/ppp-comp.h |
* PPP compression. |
*/ |
/* $NetBSD: ppp-comp.h,v 1.3 1997/03/12 20:26:55 christos Exp $ */ |
/* |
* ppp-comp.h - Definitions for doing PPP packet compression. |
* |
* Copyright (c) 1994 The Australian National University. |
* All rights reserved. |
* |
* Permission to use, copy, modify, and distribute this software and its |
* documentation is hereby granted, provided that the above copyright |
* notice appears in all copies. This software is provided without any |
* warranty, express or implied. The Australian National University |
* makes no representations about the suitability of this software for |
* any purpose. |
* |
* IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY |
* PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF |
* THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY |
* OF SUCH DAMAGE. |
* |
* THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, |
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
* ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO |
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, |
* OR MODIFICATIONS. |
* |
* Id: ppp-comp.h,v 1.10 1996/09/26 06:30:11 paulus Exp |
*/ |
#ifndef __NET_PPP_COMP_H |
#define __NET_PPP_COMP_H |
/* |
* The following symbols control whether we include code for |
* various compression methods. |
*/ |
#ifndef DO_BSD_COMPRESS |
#define DO_BSD_COMPRESS 1 /* by default, include BSD-Compress */ |
#endif |
#ifndef DO_DEFLATE |
#define DO_DEFLATE 1 /* by default, include Deflate */ |
#endif |
#define DO_PREDICTOR_1 0 |
#define DO_PREDICTOR_2 0 |
/* |
* Structure giving methods for compression/decompression. |
*/ |
#ifdef PACKETPTR |
struct compressor { |
int compress_proto; /* CCP compression protocol number */ |
/* Allocate space for a compressor (transmit side) */ |
void *(*comp_alloc) (u_char *options, int opt_len); |
/* Free space used by a compressor */ |
void (*comp_free) (void *state); |
/* Initialize a compressor */ |
int (*comp_init) (void *state, u_char *options, int opt_len, |
int unit, int hdrlen, int debug); |
/* Reset a compressor */ |
void (*comp_reset) (void *state); |
/* Compress a packet */ |
int (*compress) (void *state, PACKETPTR *mret, |
PACKETPTR mp, int orig_len, int max_len); |
/* Return compression statistics */ |
void (*comp_stat) (void *state, struct compstat *stats); |
/* Allocate space for a decompressor (receive side) */ |
void *(*decomp_alloc) (u_char *options, int opt_len); |
/* Free space used by a decompressor */ |
void (*decomp_free) (void *state); |
/* Initialize a decompressor */ |
int (*decomp_init) (void *state, u_char *options, int opt_len, |
int unit, int hdrlen, int mru, int debug); |
/* Reset a decompressor */ |
void (*decomp_reset) (void *state); |
/* Decompress a packet. */ |
int (*decompress) (void *state, PACKETPTR mp, PACKETPTR *dmpp); |
/* Update state for an incompressible packet received */ |
void (*incomp) (void *state, PACKETPTR mp); |
/* Return decompression statistics */ |
void (*decomp_stat) (void *state, struct compstat *stats); |
}; |
#endif /* PACKETPTR */ |
/* |
* Return values for decompress routine. |
* We need to make these distinctions so that we can disable certain |
* useful functionality, namely sending a CCP reset-request as a result |
* of an error detected after decompression. This is to avoid infringing |
* a patent held by Motorola. |
* Don't you just lurve software patents. |
*/ |
#define DECOMP_OK 0 /* everything went OK */ |
#define DECOMP_ERROR 1 /* error detected before decomp. */ |
#define DECOMP_FATALERROR 2 /* error detected after decomp. */ |
/* |
* CCP codes. |
*/ |
#define CCP_CONFREQ 1 |
#define CCP_CONFACK 2 |
#define CCP_TERMREQ 5 |
#define CCP_TERMACK 6 |
#define CCP_RESETREQ 14 |
#define CCP_RESETACK 15 |
/* |
* Max # bytes for a CCP option |
*/ |
#define CCP_MAX_OPTION_LENGTH 32 |
/* |
* Parts of a CCP packet. |
*/ |
#define CCP_CODE(dp) ((dp)[0]) |
#define CCP_ID(dp) ((dp)[1]) |
#define CCP_LENGTH(dp) (((dp)[2] << 8) + (dp)[3]) |
#define CCP_HDRLEN 4 |
#define CCP_OPT_CODE(dp) ((dp)[0]) |
#define CCP_OPT_LENGTH(dp) ((dp)[1]) |
#define CCP_OPT_MINLEN 2 |
/* |
* Definitions for BSD-Compress. |
*/ |
#define CI_BSD_COMPRESS 21 /* config. option for BSD-Compress */ |
#define CILEN_BSD_COMPRESS 3 /* length of config. option */ |
/* Macros for handling the 3rd byte of the BSD-Compress config option. */ |
#define BSD_NBITS(x) ((x) & 0x1F) /* number of bits requested */ |
#define BSD_VERSION(x) ((x) >> 5) /* version of option format */ |
#define BSD_CURRENT_VERSION 1 /* current version number */ |
#define BSD_MAKE_OPT(v, n) (((v) << 5) | (n)) |
#define BSD_MIN_BITS 9 /* smallest code size supported */ |
#define BSD_MAX_BITS 15 /* largest code size supported */ |
/* |
* Definitions for Deflate. |
*/ |
#define CI_DEFLATE 24 /* config option for Deflate */ |
#define CILEN_DEFLATE 4 /* length of its config option */ |
#define DEFLATE_MIN_SIZE 8 |
#define DEFLATE_MAX_SIZE 15 |
#define DEFLATE_METHOD_VAL 8 |
#define DEFLATE_SIZE(x) (((x) >> 4) + DEFLATE_MIN_SIZE) |
#define DEFLATE_METHOD(x) ((x) & 0x0F) |
#define DEFLATE_MAKE_OPT(w) ((((w) - DEFLATE_MIN_SIZE) << 4) \ |
+ DEFLATE_METHOD_VAL) |
#define DEFLATE_CHK_SEQUENCE 0 |
/* |
* Definitions for other, as yet unsupported, compression methods. |
*/ |
#define CI_PREDICTOR_1 1 /* config option for Predictor-1 */ |
#define CILEN_PREDICTOR_1 2 /* length of its config option */ |
#define CI_PREDICTOR_2 2 /* config option for Predictor-2 */ |
#define CILEN_PREDICTOR_2 2 /* length of its config option */ |
#endif |
//pkgnet/trunk/watt32/inc/net/ppp_defs.h |
---|
0,0 → 1,195 |
/*!\file net/ppp_defs.h |
* PPP definitions. |
*/ |
/* $Id: ppp_defs.h,v 1.11 1997/04/30 05:46:24 paulus Exp $ */ |
/* |
* ppp_defs.h - PPP definitions. |
* |
* Copyright (c) 1994 The Australian National University. |
* All rights reserved. |
* |
* Permission to use, copy, modify, and distribute this software and its |
* documentation is hereby granted, provided that the above copyright |
* notice appears in all copies. This software is provided without any |
* warranty, express or implied. The Australian National University |
* makes no representations about the suitability of this software for |
* any purpose. |
* |
* IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY |
* PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF |
* THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY |
* OF SUCH DAMAGE. |
* |
* THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, |
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
* ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO |
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, |
* OR MODIFICATIONS. |
*/ |
#ifndef __NET_PPP_DEFS_H |
#define __NET_PPP_DEFS_H |
/* |
* The basic PPP frame. |
*/ |
#define PPP_HDRLEN 4 /* octets for standard ppp header */ |
#define PPP_FCSLEN 2 /* octets for FCS */ |
/* |
* Packet sizes |
* |
* Note - lcp shouldn't be allowed to negotiate stuff outside these |
* limits. See lcp.h in the pppd directory. |
* (XXX - these constants should simply be shared by lcp.c instead |
* of living in lcp.h) |
*/ |
#define PPP_MTU 1500 /* Default MTU (size of Info field) */ |
#define PPP_MAXMTU 65535 - (PPP_HDRLEN + PPP_FCSLEN) |
#define PPP_MINMTU 64 |
#define PPP_MRU 1500 /* default MRU = max length of info field */ |
#define PPP_MAXMRU 65000 /* Largest MRU we allow */ |
#define PPP_MINMRU 128 |
#define PPP_ADDRESS(p) (((u_char *)(p))[0]) |
#define PPP_CONTROL(p) (((u_char *)(p))[1]) |
#define PPP_PROTOCOL(p) ((((u_char *)(p))[2] << 8) + ((u_char *)(p))[3]) |
/* |
* Significant octet values. |
*/ |
#define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */ |
#define PPP_UI 0x03 /* Unnumbered Information */ |
#define PPP_FLAG 0x7e /* Flag Sequence */ |
#define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */ |
#define PPP_TRANS 0x20 /* Asynchronous transparency modifier */ |
/* |
* Protocol field values. |
*/ |
#define PPP_IP 0x0021 /* Raw IP */ |
#define PPP_OSI 0x0023 /* OSI Network Layer */ |
#define PPP_NS 0x0025 /* Xerox NS IDP */ |
#define PPP_DECNET 0x0027 /* DECnet Phase IV */ |
#define PPP_APPLE 0x0029 /* Appletalk */ |
#define PPP_IPX 0x002b /* Novell IPX */ |
#define PPP_VJC 0x002d /* Van Jacobson Compressed TCP/IP */ |
#define PPP_VJNC 0x002f /* Van Jacobson Uncompressed TCP/IP */ |
#define PPP_VJC_COMP PPP_VJC |
#define PPP_VJC_UNCOMP PPP_VJNC |
#define PPP_BRPDU 0x0031 /* Bridging PDU */ |
#define PPP_STII 0x0033 /* Stream Protocol (ST-II) */ |
#define PPP_VINES 0x0035 /* Banyan Vines */ |
#define PPP_IPV6 0x0057 /* Internet Protocol Version 6 */ |
#define PPP_COMP 0x00fd /* compressed packet */ |
#define PPP_HELLO 0x0201 /* 802.1d Hello Packets */ |
#define PPP_LUXCOM 0x0231 /* Luxcom */ |
#define PPP_SNS 0x0233 /* Sigma Network Systems */ |
#define PPP_IPCP 0x8021 /* IP Control Protocol */ |
#define PPP_OSICP 0x8023 /* OSI Network Layer Control Protocol */ |
#define PPP_NSCP 0x8025 /* Xerox NS IDP Control Protocol */ |
#define PPP_DECNETCP 0x8027 /* DECnet Control Protocol */ |
#define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */ |
#define PPP_IPXCP 0x802b /* IPX Control Protocol */ |
#define PPP_STIICP 0x8033 /* Strean Protocol Control Protocol */ |
#define PPP_VINESCP 0x8035 /* Banyan Vines Control Protocol */ |
#define PPP_CCP 0x80fd /* Compression Control Protocol */ |
#define PPP_LCP 0xc021 /* Link Control Protocol */ |
#define PPP_PAP 0xc023 /* Password Authentication Protocol */ |
#define PPP_LQR 0xc025 /* Link Quality Report protocol */ |
#define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */ |
#define PPP_CBCP 0xc029 /* Callback Control Protocol */ |
/* |
* Values for FCS calculations. |
*/ |
#define PPP_INITFCS 0xffff /* Initial FCS value */ |
#define PPP_GOODFCS 0xf0b8 /* Good final FCS value */ |
#define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff]) |
/* |
* A 32-bit unsigned integral type. |
*/ |
#if !defined(__BIT_TYPES_DEFINED__) && !defined(_BITYPES) && !defined(__SYS_WTYPES_H) |
#ifdef UINT32_T |
typedef UINT32_T u_int32_t; |
#else |
typedef unsigned long u_int32_t; |
#endif |
#endif |
/* |
* Extended asyncmap - allows any character to be escaped. |
*/ |
typedef u_int32_t ext_accm[8]; |
/* |
* What to do with network protocol (NP) packets. |
*/ |
enum NPmode { |
NPMODE_PASS, /* pass the packet through */ |
NPMODE_DROP, /* silently drop the packet */ |
NPMODE_ERROR, /* return an error */ |
NPMODE_QUEUE /* save it up for later. */ |
}; |
/* |
* Statistics. |
*/ |
struct pppstat { |
unsigned int ppp_ibytes; /* bytes received */ |
unsigned int ppp_ipackets; /* packets received */ |
unsigned int ppp_ierrors; /* receive errors */ |
unsigned int ppp_obytes; /* bytes sent */ |
unsigned int ppp_opackets; /* packets sent */ |
unsigned int ppp_oerrors; /* transmit errors */ |
}; |
struct vjstat { |
unsigned int vjs_packets; /* outbound packets */ |
unsigned int vjs_compressed; /* outbound compressed packets */ |
unsigned int vjs_searches; /* searches for connection state */ |
unsigned int vjs_misses; /* times couldn't find conn. state */ |
unsigned int vjs_uncompressedin; /* inbound uncompressed packets */ |
unsigned int vjs_compressedin; /* inbound compressed packets */ |
unsigned int vjs_errorin; /* inbound unknown type packets */ |
unsigned int vjs_tossed; /* inbound packets tossed because of error */ |
}; |
struct ppp_stats { |
struct pppstat p; /* basic PPP statistics */ |
struct vjstat vj; /* VJ header compression statistics */ |
}; |
struct compstat { |
unsigned int unc_bytes; /* total uncompressed bytes */ |
unsigned int unc_packets; /* total uncompressed packets */ |
unsigned int comp_bytes; /* compressed bytes */ |
unsigned int comp_packets; /* compressed packets */ |
unsigned int inc_bytes; /* incompressible bytes */ |
unsigned int inc_packets; /* incompressible packets */ |
unsigned int ratio; /* recent compression ratio << 8 */ |
}; |
struct ppp_comp_stats { |
struct compstat c; /* packet compression statistics */ |
struct compstat d; /* packet decompression statistics */ |
}; |
/* |
* The following structure records the time in seconds since |
* the last NP packet was sent or received. |
*/ |
struct ppp_idle { |
time_t xmit_idle; /* time since last NP packet sent */ |
time_t recv_idle; /* time since last NP packet received */ |
}; |
#endif |
//pkgnet/trunk/watt32/inc/net/radix.h |
---|
0,0 → 1,167 |
/*!\file net/radix.h |
* Radix search trees. |
*/ |
/* $NetBSD: radix.h,v 1.9 1997/04/02 21:17:31 christos Exp $ */ |
/* |
* Copyright (c) 1988, 1989, 1993 |
* The Regents of the University of California. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
* must display the following acknowledgement: |
* This product includes software developed by the University of |
* California, Berkeley and its contributors. |
* 4. Neither the name of the University nor the names of its contributors |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
* |
* @(#)radix.h 8.2 (Berkeley) 10/31/94 |
*/ |
#ifndef _NET_RADIX_H_ |
#define _NET_RADIX_H_ |
/* |
* Radix search tree node layout. |
*/ |
struct radix_node { |
struct radix_mask *rn_mklist; /* list of masks contained in subtree */ |
struct radix_node *rn_p; /* parent */ |
short rn_b; /* bit offset; -1-index(netmask) */ |
char rn_bmask; /* node: mask for bit test*/ |
u_char rn_flags; /* enumerated next */ |
#define RNF_NORMAL 1 /* leaf contains normal route */ |
#define RNF_ROOT 2 /* leaf is root leaf for tree */ |
#define RNF_ACTIVE 4 /* This node is alive (for rtfree) */ |
union { |
struct { /* leaf only data: */ |
caddr_t rn_Key; /* object of search */ |
caddr_t rn_Mask; /* netmask, if present */ |
struct radix_node *rn_Dupedkey; |
} rn_leaf; |
struct { /* node only data: */ |
int rn_Off; /* where to start compare */ |
struct radix_node *rn_L;/* progeny */ |
struct radix_node *rn_R;/* progeny */ |
} rn_node; |
} rn_u; |
#ifdef RN_DEBUG |
int rn_info; |
struct radix_node *rn_twin; |
struct radix_node *rn_ybro; |
#endif |
}; |
#define rn_dupedkey rn_u.rn_leaf.rn_Dupedkey |
#define rn_key rn_u.rn_leaf.rn_Key |
#define rn_mask rn_u.rn_leaf.rn_Mask |
#define rn_off rn_u.rn_node.rn_Off |
#define rn_l rn_u.rn_node.rn_L |
#define rn_r rn_u.rn_node.rn_R |
/* |
* Annotations to tree concerning potential routes applying to subtrees. |
*/ |
extern struct radix_mask { |
short rm_b; /* bit offset; -1-index(netmask) */ |
char rm_unused; /* cf. rn_bmask */ |
u_char rm_flags; /* cf. rn_flags */ |
struct radix_mask *rm_mklist; /* more masks to try */ |
union { |
caddr_t rmu_mask; /* the mask */ |
struct radix_node *rmu_leaf; /* for normal routes */ |
} rm_rmu; |
int rm_refs; /* # of references to this struct */ |
} *rn_mkfreelist; |
#define rm_mask rm_rmu.rmu_mask |
#define rm_leaf rm_rmu.rmu_leaf /* extra field would make 32 bytes */ |
#define MKGet(m) {\ |
if (rn_mkfreelist) {\ |
m = rn_mkfreelist; \ |
rn_mkfreelist = (m)->rm_mklist; \ |
} else \ |
R_Malloc(m, struct radix_mask *, sizeof (*(m))); }\ |
#define MKFree(m) { (m)->rm_mklist = rn_mkfreelist; rn_mkfreelist = (m);} |
struct radix_node_head { |
struct radix_node *rnh_treetop; |
int rnh_addrsize; /* permit, but not require fixed keys */ |
int rnh_pktsize; /* permit, but not require fixed keys */ |
struct radix_node *(*rnh_addaddr) /* add based on sockaddr */ |
__P((void *v, void *mask, |
struct radix_node_head *head, struct radix_node nodes[])); |
struct radix_node *(*rnh_addpkt) /* add based on packet hdr */ |
__P((void *v, void *mask, |
struct radix_node_head *head, struct radix_node nodes[])); |
struct radix_node *(*rnh_deladdr) /* remove based on sockaddr */ |
__P((void *v, void *mask, struct radix_node_head *head)); |
struct radix_node *(*rnh_delpkt) /* remove based on packet hdr */ |
__P((void *v, void *mask, struct radix_node_head *head)); |
struct radix_node *(*rnh_matchaddr) /* locate based on sockaddr */ |
__P((void *v, struct radix_node_head *head)); |
struct radix_node *(*rnh_lookup) /* locate based on sockaddr */ |
__P((void *v, void *mask, struct radix_node_head *head)); |
struct radix_node *(*rnh_matchpkt) /* locate based on packet hdr */ |
__P((void *v, struct radix_node_head *head)); |
int (*rnh_walktree) /* traverse tree */ |
__P((struct radix_node_head *, |
int (*)(struct radix_node *, void *), void *)); |
struct radix_node rnh_nodes[3]; /* empty tree for common case */ |
}; |
#define Bcmp(a,b,n) memcmp (a,b,n) |
#define Bcopy(a,b,n) memcpy (b,a,n) |
#define Bzero(p,n) memset ((void*)(p),0,(int)(n)); |
#define R_Malloc(p,t,n) (p = (t) malloc((unsigned int)(n))) |
#define Free(p) free ((void*)p); |
__BEGIN_DECLS |
void rn_init (void); |
int rn_inithead (void **, int); |
int rn_refines (void *, void *); |
int rn_walktree (struct radix_node_head *, |
int (*)(struct radix_node *, void *), |
void *); |
struct radix_node *rn_addroute (void *, void *, struct radix_node_head *, struct radix_node [2]); |
struct radix_node *rn_insert (void *, struct radix_node_head *, int *, struct radix_node [2]); |
struct radix_node *rn_newpair (void *, int, struct radix_node[2]); |
struct radix_node *rn_addmask (void *, int, int); |
struct radix_node *rn_delete (void *, void *, struct radix_node_head *); |
struct radix_node *rn_lookup (void *, void *, struct radix_node_head *); |
struct radix_node *rn_match (void *, struct radix_node_head *); |
struct radix_node *rn_search (void *, struct radix_node *); |
struct radix_node *rn_search_m (void *, struct radix_node *, void *); |
__END_DECLS |
#endif /* _NET_RADIX_H_ */ |
//pkgnet/trunk/watt32/inc/net/raw_cb.h |
---|
0,0 → 1,65 |
/*!\file net/raw_cb.h |
* |
*/ |
/* $NetBSD: raw_cb.h,v 1.11 1996/05/28 23:24:50 pk Exp $ */ |
/* |
* Copyright (c) 1980, 1986, 1993 |
* The Regents of the University of California. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
* must display the following acknowledgement: |
* This product includes software developed by the University of |
* California, Berkeley and its contributors. |
* 4. Neither the name of the University nor the names of its contributors |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
* |
* @(#)raw_cb.h 8.1 (Berkeley) 6/10/93 |
*/ |
#ifndef __NET_RAW_CB_H |
#define __NET_RAW_CB_H |
/* |
* Raw protocol interface control block. Used |
* to tie a socket to the generic raw interface. |
*/ |
struct rawcb { |
LIST_ENTRY(rawcb) rcb_list; /* doubly linked list */ |
struct socket *rcb_socket; /* back pointer to socket */ |
struct sockaddr *rcb_faddr; /* destination address */ |
struct sockaddr *rcb_laddr; /* socket's address */ |
struct sockproto rcb_proto; /* protocol family, protocol */ |
}; |
#define sotorawcb(so) ((struct rawcb *)(so)->so_pcb) |
/* |
* Nominal space allocated to a raw socket. |
*/ |
#define RAWSNDQ 8192 |
#define RAWRCVQ 8192 |
#endif |
//pkgnet/trunk/watt32/inc/net/route.h |
---|
0,0 → 1,236 |
/*!\file net/route.h |
* Route handling. |
*/ |
/* $NetBSD: route.h,v 1.11 1997/04/02 21:17:29 christos Exp $ */ |
/* |
* Copyright (c) 1980, 1986, 1993 |
* The Regents of the University of California. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
* must display the following acknowledgement: |
* This product includes software developed by the University of |
* California, Berkeley and its contributors. |
* 4. Neither the name of the University nor the names of its contributors |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
* |
* @(#)route.h 8.5 (Berkeley) 2/8/95 |
*/ |
#ifndef __NET_ROUTE_H |
#define __NET_ROUTE_H |
/* |
* Kernel resident routing tables. |
* |
* The routing tables are initialized when interface addresses |
* are set by making entries for all directly connected interfaces. |
*/ |
/* |
* A route consists of a destination address and a reference |
* to a routing entry. These are often held by protocols |
* in their control blocks, e.g. inpcb. |
*/ |
struct route { |
struct rtentry *ro_rt; |
struct sockaddr ro_dst; |
}; |
/* |
* These numbers are used by reliable protocols for determining |
* retransmission behavior and are included in the routing structure. |
*/ |
struct rt_metrics { |
u_long rmx_locks; /* Kernel must leave these values alone */ |
u_long rmx_mtu; /* MTU for this path */ |
u_long rmx_hopcount; /* max hops expected */ |
u_long rmx_expire; /* lifetime for route, e.g. redirect */ |
u_long rmx_recvpipe; /* inbound delay-bandwith product */ |
u_long rmx_sendpipe; /* outbound delay-bandwith product */ |
u_long rmx_ssthresh; /* outbound gateway buffer limit */ |
u_long rmx_rtt; /* estimated round trip time */ |
u_long rmx_rttvar; /* estimated rtt variance */ |
u_long rmx_pksent; /* packets sent using this route */ |
}; |
/* |
* rmx_rtt and rmx_rttvar are stored as microseconds; |
* RTTTOPRHZ(rtt) converts to a value suitable for use |
* by a protocol slowtimo counter. |
*/ |
#define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */ |
#define RTTTOPRHZ(r) ((r) / (RTM_RTTUNIT / PR_SLOWHZ)) |
/* |
* We distinguish between routes to hosts and routes to networks, |
* preferring the former if available. For each route we infer |
* the interface to use from the gateway address supplied when |
* the route was entered. Routes that forward packets through |
* gateways are marked so that the output routines know to address the |
* gateway rather than the ultimate destination. |
*/ |
#ifndef RNF_NORMAL |
#include <net/radix.h> |
#endif |
struct rtentry { |
struct radix_node rt_nodes[2]; /* tree glue, and other values */ |
#define rt_key(r) ((struct sockaddr *)((r)->rt_nodes->rn_key)) |
#define rt_mask(r) ((struct sockaddr *)((r)->rt_nodes->rn_mask)) |
struct sockaddr *rt_gateway; /* value */ |
short rt_flags; /* up/down?, host/net */ |
short rt_refcnt; /* # held references */ |
u_long rt_use; /* raw # packets forwarded */ |
struct ifnet *rt_ifp; /* the answer: interface to use */ |
struct ifaddr *rt_ifa; /* the answer: interface to use */ |
struct sockaddr *rt_genmask; /* for generation of cloned routes */ |
caddr_t rt_llinfo; /* pointer to link level info cache */ |
struct rt_metrics rt_rmx; /* metrics used by rx'ing protocols */ |
struct rtentry *rt_gwroute; /* implied entry for gatewayed routes */ |
}; |
/* |
* Following structure necessary for 4.3 compatibility; |
* We should eventually move it to a compat file. |
*/ |
struct ortentry { |
u_int32_t rt_hash; /* to speed lookups */ |
struct sockaddr rt_dst; /* key */ |
struct sockaddr rt_gateway; /* value */ |
int16_t rt_flags; /* up/down?, host/net */ |
int16_t rt_refcnt; /* # held references */ |
u_int32_t rt_use; /* raw # packets forwarded */ |
struct ifnet *rt_ifp; /* the answer: interface to use */ |
}; |
#define RTF_UP 0x1 /* route usable */ |
#define RTF_GATEWAY 0x2 /* destination is a gateway */ |
#define RTF_HOST 0x4 /* host entry (net otherwise) */ |
#define RTF_REJECT 0x8 /* host or net unreachable */ |
#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */ |
#define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */ |
#define RTF_DONE 0x40 /* message confirmed */ |
#define RTF_MASK 0x80 /* subnet mask present */ |
#define RTF_CLONING 0x100 /* generate new routes on use */ |
#define RTF_XRESOLVE 0x200 /* external daemon resolves name */ |
#define RTF_LLINFO 0x400 /* generated by ARP or ESIS */ |
#define RTF_STATIC 0x800 /* manually added */ |
#define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */ |
#define RTF_PROTO2 0x4000 /* protocol specific routing flag */ |
#define RTF_PROTO1 0x8000 /* protocol specific routing flag */ |
/* |
* Routing statistics. |
*/ |
struct rtstat { |
short rts_badredirect; /* bogus redirect calls */ |
short rts_dynamic; /* routes created by redirects */ |
short rts_newgateway; /* routes modified by redirects */ |
short rts_unreach; /* lookups which failed */ |
short rts_wildcard; /* lookups satisfied by a wildcard */ |
}; |
/* |
* Structures for routing messages. |
*/ |
struct rt_msghdr { |
u_short rtm_msglen; /* to skip over non-understood messages */ |
u_char rtm_version; /* future binary compatibility */ |
u_char rtm_type; /* message type */ |
u_short rtm_index; /* index for associated ifp */ |
int rtm_flags; /* flags, incl. kern & message, e.g. DONE */ |
int rtm_addrs; /* bitmask identifying sockaddrs in msg */ |
int rtm_pid; /* identify sender */ |
int rtm_seq; /* for sender to identify action */ |
int rtm_errno; /* why failed */ |
int rtm_use; /* from rtentry */ |
u_long rtm_inits; /* which metrics we are initializing */ |
struct rt_metrics rtm_rmx; /* metrics themselves */ |
}; |
#define RTM_VERSION 3 /* Up the ante and ignore older versions */ |
#define RTM_ADD 0x1 /* Add Route */ |
#define RTM_DELETE 0x2 /* Delete Route */ |
#define RTM_CHANGE 0x3 /* Change Metrics or flags */ |
#define RTM_GET 0x4 /* Report Metrics */ |
#define RTM_LOSING 0x5 /* Kernel Suspects Partitioning */ |
#define RTM_REDIRECT 0x6 /* Told to use different route */ |
#define RTM_MISS 0x7 /* Lookup failed on this address */ |
#define RTM_LOCK 0x8 /* fix specified metrics */ |
#define RTM_OLDADD 0x9 /* caused by SIOCADDRT */ |
#define RTM_OLDDEL 0xa /* caused by SIOCDELRT */ |
#define RTM_RESOLVE 0xb /* req to resolve dst to LL addr */ |
#define RTM_NEWADDR 0xc /* address being added to iface */ |
#define RTM_DELADDR 0xd /* address being removed from iface */ |
#define RTM_IFINFO 0xe /* iface going up/down etc. */ |
#define RTV_MTU 0x1 /* init or lock _mtu */ |
#define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */ |
#define RTV_EXPIRE 0x4 /* init or lock _hopcount */ |
#define RTV_RPIPE 0x8 /* init or lock _recvpipe */ |
#define RTV_SPIPE 0x10 /* init or lock _sendpipe */ |
#define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */ |
#define RTV_RTT 0x40 /* init or lock _rtt */ |
#define RTV_RTTVAR 0x80 /* init or lock _rttvar */ |
/* |
* Bitmask values for rtm_addr. |
*/ |
#define RTA_DST 0x1 /* destination sockaddr present */ |
#define RTA_GATEWAY 0x2 /* gateway sockaddr present */ |
#define RTA_NETMASK 0x4 /* netmask sockaddr present */ |
#define RTA_GENMASK 0x8 /* cloning mask sockaddr present */ |
#define RTA_IFP 0x10 /* interface name sockaddr present */ |
#define RTA_IFA 0x20 /* interface addr sockaddr present */ |
#define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */ |
#define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */ |
/* |
* Index offsets for sockaddr array for alternate internal encoding. |
*/ |
#define RTAX_DST 0 /* destination sockaddr present */ |
#define RTAX_GATEWAY 1 /* gateway sockaddr present */ |
#define RTAX_NETMASK 2 /* netmask sockaddr present */ |
#define RTAX_GENMASK 3 /* cloning mask sockaddr present */ |
#define RTAX_IFP 4 /* interface name sockaddr present */ |
#define RTAX_IFA 5 /* interface addr sockaddr present */ |
#define RTAX_AUTHOR 6 /* sockaddr for author of redirect */ |
#define RTAX_BRD 7 /* for NEWADDR, broadcast or p-p dest addr */ |
#define RTAX_MAX 8 /* size of array to allocate */ |
struct rt_addrinfo { |
int rti_addrs; |
struct sockaddr *rti_info[RTAX_MAX]; |
}; |
struct route_cb { |
int ip_count; |
int ns_count; |
int iso_count; |
int any_count; |
}; |
#endif |
//pkgnet/trunk/watt32/inc/net/slcompre.h |
---|
0,0 → 1,175 |
/*!\file net/slcompre.h |
* SLIP/PPP compression. |
*/ |
/* $NetBSD: slcompress.h,v 1.11 1997/05/17 21:12:11 christos Exp $ */ |
/* Id: slcompress.h,v 1.4 1994/09/21 06:50:08 paulus Exp */ |
/* |
* Copyright (c) 1989, 1993 |
* The Regents of the University of California. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
* must display the following acknowledgement: |
* This product includes software developed by the University of |
* California, Berkeley and its contributors. |
* 4. Neither the name of the University nor the names of its contributors |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
* |
* @(#)slcompress.h 8.1 (Berkeley) 6/10/93 |
*/ |
/* |
* Definitions for tcp compression routines. |
* |
* Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989: |
* - Initial distribution. |
*/ |
#ifndef __NET_SLCOMPRESS_H |
#define __NET_SLCOMPRESS_H |
#ifndef MLEN |
#define MLEN 128 |
#endif |
#define MAX_STATES 16 /* must be > 2 and < 256 */ |
#define MAX_HDR MLEN /* XXX 4bsd-ism: should really be 128 */ |
/* |
* Compressed packet format: |
* |
* The first octet contains the packet type (top 3 bits), TCP |
* 'push' bit, and flags that indicate which of the 4 TCP sequence |
* numbers have changed (bottom 5 bits). The next octet is a |
* conversation number that associates a saved IP/TCP header with |
* the compressed packet. The next two octets are the TCP checksum |
* from the original datagram. The next 0 to 15 octets are |
* sequence number changes, one change per bit set in the header |
* (there may be no changes and there are two special cases where |
* the receiver implicitly knows what changed -- see below). |
* |
* There are 5 numbers which can change (they are always inserted |
* in the following order): TCP urgent pointer, window, |
* acknowlegement, sequence number and IP ID. (The urgent pointer |
* is different from the others in that its value is sent, not the |
* change in value.) Since typical use of SLIP links is biased |
* toward small packets (see comments on MTU/MSS below), changes |
* use a variable length coding with one octet for numbers in the |
* range 1 - 255 and 3 octets (0, MSB, LSB) for numbers in the |
* range 256 - 65535 or 0. (If the change in sequence number or |
* ack is more than 65535, an uncompressed packet is sent.) |
*/ |
/* |
* Packet types (must not conflict with IP protocol version) |
* |
* The top nibble of the first octet is the packet type. There are |
* three possible types: IP (not proto TCP or tcp with one of the |
* control flags set); uncompressed TCP (a normal IP/TCP packet but |
* with the 8-bit protocol field replaced by an 8-bit connection id -- |
* this type of packet syncs the sender & receiver); and compressed |
* TCP (described above). |
* |
* LSB of 4-bit field is TCP "PUSH" bit (a worthless anachronism) and |
* is logically part of the 4-bit "changes" field that follows. Top |
* three bits are actual packet type. For backward compatibility |
* and in the interest of conserving bits, numbers are chosen so the |
* IP protocol version number (4) which normally appears in this nibble |
* means "IP packet". |
*/ |
/* packet types */ |
#define TYPE_IP 0x40 |
#define TYPE_UNCOMPRESSED_TCP 0x70 |
#define TYPE_COMPRESSED_TCP 0x80 |
#define TYPE_ERROR 0x00 |
/* Bits in first octet of compressed packet */ |
#define NEW_C 0x40 /* flag bits for what changed in a packet */ |
#define NEW_I 0x20 |
#define NEW_S 0x08 |
#define NEW_A 0x04 |
#define NEW_W 0x02 |
#define NEW_U 0x01 |
/* reserved, special-case values of above */ |
#define SPECIAL_I (NEW_S|NEW_W|NEW_U) /* echoed interactive traffic */ |
#define SPECIAL_D (NEW_S|NEW_A|NEW_W|NEW_U) /* unidirectional data */ |
#define SPECIALS_MASK (NEW_S|NEW_A|NEW_W|NEW_U) |
#define TCP_PUSH_BIT 0x10 |
/* |
* "state" data for each active tcp conversation on the wire. This is |
* basically a copy of the entire IP/TCP header from the last packet |
* we saw from the conversation together with a small identifier |
* the transmit & receive ends of the line use to locate saved header. |
*/ |
struct cstate { |
struct cstate *cs_next; /* next most recently used cstate (xmit only) */ |
u_int16_t cs_hlen; /* size of hdr (receive only) */ |
u_char cs_id; /* connection # associated with this state */ |
u_char cs_filler; |
union { |
char csu_hdr[MAX_HDR]; |
struct ip csu_ip; /* ip/tcp hdr from most recent packet */ |
} slcs_u; |
}; |
#define cs_ip slcs_u.csu_ip |
#define cs_hdr slcs_u.csu_hdr |
/* |
* all the state data for one serial line (we need one of these |
* per line). |
*/ |
struct slcompress { |
struct cstate *last_cs; /* most recently used tstate */ |
u_char last_recv; /* last rcvd conn. id */ |
u_char last_xmit; /* last sent conn. id */ |
u_int16_t flags; |
#ifndef SL_NO_STATS |
int sls_packets; /* outbound packets */ |
int sls_compressed; /* outbound compressed packets */ |
int sls_searches; /* searches for connection state */ |
int sls_misses; /* times couldn't find conn. state */ |
int sls_uncompressedin; /* inbound uncompressed packets */ |
int sls_compressedin; /* inbound compressed packets */ |
int sls_errorin; /* inbound unknown type packets */ |
int sls_tossed; /* inbound packets tossed because of error */ |
#endif |
struct cstate tstate[MAX_STATES]; /* xmit connection states */ |
struct cstate rstate[MAX_STATES]; /* receive connection states */ |
}; |
/* flag values */ |
#define SLF_TOSS 1 /* tossing rcvd frames because of input err */ |
void sl_compress_init (struct slcompress *); |
void sl_compress_setup (struct slcompress *, int); |
u_int sl_compress_tcp (struct mbuf *, struct ip *, struct slcompress *, int); |
int sl_uncompress_tcp (u_char **, int, u_int, struct slcompress *); |
int sl_uncompress_tcp_core (u_char *, int, int, u_int, struct slcompress *, u_char **, u_int *); |
#endif |
//pkgnet/trunk/watt32/inc/net/slip.h |
---|
0,0 → 1,62 |
/*!\file net/slip.h |
* BPF SLIP definitions. |
*/ |
/* $NetBSD: slip.h,v 1.6 1994/06/29 06:36:53 cgd Exp $ */ |
/*- |
* Copyright (c) 1994 |
* The Regents of the University of California. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
* must display the following acknowledgement: |
* This product includes software developed by the University of |
* California, Berkeley and its contributors. |
* 4. Neither the name of the University nor the names of its contributors |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
* |
* @(#)slip.h 8.1 (Berkeley) 2/12/94 |
*/ |
#ifndef __NET_SLIP_H |
#define __NET_SLIP_H |
/* Ioctls operating on SLIP ttys. */ |
#define SLIOCGUNIT _IOR('t', 88, int) /* get slip unit number */ |
/* |
* Definitions of the pseudo-link-level header attached to slip |
* packets grabbed by the packet filter (bpf) traffic monitor. |
*/ |
#define SLIP_HDRLEN 16 /* BPF SLIP header length */ |
/* Offsets into BPF SLIP header. */ |
#define SLX_DIR 0 /* direction; see below */ |
#define SLX_CHDR 1 /* compressed header data */ |
#define CHDR_LEN 15 /* length of compressed header data */ |
#define SLIPDIR_IN 0 /* incoming */ |
#define SLIPDIR_OUT 1 /* outgoing */ |
#endif |