* Removed useless legacy header.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34322 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
dec91a9754
commit
aeb728e132
@ -1,278 +0,0 @@
|
||||
/* if.h
|
||||
* Interface definitions for beos
|
||||
*/
|
||||
|
||||
#ifndef _NET_IF_H
|
||||
#define _NET_IF_H
|
||||
|
||||
/* FIXME: this file is NOT POSIX compliant, and rely on way too much OS-dependent
|
||||
definition.
|
||||
Moving private parts to private headers should help clean up this file
|
||||
|
||||
POSIX net/if.h spec:
|
||||
http://www.opengroup.org/onlinepubs/007904975/basedefs/net/if.h.html
|
||||
*/
|
||||
|
||||
#include <OS.h> /* FIXME */
|
||||
#include <net/if_types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <net/route.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Forward reference... */
|
||||
struct socket;
|
||||
|
||||
/* Media types are now listed in net/if_types.h */
|
||||
|
||||
/* Interface flags */
|
||||
enum {
|
||||
IFF_UP = 0x0001,
|
||||
IFF_DOWN = 0x0002,
|
||||
IFF_PROMISC = 0x0004,
|
||||
IFF_RUNNING = 0x0008,
|
||||
IFF_MULTICAST = 0x0010,
|
||||
IFF_BROADCAST = 0x0020,
|
||||
IFF_POINTOPOINT = 0x0040,
|
||||
IFF_NOARP = 0x0080,
|
||||
IFF_LOOPBACK = 0x0100,
|
||||
IFF_DEBUG = 0x0200,
|
||||
IFF_LINK0 = 0x0400,
|
||||
IFF_LINK1 = 0x0800,
|
||||
IFF_LINK2 = 0x1000,
|
||||
IFF_SIMPLEX = 0x2000
|
||||
};
|
||||
|
||||
struct ifq {
|
||||
struct mbuf *head;
|
||||
struct mbuf *tail;
|
||||
int maxlen;
|
||||
int len;
|
||||
sem_id lock;
|
||||
sem_id pop;
|
||||
};
|
||||
|
||||
#define IFQ_FULL(ifq) (ifq->len >= ifq->maxlen)
|
||||
|
||||
#define IFQ_ENQUEUE(ifq, m) { \
|
||||
acquire_sem((ifq)->lock); \
|
||||
(m)->m_nextpkt = 0; \
|
||||
if ((ifq)->tail == 0) \
|
||||
(ifq)->head = m; \
|
||||
else \
|
||||
(ifq)->tail->m_nextpkt = m; \
|
||||
(ifq)->tail = m; \
|
||||
(ifq)->len++; \
|
||||
release_sem((ifq)->lock); \
|
||||
release_sem((ifq)->pop); \
|
||||
}
|
||||
|
||||
#define IFQ_DEQUEUE(ifq, m) { \
|
||||
acquire_sem((ifq)->lock); \
|
||||
(m) = (ifq)->head; \
|
||||
if (m) { \
|
||||
if (((ifq)->head = (m)->m_nextpkt) == 0) \
|
||||
(ifq)->tail = 0; \
|
||||
(m)->m_nextpkt = 0; \
|
||||
(ifq)->len--; \
|
||||
} \
|
||||
release_sem((ifq)->lock); \
|
||||
}
|
||||
|
||||
struct ifaddr {
|
||||
struct ifaddr *ifa_next; /* the next address for the interface */
|
||||
struct ifnet *ifa_ifp; /* pointer to the interface structure */
|
||||
|
||||
struct sockaddr *ifa_addr; /* the address - cast to be a suitable type, so we
|
||||
* use this structure to store any type of address that
|
||||
* we have a struct sockaddr_? for. e.g.
|
||||
* link level address via sockaddr_dl and
|
||||
* ipv4 via sockeddr_in
|
||||
* same for next 2 pointers as well
|
||||
*/
|
||||
struct sockaddr *ifa_dstaddr; /* if we're on a point-to-point link this
|
||||
* is the other end */
|
||||
struct sockaddr *ifa_netmask; /* The netmask we're using */
|
||||
|
||||
/* check or clean routes... */
|
||||
void (*ifa_rtrequest)(int, struct rtentry *, struct sockaddr *);
|
||||
uint8 ifa_flags; /* flags (mainly routing */
|
||||
uint16 ifa_refcnt; /* how many references are there to
|
||||
* this structure? */
|
||||
int ifa_metric; /* the metirc for this interface/address */
|
||||
};
|
||||
#define ifa_broadaddr ifa_dstaddr
|
||||
|
||||
struct if_data {
|
||||
uint8 ifi_type; /* type of media */
|
||||
uint8 ifi_addrlen; /* length of media address length */
|
||||
uint8 ifi_hdrlen; /* size of media header */
|
||||
uint32 ifi_mtu; /* mtu */
|
||||
uint32 ifi_metric; /* routing metric */
|
||||
uint32 ifi_baudrate; /* baudrate of line */
|
||||
/* statistics!! */
|
||||
int32 ifi_ipackets; /* packets received on interface */
|
||||
int32 ifi_ierrors; /* input errors on interface */
|
||||
int32 ifi_opackets; /* packets sent on interface */
|
||||
int32 ifi_oerrors; /* output errors on interface */
|
||||
int32 ifi_collisions; /* collisions on csma interfaces */
|
||||
int32 ifi_ibytes; /* total number of octets received */
|
||||
int32 ifi_obytes; /* total number of octets sent */
|
||||
int32 ifi_imcasts; /* packets received via multicast */
|
||||
int32 ifi_omcasts; /* packets sent via multicast */
|
||||
int32 ifi_iqdrops; /* dropped on input, this interface */
|
||||
int32 ifi_noproto; /* destined for unsupported protocol */
|
||||
};
|
||||
|
||||
struct ifnet {
|
||||
struct ifnet *if_next; /* next device */
|
||||
struct ifaddr *if_addrlist; /* linked list of addresses */
|
||||
int devid; /* our device id if we have one... */
|
||||
int id; /* id within the stack's device list */
|
||||
char *name; /* name of driver e.g. tulip */
|
||||
int if_unit; /* number of unit e.g 0 */
|
||||
char *if_name; /* full name, e.g. tulip0 */
|
||||
struct if_data ifd; /* if_data structure, shortcuts below */
|
||||
int if_flags; /* if flags */
|
||||
int if_index; /* our index in ifnet_addrs and interfaces */
|
||||
|
||||
struct ifq *rxq;
|
||||
thread_id rx_thread;
|
||||
struct ifq *txq;
|
||||
thread_id tx_thread;
|
||||
struct ifq *devq;
|
||||
|
||||
int (*start) (struct ifnet *);
|
||||
int (*stop) (struct ifnet *);
|
||||
void (*input) (struct mbuf*);
|
||||
int (*output)(struct ifnet *, struct mbuf*,
|
||||
struct sockaddr*, struct rtentry *);
|
||||
int (*ioctl) (struct ifnet *, ulong, caddr_t);
|
||||
};
|
||||
#define if_mtu ifd.ifi_mtu
|
||||
#define if_type ifd.ifi_type
|
||||
#define if_addrlen ifd.ifi_addrlen
|
||||
#define if_hdrlen ifd.ifi_hdrlen
|
||||
#define if_metric ifd.ifi_metric
|
||||
#define if_baudrate ifd.ifi_baudrate
|
||||
#define if_ipackets ifd.ifi_ipackets
|
||||
#define if_ierrors ifd.ifi_ierrors
|
||||
#define if_opackets ifd.ifi_opackets
|
||||
#define if_oerrors ifd.ifi_oerrors
|
||||
#define if_collisions ifd.ifi_collisions
|
||||
#define if_ibytes ifd.ifi_ibytes
|
||||
#define if_obytes ifd.ifi_obytes
|
||||
#define if_imcasts ifd.ifi_imcasts
|
||||
#define if_omcasts ifd.ifi_omcasts
|
||||
#define if_iqdrops ifd.ifi_iqdrops
|
||||
#define if_noproto ifd.ifi_noproto
|
||||
|
||||
#define IFNAMSIZ 16
|
||||
|
||||
/* This structure is used for passing interface requests via ioctl */
|
||||
struct ifreq {
|
||||
char ifr_name[IFNAMSIZ]; /* name of interface */
|
||||
union {
|
||||
struct sockaddr ifru_addr;
|
||||
struct sockaddr ifru_dstaddr;
|
||||
struct sockaddr ifru_broadaddr;
|
||||
uint16 ifru_flags;
|
||||
int ifru_metric;
|
||||
char * ifru_data;
|
||||
} ifr_ifru;
|
||||
};
|
||||
#define ifr_addr ifr_ifru.ifru_addr
|
||||
#define ifr_dstaddr ifr_ifru.ifru_dstaddr
|
||||
#define ifr_broadaddr ifr_ifru.ifru_broadaddr
|
||||
#define ifr_flags ifr_ifru.ifru_flags
|
||||
#define ifr_metric ifr_ifru.ifru_metric
|
||||
#define ifr_mtu ifr_ifru.ifru_metric /* sneaky overload :) */
|
||||
#define ifr_data ifr_ifru.ifru_data
|
||||
|
||||
struct ifconf {
|
||||
int ifc_len; /* length of associated buffer */
|
||||
union {
|
||||
char * ifcu_buf;
|
||||
struct ifreq *ifcu_req;
|
||||
} ifc_ifcu;
|
||||
};
|
||||
#define ifc_buf ifc_ifcu.ifcu_buf
|
||||
#define ifc_req ifc_ifcu.ifcu_req
|
||||
|
||||
|
||||
#define IFAFREE(ifa) \
|
||||
do { \
|
||||
if ((ifa)->ifa_refcnt <= 0) \
|
||||
ifafree(ifa); \
|
||||
else \
|
||||
(ifa)->ifa_refcnt--; \
|
||||
} while (0)
|
||||
|
||||
/* used to pass in additional information, such as aliases */
|
||||
struct ifaliasreq {
|
||||
char ifa_name[IFNAMSIZ];
|
||||
struct sockaddr ifra_addr;
|
||||
struct sockaddr ifra_broadaddr;
|
||||
#define ifra_dstaddr ifra_broadaddr
|
||||
struct sockaddr ifra_mask;
|
||||
};
|
||||
|
||||
#define IFA_ROUTE RTF_UP
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
};
|
||||
|
||||
/* function declaration */
|
||||
struct ifq *start_ifq(void);
|
||||
void stop_ifq(struct ifq *);
|
||||
struct ifnet *get_interfaces(void);
|
||||
struct ifnet *ifunit(char *name);
|
||||
struct ifaddr *ifa_ifwithaddr(struct sockaddr *);
|
||||
struct ifaddr *ifa_ifwithaf(int);
|
||||
struct ifaddr *ifa_ifwithdstaddr(struct sockaddr *);
|
||||
struct ifaddr *ifa_ifwithnet(struct sockaddr *);
|
||||
struct ifaddr *ifa_ifwithroute(int, struct sockaddr *,
|
||||
struct sockaddr *);
|
||||
struct ifaddr *ifaof_ifpforaddr(struct sockaddr *, struct ifnet *);
|
||||
void ifafree(struct ifaddr *);
|
||||
|
||||
void if_attach(struct ifnet *ifp);
|
||||
void if_detach(struct ifnet *ifp);
|
||||
|
||||
int ifioctl(struct socket *so, ulong cmd, caddr_t data);
|
||||
int ifconf(int cmd, char *data);
|
||||
void if_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _NET_IF_H */
|
||||
|
@ -1,92 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
struct arphdr {
|
||||
uint16 ar_hrd; /* format of hardware address */
|
||||
uint16 ar_pro; /* format of protocol address */
|
||||
uint8 ar_hln; /* length of hardware address */
|
||||
uint8 ar_pln; /* length of protocol address */
|
||||
uint16 ar_op; /* one of: */
|
||||
/*
|
||||
* The remaining fields are variable in size,
|
||||
* according to the sizes above.
|
||||
*/
|
||||
#ifdef COMMENT_ONLY
|
||||
uint8 ar_sha[]; /* sender hardware address */
|
||||
uint8 ar_spa[]; /* sender protocol address */
|
||||
uint8 ar_tha[]; /* target hardware address */
|
||||
uint8 ar_tpa[]; /* target protocol address */
|
||||
#endif
|
||||
};
|
||||
|
||||
#define ARPHRD_ETHER 1 /* ethernet hardware format */
|
||||
#define ARPHRD_IEEE802 6 /* IEEE 802 hardware format */
|
||||
#define ARPHRD_FRELAY 15 /* frame relay hardware format */
|
||||
|
||||
#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 */
|
||||
|
||||
/*
|
||||
* ARP ioctl request
|
||||
*/
|
||||
struct arpreq {
|
||||
struct sockaddr arp_pa; /* protocol address */
|
||||
struct sockaddr arp_ha; /* hardware address */
|
||||
int arp_flags; /* flags */
|
||||
};
|
||||
/* 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 /* NET_IF_ARP_H */
|
@ -1,38 +0,0 @@
|
||||
/* if.h
|
||||
* Interface definitions for beos
|
||||
*/
|
||||
|
||||
#ifndef OBOS_IF_DL_H
|
||||
#define OBOS_IF_DL_H
|
||||
|
||||
#include <net/if.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* link level sockaddr structure */
|
||||
struct sockaddr_dl {
|
||||
uint8 sdl_len; /* Total length of sockaddr */
|
||||
uint8 sdl_family; /* AF_LINK */
|
||||
uint16 sdl_index; /* if != 0, system given index for interface */
|
||||
uint8 sdl_type; /* interface type */
|
||||
uint8 sdl_nlen; /* interface name length, no trailing 0 reqd. */
|
||||
uint8 sdl_alen; /* link level address length */
|
||||
uint8 sdl_slen; /* link layer selector length */
|
||||
char sdl_data[24]; /* minimum work area, can be larger;
|
||||
contains both if name and ll address */
|
||||
};
|
||||
|
||||
/* Macro to get a pointer to the link level address */
|
||||
#define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen))
|
||||
|
||||
void link_addr (const char *, struct sockaddr_dl *);
|
||||
char *link_ntoa (const struct sockaddr_dl *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OBOS_IF_DL_H */
|
||||
|
@ -1,129 +0,0 @@
|
||||
/* $OpenBSD: if_ppp.h,v 1.6 2001/06/09 06:16:38 angelos Exp $ */
|
||||
/* $NetBSD: if_ppp.h,v 1.11 1996/03/15 02:28:05 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 */
|
||||
int on;
|
||||
};
|
||||
|
||||
/* 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 */
|
||||
#define PPPIOCSPASS _IOW('t', 71, struct bpf_program) /* set pass filter */
|
||||
#define PPPIOCSACTIVE _IOW('t', 70, struct bpf_program) /* set active filt */
|
||||
|
||||
/* 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)
|
||||
|
||||
#ifdef _KERNEL_MODE
|
||||
int pppoutput (struct ifnet *, struct mbuf *, struct sockaddr *,
|
||||
struct rtentry *);
|
||||
void pppinput (struct mbuf *);
|
||||
#endif
|
||||
|
||||
#endif /* _NET_IF_PPP_H_ */
|
@ -1,23 +0,0 @@
|
||||
/* if_types.h
|
||||
*
|
||||
* <URL:http://www.iana.org/assignments/ianaiftype-mib>
|
||||
*/
|
||||
|
||||
#ifndef NET_IF_TYPES_H
|
||||
#define NET_IF_TYPES_H
|
||||
|
||||
/* We just list the ones here we actually use... */
|
||||
|
||||
#define IFT_ETHER 0x06
|
||||
#define IFT_PPP 0x17
|
||||
#define IFT_LOOP 0x18
|
||||
#define IFT_SLIP 0x1c
|
||||
#define IFT_RS232 0x21
|
||||
#define IFT_PARA 0x22 /* Parallel port! ?? */
|
||||
#define IFT_ATM 0x25
|
||||
#define IFT_MODEM 0x31 /* Just a simple generic modem */
|
||||
#define IFT_FASTETHER 0x32 /* 100BaseT ethernet */
|
||||
#define IFT_ISDN 0x3f /* ISDN / X.25 */
|
||||
|
||||
#endif /* NET_IF_TYPES_H */
|
||||
|
@ -1,165 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
* $FreeBSD: src/sys/net/radix.h,v 1.16.2.1 2000/05/03 19:17:11 wollman Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NET_RADIX_H_
|
||||
#define _NET_RADIX_H_
|
||||
|
||||
//#include <memheap.h>
|
||||
|
||||
/*
|
||||
* Radix search tree node layout.
|
||||
*/
|
||||
|
||||
struct radix_node {
|
||||
struct radix_mask *rn_mklist; /* list of masks contained in subtree */
|
||||
struct radix_node *rn_parent; /* parent */
|
||||
short rn_bit; /* 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: */
|
||||
char * rn_Key; /* object of search */
|
||||
char * 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_offset rn_u.rn_node.rn_Off
|
||||
#define rn_left rn_u.rn_node.rn_L
|
||||
#define rn_right rn_u.rn_node.rn_R
|
||||
|
||||
/*
|
||||
* Annotations to tree concerning potential routes applying to subtrees.
|
||||
*/
|
||||
|
||||
struct radix_mask {
|
||||
short rm_bit; /* 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 {
|
||||
char * rmu_mask; /* the mask */
|
||||
struct radix_node *rmu_leaf; /* for normal routes */
|
||||
} rm_rmu;
|
||||
int rm_refs; /* # of references to this struct */
|
||||
};
|
||||
|
||||
#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);}
|
||||
|
||||
typedef int walktree_f_t (struct radix_node *, void *);
|
||||
|
||||
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 */
|
||||
(void *v, void *mask,
|
||||
struct radix_node_head *head, struct radix_node nodes[]);
|
||||
struct radix_node *(*rnh_addpkt) /* add based on packet hdr */
|
||||
(void *v, void *mask,
|
||||
struct radix_node_head *head, struct radix_node nodes[]);
|
||||
struct radix_node *(*rnh_deladdr) /* remove based on sockaddr */
|
||||
(void *v, void *mask, struct radix_node_head *head);
|
||||
struct radix_node *(*rnh_delpkt) /* remove based on packet hdr */
|
||||
(void *v, void *mask, struct radix_node_head *head);
|
||||
struct radix_node *(*rnh_matchaddr) /* locate based on sockaddr */
|
||||
(void *v, struct radix_node_head *head);
|
||||
struct radix_node *(*rnh_lookup) /* locate based on sockaddr */
|
||||
(void *v, void *mask, struct radix_node_head *head);
|
||||
struct radix_node *(*rnh_matchpkt) /* locate based on packet hdr */
|
||||
(void *v, struct radix_node_head *head);
|
||||
int (*rnh_walktree) /* traverse tree */
|
||||
(struct radix_node_head *head, walktree_f_t *f, void *w);
|
||||
int (*rnh_walktree_from) /* traverse tree below a */
|
||||
(struct radix_node_head *head, void *a, void *m,
|
||||
walktree_f_t *f, void *w);
|
||||
void (*rnh_close) /* do something when the last ref drops */
|
||||
(struct radix_node *rn, struct radix_node_head *head);
|
||||
struct radix_node rnh_nodes[3]; /* empty tree for common case */
|
||||
};
|
||||
|
||||
#define Bcmp(a, b, n) memcmp(((char *)(a)), ((char *)(b)), (n))
|
||||
#define Bcopy(a, b, n) memcpy(((char *)(b)), ((char *)(a)), (unsigned)(n))
|
||||
#define Bzero(p, n) memset((char *)(p),0, (int)(n));
|
||||
#define R_Malloc(p, t, n) do { \
|
||||
(p = (t) malloc((unsigned int)(n))); \
|
||||
memset(p, 0, sizeof(*p)); \
|
||||
} while (0)
|
||||
#define Free(p) free((char *)p);
|
||||
|
||||
void rn_init (void);
|
||||
int rn_inithead (void **, int);
|
||||
int rn_refines (void *, void *);
|
||||
struct radix_node
|
||||
*rn_addmask (void *, int, int),
|
||||
*rn_addroute (void *, void *, struct radix_node_head *,
|
||||
struct radix_node [2]),
|
||||
*rn_delete (void *, void *, struct radix_node_head *),
|
||||
*rn_lookup (void *v_arg, void *m_arg,
|
||||
struct radix_node_head *head),
|
||||
*rn_match (void *, struct radix_node_head *);
|
||||
|
||||
/* extra fucntion so we don't have to export the mask_rnhead */
|
||||
struct radix_node *rn_head_search(void *argv_v);
|
||||
|
||||
#endif /* _NET_RADIX_H_ */
|
@ -1,17 +0,0 @@
|
||||
/* raw_cb.h */
|
||||
|
||||
#ifndef NET_RAW_CB_H
|
||||
#define NET_RAW_CB_H
|
||||
|
||||
struct rawcb {
|
||||
struct rawcb *rcb_next;
|
||||
struct rawcb *rcb_prev;
|
||||
struct socket *rcb_socket;
|
||||
struct sockaddr *rcb_faddr;
|
||||
struct sockaddr *rcb_laddr;
|
||||
struct sockproto rcb_proto;
|
||||
};
|
||||
|
||||
#define sotorawcb(so) ((struct rawcb*)(so)->so_pcb)
|
||||
|
||||
#endif /* NET_RAW_CB_H */
|
@ -1,208 +0,0 @@
|
||||
/* route.h */
|
||||
|
||||
#ifndef _NET_ROUTE_H
|
||||
#define _NET_ROUTE_H
|
||||
|
||||
#include <net/radix.h>
|
||||
#include <sys/socket.h> /* for AF_MAX */
|
||||
/*
|
||||
* 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 {
|
||||
uint32 rmx_locks; /* Kernel must leave these values alone */
|
||||
uint32 rmx_mtu; /* MTU for this path */
|
||||
uint32 rmx_hopcount; /* max hops expected */
|
||||
uint32 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))
|
||||
|
||||
struct rtentry {
|
||||
struct radix_node rt_nodes[2]; /* tree glue, and other values */
|
||||
struct sockaddr *rt_gateway; /* value */
|
||||
uint rt_flags; /* up/down?, host/net */
|
||||
int rt_refcnt; /* # held references */
|
||||
uint32 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 */
|
||||
char * 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 */
|
||||
struct rtentry *rt_parent; /* If cloned, parent of this route. */
|
||||
/* XXX - add this! */
|
||||
// rt_timer; * queue of timeouts for misc funcs *
|
||||
};
|
||||
#define rt_use rt_rmx.rmx_pksent
|
||||
#define rt_key(r) ((struct sockaddr *)((r)->rt_nodes->rn_key))
|
||||
#define rt_mask(r) ((struct sockaddr *)((r)->rt_nodes->rn_mask))
|
||||
|
||||
#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_PROTO3 0x2000 /* protocol specific routing flag */
|
||||
#define RTF_PROTO2 0x4000 /* protocol specific routing flag */
|
||||
#define RTF_PROTO1 0x8000 /* protocol specific routing flag */
|
||||
|
||||
#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_msghdr {
|
||||
uint16 rtm_msglen;
|
||||
uint8 rtm_version;
|
||||
uint8 rtm_type;
|
||||
|
||||
uint16 rtm_index;
|
||||
int rtm_flags;
|
||||
int rtm_addrs;
|
||||
int rtm_seq;
|
||||
int rtm_errno;
|
||||
int rtm_use;
|
||||
uint32 rtm_inits;
|
||||
struct rt_metrics rtm_rmx;
|
||||
};
|
||||
|
||||
struct rt_addrinfo {
|
||||
int rti_addrs;
|
||||
struct sockaddr *rti_info[RTAX_MAX];
|
||||
int rti_flags;
|
||||
struct ifaddr *rti_ifa;
|
||||
struct ifnet *rti_ifp;
|
||||
struct rt_msghdr *rti_rtm;
|
||||
};
|
||||
|
||||
struct route_cb {
|
||||
int32 ip_count; /* how many AF_INET structures we have */
|
||||
int32 any_count; /* total of all above... */
|
||||
};
|
||||
|
||||
struct walkarg {
|
||||
int w_op;
|
||||
int w_arg;
|
||||
int w_given;
|
||||
int w_needed;
|
||||
int w_tmemsize;
|
||||
char * w_where;
|
||||
char * w_tmem;
|
||||
};
|
||||
|
||||
/*
|
||||
* Routing statistics.
|
||||
*/
|
||||
struct rtstat {
|
||||
int32 rts_badredirect; /* bogus redirect calls */
|
||||
int32 rts_dynamic; /* routes created by redirects */
|
||||
int32 rts_newgateway; /* routes modified by redirects */
|
||||
int32 rts_unreach; /* lookups which failed */
|
||||
int32 rts_wildcard; /* lookups satisfied by a wildcard */
|
||||
};
|
||||
|
||||
#define RTFREE(rt) do { \
|
||||
if ((rt)->rt_refcnt <= 1) \
|
||||
rtfree(rt); \
|
||||
else \
|
||||
(rt)->rt_refcnt--; \
|
||||
} while (0)
|
||||
|
||||
extern struct rtstat rtstat;
|
||||
extern struct radix_node_head *rt_tables[AF_MAX+1];
|
||||
|
||||
void route_init(void);
|
||||
|
||||
int rtinit (struct ifaddr *, int, int);
|
||||
void rtalloc (struct route *);
|
||||
struct rtentry *rtalloc1 (struct sockaddr *, int);
|
||||
void rtfree (struct rtentry *);
|
||||
int rtrequest (int, struct sockaddr *,
|
||||
struct sockaddr *, struct sockaddr *, int,
|
||||
struct rtentry **);
|
||||
void rt_maskedcopy(struct sockaddr *src,
|
||||
struct sockaddr *dst,
|
||||
struct sockaddr *netmask);
|
||||
int rt_setgate (struct rtentry *, struct sockaddr *,
|
||||
struct sockaddr *);
|
||||
|
||||
struct radix_node_head ** get_rt_tables(void);
|
||||
|
||||
#endif /* NET_ROUTE_H */
|
@ -1,59 +0,0 @@
|
||||
/* Parts of this file are covered under the following copyright */
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* @(#)icmp_var.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#ifndef NETINET_ICMP_VAR_H
|
||||
#define NETINET_ICMP_VAR_H
|
||||
|
||||
#include "netinet/ip_icmp.h"
|
||||
|
||||
struct icmpstat {
|
||||
int32 icps_oldicmp;
|
||||
int32 icps_oldshort;
|
||||
int32 icps_badcode;
|
||||
int32 icps_badlen;
|
||||
int32 icps_checksum;
|
||||
int32 icps_tooshort;
|
||||
int32 icps_error;
|
||||
int32 icps_reflect;
|
||||
int32 icps_outhist[ICMP_MAXTYPE + 1];
|
||||
int32 icps_inhist[ICMP_MAXTYPE + 1];
|
||||
};
|
||||
|
||||
//#ifdef _KERNEL_MODE
|
||||
//struct icmpstat icmpstat;
|
||||
//#endif
|
||||
|
||||
#endif /* NETINET_ICMP_VAR_H */
|
@ -1,198 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef NETINET_IF_ETHER_H
|
||||
#define NETINET_IF_ETHER_H
|
||||
|
||||
#include "net/if_arp.h"
|
||||
|
||||
/*
|
||||
* Ethernet address - 6 octets
|
||||
* this is only used by the ethers(3) functions.
|
||||
*/
|
||||
struct ether_addr {
|
||||
uint8 ether_addr_octet[6];
|
||||
};
|
||||
|
||||
/*
|
||||
* Some Ethernet constants.
|
||||
*/
|
||||
#define ETHER_ADDR_LEN 6 /* Ethernet address length */
|
||||
#define ETHER_TYPE_LEN 2 /* Ethernet type field length */
|
||||
#define ETHER_CRC_LEN 4 /* Ethernet CRC lenght */
|
||||
#define ETHER_HDR_LEN ((ETHER_ADDR_LEN * 2) + ETHER_TYPE_LEN)
|
||||
#define ETHER_MIN_LEN 64 /* Minimum frame length, CRC included */
|
||||
#define ETHER_MAX_LEN 1518 /* Maximum frame length, CRC included */
|
||||
|
||||
struct ether_header {
|
||||
uint8 ether_dhost[ETHER_ADDR_LEN];
|
||||
uint8 ether_shost[ETHER_ADDR_LEN];
|
||||
uint16 ether_type;
|
||||
};
|
||||
|
||||
#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 */
|
||||
#define ETHERTYPE_8021Q 0x8100 /* IEEE 802.1Q VLAN tagging */
|
||||
#define ETHERTYPE_IPV6 0x86DD /* IPv6 protocol */
|
||||
#define ETHERTYPE_PPPOEDISC 0x8863 /* PPP Over Ethernet Discovery Stage */
|
||||
#define ETHERTYPE_PPPOE 0x8864 /* PPP Over Ethernet Session Stage */
|
||||
#define ETHERTYPE_LOOPBACK 0x9000 /* used to test interfaces */
|
||||
|
||||
#define ETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address mcast/bcast? */
|
||||
|
||||
#define ETHERMTU (ETHER_MAX_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
|
||||
#define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
|
||||
|
||||
|
||||
//#ifdef _NETWORK_STACK
|
||||
|
||||
/*
|
||||
* Macro to map an IP multicast address to an Ethernet multicast address.
|
||||
* The high-order 25 bits of the Ethernet address are statically assigned,
|
||||
* and the low-order 23 bits are taken from the low end of the IP address.
|
||||
*/
|
||||
#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \
|
||||
/* struct in_addr *ipaddr; */ \
|
||||
/* u_int8_t enaddr[ETHER_ADDR_LEN]; */ \
|
||||
{ \
|
||||
(enaddr)[0] = 0x01; \
|
||||
(enaddr)[1] = 0x00; \
|
||||
(enaddr)[2] = 0x5e; \
|
||||
(enaddr)[3] = ((uint8 *)ipaddr)[1] & 0x7f; \
|
||||
(enaddr)[4] = ((uint8 *)ipaddr)[2]; \
|
||||
(enaddr)[5] = ((uint8 *)ipaddr)[3]; \
|
||||
}
|
||||
|
||||
/*
|
||||
* Macro to map an IPv6 multicast address to an Ethernet multicast address.
|
||||
* The high-order 16 bits of the Ethernet address are statically assigned,
|
||||
* and the low-order 32 bits are taken from the low end of the IPv6 address.
|
||||
*/
|
||||
#define ETHER_MAP_IPV6_MULTICAST(ip6addr, enaddr) \
|
||||
/* struct in6_addr *ip6addr; */ \
|
||||
/* u_int8_t enaddr[ETHER_ADDR_LEN]; */ \
|
||||
{ \
|
||||
(enaddr)[0] = 0x33; \
|
||||
(enaddr)[1] = 0x33; \
|
||||
(enaddr)[2] = ((u_int8_t *)ip6addr)[12]; \
|
||||
(enaddr)[3] = ((u_int8_t *)ip6addr)[13]; \
|
||||
(enaddr)[4] = ((u_int8_t *)ip6addr)[14]; \
|
||||
(enaddr)[5] = ((u_int8_t *)ip6addr)[15]; \
|
||||
}
|
||||
//#endif
|
||||
|
||||
/*
|
||||
* Structure shared between the ethernet driver modules and
|
||||
* the address resolution code. For example, each ec_softc or il_softc
|
||||
* begins with this structure.
|
||||
*/
|
||||
struct arpcom {
|
||||
struct ifnet ac_if; /* network-visible interface */
|
||||
uint8 ac_enaddr[ETHER_ADDR_LEN]; /* ethernet hardware address */
|
||||
struct in_addr ac_ipaddr;
|
||||
char ac__pad[2]; /* pad for some machines */
|
||||
// struct ether_multi *ac_multiaddrs; /* list of ether multicast addrs */
|
||||
int ac_multicnt; /* length of ac_multiaddrs list */
|
||||
};
|
||||
|
||||
struct ether_device {
|
||||
struct arpcom sc_ac;
|
||||
struct ether_device *next; /* next ether_device */
|
||||
};
|
||||
#define sc_if sc_ac.ac_if
|
||||
#define sc_addr sc_ac.ac_enaddr
|
||||
|
||||
struct ether_arp {
|
||||
struct arphdr ea_hdr;
|
||||
u_char arp_sha[6];
|
||||
u_char arp_spa[4];
|
||||
u_char arp_tha[6];
|
||||
u_char arp_tpa[4];
|
||||
};
|
||||
#define arp_hrd ea_hdr.ar_hrd
|
||||
#define arp_pro ea_hdr.ar_pro
|
||||
#define arp_hln ea_hdr.ar_hln
|
||||
#define arp_pln ea_hdr.ar_pln
|
||||
#define arp_op ea_hdr.ar_op
|
||||
|
||||
struct llinfo_arp {
|
||||
struct llinfo_arp *la_next;
|
||||
struct llinfo_arp *la_prev;
|
||||
struct rtentry *la_rt;
|
||||
struct mbuf *la_hold;
|
||||
int32 la_asked;
|
||||
};
|
||||
|
||||
#define la_timer la_rt->rt_rmx.rmx_expire
|
||||
|
||||
struct sockaddr_inarp {
|
||||
uint8 sin_len;
|
||||
uint8 sin_family;
|
||||
uint16 sin_port;
|
||||
struct in_addr sin_addr;
|
||||
struct in_addr sin_srcaddr;
|
||||
uint16 sin_tos;
|
||||
uint16 sin_other;
|
||||
};
|
||||
#define SIN_PROXY 1
|
||||
|
||||
/*
|
||||
* IP and ethernet specific routing flags
|
||||
*/
|
||||
#define RTF_USETRAILERS RTF_PROTO1 /* use trailers */
|
||||
#define RTF_ANNOUNCE RTF_PROTO2 /* announce new arp entry */
|
||||
#define RTF_PERMANENT_ARP RTF_PROTO3 /* only manual overwrite of entry */
|
||||
|
||||
//#ifdef _NETWORK_STACK
|
||||
|
||||
int arpresolve(struct arpcom *ac, struct rtentry *rt, struct mbuf *m,
|
||||
struct sockaddr *dst, uint8 *desten);
|
||||
//void arpwhohas(struct arpcom *ac, struct in_addr *ia);
|
||||
|
||||
|
||||
//#else
|
||||
|
||||
char *ether_ntoa (struct ether_addr *);
|
||||
struct ether_addr *ether_aton (char *);
|
||||
int ether_ntohost (char *, struct ether_addr *);
|
||||
int ether_hostton (char *, struct ether_addr *);
|
||||
int ether_line(char *line, struct ether_addr *e, char *hostname);
|
||||
|
||||
//#endif
|
||||
|
||||
#endif /* NETINET_IF_ETHER_H */
|
||||
|
@ -1,172 +0,0 @@
|
||||
/* in.h */
|
||||
|
||||
#ifndef _NETINET_IN_H_
|
||||
#define _NETINET_IN_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <net/if.h>
|
||||
#include <endian.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef unsigned short in_port_t;
|
||||
typedef unsigned long in_addr_t;
|
||||
|
||||
/* We can't include <ByteOrder.h> since we are a posix file,
|
||||
* and we are not allowed to import all the BeOS types here.
|
||||
*/
|
||||
#ifndef htonl
|
||||
extern unsigned long __swap_int32(unsigned long); /* private */
|
||||
extern unsigned short __swap_int16(unsigned short); /* private */
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
#define htonl(x) __swap_int32(x)
|
||||
#define ntohl(x) __swap_int32(x)
|
||||
#define htons(x) __swap_int16(x)
|
||||
#define ntohs(x) __swap_int16(x)
|
||||
#elif BYTE_ORDER == BIG_ENDIAN
|
||||
#define htonl(x) (x)
|
||||
#define ntohl(x) (x)
|
||||
#define htons(x) (x)
|
||||
#define ntohs(x) (x)
|
||||
#else
|
||||
#error Unknown byte order.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Protocol definitions - add to as required... */
|
||||
enum {
|
||||
IPPROTO_IP = 0, /* 0, IPv4 */
|
||||
IPPROTO_ICMP = 1, /* 1, ICMP (v4) */
|
||||
IPPROTO_IGMP = 2, /* 2, IGMP (group management) */
|
||||
IPPROTO_TCP = 6, /* 6, tcp */
|
||||
IPPROTO_UDP = 17, /* 17, UDP */
|
||||
IPPROTO_IPV6 = 41, /* 41, IPv6 in IPv6 */
|
||||
IPPROTO_ROUTING = 43, /* 43, Routing */
|
||||
IPPROTO_ICMPV6 = 58, /* 58, IPv6 ICMP */
|
||||
IPPROTO_ETHERIP = 97, /* 97, Ethernet in IPv4 */
|
||||
IPPROTO_RAW = 255 /* 255 */
|
||||
};
|
||||
|
||||
#define IPPROTO_MAX 256
|
||||
|
||||
/* Port numbers...
|
||||
* < IPPORT_RESERVED are privileged and should be
|
||||
* accessible only by root
|
||||
* > IPPORT_USERRESERVED are reserved for servers, though
|
||||
* not requiring privileged status
|
||||
*/
|
||||
|
||||
#define IPPORT_RESERVED 1024
|
||||
#define IPPORT_USERRESERVED 49151
|
||||
|
||||
/* This is an IPv4 address structure. Why is it a structure?
|
||||
* Historical reasons.
|
||||
*/
|
||||
struct in_addr {
|
||||
in_addr_t s_addr;
|
||||
};
|
||||
|
||||
/*
|
||||
* IP Version 4 socket address.
|
||||
*/
|
||||
struct sockaddr_in {
|
||||
uint8 sin_len;
|
||||
uint8 sin_family;
|
||||
uint16 sin_port;
|
||||
struct in_addr sin_addr;
|
||||
int8 sin_zero[24];
|
||||
};
|
||||
/* the address is therefore at sin_addr.s_addr */
|
||||
|
||||
/*
|
||||
* Options for use with [gs]etsockopt at the IP level.
|
||||
* First word of comment is data type; bool is stored in int.
|
||||
*/
|
||||
#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */
|
||||
#define IP_HDRINCL 2 /* int; header is included with data */
|
||||
#define IP_TOS 3 /* int; IP type of service and preced. */
|
||||
#define IP_TTL 4 /* int; IP time to live */
|
||||
#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */
|
||||
#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */
|
||||
#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */
|
||||
#define IP_RETOPTS 8 /* ip_opts; set/get IP options */
|
||||
#define IP_MULTICAST_IF 9 /* in_addr; set/get IP multicast i/f */
|
||||
#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */
|
||||
#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */
|
||||
#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */
|
||||
#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */
|
||||
|
||||
#define __IPADDR(x) ((uint32) htonl((uint32)(x)))
|
||||
|
||||
#define INADDR_ANY __IPADDR(0x00000000)
|
||||
#define INADDR_LOOPBACK __IPADDR(0x7f000001)
|
||||
#define INADDR_BROADCAST __IPADDR(0xffffffff) /* must be masked */
|
||||
|
||||
#define INADDR_UNSPEC_GROUP __IPADDR(0xe0000000) /* 224.0.0.0 */
|
||||
#define INADDR_ALLHOSTS_GROUP __IPADDR(0xe0000001) /* 224.0.0.1 */
|
||||
#define INADDR_ALLROUTERS_GROUP __IPADDR(0xe0000002) /* 224.0.0.2 */
|
||||
#define INADDR_MAX_LOCAL_GROUP __IPADDR(0xe00000ff) /* 224.0.0.255 */
|
||||
|
||||
#define IN_LOOPBACKNET 127 /* official! */
|
||||
|
||||
#define INADDR_NONE __IPADDR(0xffffffff)
|
||||
|
||||
#define IN_CLASSA(i) (((uint32)(i) & __IPADDR(0x80000000)) == \
|
||||
__IPADDR(0x00000000))
|
||||
#define IN_CLASSA_NET __IPADDR(0xff000000)
|
||||
#define IN_CLASSA_NSHIFT 24
|
||||
#define IN_CLASSA_HOST __IPADDR(0x00ffffff)
|
||||
#define IN_CLASSA_MAX 128
|
||||
|
||||
#define IN_CLASSB(i) (((uint32)(i) & __IPADDR(0xc0000000)) == \
|
||||
__IPADDR(0x80000000))
|
||||
#define IN_CLASSB_NET __IPADDR(0xffff0000)
|
||||
#define IN_CLASSB_NSHIFT 16
|
||||
#define IN_CLASSB_HOST __IPADDR(0x0000ffff)
|
||||
#define IN_CLASSB_MAX 65536
|
||||
|
||||
#define IN_CLASSC(i) (((uint32)(i) & __IPADDR(0xe0000000)) == \
|
||||
__IPADDR(0xc0000000))
|
||||
#define IN_CLASSC_NET __IPADDR(0xffffff00)
|
||||
#define IN_CLASSC_NSHIFT 8
|
||||
#define IN_CLASSC_HOST __IPADDR(0x000000ff)
|
||||
|
||||
#define IN_CLASSD(i) (((uint32)(i) & __IPADDR(0xf0000000)) == \
|
||||
__IPADDR(0xe0000000))
|
||||
/* These ones aren't really net and host fields, but routing needn't know. */
|
||||
#define IN_CLASSD_NET __IPADDR(0xf0000000)
|
||||
#define IN_CLASSD_NSHIFT 28
|
||||
#define IN_CLASSD_HOST __IPADDR(0x0fffffff)
|
||||
|
||||
#define IN_MULTICAST(i) IN_CLASSD(i)
|
||||
|
||||
#define IN_EXPERIMENTAL(i) (((uint32)(i) & 0xf0000000) == 0xf0000000)
|
||||
#define IN_BADCLASS(i) (((uint32)(i) & 0xf0000000) == 0xf0000000)
|
||||
|
||||
#define IP_MAX_MEMBERSHIPS 20
|
||||
|
||||
/* some helpful macro's :) */
|
||||
#define in_hosteq(s,t) ((s).s_addr == (t).s_addr)
|
||||
#define in_nullhost(x) ((x).s_addr == INADDR_ANY)
|
||||
#define satosin(sa) ((struct sockaddr_in *)(sa))
|
||||
#define sintosa(sin) ((struct sockaddr *)(sin))
|
||||
|
||||
struct ifnet; // forward declaration
|
||||
|
||||
/* Prototypes... */
|
||||
int in_broadcast (struct in_addr, struct ifnet *);
|
||||
int in_canforward (struct in_addr);
|
||||
int in_localaddr (struct in_addr);
|
||||
void in_socktrim (struct sockaddr_in*);
|
||||
/* uint16 in_cksum (struct mbuf *, int); */
|
||||
struct mbuf;
|
||||
uint16 in_cksum(struct mbuf *m, int len, int off);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* NETINET_IN_H */
|
@ -1,71 +0,0 @@
|
||||
/* in_pcb.h
|
||||
* internet protcol control blocks
|
||||
*/
|
||||
|
||||
//#include <sys/socketvar.h>
|
||||
#include <sys/socket.h>
|
||||
#include <pools.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/in.h>
|
||||
#include <net/route.h>
|
||||
|
||||
#ifndef _NETINET_INPCB_H
|
||||
#define _NETINET_INPCB_H
|
||||
|
||||
enum {
|
||||
INP_HDRINCL = 0x01,
|
||||
INP_RECVOPTS = 0x02,
|
||||
INP_RECVRETOPTS = 0x04,
|
||||
INP_RECVDSTADDR = 0x08 /* receive IP destination as control inf. */
|
||||
};
|
||||
#define INP_CONTROLOPT (INP_RECVOPTS | INP_RECVRETOPTS | INP_RECVDSTADDR)
|
||||
|
||||
/* Constants for in_pcblookup */
|
||||
enum {
|
||||
INPLOOKUP_WILDCARD = 1,
|
||||
INPLOOKUP_SETLOCAL = 2,
|
||||
INPLOOKUP_IPV6 = 4
|
||||
};
|
||||
|
||||
struct inpcb {
|
||||
struct inpcb *inp_next;
|
||||
struct inpcb *inp_prev;
|
||||
struct inpcb *inp_head;
|
||||
|
||||
struct in_addr faddr; /* foreign address */
|
||||
uint16 fport; /* foreign port # */
|
||||
struct in_addr laddr; /* local address */
|
||||
uint16 lport; /* local port # */
|
||||
|
||||
struct socket *inp_socket;
|
||||
char *inp_ppcb; /* pointer to a per protocol pcb*/
|
||||
struct ip inp_ip; /* header prototype */
|
||||
int inp_flags; /* flags */
|
||||
struct mbuf *inp_options; /* IP options */
|
||||
/* more will be required */
|
||||
struct route inp_route; /* the route to host */
|
||||
};
|
||||
|
||||
int in_pcbinit (void);
|
||||
int in_pcballoc (struct socket *, struct inpcb *);
|
||||
int in_pcbbind (struct inpcb *, struct mbuf *);
|
||||
int in_pcbconnect (struct inpcb *, struct mbuf *);
|
||||
void in_pcbdetach (struct inpcb *);
|
||||
int in_pcbdisconnect (struct inpcb *);
|
||||
void in_losing (struct inpcb *);
|
||||
void in_setpeeraddr (struct inpcb *, struct mbuf *);
|
||||
void in_setsockaddr (struct inpcb *, struct mbuf *);
|
||||
|
||||
struct inpcb *in_pcblookup(struct inpcb *head, struct in_addr faddr,
|
||||
uint16 fport_a, struct in_addr laddr,
|
||||
uint16 lport_a, int flags);
|
||||
struct rtentry *in_pcbrtentry (struct inpcb *);
|
||||
void in_pcbnotify (struct inpcb *, struct sockaddr *,
|
||||
uint16, struct in_addr, uint16,
|
||||
int, void (*)(struct inpcb *, int));
|
||||
|
||||
/* helpful macro's */
|
||||
#define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb)
|
||||
|
||||
#endif /* _NETINET_INPCB_H */
|
||||
|
@ -1,62 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*@(#)in_systm.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#ifndef NETINET_IN_SYSTM_H
|
||||
#define NETINET_IN_SYSTM_H
|
||||
|
||||
#include <stdint.h>
|
||||
/*
|
||||
* Miscellaneous internetwork
|
||||
* definitions for kernel.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Network types.
|
||||
*
|
||||
* Internally the system keeps counters in the headers with the bytes
|
||||
* swapped so that VAX instructions will work on them. It reverses
|
||||
* the bytes before transmission at each protocol level. The n_ types
|
||||
* represent the types with the bytes in ``high-ender'' order.
|
||||
*/
|
||||
typedef uint16_t n_short; /* short as received from the net */
|
||||
typedef uint32_t n_long; /* long as received from the net */
|
||||
|
||||
typedef uint32_t n_time; /* ms since 00:00 GMT, byte rev */
|
||||
|
||||
#define iptime() (htonl((uint32_t)real_time_clock_usecs()))
|
||||
|
||||
#endif /* NETINET_IN_SYSTM_H */
|
||||
|
||||
|
@ -1,66 +0,0 @@
|
||||
/* in_var.h */
|
||||
#ifndef NETINET_IN_VAR_H
|
||||
#define NETINET_IN_VAR_H
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <net/if.h>
|
||||
|
||||
struct in_ifaddr {
|
||||
struct ifaddr ia_ifa;
|
||||
struct in_ifaddr *ia_next;
|
||||
|
||||
uint32 ia_net;
|
||||
uint32 ia_netmask;
|
||||
uint32 ia_subnet;
|
||||
uint32 ia_subnetmask;
|
||||
struct in_addr ia_netbroadcast;
|
||||
struct sockaddr_in ia_addr;
|
||||
struct sockaddr_in ia_dstaddr; /* broadcast address */
|
||||
struct sockaddr_in ia_sockmask;
|
||||
/*XXX - milticast address list */
|
||||
};
|
||||
#define ia_ifp ia_ifa.ifa_ifp
|
||||
#define ia_flags ia_ifa.ifa_flags
|
||||
#define ia_broadaddr ia_dstaddr
|
||||
|
||||
#define ifatoia(ifa) ((struct in_ifaddr *)(ifa))
|
||||
#define sintosa(sin) ((struct sockaddr *)(sin))
|
||||
|
||||
/* used to pass in additional information, such as aliases */
|
||||
struct in_aliasreq {
|
||||
char ifa_name[IFNAMSIZ];
|
||||
struct sockaddr_in ifra_addr;
|
||||
struct sockaddr_in ifra_broadaddr;
|
||||
#define ifra_dstaddr ifra_broadaddr
|
||||
struct sockaddr_in ifra_mask;
|
||||
};
|
||||
|
||||
|
||||
struct in_multi {
|
||||
struct in_addr inm_addr;
|
||||
struct ifnet *inm_ifp;
|
||||
struct in_ifaddr *inm_ia;
|
||||
uint inm_refcount;
|
||||
uint inm_timer;
|
||||
struct in_multi *next;
|
||||
struct in_multi **prev;
|
||||
uint inm_state;
|
||||
};
|
||||
|
||||
/*
|
||||
* Given a pointer to an in_ifaddr (ifaddr),
|
||||
* return a pointer to the addr as a sockaddr_in.
|
||||
*/
|
||||
|
||||
#define IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr))
|
||||
|
||||
// extern struct in_ifaddr *in_ifaddr;
|
||||
|
||||
int in_control(struct socket *so, int cmd, char *data, struct ifnet *ifp);
|
||||
int in_ifinit(struct ifnet *dev, struct in_ifaddr *ia, struct sockaddr_in *sin,
|
||||
int scrub);
|
||||
int inetctlerr(int cmd);
|
||||
struct in_ifaddr *get_primary_addr(void);
|
||||
|
||||
#endif /* NETINET_IN_VAR_H */
|
||||
|
@ -1,125 +0,0 @@
|
||||
/* netinet/ip.h
|
||||
* definitions for ipv4 protocol
|
||||
*/
|
||||
|
||||
#ifndef _NETINET_IP_H
|
||||
#define _NETINET_IP_H
|
||||
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
/* Based on RFC 791 */
|
||||
|
||||
#define IPVERSION 4
|
||||
|
||||
struct ip {
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
uint8 ip_v:4;
|
||||
uint8 ip_hl:4;
|
||||
#elif BYTE_ORDER == LITTLE_ENDIAN
|
||||
uint8 ip_hl:4;
|
||||
uint8 ip_v:4;
|
||||
#endif
|
||||
uint8 ip_tos;
|
||||
uint16 ip_len;
|
||||
uint16 ip_id;
|
||||
int16 ip_off;
|
||||
uint8 ip_ttl;
|
||||
uint8 ip_p;
|
||||
uint16 ip_sum;
|
||||
struct in_addr ip_src;
|
||||
struct in_addr ip_dst;
|
||||
} _PACKED;
|
||||
|
||||
#define IP_MAXPACKET 65535/* Maximum packet size */
|
||||
|
||||
/* IP Type of Service */
|
||||
#define IPTOS_RELIABILITY 0x04
|
||||
#define IPTOS_THROUGHPUT 0x08
|
||||
#define IPTOS_LOWDELAY 0x10
|
||||
|
||||
/*
|
||||
* Definitions for options.
|
||||
*/
|
||||
#define IPOPT_COPIED(o)((o)&0x80)
|
||||
#define IPOPT_CLASS(o)((o)&0x60)
|
||||
#define IPOPT_NUMBER(o)((o)&0x1f)
|
||||
|
||||
#define IPOPT_CONTROL 0x00
|
||||
#define IPOPT_RESERVED1 0x20
|
||||
#define IPOPT_DEBMEAS 0x40
|
||||
#define IPOPT_RESERVED2 0x60
|
||||
|
||||
#define IPOPT_EOL 0/* end of option list */
|
||||
#define IPOPT_NOP 1/* no operation */
|
||||
|
||||
#define IPOPT_RR 7/* record packet route */
|
||||
#define IPOPT_TS 68/* timestamp */
|
||||
#define IPOPT_SECURITY 130/* provide s,c,h,tcc */
|
||||
#define IPOPT_LSRR 131/* loose source route */
|
||||
#define IPOPT_SATID 136/* satnet id */
|
||||
#define IPOPT_SSRR 137/* strict source route */
|
||||
|
||||
/*
|
||||
* Offsets to fields in options other than EOL and NOP.
|
||||
*/
|
||||
#define IPOPT_OPTVAL 0/* option ID */
|
||||
#define IPOPT_OLEN 1/* option length */
|
||||
#define IPOPT_OFFSET 2/* offset within option */
|
||||
#define IPOPT_MINOFF 4/* min value of above */
|
||||
|
||||
struct ip_timestamp {
|
||||
uint8 ipt_code;/* IPOPT_TS */
|
||||
uint8 ipt_len;/* size of structure (variable) */
|
||||
uint8 ipt_ptr;/* index of current entry */
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
uint8 ipt_oflw:4,
|
||||
ipt_flg:4;
|
||||
#elif BYTE_ORDER == LITTLE_ENDIAN
|
||||
uint8 ipt_flg:4,
|
||||
ipt_oflw:4;
|
||||
#endif
|
||||
union ipt_timestamp {
|
||||
n_time ipt_time[1];
|
||||
struct ipt_ta {
|
||||
struct in_addr ipt_addr;
|
||||
n_time ipt_time;
|
||||
} ipt_ta;
|
||||
} ipt_timestamp;
|
||||
};
|
||||
|
||||
/* flag bits for ipt_flg */
|
||||
#define IPOPT_TS_TSONLY 0/* timestamps only */
|
||||
#define IPOPT_TS_TSANDADDR 1/* timestamps and addresses */
|
||||
#define IPOPT_TS_PRESPEC 3/* specified modules only */
|
||||
|
||||
/* bits for security (not byte swapped) */
|
||||
#define IPOPT_SECUR_UNCLASS 0x0000
|
||||
#define IPOPT_SECUR_CONFID 0xf135
|
||||
#define IPOPT_SECUR_EFTO 0x789a
|
||||
#define IPOPT_SECUR_MMMM 0xbc4d
|
||||
#define IPOPT_SECUR_RESTR 0xaf13
|
||||
#define IPOPT_SECUR_SECRET 0xd788
|
||||
#define IPOPT_SECUR_TOPSECRET 0x6bc5
|
||||
|
||||
#define MAXTTL 255/* maximum time to live (seconds) */
|
||||
#define IPDEFTTL 64/* default ttl, from RFC 1340 */
|
||||
#define IPFRAGTTL 60/* time to live for frags, slowhz */
|
||||
#define IPTTLDEC 1/* subtracted when forwarding */
|
||||
|
||||
#define IP_MSS 576/* default maximum segment size */
|
||||
|
||||
struct ippseudo {
|
||||
struct in_addr ippseudo_src; /* source internet address */
|
||||
struct in_addr ippseudo_dst; /* destination internet address */
|
||||
uint8 ippseudo_pad;/* pad, must be zero */
|
||||
uint8 ippseudo_p;/* protocol */
|
||||
uint16 ippseudo_len;/* protocol length */
|
||||
};
|
||||
|
||||
/* Fragment flags */
|
||||
#define IP_DF 0x4000 /* don't fragment */
|
||||
#define IP_MF 0x2000 /* more fragments */
|
||||
#define IP_OFFMASK 0x1fff
|
||||
|
||||
#endif /* NETINET_IP_H */
|
@ -1,171 +0,0 @@
|
||||
/* Parts of this file are covered under the following copyright */
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#ifndef NETINET_IP_ICMP_H
|
||||
#define NETINET_IP_ICMP_H
|
||||
|
||||
#include <endian.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
struct icmp {
|
||||
uint8 icmp_type;
|
||||
uint8 icmp_code;
|
||||
uint16 icmp_cksum;
|
||||
union {
|
||||
uint8 ih_pptr;
|
||||
struct in_addr ih_gwaddr;
|
||||
struct ih_idseq {
|
||||
n_short icd_id;
|
||||
n_short icd_seq;
|
||||
} ih_idseq;
|
||||
int32 ih_void;
|
||||
|
||||
/* ICMP_UNREACH_NEEDFRAG (RFC 1191) */
|
||||
struct ih_pmtu {
|
||||
n_short ipm_void;
|
||||
n_short ipm_nextmtu;
|
||||
} ih_pmtu;
|
||||
} icmp_hun;
|
||||
union {
|
||||
struct id_ts {
|
||||
n_time its_otime;
|
||||
n_time its_rtime;
|
||||
n_time its_ttime;
|
||||
} id_ts;
|
||||
struct id_ip {
|
||||
struct ip idi_ip;
|
||||
} id_ip;
|
||||
uint32 id_mask;
|
||||
char id_data[1];
|
||||
} icmp_dun;
|
||||
};
|
||||
|
||||
#define icmp_pptr icmp_hun.ih_pptr
|
||||
#define icmp_gwaddr icmp_hun.ih_gwaddr
|
||||
#define icmp_id icmp_hun.ih_idseq.icd_id
|
||||
#define icmp_seq icmp_hun.ih_idseq.icd_seq
|
||||
#define icmp_void icmp_hun.ih_void
|
||||
#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void
|
||||
#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu
|
||||
|
||||
#define icmp_otime icmp_dun.id_ts.its_otime
|
||||
#define icmp_rtime icmp_dun.id_ts.its_rtime
|
||||
#define icmp_ttime icmp_dun.id_ts.its_ttime
|
||||
#define icmp_ip icmp_dun.id_ip.idi_ip
|
||||
#define icmp_mask icmp_dun.id_mask
|
||||
#define icmp_data icmp_dun.id_data
|
||||
|
||||
#define ICMP_MINLEN 8 /* absolute minimum length */
|
||||
#define ICMP_ADVLENMIN (8 + sizeof(struct ip) + 8)
|
||||
#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8)
|
||||
|
||||
/* Definition of type and code field values.
|
||||
*http://www.iana.org/assignments/icmp-parameters
|
||||
*/
|
||||
#define ICMP_ECHOREPLY 0/* echo reply */
|
||||
#define ICMP_UNREACH 3/* dest unreachable, codes: */
|
||||
#define ICMP_SOURCEQUENCH 4/* packet lost, slow down */
|
||||
#define ICMP_REDIRECT 5/* shorter route, codes: */
|
||||
#define ICMP_ALTHOSTADDR 6/* alternate host address */
|
||||
#define ICMP_ECHO 8/* echo service */
|
||||
#define ICMP_ROUTERADVERT 9/* router advertisement */
|
||||
#define ICMP_ROUTERSOLICIT 10/* router solicitation */
|
||||
#define ICMP_TIMXCEED 11/* time exceeded, code: */
|
||||
#define ICMP_PARAMPROB 12/* ip header bad */
|
||||
#define ICMP_TSTAMP 13/* timestamp request */
|
||||
#define ICMP_TSTAMPREPLY 14/* timestamp reply */
|
||||
#define ICMP_IREQ 15/* information request */
|
||||
#define ICMP_IREQREPLY 16/* information reply */
|
||||
#define ICMP_MASKREQ 17/* address mask request */
|
||||
#define ICMP_MASKREPLY 18/* address mask reply */
|
||||
#define ICMP_TRACEROUTE 30/* traceroute */
|
||||
#define ICMP_DATACONVERR 31/* data conversion error */
|
||||
#define ICMP_MOBILE_REDIRECT 32/* mobile host redirect */
|
||||
#define ICMP_IPV6_WHEREAREYOU 33/* IPv6 where-are-you */
|
||||
#define ICMP_IPV6_IAMHERE 34/* IPv6 i-am-here */
|
||||
#define ICMP_MOBILE_REGREQUEST 35/* mobile registration req */
|
||||
#define ICMP_MOBILE_REGREPLY 36/* mobile registration reply */
|
||||
#define ICMP_SKIP 39/* SKIP */
|
||||
#define ICMP_PHOTURIS 40/* Photuris */
|
||||
|
||||
#define ICMP_MAXTYPE 40
|
||||
|
||||
#define ICMP_UNREACH_NET 0/* bad net */
|
||||
#define ICMP_UNREACH_HOST 1/* bad host */
|
||||
#define ICMP_UNREACH_PROTOCOL 2/* bad protocol */
|
||||
#define ICMP_UNREACH_PORT 3/* bad port */
|
||||
#define ICMP_UNREACH_NEEDFRAG 4/* IP_DF caused drop */
|
||||
#define ICMP_UNREACH_SRCFAIL 5/* src route failed */
|
||||
#define ICMP_UNREACH_NET_UNKNOWN 6/* unknown net */
|
||||
#define ICMP_UNREACH_HOST_UNKNOWN 7/* unknown host */
|
||||
#define ICMP_UNREACH_ISOLATED 8/* src host isolated */
|
||||
#define ICMP_UNREACH_NET_PROHIB 9/* for crypto devs */
|
||||
#define ICMP_UNREACH_HOST_PROHIB 10/* ditto */
|
||||
#define ICMP_UNREACH_TOSNET 11/* bad tos for net */
|
||||
#define ICMP_UNREACH_TOSHOST 12/* bad tos for host */
|
||||
#define ICMP_UNREACH_FILTER_PROHIB 13/* prohibited access */
|
||||
#define ICMP_UNREACH_HOST_PRECEDENCE 14/* precedence violat'n*/
|
||||
#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15/* precedence cutoff */
|
||||
|
||||
#define ICMP_REDIRECT_NET 0/* for network */
|
||||
#define ICMP_REDIRECT_HOST 1/* for host */
|
||||
#define ICMP_REDIRECT_TOSNET 2/* for tos and net */
|
||||
#define ICMP_REDIRECT_TOSHOST 3/* for tos and host */
|
||||
|
||||
#define ICMP_ROUTERADVERT_NORMAL 0/* normal advertisement */
|
||||
#define ICMP_ROUTERADVERT_NOROUTE_COMMON16/* selective routing */
|
||||
|
||||
#define ICMP_TIMXCEED_INTRANS 0/* ttl==0 in transit */
|
||||
#define ICMP_TIMXCEED_REASS 1/* ttl==0 in reass */
|
||||
|
||||
#define ICMP_PARAMPROB_ERRATPTR 0/* req. opt. absent */
|
||||
#define ICMP_PARAMPROB_OPTABSENT 1/* req. opt. absent */
|
||||
#define ICMP_PARAMPROB_LENGTH 2/* bad length */
|
||||
|
||||
#define ICMP_PHOTURIS_UNKNOWN_INDEX 1/* unknown sec index */
|
||||
#define ICMP_PHOTURIS_AUTH_FAILED 2/* auth failed */
|
||||
#define ICMP_PHOTURIS_DECRYPT_FAILED 3/* decrypt failed */
|
||||
|
||||
|
||||
#define ICMP_INFOTYPE(type) \
|
||||
((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
|
||||
(type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
|
||||
(type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
|
||||
(type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
|
||||
(type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
|
||||
|
||||
#endif /* NETINET_IP_ICMP_H */
|
@ -1,163 +0,0 @@
|
||||
/* Parts of this file are covered under the following copyright */
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* @(#)ip_var.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#ifndef NETINET_IP_VAR_H
|
||||
#define NETINET_IP_VAR_H
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
/*
|
||||
* Overlay for ip header used by other protocols (tcp, udp).
|
||||
*/
|
||||
struct ipovly {
|
||||
char * ih_next;
|
||||
char * ih_prev;
|
||||
uint8 ih_x1; /* (unused) */
|
||||
uint8 ih_pr; /* protocol */
|
||||
uint16 ih_len; /* protocol length */
|
||||
struct in_addr ih_src; /* source internet address */
|
||||
struct in_addr ih_dst; /* destination internet address */
|
||||
};
|
||||
|
||||
/*
|
||||
* Structure stored in mbuf in inpcb.ip_options
|
||||
* and passed to ip_output when ip options are in use.
|
||||
* The actual length of the options (including ipopt_dst)
|
||||
* is in m_len.
|
||||
*/
|
||||
#define MAX_IPOPTLEN 40
|
||||
|
||||
struct ipoption {
|
||||
struct in_addr ipopt_dst; /* first-hop dst if source routed */
|
||||
int8 ipopt_list[MAX_IPOPTLEN]; /* options proper */
|
||||
};
|
||||
|
||||
/*
|
||||
* Structure attached to inpcb.ip_moptions and
|
||||
* passed to ip_output when IP multicast options are in use.
|
||||
*/
|
||||
struct ip_moptions {
|
||||
struct ifnet *imo_multicast_ifp; /* ifp for outgoing multicasts */
|
||||
uint8 imo_multicast_ttl; /* TTL for outgoing multicasts */
|
||||
uint8 imo_multicast_loop; /* 1 => here sends if a member */
|
||||
uint16 imo_num_memberships; /* no. memberships this socket */
|
||||
struct in_multi *imo_membership[IP_MAX_MEMBERSHIPS];
|
||||
};
|
||||
|
||||
struct ipasfrag {
|
||||
#if B_HOST_IS_BENDIAN
|
||||
uint8 ip_v:4;
|
||||
uint8 ip_hl:4;
|
||||
#else
|
||||
uint8 ip_hl:4;
|
||||
uint8 ip_v:4;
|
||||
#endif
|
||||
uint8 ipf_mff;
|
||||
int16 ip_len;
|
||||
uint16 ip_id;
|
||||
int16 ip_off;
|
||||
uint8 ip_ttl;
|
||||
uint8 ip_p;
|
||||
struct ipasfrag *ipf_next;
|
||||
struct ipasfrag *ipf_prev;
|
||||
};
|
||||
|
||||
struct ipq {
|
||||
struct ipq *next, *prev;
|
||||
uint8 ipq_ttl;
|
||||
uint8 ipq_p;
|
||||
uint16 ipq_id;
|
||||
struct ipasfrag *ipq_next, *ipq_prev;
|
||||
struct in_addr ipq_src, ipq_dst;
|
||||
};
|
||||
|
||||
struct ipstat {
|
||||
int32 ips_total; /* total packets received */
|
||||
int32 ips_badsum; /* checksum bad */
|
||||
int32 ips_tooshort; /* packet too short */
|
||||
int32 ips_toosmall; /* not enough data */
|
||||
int32 ips_badhlen; /* ip header length < data size */
|
||||
int32 ips_badlen; /* ip length < ip header length */
|
||||
int32 ips_fragments; /* fragments received */
|
||||
int32 ips_fragdropped; /* frags dropped (dups, out of space) */
|
||||
int32 ips_fragtimeout; /* fragments timed out */
|
||||
int32 ips_forward; /* packets forwarded */
|
||||
int32 ips_cantforward; /* packets rcvd for unreachable dest */
|
||||
int32 ips_redirectsent; /* packets forwarded on same net */
|
||||
int32 ips_noproto; /* unknown or unsupported protocol */
|
||||
int32 ips_delivered; /* datagrams delivered to upper level*/
|
||||
int32 ips_localout; /* total ip packets generated here */
|
||||
int32 ips_odropped; /* lost packets due to nobufs, etc. */
|
||||
int32 ips_reassembled; /* total packets reassembled ok */
|
||||
int32 ips_fragmented; /* datagrams sucessfully fragmented */
|
||||
int32 ips_ofragments; /* output fragments created */
|
||||
int32 ips_cantfrag; /* don't fragment flag was set, etc. */
|
||||
int32 ips_badoptions; /* error in option processing */
|
||||
int32 ips_noroute; /* packets discarded due to no route */
|
||||
int32 ips_badvers; /* ip version != 4 */
|
||||
int32 ips_rawout; /* total raw ip packets generated */
|
||||
int32 ips_badfrags; /* malformed fragments (bad length) */
|
||||
int32 ips_rcvmemdrop; /* frags dropped for lack of memory */
|
||||
int32 ips_toolong; /* ip length > max ip packet size */
|
||||
int32 ips_nogif; /* no match gif found */
|
||||
int32 ips_badaddr; /* invalid address on header */
|
||||
int32 ips_inhwcsum; /* hardware checksummed on input */
|
||||
int32 ips_outhwcsum; /* hardware checksummed on output */
|
||||
};
|
||||
|
||||
//#ifdef _KERNEL_MODE
|
||||
|
||||
#define IP_FORWARDING 0x1 /* most of ip header exists */
|
||||
#define IP_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */
|
||||
#define IP_RAWOUTPUT 0x4 /* raw ip header exists */
|
||||
#define IP_ROUTETOIF SO_DONTROUTE /* bypass routing tables */
|
||||
#define IP_MTUDISC 0x10 /* pmtu discovery, set DF */
|
||||
|
||||
#if 0
|
||||
//struct ipstat ipstat;
|
||||
|
||||
void ipv4_input(struct mbuf *, int);
|
||||
int ipv4_output(struct mbuf *, struct mbuf *, struct route *, int, void *);
|
||||
int ipv4_ctloutput(int, struct socket *, int, int, struct mbuf **);
|
||||
|
||||
int ip_dooptions(struct mbuf *);
|
||||
void ip_stripoptions (struct mbuf *, struct mbuf *);
|
||||
struct mbuf *ip_srcroute(void);
|
||||
|
||||
|
||||
#endif /* _KERNEL_MODE */
|
||||
|
||||
#endif /* NETINET_IP_VAR_H */
|
@ -1,95 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NETINET_TCP_H
|
||||
#define NETINET_TCP_H
|
||||
|
||||
typedef uint32 tcp_seq;
|
||||
|
||||
struct tcphdr {
|
||||
uint16 th_sport; /* src port */
|
||||
uint16 th_dport; /* dest. port */
|
||||
tcp_seq th_seq; /* seq number */
|
||||
tcp_seq th_ack; /* ack number */
|
||||
|
||||
#if B_HOST_IS_BENDIAN
|
||||
uint8 th_off:4,
|
||||
th_x2:4;
|
||||
#else
|
||||
uint8 th_x2:4, /* unused */
|
||||
th_off:4; /* data offset */
|
||||
#endif
|
||||
uint8 th_flags; /* ACK, FIN, PUSH, RST, SYN, URG */
|
||||
uint16 th_win; /* advertised window */
|
||||
uint16 th_sum; /* checksum */
|
||||
uint16 th_urp; /* urgent offset */
|
||||
} _PACKED;
|
||||
|
||||
#define TH_FIN 0x01
|
||||
#define TH_SYN 0x02
|
||||
#define TH_RST 0x04
|
||||
#define TH_PUSH 0x08
|
||||
#define TH_ACK 0x10
|
||||
#define TH_URG 0x20
|
||||
|
||||
#define TCPOPT_EOL 0
|
||||
#define TCPOPT_NOP 1
|
||||
#define TCPOPT_MAXSEG 2
|
||||
#define TCPOPT_WINDOW 3
|
||||
#define TCPOPT_SACK_PERMITTED 4 /* Experimental */
|
||||
#define TCPOPT_SACK 5 /* Experimental */
|
||||
#define TCPOPT_TIMESTAMP 8
|
||||
#define TCPOPT_SIGNATURE 19
|
||||
|
||||
#define MAX_TCPOPTLEN 40 /* Absolute maximum TCP options len */
|
||||
|
||||
#define TCPOLEN_MAXSEG 4
|
||||
#define TCPOLEN_WINDOW 3
|
||||
#define TCPOLEN_SACK 8 /* 2*sizeof(tcp_seq) */
|
||||
#define TCPOLEN_SACK_PERMITTED 2
|
||||
#define TCPOLEN_TIMESTAMP 10
|
||||
#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
|
||||
#define TCPOLEN_SIGNATURE 18
|
||||
|
||||
#define TCPOPT_TSTAMP_HDR \
|
||||
(TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
|
||||
|
||||
#define TCP_MSS 512
|
||||
#define TCP_MAXWIN 65535
|
||||
#define TCP_MAX_WINSHIFT 14
|
||||
|
||||
|
||||
#endif /* NETINET_TCP_H */
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* @(#)tcp_debug.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#ifndef NETINET_TCP_DEBUG_H_
|
||||
#define NETINET_TCP_DEBUG_H_
|
||||
|
||||
struct tcp_debug {
|
||||
n_time td_time;
|
||||
short td_act;
|
||||
short td_ostate;
|
||||
caddr_t td_tcb;
|
||||
struct tcpiphdr td_ti;
|
||||
short td_req;
|
||||
struct tcpcb td_cb;
|
||||
};
|
||||
|
||||
#define TA_INPUT 0
|
||||
#define TA_OUTPUT 1
|
||||
#define TA_USER 2
|
||||
#define TA_RESPOND 3
|
||||
#define TA_DROP 4
|
||||
|
||||
//#ifdef TANAMES
|
||||
//char *tanames[] =
|
||||
// { "input", "output", "user", "respond", "drop" };
|
||||
//#endif /* TANAMES */
|
||||
|
||||
#define TCP_NDEBUG 100
|
||||
struct tcp_debug tcp_debug[TCP_NDEBUG];
|
||||
int tcp_debx;
|
||||
#endif /* _NETINET_TCP_DEBUG_H_ */
|
@ -1,86 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* @(#)tcp_fsm.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#ifndef _NETINET_TCP_FSM_H_
|
||||
#define _NETINET_TCP_FSM_H_
|
||||
|
||||
/*
|
||||
* TCP FSM state definitions.
|
||||
* Per RFC793, September, 1981.
|
||||
*/
|
||||
|
||||
#define TCP_NSTATES 11
|
||||
|
||||
#define TCPS_CLOSED 0 /* closed */
|
||||
#define TCPS_LISTEN 1 /* listening for connection */
|
||||
#define TCPS_SYN_SENT 2 /* active, have sent syn */
|
||||
#define TCPS_SYN_RECEIVED 3 /* have sent and received syn */
|
||||
/* states < TCPS_ESTABLISHED are those where connections not established */
|
||||
#define TCPS_ESTABLISHED 4 /* established */
|
||||
#define TCPS_CLOSE_WAIT 5 /* rcvd fin, waiting for close */
|
||||
/* states > TCPS_CLOSE_WAIT are those where user has closed */
|
||||
#define TCPS_FIN_WAIT_1 6 /* have closed, sent fin */
|
||||
#define TCPS_CLOSING 7 /* closed xchd FIN; await ACK */
|
||||
#define TCPS_LAST_ACK 8 /* had fin and close; await FIN ACK */
|
||||
/* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */
|
||||
#define TCPS_FIN_WAIT_2 9 /* have closed, fin is acked */
|
||||
#define TCPS_TIME_WAIT 10 /* in 2*msl quiet wait after close */
|
||||
|
||||
#define TCPS_HAVERCVDSYN(s) ((s) >= TCPS_SYN_RECEIVED)
|
||||
#define TCPS_HAVEESTABLISHED(s) ((s) >= TCPS_ESTABLISHED)
|
||||
#define TCPS_HAVERCVDFIN(s) ((s) >= TCPS_TIME_WAIT)
|
||||
|
||||
#ifdef TCPOUTFLAGS
|
||||
/*
|
||||
* Flags used when sending segments in tcp_output.
|
||||
* Basic flags (TH_RST,TH_ACK,TH_SYN,TH_FIN) are totally
|
||||
* determined by state, with the proviso that TH_FIN is sent only
|
||||
* if all data queued for output is included in the segment.
|
||||
*/
|
||||
u_char tcp_outflags[TCP_NSTATES] = {
|
||||
TH_RST|TH_ACK, 0, TH_SYN, TH_SYN|TH_ACK,
|
||||
TH_ACK, TH_ACK,
|
||||
TH_FIN|TH_ACK, TH_ACK, TH_FIN|TH_ACK, TH_ACK, TH_ACK,
|
||||
};
|
||||
#endif /* TCPOUTFLAGS */
|
||||
|
||||
#ifdef TCPSTATES
|
||||
char *tcpstates[] = {
|
||||
"CLOSED", "LISTEN", "SYN_SENT", "SYN_RCVD",
|
||||
"ESTABLISHED", "CLOSE_WAIT", "FIN_WAIT_1", "CLOSING",
|
||||
"LAST_ACK", "FIN_WAIT_2", "TIME_WAIT",
|
||||
};
|
||||
#endif /* TCPSTATES */
|
||||
#endif /* _NETINET_TCP_FSM_H_ */
|
@ -1,67 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* @(#)tcp_seq.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#ifndef _NETINET_TCP_SEQ_H_
|
||||
#define _NETINET_TCP_SEQ_H_
|
||||
|
||||
/*
|
||||
* TCP sequence numbers are 32 bit integers operated
|
||||
* on with modular arithmetic. These macros can be
|
||||
* used to compare such integers.
|
||||
*/
|
||||
#define SEQ_LT(a,b) ((int)((a)-(b)) < 0)
|
||||
#define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0)
|
||||
#define SEQ_GT(a,b) ((int)((a)-(b)) > 0)
|
||||
#define SEQ_GEQ(a,b) ((int)((a)-(b)) >= 0)
|
||||
|
||||
/*
|
||||
* Macros to initialize tcp sequence numbers for
|
||||
* send and receive from initial send and receive
|
||||
* sequence numbers.
|
||||
*/
|
||||
#define tcp_rcvseqinit(tp) \
|
||||
(tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1
|
||||
|
||||
#define tcp_sendseqinit(tp) \
|
||||
(tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \
|
||||
(tp)->iss
|
||||
|
||||
#define TCP_ISSINCR (125*1024) /* increment for tcp_iss each second */
|
||||
|
||||
//#ifdef _NETWORK_STACK
|
||||
extern tcp_seq tcp_iss; /* tcp initial send seq # */
|
||||
//#endif /* _NETWORK_STACK */
|
||||
|
||||
#endif /* _NETINET_TCP_SEQ_H_ */
|
@ -1,137 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NETINET_TCP_TIMERS_H
|
||||
#define NETINET_TCP_TIMERS_H
|
||||
|
||||
/*
|
||||
* Definitions of the TCP timers. These timers are counted
|
||||
* down PR_SLOWHZ times a second.
|
||||
*/
|
||||
#define TCPT_NTIMERS 4
|
||||
|
||||
#define TCPT_REXMT 0 /* retransmission timer */
|
||||
#define TCPT_PERSIST 1 /* presist timer */
|
||||
#define TCPT_KEEP 2 /* keeplaive timer or conn est timer */
|
||||
#define TCPT_2MSL 3 /* 2MSL timer or FIN_WAIT_2 timer */
|
||||
|
||||
/*
|
||||
* The TCPT_REXMT timer is used to force retransmissions.
|
||||
* The TCP has the TCPT_REXMT timer set whenever segments
|
||||
* have been sent for which ACKs are expected but not yet
|
||||
* received. If an ACK is received which advances tp->snd_una,
|
||||
* then the retransmit timer is cleared (if there are no more
|
||||
* outstanding segments) or reset to the base value (if there
|
||||
* are more ACKs expected). Whenever the retransmit timer goes off,
|
||||
* we retransmit one unacknowledged segment, and do a backoff
|
||||
* on the retransmit timer.
|
||||
*
|
||||
* The TCPT_PERSIST timer is used to keep window size information
|
||||
* flowing even if the window goes shut. If all previous transmissions
|
||||
* have been acknowledged (so that there are no retransmissions in progress),
|
||||
* and the window is too small to bother sending anything, then we start
|
||||
* the TCPT_PERSIST timer. When it expires, if the window is nonzero,
|
||||
* we go to transmit state. Otherwise, at intervals send a single byte
|
||||
* into the peer's window to force him to update our window information.
|
||||
* We do this at most as often as TCPT_PERSMIN time intervals,
|
||||
* but no more frequently than the current estimate of round-trip
|
||||
* packet time. The TCPT_PERSIST timer is cleared whenever we receive
|
||||
* a window update from the peer.
|
||||
*
|
||||
* The TCPT_KEEP timer is used to keep connections alive. If an
|
||||
* connection is idle (no segments received) for TCPTV_KEEP_INIT amount of time,
|
||||
* but not yet established, then we drop the connection. Once the connection
|
||||
* is established, if the connection is idle for TCPTV_KEEP_IDLE time
|
||||
* (and keepalives have been enabled on the socket), we begin to probe
|
||||
* the connection. We force the peer to send us a segment by sending:
|
||||
* <SEQ=SND.UNA-1><ACK=RCV.NXT><CTL=ACK>
|
||||
* This segment is (deliberately) outside the window, and should elicit
|
||||
* an ack segment in response from the peer. If, despite the TCPT_KEEP
|
||||
* initiated segments we cannot elicit a response from a peer in TCPT_MAXIDLE
|
||||
* amount of time probing, then we drop the connection.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Time constants.
|
||||
*/
|
||||
#define TCPTV_MSL ( 30*PR_SLOWHZ ) /* max seg lifetime (hah!) */
|
||||
#define TCPTV_SRTTBASE 0 /* base roundtrip time;
|
||||
* if 0, no idea yet */
|
||||
#define TCPTV_SRTTDFLT ( 3*PR_SLOWHZ ) /* assumed RTT if no info */
|
||||
|
||||
#define TCPTV_PERSMIN ( 5*PR_SLOWHZ ) /* retransmit persistance */
|
||||
#define TCPTV_PERSMAX ( 60*PR_SLOWHZ ) /* maximum persist interval */
|
||||
|
||||
#define TCPTV_KEEP_INIT ( 75*PR_SLOWHZ ) /* initial connect keep alive */
|
||||
#define TCPTV_KEEP_IDLE (120*60*PR_SLOWHZ) /* dflt time before probing */
|
||||
#define TCPTV_KEEPINTVL ( 75*PR_SLOWHZ ) /* default probe interval */
|
||||
#define TCPTV_KEEPCNT 8 /* max probes before drop */
|
||||
|
||||
#define TCPTV_MIN ( 1*PR_SLOWHZ ) /* minimum allowable value */
|
||||
#define TCPTV_REXMTMAX ( 64*PR_SLOWHZ ) /* max allowable REXMT value */
|
||||
|
||||
#define TCP_LINGERTIME 120 /* at most 2 minutes... */
|
||||
#define TCP_MAXRXTSHIFT 12 /* maximum retransmits */
|
||||
|
||||
//#ifdef TCPTIMERS
|
||||
//char *tcptimers[] =
|
||||
// { "REXMT", "PERSIST", "KEEP", "2MSL" };
|
||||
//#endif /* TCPTIMERS */
|
||||
extern char *tcptimers[];
|
||||
|
||||
/*
|
||||
* Force a time value to be in a certain range.
|
||||
*/
|
||||
#define TCPT_RANGESET(tv, value, tvmin, tvmax) { \
|
||||
(tv) = (value); \
|
||||
if ((tv) < (tvmin)) \
|
||||
(tv) = (tvmin); \
|
||||
else if ((tv) > (tvmax)) \
|
||||
(tv) = (tvmax); \
|
||||
}
|
||||
|
||||
//#ifdef _NETWORK_STACK
|
||||
extern int tcptv_keep_init;
|
||||
extern int tcp_keepidle; /* time before keepalive probes begin */
|
||||
extern int tcp_keepintvl; /* time between keepalive probes */
|
||||
extern int tcp_maxidle; /* time to drop after starting probes */
|
||||
extern int tcp_ttl; /* time to live for TCP segs */
|
||||
extern int tcp_backoff[];
|
||||
|
||||
|
||||
//#endif /* _NETWORK_STACK */
|
||||
|
||||
#endif /* NETINET_TCP_TIMERS_H */
|
@ -1,282 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NETINET_TCP_VAR_H
|
||||
#define NETINET_TCP_VAR_H
|
||||
|
||||
/*
|
||||
* Tcp control block, one per tcp connection
|
||||
*/
|
||||
struct tcpcb {
|
||||
struct tcpiphdr *seg_next;
|
||||
struct tcpiphdr *seg_prev;
|
||||
int16 t_state; /* state of this connection */
|
||||
int16 t_timer[TCPT_NTIMERS]; /* tcp timers */
|
||||
int16 t_rxtshift; /* log(2) of rexmt exp. backoff */
|
||||
int16 t_rxtcur; /* current retransmit value */
|
||||
int16 t_dupacks; /* consecutive dup acks recd */
|
||||
uint16 t_maxseg; /* maximum segment size */
|
||||
int8 t_force; /* 1 if forcing out a byte */
|
||||
uint16 t_flags;
|
||||
|
||||
struct tcpiphdr *t_template; /* skeletal packet for transmit */
|
||||
struct inpcb *t_inpcb; /* back pointer to internet pcb */
|
||||
/*
|
||||
* The following fields are used as in the protocol specification.
|
||||
* See RFC783, Dec. 1981, page 21.
|
||||
*/
|
||||
/* send sequence variables */
|
||||
tcp_seq snd_una; /* send unacknowledged */
|
||||
tcp_seq snd_nxt; /* send next */
|
||||
tcp_seq snd_up; /* send urgent pointer */
|
||||
tcp_seq snd_wl1; /* window update seg seq number */
|
||||
tcp_seq snd_wl2; /* window update seg ack number */
|
||||
tcp_seq iss; /* initial send sequence number */
|
||||
unsigned long snd_wnd; /* send window */
|
||||
|
||||
/* receive sequence variables */
|
||||
unsigned long rcv_wnd; /* receive window */
|
||||
tcp_seq rcv_nxt; /* receive next */
|
||||
tcp_seq rcv_up; /* receive urgent pointer */
|
||||
tcp_seq irs; /* initial receive sequence number */
|
||||
|
||||
/*
|
||||
* Additional variables for this implementation.
|
||||
*/
|
||||
/* receive variables */
|
||||
tcp_seq rcv_adv; /* advertised window */
|
||||
/* retransmit variables */
|
||||
tcp_seq snd_max; /* highest sequence number sent;
|
||||
* used to recognize retransmits
|
||||
*/
|
||||
/* congestion control (for slow start, source quench, retransmit after loss) */
|
||||
unsigned long snd_cwnd; /* congestion-controlled window */
|
||||
unsigned long snd_ssthresh; /* snd_cwnd size threshhold for
|
||||
* for slow start exponential to
|
||||
* linear switch
|
||||
*/
|
||||
uint16 t_maxopd; /* mss plus options */
|
||||
uint16 t_peermss; /* peer's maximum segment size */
|
||||
|
||||
/*
|
||||
* transmit timing stuff. See below for scale of srtt and rttvar.
|
||||
* "Variance" is actually smoothed difference.
|
||||
*/
|
||||
int16 t_idle; /* inactivity time */
|
||||
int16 t_rtt; /* round trip time */
|
||||
tcp_seq t_rtseq; /* sequence number being timed */
|
||||
uint16 t_srtt; /* smoothed round-trip time */
|
||||
uint16 t_rttvar; /* variance in round-trip time */
|
||||
uint16 t_rttmin; /* minimum rtt allowed */
|
||||
uint32 max_sndwnd; /* largest window peer has offered */
|
||||
|
||||
/* out-of-band data */
|
||||
int8 t_oobflags; /* have some */
|
||||
int8 t_iobc; /* input character */
|
||||
int16 t_softerror; /* possible error, not yet reported... */
|
||||
/* RFC 1323 variables */
|
||||
uint8 snd_scale; /* window scaling for send window */
|
||||
uint8 rcv_scale; /* window scaling for recv window */
|
||||
uint8 request_r_scale; /* pending window scaling */
|
||||
uint8 requested_s_scale;
|
||||
uint32 ts_recent; /* timestamp echo data */
|
||||
uint32 ts_recent_age; /* when last updated */
|
||||
tcp_seq last_ack_sent;
|
||||
};
|
||||
|
||||
#define intotcpcb(ip) ((struct tcpcb*)(ip)->inp_ppcb)
|
||||
#define sototcpcb(so) (intotcpcb(sotoinpcb(so)))
|
||||
|
||||
#define TF_ACKNOW 0x0001 /* send ACK immeadiately */
|
||||
#define TF_DELACK 0x0002 /* send ACK, but try to delay it */
|
||||
#define TF_NODELAY 0x0004 /* don't delay packets to coalesce */
|
||||
#define TF_NOOPT 0x0008 /* don't use tcp options */
|
||||
#define TF_SENTFIN 0x0010 /* have sent FIN */
|
||||
#define TF_REQ_SCALE 0x0020 /* have/will request window scaling */
|
||||
#define TF_RCVD_SCALE 0x0040 /* other side has requested scaling */
|
||||
#define TF_REQ_TSTMP 0x0080 /* have/will request timestamps */
|
||||
#define TF_RCVD_TSTMP 0x0100 /* a timestamp was received in SYN */
|
||||
#define TF_SACK_PERMIT 0x0200 /* other side said I could SACK */
|
||||
#define TF_SIGNATURE 0x0400 /* require TCP MD5 signature */
|
||||
|
||||
#define TCPOOB_HAVEDATA 0x01 /* we have TCP OOB data */
|
||||
#define TCPOOB_HADDATA 0x02 /* we've had some TCP OOB data */
|
||||
|
||||
/*
|
||||
* The smoothed round-trip time and estimated variance
|
||||
* are stored as fixed point numbers scaled by the values below.
|
||||
* For convenience, these scales are also used in smoothing the average
|
||||
* (smoothed = (1/scale)sample + ((scale-1)/scale)smoothed).
|
||||
* With these scales, srtt has 3 bits to the right of the binary point,
|
||||
* and thus an "ALPHA" of 0.875. rttvar has 2 bits to the right of the
|
||||
* binary point, and is smoothed with an ALPHA of 0.75.
|
||||
*/
|
||||
#define TCP_RTT_SCALE 8 /* multiplier for srtt; 3 bits frac. */
|
||||
#define TCP_RTT_SHIFT 3 /* shift for srtt; 3 bits frac. */
|
||||
#define TCP_RTTVAR_SCALE 4 /* multiplier for rttvar; 2 bits */
|
||||
#define TCP_RTTVAR_SHIFT 2 /* multiplier for rttvar; 2 bits */
|
||||
|
||||
#define TCP_REXMTVAL(tp) \
|
||||
((((tp)->t_srtt >> TCP_RTT_SHIFT) + (tp)->t_rttvar) >> 2)
|
||||
/*
|
||||
* TCP statistics.
|
||||
* Many of these should be kept per connection,
|
||||
* but that's inconvenient at the moment.
|
||||
*/
|
||||
struct tcpstat {
|
||||
uint32 tcps_connattempt; /* connections initiated */
|
||||
uint32 tcps_accepts; /* connections accepted */
|
||||
uint32 tcps_connects; /* connections established */
|
||||
uint32 tcps_drops; /* connections dropped */
|
||||
uint32 tcps_conndrops; /* embryonic connections dropped */
|
||||
uint32 tcps_closed; /* conn. closed (includes drops) */
|
||||
uint32 tcps_segstimed; /* segs where we tried to get rtt */
|
||||
uint32 tcps_rttupdated; /* times we succeeded */
|
||||
uint32 tcps_delack; /* delayed acks sent */
|
||||
uint32 tcps_timeoutdrop; /* conn. dropped in rxmt timeout */
|
||||
uint32 tcps_rexmttimeo; /* retransmit timeouts */
|
||||
uint32 tcps_persisttimeo; /* persist timeouts */
|
||||
uint32 tcps_persistdrop; /* connections dropped in persist */
|
||||
uint32 tcps_keeptimeo; /* keepalive timeouts */
|
||||
uint32 tcps_keepprobe; /* keepalive probes sent */
|
||||
uint32 tcps_keepdrops; /* connections dropped in keepalive */
|
||||
|
||||
uint32 tcps_sndtotal; /* total packets sent */
|
||||
uint32 tcps_sndpack; /* data packets sent */
|
||||
uint64 tcps_sndbyte; /* data bytes sent */
|
||||
uint32 tcps_sndrexmitpack; /* data packets retransmitted */
|
||||
uint64 tcps_sndrexmitbyte; /* data bytes retransmitted */
|
||||
uint64 tcps_sndrexmitfast; /* Fast retransmits */
|
||||
uint32 tcps_sndacks; /* ack-only packets sent */
|
||||
uint32 tcps_sndprobe; /* window probes sent */
|
||||
uint32 tcps_sndurg; /* packets sent with URG only */
|
||||
uint32 tcps_sndwinup; /* window update-only packets sent */
|
||||
uint32 tcps_sndctrl; /* control (SYN|FIN|RST) packets sent */
|
||||
|
||||
uint32 tcps_rcvtotal; /* total packets received */
|
||||
uint32 tcps_rcvpack; /* packets received in sequence */
|
||||
uint64 tcps_rcvbyte; /* bytes received in sequence */
|
||||
uint32 tcps_rcvbadsum; /* packets received with ccksum errs */
|
||||
uint32 tcps_rcvbadoff; /* packets received with bad offset */
|
||||
uint32 tcps_rcvmemdrop; /* packets dropped for lack of memory */
|
||||
uint32 tcps_rcvnosec; /* packets dropped for lack of ipsec */
|
||||
uint32 tcps_rcvshort; /* packets received too short */
|
||||
uint32 tcps_rcvduppack; /* duplicate-only packets received */
|
||||
uint64 tcps_rcvdupbyte; /* duplicate-only bytes received */
|
||||
uint32 tcps_rcvpartduppack; /* packets with some duplicate data */
|
||||
uint64 tcps_rcvpartdupbyte; /* dup. bytes in part-dup. packets */
|
||||
uint32 tcps_rcvoopack; /* out-of-order packets received */
|
||||
uint64 tcps_rcvoobyte; /* out-of-order bytes received */
|
||||
uint32 tcps_rcvpackafterwin; /* packets with data after window */
|
||||
uint64 tcps_rcvbyteafterwin; /* bytes rcvd after window */
|
||||
uint32 tcps_rcvafterclose; /* packets rcvd after "close" */
|
||||
uint32 tcps_rcvwinprobe; /* rcvd window probe packets */
|
||||
uint32 tcps_rcvdupack; /* rcvd duplicate acks */
|
||||
uint32 tcps_rcvacktoomuch; /* rcvd acks for unsent data */
|
||||
uint32 tcps_rcvackpack; /* rcvd ack packets */
|
||||
uint64 tcps_rcvackbyte; /* bytes acked by rcvd acks */
|
||||
uint32 tcps_rcvwinupd; /* rcvd window update packets */
|
||||
uint32 tcps_pawsdrop; /* segments dropped due to PAWS */
|
||||
uint32 tcps_predack; /* times hdr predict ok for acks */
|
||||
uint32 tcps_preddat; /* times hdr predict ok for data pkts */
|
||||
|
||||
uint32 tcps_pcbhashmiss; /* input packets missing pcb hash */
|
||||
uint32 tcps_noport; /* no socket on port */
|
||||
uint32 tcps_badsyn; /* SYN packet with src==dst rcv'ed */
|
||||
|
||||
uint32 tcps_rcvbadsig; /* rcvd bad/missing TCP signatures */
|
||||
uint64 tcps_rcvgoodsig; /* rcvd good TCP signatures */
|
||||
uint32 tcps_inhwcsum; /* input hardware-checksummed packets */
|
||||
uint32 tcps_outhwcsum; /* output hardware-checksummed packets */
|
||||
};
|
||||
|
||||
/*
|
||||
* Names for TCP sysctl objects.
|
||||
*/
|
||||
|
||||
#define TCPCTL_RFC1323 1 /* enable/disable RFC1323 timestamps/scaling */
|
||||
#define TCPCTL_KEEPINITTIME 2 /* TCPT_KEEP value */
|
||||
#define TCPCTL_KEEPIDLE 3 /* allow tcp_keepidle to be changed */
|
||||
#define TCPCTL_KEEPINTVL 4 /* allow tcp_keepintvl to be changed */
|
||||
#define TCPCTL_SLOWHZ 5 /* return kernel idea of PR_SLOWHZ */
|
||||
#define TCPCTL_BADDYNAMIC 6 /* return bad dynamic port bitmap */
|
||||
#define TCPCTL_RECVSPACE 7 /* receive buffer space */
|
||||
#define TCPCTL_SENDSPACE 8 /* send buffer space */
|
||||
#define TCPCTL_IDENT 9 /* get connection owner */
|
||||
#define TCPCTL_SACK 10 /* selective acknowledgement, rfc 2018 */
|
||||
#define TCPCTL_MSSDFLT 11 /* Default maximum segment size */
|
||||
#define TCPCTL_RSTPPSLIMIT 12 /* RST pps limit */
|
||||
#define TCPCTL_MAXID 13
|
||||
|
||||
//#ifdef _NETWORK_STACK
|
||||
|
||||
extern struct inpcb tcb;
|
||||
extern struct tcpstat tcpstat;
|
||||
extern int tcp_mssdflt;
|
||||
extern int tcp_do_rfc1323;
|
||||
extern unsigned long tcp_now;
|
||||
|
||||
|
||||
void tcp_input(struct mbuf *, int);
|
||||
int tcp_output(struct tcpcb*);
|
||||
int tcp_mss(struct tcpcb *, uint);
|
||||
void tcp_mss_update(struct tcpcb *);
|
||||
void tcp_quench(struct inpcb *, int);
|
||||
int tcp_userreq(struct socket *, int, struct mbuf *, struct mbuf *,
|
||||
struct mbuf *);
|
||||
struct tcpcb * tcp_timers(struct tcpcb *, int);
|
||||
struct tcpcb *tcp_close(struct tcpcb *);
|
||||
void tcp_setpersist(struct tcpcb *);
|
||||
struct tcpcb *tcp_drop(struct tcpcb *, int);
|
||||
void tcp_respond(struct tcpcb *, struct tcpiphdr *, struct mbuf *,
|
||||
tcp_seq, tcp_seq, int);
|
||||
void tcp_xmit_timer(struct tcpcb *, int16);
|
||||
void tcp_dooptions(struct tcpcb *, u_char *, int, struct tcpiphdr *,
|
||||
int *, uint32 *, uint32 *);
|
||||
struct tcpiphdr *tcp_template(struct tcpcb *);
|
||||
void tcp_pulloutofband(struct socket *, struct tcpiphdr *, struct mbuf *);
|
||||
|
||||
void tcp_canceltimers(struct tcpcb *);
|
||||
void tcp_trace(int16, int16, struct tcpcb *, void *, int, int);
|
||||
|
||||
void tcp_slowtimer(void *data);
|
||||
void tcp_fasttimer(void *data);
|
||||
|
||||
|
||||
|
||||
//#endif
|
||||
|
||||
#endif /* NETINET_TCP_VAR_H */
|
@ -1,66 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NETINET_TCPIP_H
|
||||
#define NETINET_TCPIP_H
|
||||
|
||||
/* The TCP + IPv4 header (NB no options) */
|
||||
struct tcpiphdr {
|
||||
struct ipovly ti_i;
|
||||
struct tcphdr ti_t;
|
||||
};
|
||||
|
||||
#define ti_next ti_i.ih_next
|
||||
#define ti_prev ti_i.ih_prev
|
||||
#define ti_x1 ti_i.ih_x1
|
||||
#define ti_pr ti_i.ih_pr
|
||||
#define ti_len ti_i.ih_len
|
||||
#define ti_src ti_i.ih_src
|
||||
#define ti_dst ti_i.ih_dst
|
||||
#define ti_sport ti_t.th_sport
|
||||
#define ti_dport ti_t.th_dport
|
||||
#define ti_seq ti_t.th_seq
|
||||
#define ti_ack ti_t.th_ack
|
||||
#define ti_x2 ti_t.th_x2
|
||||
#define ti_off ti_t.th_off
|
||||
#define ti_flags ti_t.th_flags
|
||||
#define ti_win ti_t.th_win
|
||||
#define ti_sum ti_t.th_sum
|
||||
#define ti_urp ti_t.th_urp
|
||||
|
||||
#define REASS_MBUF(ti) (*(struct mbuf **)&((ti)->ti_t))
|
||||
|
||||
#endif /* NETINET_TCPIP_H */
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*@(#)udp.h8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#ifndef NETINET_UDP_H
|
||||
#define NETINET_UDP_H
|
||||
|
||||
struct udphdr {
|
||||
uint16 uh_sport;
|
||||
uint16 uh_dport;
|
||||
uint16 uh_ulen;
|
||||
uint16 uh_sum;
|
||||
};
|
||||
|
||||
#endif /* NETINET_UDP_H */
|
@ -1,51 +0,0 @@
|
||||
/* udp_var.h */
|
||||
|
||||
#ifndef UDP_VAR_H
|
||||
#define UDP_VAR_H
|
||||
|
||||
#include "netinet/ip_var.h"
|
||||
|
||||
struct udpiphdr {
|
||||
struct ipovly ui_i;
|
||||
struct udphdr ui_u;
|
||||
};
|
||||
#define ui_next ui_i.ih_next
|
||||
#define ui_prev ui_i.ih_prev
|
||||
#define ui_x1 ui_i.ih_x1 /* NB _x1 (one) */
|
||||
#define ui_pr ui_i.ih_pr
|
||||
#define ui_len ui_i.ih_len
|
||||
#define ui_src ui_i.ih_src
|
||||
#define ui_dst ui_i.ih_dst
|
||||
#define ui_sport ui_u.uh_sport
|
||||
#define ui_dport ui_u.uh_dport
|
||||
#define ui_ulen ui_u.uh_ulen
|
||||
#define ui_sum ui_u.uh_sum
|
||||
|
||||
struct udpstat {
|
||||
/* input statistics: */
|
||||
uint32 udps_ipackets; /* total input packets */
|
||||
uint32 udps_hdrops; /* packet shorter than header */
|
||||
uint32 udps_badsum; /* checksum error */
|
||||
uint32 udps_nosum; /* no checksum */
|
||||
uint32 udps_badlen; /* data length larger than packet */
|
||||
uint32 udps_noport; /* no socket on port */
|
||||
uint32 udps_noportbcast; /* of above, arrived as broadcast */
|
||||
uint32 udps_nosec; /* dropped for lack of ipsec */
|
||||
uint32 udps_fullsock; /* not delivered, input socket full */
|
||||
uint32 udps_pcbhashmiss; /* input packets missing pcb hash */
|
||||
uint32 udps_inhwcsum; /* input hardware-csummed packets */
|
||||
/* output statistics: */
|
||||
uint32 udps_opackets; /* total output packets */
|
||||
uint32 udps_outhwcsum; /* output hardware-csummed packets */
|
||||
};
|
||||
|
||||
/*
|
||||
* Names for UDP sysctl objects
|
||||
*/
|
||||
#define UDPCTL_CHECKSUM 1 /* checksum UDP packets */
|
||||
#define UDPCTL_BADDYNAMIC 2 /* return bad dynamic port bitmap */
|
||||
#define UDPCTL_RECVSPACE 3 /* receive buffer space */
|
||||
#define UDPCTL_SENDSPACE 4 /* send buffer space */
|
||||
#define UDPCTL_MAXID 5
|
||||
|
||||
#endif
|
@ -1,62 +0,0 @@
|
||||
#ifndef _SYS_SELECT_H
|
||||
#define _SYS_SELECT_H
|
||||
/*
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <signal.h>
|
||||
|
||||
|
||||
/* If FD_SET is already defined, only the select() prototype is
|
||||
* exported in this header.
|
||||
*/
|
||||
#ifndef FD_SET
|
||||
|
||||
/* You can define your own FDSETSIZE if you need more bits - but
|
||||
* it should be enough for most uses.
|
||||
*/
|
||||
#ifndef FD_SETSIZE
|
||||
# define FD_SETSIZE 1024
|
||||
#endif
|
||||
|
||||
typedef unsigned long fd_mask;
|
||||
|
||||
#ifndef _howmany
|
||||
# define _howmany(x, y) (((x) + ((y) - 1)) / (y))
|
||||
#endif
|
||||
|
||||
#define NFDBITS (sizeof(fd_mask) * 8) /* bits per mask */
|
||||
|
||||
typedef struct fd_set {
|
||||
fd_mask bits[_howmany(FD_SETSIZE, NFDBITS)];
|
||||
} fd_set;
|
||||
|
||||
#define _FD_BITSINDEX(fd) ((fd) / NFDBITS)
|
||||
#define _FD_BIT(fd) (1L << ((fd) % NFDBITS))
|
||||
|
||||
#define FD_ZERO(set) memset((set), 0, sizeof(fd_set))
|
||||
#define FD_SET(fd, set) ((set)->bits[_FD_BITSINDEX(fd)] |= _FD_BIT(fd))
|
||||
#define FD_CLR(fd, set) ((set)->bits[_FD_BITSINDEX(fd)] &= ~_FD_BIT(fd))
|
||||
#define FD_ISSET(fd, set) ((set)->bits[_FD_BITSINDEX(fd)] & _FD_BIT(fd))
|
||||
|
||||
#endif /* FD_SET */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __HAIKU__
|
||||
extern int pselect(int numBits, struct fd_set *readBits, struct fd_set *writeBits,
|
||||
struct fd_set *errorBits, const struct timespec *timeout, const sigset_t *sigMask);
|
||||
#endif
|
||||
|
||||
extern int select(int numBits, struct fd_set *readBits, struct fd_set *writeBits,
|
||||
struct fd_set *errorBits, struct timeval *timeout);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_SELECT_H */
|
@ -1,291 +0,0 @@
|
||||
/* sys/socket.h */
|
||||
|
||||
|
||||
#ifndef _SYS_SOCKET_H
|
||||
#define _SYS_SOCKET_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef uint32_t socklen_t;
|
||||
|
||||
/* These are the address/protocol families we'll be using... */
|
||||
/* NB these should be added to as required... */
|
||||
|
||||
/* If we want to have Binary compatability we may need to alter these
|
||||
* to agree with the Be versions...
|
||||
*/
|
||||
#define AF_UNSPEC 0
|
||||
#define AF_INET 1
|
||||
#define AF_LOCAL 2
|
||||
#define AF_UNIX AF_LOCAL /* for compatability */
|
||||
#define AF_ROUTE 3
|
||||
#define AF_LINK 4
|
||||
#define AF_INET6 5
|
||||
#define AF_IPX 7
|
||||
#define AF_IMPLINK 20
|
||||
|
||||
#define AF_MAX 24
|
||||
|
||||
#define PF_UNSPEC AF_UNSPEC
|
||||
#define PF_INET AF_INET
|
||||
#define PF_ROUTE AF_ROUTE
|
||||
#define PF_LINK AF_LINK
|
||||
#define PF_INET6 AF_INET6
|
||||
#define PF_IPX AF_IPX
|
||||
#define PF_IMPLINK AF_IMPLINK
|
||||
|
||||
/* Types of socket we can create (eventually) */
|
||||
#ifndef BUILDING_R5_LIBNET
|
||||
#define SOCK_STREAM 1
|
||||
#define SOCK_DGRAM 2
|
||||
#define SOCK_RAW 3
|
||||
#define SOCK_MISC 255
|
||||
#else /* BUILDING_R5_LIBNET */
|
||||
/* XXX: HACK: we use socket emulation for libnet.so */
|
||||
#define SOCK_DGRAM 10
|
||||
#define SOCK_STREAM 11
|
||||
#define SOCK_RAW 12
|
||||
#define SOCK_MISC 255
|
||||
#define SOCK_NATIVE_STREAM 1
|
||||
#define SOCK_NATIVE_DGRAM 2
|
||||
#define SOCK_NATIVE_RAW 3
|
||||
#define SOCK_NATIVE_MISC 255
|
||||
#endif /* BUILDING_R5_LIBNET */
|
||||
|
||||
/*
|
||||
* Option flags per-socket.
|
||||
*/
|
||||
#define SOL_SOCKET 0xffffffff
|
||||
|
||||
#define SO_ACCEPTCONN 0x00000001 /* socket has had listen() */
|
||||
#define SO_BROADCAST 0x00000002 /* permit sending of broadcast msgs */
|
||||
#define SO_DEBUG 0x00000004 /* turn on debugging info recording */
|
||||
#define SO_DONTROUTE 0x00000008 /* just use interface addresses */
|
||||
#define SO_KEEPALIVE 0x00000010 /* keep connections alive */
|
||||
#define SO_OOBINLINE 0x00000020 /* leave received OOB data in line */
|
||||
#define SO_REUSEADDR 0x00000040 /* allow local address reuse */
|
||||
#define SO_REUSEPORT 0x00000080 /* allow local address & port reuse */
|
||||
#define SO_USELOOPBACK 0x00000100 /* bypass hardware when possible */
|
||||
#define SO_LINGER 0x00000200 /* linger on close if data present */
|
||||
|
||||
/*
|
||||
* Additional options, not kept in so_options.
|
||||
*/
|
||||
#define SO_SNDBUF 0x40000001 /* send buffer size */
|
||||
#define SO_SNDLOWAT 0x40000002 /* send low-water mark */
|
||||
#define SO_SNDTIMEO 0x40000003 /* send timeout */
|
||||
#define SO_RCVBUF 0x40000004 /* receive buffer size */
|
||||
#define SO_RCVLOWAT 0x40000005 /* receive low-water mark */
|
||||
#define SO_RCVTIMEO 0x40000006 /* receive timeout */
|
||||
#define SO_ERROR 0x40000007 /* get error status and clear */
|
||||
#define SO_TYPE 0x40000008 /* get socket type */
|
||||
|
||||
/* not handled by OpenBeOS */
|
||||
#define SO_NONBLOCK 0x40000009
|
||||
#define SO_BINDTODEVICE 0x4000000a
|
||||
|
||||
/* only defined in OpenBeOS */
|
||||
#define SO_NETPROC 0x00001020 /* multiplex; network processing */
|
||||
|
||||
/*
|
||||
* These are the valid values for the "how" field used by shutdown(2).
|
||||
*/
|
||||
#define SHUT_RD 0
|
||||
#define SHUT_WR 1
|
||||
#define SHUT_RDWR 2
|
||||
/* for BONE compatibility */
|
||||
#define SHUTDOWN_RECV SHUT_RD
|
||||
#define SHUTDOWN_SEND SHUT_WR
|
||||
#define SHUTDOWN_BOTH SHUT_RDWR
|
||||
|
||||
|
||||
struct linger {
|
||||
int l_onoff;
|
||||
int l_linger;
|
||||
};
|
||||
|
||||
struct sockaddr {
|
||||
uint8_t sa_len;
|
||||
uint8_t sa_family;
|
||||
uint8_t sa_data[30];
|
||||
};
|
||||
|
||||
/* this can hold ANY sockaddr we care to throw at it! */
|
||||
struct sockaddr_storage {
|
||||
uint8_t ss_len; /* total length */
|
||||
uint8_t ss_family; /* address family */
|
||||
uint8_t __ss_pad1[6]; /* align to quad */
|
||||
uint64_t __ss_pad2; /* force alignment for stupid compilers */
|
||||
uint8_t __ss_pad3[240]; /* pad to a total of 256 bytes */
|
||||
};
|
||||
|
||||
struct sockproto {
|
||||
uint16_t sp_family;
|
||||
uint16_t sp_protocol;
|
||||
};
|
||||
|
||||
#define CTL_NET 4
|
||||
|
||||
#define CTL_NET_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
{ "unix", CTLTYPE_NODE }, \
|
||||
{ "inet", CTLTYPE_NODE }, \
|
||||
{ "implink", CTLTYPE_NODE }, \
|
||||
{ "pup", CTLTYPE_NODE }, \
|
||||
{ "chaos", CTLTYPE_NODE }, \
|
||||
{ "xerox_ns", CTLTYPE_NODE }, \
|
||||
{ "iso", CTLTYPE_NODE }, \
|
||||
{ "emca", CTLTYPE_NODE }, \
|
||||
{ "datakit", CTLTYPE_NODE }, \
|
||||
{ "ccitt", CTLTYPE_NODE }, \
|
||||
{ "ibm_sna", CTLTYPE_NODE }, \
|
||||
{ "decnet", CTLTYPE_NODE }, \
|
||||
{ "dec_dli", CTLTYPE_NODE }, \
|
||||
{ "lat", CTLTYPE_NODE }, \
|
||||
{ "hylink", CTLTYPE_NODE }, \
|
||||
{ "appletalk", CTLTYPE_NODE }, \
|
||||
{ "route", CTLTYPE_NODE }, \
|
||||
{ "link_layer", CTLTYPE_NODE }, \
|
||||
{ "xtp", CTLTYPE_NODE }, \
|
||||
{ "coip", CTLTYPE_NODE }, \
|
||||
{ "cnt", CTLTYPE_NODE }, \
|
||||
{ "rtip", CTLTYPE_NODE }, \
|
||||
{ "ipx", CTLTYPE_NODE }, \
|
||||
{ "inet6", CTLTYPE_NODE }, \
|
||||
{ "pip", CTLTYPE_NODE }, \
|
||||
{ "isdn", CTLTYPE_NODE }, \
|
||||
{ "natm", CTLTYPE_NODE }, \
|
||||
{ "encap", CTLTYPE_NODE }, \
|
||||
{ "sip", CTLTYPE_NODE }, \
|
||||
{ "key", CTLTYPE_NODE }, \
|
||||
}
|
||||
|
||||
/*
|
||||
* PF_ROUTE - Routing table
|
||||
*
|
||||
* Three additional levels are defined:
|
||||
* Fourth: address family, 0 is wildcard
|
||||
* Fifth: type of info, defined below
|
||||
* Sixth: flag(s) to mask with for NET_RT_FLAGS
|
||||
*/
|
||||
#define NET_RT_DUMP 1 /* dump; may limit to a.f. */
|
||||
#define NET_RT_FLAGS 2 /* by flags, e.g. RESOLVING */
|
||||
#define NET_RT_IFLIST 3 /* survey interface list */
|
||||
#define NET_RT_MAXID 4
|
||||
|
||||
#define CTL_NET_RT_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
{ "dump", CTLTYPE_STRUCT }, \
|
||||
{ "flags", CTLTYPE_STRUCT }, \
|
||||
{ "iflist", CTLTYPE_STRUCT }, \
|
||||
}
|
||||
|
||||
/* Max listen queue for a socket */
|
||||
#define SOMAXCONN 5 /* defined as 128 in OpenBSD */
|
||||
|
||||
struct msghdr {
|
||||
char * msg_name; /* address we're using (optional) */
|
||||
uint msg_namelen; /* length of address */
|
||||
struct iovec *msg_iov; /* scatter/gather array we'll use */
|
||||
uint msg_iovlen; /* # elements in msg_iov */
|
||||
char * msg_control; /* extra data */
|
||||
uint msg_controllen; /* length of extra data */
|
||||
int msg_flags; /* flags */
|
||||
};
|
||||
|
||||
/* Defines used in msghdr structure. */
|
||||
#define MSG_OOB 0x1 /* process out-of-band data */
|
||||
#define MSG_PEEK 0x2 /* peek at incoming message */
|
||||
#define MSG_DONTROUTE 0x4 /* send without using routing tables */
|
||||
#define MSG_EOR 0x8 /* data completes record */
|
||||
#define MSG_TRUNC 0x10 /* data discarded before delivery */
|
||||
#define MSG_CTRUNC 0x20 /* control data lost before delivery */
|
||||
#define MSG_WAITALL 0x40 /* wait for full request or error */
|
||||
#define MSG_DONTWAIT 0x80 /* this message should be nonblocking */
|
||||
#define MSG_BCAST 0x100 /* this message rec'd as broadcast */
|
||||
#define MSG_MCAST 0x200 /* this message rec'd as multicast */
|
||||
/* not defind in OpenBeOS */
|
||||
#define MSG_EOF 0x400 /* data completes connection */
|
||||
|
||||
|
||||
struct cmsghdr {
|
||||
uint cmsg_len;
|
||||
int cmsg_level;
|
||||
int cmsg_type;
|
||||
/* there now follows uchar[] cmsg_data */
|
||||
};
|
||||
|
||||
|
||||
#define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */
|
||||
#define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */
|
||||
#define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */
|
||||
#define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */
|
||||
#define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */
|
||||
|
||||
#define SIOCADDRT _IOW('r', 10, struct ortentry) /* add route */
|
||||
#define SIOCDELRT _IOW('r', 11, struct ortentry) /* delete route */
|
||||
|
||||
#define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */
|
||||
#define OSIOCGIFADDR _IOWR('i', 13, struct ifreq) /* get ifnet address */
|
||||
#define SIOCGIFADDR _IOWR('i', 33, struct ifreq) /* get ifnet address */
|
||||
#define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */
|
||||
#define OSIOCGIFDSTADDR _IOWR('i', 15, struct ifreq) /* get p-p address */
|
||||
#define SIOCGIFDSTADDR _IOWR('i', 34, struct ifreq) /* get p-p address */
|
||||
#define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */
|
||||
#define SIOCGIFFLAGS _IOWR('i', 17, struct ifreq) /* get ifnet flags */
|
||||
#define OSIOCGIFBRDADDR _IOWR('i', 18, struct ifreq) /* get broadcast addr */
|
||||
#define SIOCGIFBRDADDR _IOWR('i', 35, struct ifreq) /* get broadcast addr */
|
||||
#define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */
|
||||
#define OSIOCGIFCONF _IOWR('i', 20, struct ifconf) /* get ifnet list */
|
||||
#define SIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */
|
||||
#define OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq) /* get net addr mask */
|
||||
#define SIOCGIFNETMASK _IOWR('i', 37, struct ifreq) /* get net addr mask */
|
||||
#define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */
|
||||
#define SIOCGIFMETRIC _IOWR('i', 23, struct ifreq) /* get IF metric */
|
||||
#define SIOCSIFMETRIC _IOW('i', 24, struct ifreq) /* set IF metric */
|
||||
#define SIOCDIFADDR _IOW('i', 25, struct ifreq) /* delete IF addr */
|
||||
#define SIOCAIFADDR _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */
|
||||
#define SIOCGIFDATA _IOWR('i', 27, struct ifreq) /* get if_data */
|
||||
|
||||
#define SIOCGIFMTU _IOWR('i', 126, struct ifreq) /* get ifnet MTU */
|
||||
#define SIOCSIFMTU _IOW('i', 127, struct ifreq) /* set ifnet MTU */
|
||||
|
||||
#define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */
|
||||
#define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */
|
||||
|
||||
|
||||
#ifndef _KERNEL_MODE
|
||||
/* Function declarations */
|
||||
int socket (int, int, int);
|
||||
int socketpair(int domain, int type, int protocol, int socket_vector[2]);
|
||||
int bind(int, const struct sockaddr *, int);
|
||||
int connect(int, const struct sockaddr *, int);
|
||||
int listen(int, int);
|
||||
int accept(int, struct sockaddr *, int *);
|
||||
int closesocket(int);
|
||||
int shutdown(int sock, int how);
|
||||
|
||||
ssize_t send(int, const void *, size_t, int);
|
||||
ssize_t recv(int, void *, size_t, int);
|
||||
ssize_t sendto(int, const void *, size_t, int, const struct sockaddr *, int);
|
||||
ssize_t recvfrom(int, void *, size_t, int, struct sockaddr *, int *);
|
||||
|
||||
int setsockopt(int, int, int, const void *, int);
|
||||
int getsockopt(int, int, int, void *, int *);
|
||||
int getpeername(int, struct sockaddr *, int *);
|
||||
int getsockname(int, struct sockaddr *, int *);
|
||||
#endif /* _KERNEL_MODE */
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _SYS_SOCKET_H */
|
||||
|
Loading…
Reference in New Issue
Block a user