Preparing for libnetwork.so.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15502 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,278 @@
|
||||
/* 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 */
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* 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 */
|
||||
@@ -0,0 +1,38 @@
|
||||
/* 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 */
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
/* $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_ */
|
||||
@@ -0,0 +1,23 @@
|
||||
/* 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 */
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
* 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_ */
|
||||
@@ -0,0 +1,17 @@
|
||||
/* 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 */
|
||||
@@ -0,0 +1,208 @@
|
||||
/* 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 */
|
||||
Reference in New Issue
Block a user