original files of m241
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
/* domain.h - communication domain structure and prototypes */
|
||||
|
||||
/* Copyright 2001-2005 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* @(#)domain.h 8.1 (Berkeley) 6/2/93
|
||||
* $FreeBSD: src/sys/sys/domain.h,v 1.14 1999/12/29 04:24:40 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01j,09sep06,kch Cleanup for IPNet integration.
|
||||
01i,07feb05,vvv _KERNEL cleanup
|
||||
01h,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
01g,04nov03,rlm Ran batch header path update for header re-org.
|
||||
01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
01e,06aug03,nee Accordion Base6 merge from ACCORDION_BASE6_MERGE_BASELINE
|
||||
label
|
||||
01d,03jan03,ann added the prototype for addDomain
|
||||
01d,02dec02,spm merged from WINDNET_IPV6-1_0-FCS label (ver 01c,06sep02,hsh)
|
||||
01c,26aug02,kal virtualised and moved to addDomain()
|
||||
01b,03feb02,ham included cdefs.h for tornado build.
|
||||
01a,15aug01,ann ported to clarinet from freeBSD 4.3 ver 1.14
|
||||
*/
|
||||
|
||||
#ifndef _SYS_DOMAIN_H_
|
||||
#define _SYS_DOMAIN_H_
|
||||
|
||||
#ifdef _WRS_KERNEL
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Structure per communications domain.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Forward structure declarations for function prototypes [sic].
|
||||
*/
|
||||
struct mbuf;
|
||||
|
||||
struct domain {
|
||||
int dom_family; /* AF_xxx */
|
||||
char *dom_name;
|
||||
void (*dom_init) /* initialize domain data structures */
|
||||
__P((void));
|
||||
int (*dom_externalize) /* externalize access rights */
|
||||
__P((struct mbuf *));
|
||||
void (*dom_dispose) /* dispose of internalized rights */
|
||||
__P((struct mbuf *));
|
||||
struct protosw *dom_protosw, *dom_protoswNPROTOSW;
|
||||
struct domain *dom_next;
|
||||
int (*dom_rtattach) /* initialize routing table */
|
||||
__P((void **, int));
|
||||
int dom_rtoffset; /* an arg to rtattach, in bits */
|
||||
int dom_maxrtkey; /* for routing layer */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _WRS_KERNEL */
|
||||
#endif /* _SYS_DOMAIN_H_ */
|
||||
@@ -0,0 +1,129 @@
|
||||
/* ethernet.h - ethernet header file */
|
||||
|
||||
/* Copyright 2001-2005, 2017 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
* Fundamental constants relating to ethernet.
|
||||
*
|
||||
* $FreeBSD: src/sys/net/ethernet.h,v 1.12.2.5 2000/07/19 21:43:52 archie Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01n,02feb16,h_l Add PTP ethertype definition
|
||||
01m,09jan12,h_x Move extern "C" after last header file include.
|
||||
01l,12sep06,kch Removed reference to struct ifnet.
|
||||
01k,09sep06,kch Cleanup for IPNet integration.
|
||||
01j,07feb05,vvv _KERNEL cleanup
|
||||
01i,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
01h,05nov03,cdw Removal of unnecessary _KERNEL guards.
|
||||
01g,04nov03,rlm Ran batch header path update for header re-org.
|
||||
01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
01e,20aug03,niq Include cdefs.h for __BEGIN_DECLS definition (to correct
|
||||
compilation issues
|
||||
01d,10jun03,vvv include netVersion.h
|
||||
01c,09sep02,hsh add c++ protection
|
||||
01b,12sep01,ann adding a definition for ETHERSMALL
|
||||
01a,07aug01,ham created from FreeBSD4.3-RELEASE(July-17-01).
|
||||
*/
|
||||
|
||||
#ifndef _NET_ETHERNET_H_
|
||||
#define _NET_ETHERNET_H_
|
||||
|
||||
#ifdef _WRS_KERNEL
|
||||
|
||||
#include <netVersion.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The number of bytes in an ethernet (MAC) address.
|
||||
*/
|
||||
#define ETHER_ADDR_LEN 6
|
||||
|
||||
/*
|
||||
* The number of bytes in the type field.
|
||||
*/
|
||||
#define ETHER_TYPE_LEN 2
|
||||
|
||||
/*
|
||||
* The number of bytes in the trailing CRC field.
|
||||
*/
|
||||
#define ETHER_CRC_LEN 4
|
||||
|
||||
/*
|
||||
* The length of the combined header.
|
||||
*/
|
||||
#define ETHER_HDR_LEN (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN)
|
||||
|
||||
/*
|
||||
* The minimum packet length.
|
||||
*/
|
||||
#define ETHER_MIN_LEN 64
|
||||
|
||||
/*
|
||||
* The maximum packet length.
|
||||
*/
|
||||
#define ETHER_MAX_LEN 1518
|
||||
|
||||
/*
|
||||
* A macro to validate a length with
|
||||
*/
|
||||
#define ETHER_IS_VALID_LEN(foo) \
|
||||
((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
|
||||
|
||||
/*
|
||||
* Structure of a 10Mb/s Ethernet header.
|
||||
*/
|
||||
struct ether_header {
|
||||
u_char ether_dhost[ETHER_ADDR_LEN];
|
||||
u_char ether_shost[ETHER_ADDR_LEN];
|
||||
u_short ether_type;
|
||||
};
|
||||
|
||||
/*
|
||||
* Structure of a 48-bit Ethernet address.
|
||||
*/
|
||||
struct ether_addr {
|
||||
u_char octet[ETHER_ADDR_LEN];
|
||||
};
|
||||
|
||||
#define ETHERTYPE_PUP 0x0200 /* PUP protocol */
|
||||
#define ETHERTYPE_IP 0x0800 /* IP protocol */
|
||||
#define ETHERTYPE_ARP 0x0806 /* Addr. resolution protocol */
|
||||
#define ETHERTYPE_REVARP 0x8035 /* reverse Addr. resolution protocol */
|
||||
#define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tagging */
|
||||
#define ETHERTYPE_IPV6 0x86dd /* IPv6 */
|
||||
#define ETHERTYPE_PTP 0x88f7 /* PTP */
|
||||
#define ETHERTYPE_LOOPBACK 0x9000 /* used to test interfaces */
|
||||
/* XXX - add more useful types here */
|
||||
|
||||
/*
|
||||
* The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
|
||||
* (type-ETHERTYPE_TRAIL)*512 bytes of data followed
|
||||
* by an ETHER type (as given above) and then the (variable-length) header.
|
||||
*/
|
||||
#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */
|
||||
#define ETHERTYPE_NTRAILER 16
|
||||
|
||||
#define ETHERMTU (ETHER_MAX_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN)
|
||||
#define ETHERMIN (ETHER_MIN_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN)
|
||||
|
||||
/* Clarinet */
|
||||
#define ETHERSMALL 60
|
||||
|
||||
/*
|
||||
* For device drivers to specify whether they support BPF or not
|
||||
*/
|
||||
#define ETHER_BPF_UNSUPPORTED 0
|
||||
#define ETHER_BPF_SUPPORTED 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _WRS_KERNEL */
|
||||
#endif /* !_NET_ETHERNET_H_ */
|
||||
@@ -0,0 +1,346 @@
|
||||
/* if.h - network interface header file */
|
||||
|
||||
/* Copyright 2001 - 2007 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)if.h 8.1 (Berkeley) 6/10/93
|
||||
* $FreeBSD: src/sys/net/if.h,v 1.58.2.9 2002/08/30 14:23:38 sobomax Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
02q,12jan12,h_x Move extern "C" after last header file include.
|
||||
02p,20dec07,dlk Add IFF_END_MODIFIABLE mask.
|
||||
02o,04dec06,kch Changed ifru_flags in ifreq to u_short.
|
||||
02n,25oct06,kch Comment out ifi_hwassist in if_data structure for now.
|
||||
02m,03oct06,kch Removed unsupported IFF flags for IPNet integration. Also
|
||||
changed the type for index associated with an ifp from
|
||||
u_short to u_long.
|
||||
02l,26sep06,kch Added ifru_ifindex, ifru_vr and ifru_opt members to ifreq
|
||||
structure. Changed ifru_flags from long to u_short.
|
||||
02k,12sep06,kch Restore if_nameindex structure definition and prototypes
|
||||
for if_nametoindex(), if_indextoname(), if_nameindex()
|
||||
and if_freenameindex().
|
||||
02j,09sep06,kch Cleanup for IPNet integration.
|
||||
02i,30aug05,kch Added ifdeladdrreq structure (moved from if.c) (SPR #112068).
|
||||
02h,17aug05,mcm Including sys/time.h for struct timeval
|
||||
02g,26jul05,kch Move if_clone structure definition to if_clone.h.
|
||||
02f,30jun05,wap Move ifi_link_state for binary compatibility
|
||||
02e,24jun05,wap Add link state support
|
||||
02d,18feb05,wap Allow sysctl init routines to be scaled out
|
||||
02c,07feb05,vvv _KERNEL cleanup
|
||||
02b,14jan05,vvv osdep.h cleanup
|
||||
02a,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE
|
||||
01z,19jul04,niq Move sysctl initialization from configelette to the component
|
||||
init routine
|
||||
01y,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver
|
||||
/main/vdt/base6_itn5_networking-int/2)
|
||||
01x,09feb04,niq Include if_var.h only in kernel context
|
||||
01w,14dec03,ijm added IFF_PROXY_ALL for spr#85896,for interface based proxy
|
||||
01v,20nov03,niq osdep.h cleanup
|
||||
01u,04nov03,rlm Ran batch header path update for header re-org.
|
||||
01t,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
01s,24oct03,rlm updated #includes for header re-org
|
||||
01r,15sep03,vvv updated path for new headers
|
||||
01q,18aug03,nee Merging from ACCORDION_BASE6_MERGE_BASELINE
|
||||
01p,15may03,spm Tornado 2.2 FCS merge (SPR #69683; ver 01m,10oct01,rae:
|
||||
TOR2_2-FCS-COPY label, tor2 branch, /wind/river VOB)
|
||||
01o,09may03,vvv included socket.h
|
||||
01n,08may03,vvv fixed value for IFF_PPROMISC (SPR #88237)
|
||||
01m,01may03,spm Tornado 2.2 CP1 merge (from ver 01n,17jan03,vvv:
|
||||
TOR2_2-CP1-F label, tor2_2-patch branch, /wind/river VOB)
|
||||
01l,01feb03,pas merge from FreeBSD 4.7 - clone, announce interfaces
|
||||
01k,17sep02,nee added admin control macros
|
||||
01j,09sep02,hsh add c++ protection
|
||||
01i,24aug02,nee extended ifnet for admin control;defined admin states for
|
||||
boot/up/down
|
||||
01h,12jul02,hsh fix head file for ppc
|
||||
01g,03feb02,ham modified for tornado build.
|
||||
01f,16dec01,ann temporarily moving the if_name* declerations out the _KERNEL
|
||||
condition
|
||||
01e,24sep01,ppp adding the prototype for if_name and the macro for IFAREF
|
||||
01d,12sep01,ann adding some IFF flags
|
||||
01c,11sep01,ann uncomment ifi_lastchange
|
||||
01b,09sep01,ham changed header file's path, made ifi_lastchange obsolete.
|
||||
01a,16jul01,ham created from FreeBSD4.3-RELEASE(July-17-01).
|
||||
*/
|
||||
|
||||
#ifndef __INCifh
|
||||
#define __INCifh
|
||||
|
||||
#ifdef _WRS_KERNEL
|
||||
#include <sys/queue.h>
|
||||
#include <sys/times.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <cfgDefs.h>
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Length of interface external name, including terminating '\0'.
|
||||
* Note: this is the same size as a generic device's external name.
|
||||
*/
|
||||
#define IFNAMSIZ 16
|
||||
#define IF_NAMESIZE IFNAMSIZ
|
||||
|
||||
/*
|
||||
* Structure describing information about an interface
|
||||
* which may be of interest to management entities.
|
||||
*/
|
||||
struct if_data {
|
||||
/* generic interface information */
|
||||
u_char ifi_type; /* ethernet, tokenring, etc */
|
||||
u_char ifi_addrlen; /* media address length */
|
||||
u_char ifi_hdrlen; /* media header length */
|
||||
u_char ifi_link_state; /* current link state */
|
||||
u_long ifi_mtu; /* maximum transmission unit */
|
||||
u_long ifi_metric; /* routing metric (external only) */
|
||||
u_long ifi_baudrate; /* linespeed */
|
||||
/* volatile statistics */
|
||||
u_long ifi_ipackets; /* packets received on interface */
|
||||
u_long ifi_ierrors; /* input errors on interface */
|
||||
u_long ifi_opackets; /* packets sent on interface */
|
||||
u_long ifi_oerrors; /* output errors on interface */
|
||||
u_long ifi_collisions; /* collisions on csma interfaces */
|
||||
u_long ifi_ibytes; /* total number of octets received */
|
||||
u_long ifi_obytes; /* total number of octets sent */
|
||||
u_long ifi_imcasts; /* packets received via multicast */
|
||||
u_long ifi_omcasts; /* packets sent via multicast */
|
||||
u_long ifi_iqdrops; /* dropped on input, this interface */
|
||||
u_long ifi_noproto; /* destined for unsupported protocol */
|
||||
#if 0
|
||||
u_long ifi_hwassist; /* HW offload capabilities */
|
||||
#endif
|
||||
struct timeval ifi_lastchange; /* time of last administrative change */
|
||||
};
|
||||
|
||||
#define IFF_UP 0x1 /* interface link is up */
|
||||
#define IFF_BROADCAST 0x2 /* broadcast address valid */
|
||||
#define IFF_DEBUG 0x4 /* turn on debugging */
|
||||
#define IFF_LOOPBACK 0x8 /* is a loopback net */
|
||||
#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */
|
||||
#define IFF_RUNNING 0x40 /* resources allocated */
|
||||
#define IFF_NOARP 0x80 /* no address resolution protocol */
|
||||
#define IFF_PROMISC 0x100 /* receive all packets */
|
||||
#define IFF_ALLMULTI 0x200 /* receive all multicast packets */
|
||||
#define IFF_OACTIVE 0x400 /* transmission in progress */
|
||||
#define IFF_SIMPLEX 0x800 /* can't hear own transmissions */
|
||||
#define IFF_LINK0 0x1000 /* forwarding disabled */
|
||||
#define IFF_LINK1 0x2000 /* per link layer defined bit */
|
||||
#define IFF_LINK2 0x4000 /* per link layer defined bit */
|
||||
#define IFF_ALTPHYS IFF_LINK2 /* use alternate physical connection */
|
||||
#define IFF_MULTICAST 0x8000 /* supports multicast */
|
||||
#define IFF_NOTRAILERS 0x20000 /* avoid use of trailers */
|
||||
|
||||
/*
|
||||
* These bits are modifiable for END devices via EIOCSFLAGS.
|
||||
* For now, we allow modifying some unallocated bits and the IFF_LINK* bits.
|
||||
* IFF_UP is explicitly NOT modifiable; to start or stop an interface
|
||||
* at the END level, one must use muxDevStart()/muxDevStop(). The END driver
|
||||
* controls its own IFF_UP flag in pEnd->flags.
|
||||
*/
|
||||
#define IFF_END_MODIFIABLE \
|
||||
(IFF_DEBUG | IFF_PROMISC | IFF_ALLMULTI | \
|
||||
IFF_LINK0 | IFF_LINK1 | IFF_LINK2 | \
|
||||
0xfffd0000)
|
||||
|
||||
/*
|
||||
* Values for if_link_state.
|
||||
*/
|
||||
#define LINK_STATE_UNKNOWN 0 /* link invalid/unknown */
|
||||
#define LINK_STATE_DOWN 1 /* link is down */
|
||||
#define LINK_STATE_UP 2 /* link is up */
|
||||
|
||||
/* Capabilities that interfaces can advertise. */
|
||||
#define IFCAP_RXCSUM 0x0001 /* can offload checksum on RX */
|
||||
#define IFCAP_TXCSUM 0x0002 /* can offload checksum on TX */
|
||||
#define IFCAP_NETCONS 0x0004 /* can be a network console */
|
||||
|
||||
#define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM)
|
||||
|
||||
|
||||
/*
|
||||
* Message format for use in obtaining information about interfaces
|
||||
* from getkerninfo 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_long 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 getkerninfo 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_long ifam_index; /* index for associated ifp */
|
||||
int ifam_metric; /* value of ifa_metric */
|
||||
};
|
||||
|
||||
/*
|
||||
* Message format announcing the arrival or departure of a network interface.
|
||||
*/
|
||||
struct if_announcemsghdr {
|
||||
u_short ifan_msglen; /* to skip over non-understood messages */
|
||||
u_char ifan_version; /* future binary compatibility */
|
||||
u_char ifan_type; /* message type */
|
||||
u_long ifan_index; /* index for associated ifp */
|
||||
char ifan_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
||||
u_short ifan_what; /* what type of announcement */
|
||||
};
|
||||
|
||||
#define IFAN_ARRIVAL 0 /* interface arrival */
|
||||
#define IFAN_DEPARTURE 1 /* interface departure */
|
||||
|
||||
/*
|
||||
* Interface request structure used for socket
|
||||
* ioctl's. All interface ioctl's must have parameter
|
||||
* definitions which begin with ifr_name. The
|
||||
* remainder may be interface specific.
|
||||
*/
|
||||
struct sockaddr;
|
||||
|
||||
struct ifreq {
|
||||
char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
||||
union {
|
||||
struct sockaddr ifru_addr;
|
||||
struct sockaddr ifru_dstaddr;
|
||||
struct sockaddr ifru_broadaddr;
|
||||
u_short ifru_flags;
|
||||
int ifru_metric;
|
||||
int ifru_mtu;
|
||||
int ifru_ivalue;
|
||||
int ifru_ifindex;
|
||||
int ifru_phys;
|
||||
int ifru_media;
|
||||
void * ifru_data; /* interface dependent data */
|
||||
u_short ifru_vr; /* virtual router */
|
||||
int ifru_opt; /* option: enable=1, disable=0 */
|
||||
int ifru_cap[2];
|
||||
char ifru_newname[IFNAMSIZ]; /* if name, e.g. "eth0" */
|
||||
char ifru_slave[IFNAMSIZ]; /* if name, e.g. "eth0" */
|
||||
|
||||
} ifr_ifru;
|
||||
#define ifr_addr ifr_ifru.ifru_addr /* address */
|
||||
#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
|
||||
#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
|
||||
#define ifr_flags ifr_ifru.ifru_flags /* flags */
|
||||
#define ifr_metric ifr_ifru.ifru_metric /* metric */
|
||||
#define ifr_ifindex ifr_ifru.ifru_ifindex /* Interface index */
|
||||
#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
|
||||
#define ifr_phys ifr_ifru.ifru_phys /* physical wire */
|
||||
#define ifr_media ifr_ifru.ifru_media /* physical media */
|
||||
#define ifr_data ifr_ifru.ifru_data /* for use by interface */
|
||||
#define ifr_vr ifr_ifru.ifru_vr /* Interpeak virtual router extension*/
|
||||
#define ifr_opt fr_ifru.ifru_opt /* Interpeak option extension */
|
||||
#define ifr_reqcap ifr_ifru.ifru_cap[0] /* requested capabilities */
|
||||
#define ifr_curcap ifr_ifru.ifru_cap[1] /* current capabilities */
|
||||
};
|
||||
|
||||
#define _SIZEOF_ADDR_IFREQ(ifr) \
|
||||
((ifr).ifr_addr.sa_len > sizeof(struct sockaddr) ? \
|
||||
(sizeof(struct ifreq) - sizeof(struct sockaddr) + \
|
||||
(ifr).ifr_addr.sa_len) : sizeof(struct ifreq))
|
||||
|
||||
struct ifaliasreq {
|
||||
char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
||||
struct sockaddr ifra_addr;
|
||||
struct sockaddr ifra_broadaddr;
|
||||
struct sockaddr ifra_mask;
|
||||
};
|
||||
|
||||
struct ifmediareq {
|
||||
char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
||||
int ifm_current; /* current media options */
|
||||
int ifm_mask; /* don't care mask */
|
||||
int ifm_status; /* media status */
|
||||
int ifm_active; /* active options */
|
||||
int ifm_count; /* # entries in ifm_ulist array */
|
||||
int *ifm_ulist; /* media words */
|
||||
};
|
||||
|
||||
/*
|
||||
* Structure used in SIOCGIFCONF request.
|
||||
* Used to retrieve interface configuration
|
||||
* for machine (useful for programs which
|
||||
* must know all networks accessible).
|
||||
*/
|
||||
struct ifconf {
|
||||
int ifc_len; /* size of associated buffer */
|
||||
union {
|
||||
caddr_t ifcu_buf;
|
||||
struct ifreq *ifcu_req;
|
||||
} ifc_ifcu;
|
||||
#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
|
||||
#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */
|
||||
};
|
||||
|
||||
struct if_nameindex {
|
||||
u_int if_index; /* 1, 2, ... */
|
||||
char *if_name; /* null terminated name: "le0", ... */
|
||||
};
|
||||
|
||||
u_int if_nametoindex __P((const char *));
|
||||
char *if_indextoname __P((u_int, char *));
|
||||
struct if_nameindex *if_nameindex __P((void));
|
||||
void if_freenameindex __P((struct if_nameindex *));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _WRS_KERNEL
|
||||
#include <net/if_var.h>
|
||||
#endif /* _WRS_KERNEL */
|
||||
|
||||
#endif /* !__INCifh */
|
||||
@@ -0,0 +1,164 @@
|
||||
/* if_arp.h - network interface address resolution protocol header file */
|
||||
|
||||
/* Copyright 2001-2005 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
* 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
|
||||
* $FreeBSD: src/sys/net/if_arp.h,v 1.14.2.3 2002/02/20 23:34:09 fjoe Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01r,20nov06,kch Removed unused arcbroadcastaddr extern declaration.
|
||||
01q,24oct06.kch Changed arp_ha in arpreq strcture from sockaddr to
|
||||
sockaddr_dl. Removed unsupported ATF flags and added
|
||||
ATF_GRAT and ATF_BLACKHOLE.
|
||||
01p,09sep06,kch Cleanup for IPNet integration.
|
||||
01o,07feb05,vvv _KERNEL cleanup
|
||||
01n,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE
|
||||
01m,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
01l,05nov03,cdw Removal of unnecessary _KERNEL guards.
|
||||
01k,04nov03,rlm Ran batch header path update for header re-org.
|
||||
01j,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
01i,27oct03,rlm update include statements post header re-org.
|
||||
01h,06aug03,niq Merging from Accordion label ACCORDION_BASE6_MERGE_BASELINE
|
||||
01g,09may03,vvv included socket.h and if.h
|
||||
01h,07mar03,spm merged from CLARINET-1_1-KAME-UPDATE (ver 01f,01feb03,pas)
|
||||
01g,02dec02,spm merged from WINDNET_IPV6-1_0-FCS label (ver 01e,09sep02,hsh)
|
||||
01f,27aug02,kal inclusion of in.h for struct in_addr (in arpcom)
|
||||
01e,23aug02,vlk added ac_ipaddr item into "arpcom" struct
|
||||
and ATF_INCOMPLETE definition
|
||||
01d,03feb02,ham changes for tornado build.
|
||||
01c,09dec01,ppp adding ATF_PROXY flag
|
||||
01b,20aug01,qli moving the element to protos/arp
|
||||
01a,12aug01,ham created from FreeBSD4.3-RELEASE(July-17-01).
|
||||
*/
|
||||
|
||||
#ifndef _NET_IF_ARP_H_
|
||||
#define _NET_IF_ARP_H_
|
||||
|
||||
/* includes */
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* 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 {
|
||||
u_short ar_hrd; /* format of hardware address */
|
||||
#define ARPHRD_ETHER 1 /* ethernet hardware format */
|
||||
#define ARPHRD_EETHER 2 /* experimental ethernet format */
|
||||
#define ARPHRD_AX25 3 /* AX.25 Level 2 */
|
||||
#define ARPHRD_PRONET 4 /* PROnet token ring */
|
||||
#define ARPHRD_CHAOS 5 /* Chaosnet */
|
||||
#define ARPHRD_IEEE802 6 /* token-ring hardware format */
|
||||
#define ARPHRD_ARCNET 7 /* arcnet hardware format */
|
||||
#define ARPHRD_HYPERCH 8 /* Hyper channel */
|
||||
#define ARPHRD_LANSTAR 9 /* LanStar */
|
||||
#define ARPHRD_ULTRALINK 13 /* UltraLink */
|
||||
#define ARPHRD_FRELAY 15 /* frame relay hardware format */
|
||||
#define ARPHRD_DLCI ARPHRD_FRELAY
|
||||
#define ARPHRD_ATM 19 /* ATM */
|
||||
#define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id) */
|
||||
#define ARPHRD_IEEE1394 24 /* IEEE 1394 IPv4 - RFC 2734 */
|
||||
#define ARPHRD_EUI64 27 /* EUI-64 */
|
||||
u_short ar_pro; /* format of protocol address */
|
||||
u_char ar_hln; /* length of hardware address */
|
||||
u_char ar_pln; /* length of protocol address */
|
||||
u_short ar_op; /* one of: */
|
||||
#define ARPOP_REQUEST 1 /* request to resolve address */
|
||||
#define ARPOP_REPLY 2 /* response to previous request */
|
||||
#define ARPOP_REVREQUEST 3 /* request protocol address given hardware */
|
||||
#define ARPOP_REVREPLY 4 /* response giving protocol address */
|
||||
#define ARPOP_INVREQUEST 8 /* request to identify peer */
|
||||
#define ARPOP_INVREPLY 9 /* response identifying peer */
|
||||
/*
|
||||
* The remaining fields are variable in size,
|
||||
* according to the sizes above.
|
||||
*/
|
||||
#ifdef COMMENT_ONLY
|
||||
u_char ar_sha[]; /* sender hardware address */
|
||||
u_char ar_spa[]; /* sender protocol address */
|
||||
u_char ar_tha[]; /* target hardware address */
|
||||
u_char ar_tpa[]; /* target protocol address */
|
||||
#endif
|
||||
};
|
||||
|
||||
#define ar_sha(ap) (((caddr_t)((ap)+1)) + 0)
|
||||
#define ar_spa(ap) (((caddr_t)((ap)+1)) + (ap)->ar_hln)
|
||||
#define ar_tha(ap) (((caddr_t)((ap)+1)) + (ap)->ar_hln + (ap)->ar_pln)
|
||||
#define ar_tpa(ap) (((caddr_t)((ap)+1)) + 2*(ap)->ar_hln + (ap)->ar_pln)
|
||||
|
||||
#define arphdr_len2(ar_hln, ar_pln) \
|
||||
(sizeof(struct arphdr) + 2*(ar_hln) + 2*(ar_pln))
|
||||
#define arphdr_len(ap) (arphdr_len2((ap)->ar_hln, (ap)->ar_pln))
|
||||
|
||||
/*
|
||||
* ARP ioctl request
|
||||
*/
|
||||
struct arpreq {
|
||||
struct sockaddr arp_pa; /* protocol address */
|
||||
struct sockaddr_dl arp_ha; /* hardware address */
|
||||
int arp_flags; /* flags */
|
||||
};
|
||||
/* arp_flags and at_flags field values */
|
||||
#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_GRAT 0x100 /* send gratuitous ARP request */
|
||||
#define ATF_BLACKHOLE 0x200 /* set blackhole flag on entry */
|
||||
|
||||
extern u_char etherbroadcastaddr[6];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_NET_IF_ARP_H_ */
|
||||
@@ -0,0 +1,106 @@
|
||||
/* if_dl.h - data link level structure header file */
|
||||
|
||||
/* Copyright 2001-2005 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)if_dl.h 8.1 (Berkeley) 6/10/93
|
||||
* $FreeBSD: src/sys/net/if_dl.h,v 1.10 2000/03/01 02:46:25 archie Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01k,09jan12,h_x Move extern "C" after last header file include.
|
||||
01j,02oct06,kch Removed the unsupported source routing members from the
|
||||
sockaddr_dl structure.
|
||||
01i,28sep06,kch Removed unsupported prototypes.
|
||||
01h,07feb05,vvv _KERNEL cleanup
|
||||
01g,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
01f,05nov03,cdw Removal of unnecessary _KERNEL guards.
|
||||
01e,04nov03,rlm Ran batch header path update for header re-org.
|
||||
01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
01c,10jun03,vvv include netVersion.h
|
||||
01b,09sep02,hsh add c++ protection
|
||||
01a,12jul01,ham created from FreeBSD4.3-RELEASE(July-17-01).
|
||||
*/
|
||||
|
||||
#ifndef _NET_IF_DL_H_
|
||||
#define _NET_IF_DL_H_
|
||||
|
||||
#include <netVersion.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* A Link-Level Sockaddr may specify the interface in one of two
|
||||
* ways: either by means of a system-provided index number (computed
|
||||
* anew and possibly differently on every reboot), or by a human-readable
|
||||
* string such as "il0" (for managerial convenience).
|
||||
*
|
||||
* Census taking actions, such as something akin to SIOCGCONF would return
|
||||
* both the index and the human name.
|
||||
*
|
||||
* High volume transactions (such as giving a link-level ``from'' address
|
||||
* in a recvfrom or recvmsg call) may be likely only to provide the indexed
|
||||
* form, (which requires fewer copy operations and less space).
|
||||
*
|
||||
* The form and interpretation of the link-level address is purely a matter
|
||||
* of convention between the device driver and its consumers; however, it is
|
||||
* expected that all drivers for an interface of a given if_type will agree.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Structure of a Link-Level sockaddr:
|
||||
*/
|
||||
struct sockaddr_dl {
|
||||
u_char sdl_len; /* Total length of sockaddr */
|
||||
u_char sdl_family; /* AF_LINK */
|
||||
u_short sdl_index; /* if != 0, system given index for interface */
|
||||
u_char sdl_type; /* interface type */
|
||||
u_char sdl_nlen; /* interface name length, no trailing 0 reqd. */
|
||||
u_char sdl_alen; /* link level address length */
|
||||
u_char sdl_slen; /* link layer selector length */
|
||||
char sdl_data[12]; /* minimum work area, can be larger;
|
||||
contains both if name and ll address */
|
||||
};
|
||||
|
||||
#define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,124 @@
|
||||
/* if_ll.h - layer 2 link level structure header file */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute or otherwise make use of this software
|
||||
* may be licensed only pursuant to the terms of an applicable Wind River
|
||||
* license agreement. No license to Wind River intellectual property rights
|
||||
* is granted herein. All rights not licensed by Wind River are reserved
|
||||
* by Wind River.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01a,30nov06,kch Created.
|
||||
*/
|
||||
|
||||
#ifndef _NET_IF_LL_H_
|
||||
#define _NET_IF_LL_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Frame Values
|
||||
* Used for 3rd argument to when creating packet sockets.
|
||||
*/
|
||||
#define NET_ETH_P_ALL 0
|
||||
#define NET_ETH_P_IP 0x0800
|
||||
#define NET_ETH_P_ARP 0x0806
|
||||
#define NET_ETH_P_RARP 0x8035
|
||||
#define NET_ETH_P_IPV6 0x86DD
|
||||
#define NET_ETH_P_PPPOE_DIS 0x8863
|
||||
#define NET_ETH_P_PPPOE_SES 0x8864
|
||||
#define NET_ETH_P_8021Q_VLAN 0x8100
|
||||
#define NET_ETH_P_MPLS_UNICAST 0x8847
|
||||
#define NET_ETH_P_MPLS_MULTICAST 0x8848
|
||||
|
||||
/* Packet types 'sll_pkttype'. Packet is addressed to: */
|
||||
#define PACKET_HOST 1 /* this host */
|
||||
#define PACKET_BROADCAST 2 /* all hosts on this link */
|
||||
#define PACKET_MULTICAST 3 /* a multicast group this host is a member of */
|
||||
#define PACKET_OTHERHOST 4 /* someone else */
|
||||
#define PACKET_OUTGOING 5 /* Packet was sent and read back */
|
||||
|
||||
|
||||
/*
|
||||
* The link level sockaddr is a device independent physical layer address.
|
||||
* It is used for packet socket to receive or send raw packets at the
|
||||
* Layer 2.
|
||||
*
|
||||
* When using the packet socket, the socket type is either SOCK_RAW for
|
||||
* raw packets including the link level header or SOCK_DGRAM for cooked
|
||||
* packets with the link level header removed. The link level header
|
||||
* information is available in a common format in an sockaddr_ll. Allowed
|
||||
* values for Ethernet are any of the NET_ETH_P_xxx constants in network
|
||||
*
|
||||
* When protocol is set to htons(NET_ETH_P_ALL), then all protocols are
|
||||
* received. All incoming packets of that protocol type will be passed to
|
||||
* the packet socket before they are passed to the protocols implemented in
|
||||
* SOCK_RAW packets are passed to and from the device driver without any
|
||||
* changes in the packet data. When receiving a packet, the address is still
|
||||
* parsed and passed in a standard sockaddr_ll address structure. When
|
||||
* transmitting a packet, the user-supplied buffer must contain the physical
|
||||
* layer header. That packet is then queued, unmodified, to the network
|
||||
* driver of the interface defined by the destination address.
|
||||
*
|
||||
* SOCK_DGRAM operates on a slightly higher level. The physical header is
|
||||
* removed before the packet is passed to the user. Packets sent through a
|
||||
* SOCK_DGRAM packet socket get a suitable physical layer header based on
|
||||
* the information in the sockaddr_ll destination address before they are
|
||||
* queued.
|
||||
*
|
||||
* When sending packets using a packet socket, it is enough to specify
|
||||
* sll_family, sll_addr, sll_halen and sll_ifindex. All other fields
|
||||
* should be set to 0. The sll_hatype and sll_pkttype are set on
|
||||
* received packets.
|
||||
*
|
||||
* The connect() operation is not supported on packet sockets.
|
||||
*/
|
||||
|
||||
struct sockaddr_ll
|
||||
{
|
||||
u_int8_t sll_len; /* Length of this structure */
|
||||
u_int8_t sll_family; /* Always AF_PACKET */
|
||||
|
||||
/*
|
||||
* Link layer protocol (frame type) in network order, not used when
|
||||
* sending frames on an SOCK_RAW type socket
|
||||
*/
|
||||
u_int16_t sll_protocol;
|
||||
u_int32_t sll_ifindex; /* Interface index, must not be zero */
|
||||
|
||||
/* Link layer type (IFT_xxx), only used for received frames */
|
||||
u_int16_t sll_hatype;
|
||||
|
||||
/*
|
||||
* Packet type (PACKET_xxx), only used for received frames. Valid
|
||||
* types are:
|
||||
* PACKET_HOST - for packets addressed to the local host
|
||||
* PACKET_BROADCAST - for physical layer broadcast packets to all
|
||||
* hosts on this link
|
||||
* PACKET_MULTICAST - for packets sent to a physical layer multicast
|
||||
* address
|
||||
* PACKET_OTHERHOST - for packets send to some other host that has
|
||||
* been caught by a device driver in promiscuous
|
||||
* mode
|
||||
* PACKET_OUTGOING - for packets originated from local host that
|
||||
* is looped back to a packet socket.
|
||||
*/
|
||||
u_int8_t sll_pkttype;
|
||||
|
||||
u_int8_t sll_halen; /* Length of link layer address */
|
||||
u_int8_t sll_addr[8]; /* Link layer address */
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _NET_IF_LL_H_ */
|
||||
@@ -0,0 +1,173 @@
|
||||
/* if.h - network interface header file */
|
||||
|
||||
/* Copyright 2001-2004 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)if_llc.h 8.1 (Berkeley) 6/10/93
|
||||
* $FreeBSD: src/sys/net/if_llc.h,v 1.7 1999/08/28 00:48:18 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01i,09jan12,h_x Move extern "C" after last header file include.
|
||||
01h,10nov04,syy Fix SPR#103861
|
||||
01g,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
01f,05nov03,cdw Removal of unnecessary _KERNEL guards.
|
||||
01e,04nov03,rlm Ran batch header path update for header re-org.
|
||||
01d,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
01c,10jun03,vvv include netVersion.h
|
||||
01b,09sep02,hsh add c++ protection
|
||||
01a,10aug01,ham created from FreeBSD4.3-RELEASE(July-17-01).
|
||||
*/
|
||||
|
||||
#ifndef _NET_IF_LLC_H_
|
||||
#define _NET_IF_LLC_H_
|
||||
|
||||
#include <netVersion.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* IEEE 802.2 Link Level Control headers, for use in conjunction with
|
||||
* 802.{3,4,5} media access control methods.
|
||||
*
|
||||
* Headers here do not use bit fields due to shortcomings in many
|
||||
* compilers.
|
||||
*/
|
||||
|
||||
struct llc {
|
||||
u_char llc_dsap;
|
||||
u_char llc_ssap;
|
||||
union {
|
||||
struct {
|
||||
u_char control;
|
||||
u_char format_id;
|
||||
u_char llc_class;
|
||||
u_char window_x2;
|
||||
} type_u;
|
||||
struct {
|
||||
u_char num_snd_x2;
|
||||
u_char num_rcv_x2;
|
||||
} type_i;
|
||||
struct {
|
||||
u_char control;
|
||||
u_char num_rcv_x2;
|
||||
} type_s;
|
||||
struct {
|
||||
u_char control;
|
||||
struct frmrinfo {
|
||||
u_char rej_pdu_0;
|
||||
u_char rej_pdu_1;
|
||||
u_char frmr_control;
|
||||
u_char frmr_control_ext;
|
||||
u_char frmr_cause;
|
||||
} frmrinfo;
|
||||
} type_frmr;
|
||||
struct {
|
||||
u_char control;
|
||||
u_char org_code[3];
|
||||
u_short ether_type;
|
||||
} type_snap;
|
||||
struct {
|
||||
u_char control;
|
||||
u_char control_ext;
|
||||
} type_raw;
|
||||
} llc_un;
|
||||
};
|
||||
#define llc_control llc_un.type_u.control
|
||||
#define llc_control_ext llc_un.type_raw.control_ext
|
||||
#define llc_fid llc_un.type_u.format_id
|
||||
#define llc_class llc_un.type_u.llc_class
|
||||
#define llc_window llc_un.type_u.window_x2
|
||||
#define llc_frmrinfo llc_un.type_frmr.frmrinfo
|
||||
#define llc_frmr_pdu0 llc_un.type_frmr.frmrinfo.rej_pdu0
|
||||
#define llc_frmr_pdu1 llc_un.type_frmr.frmrinfo.rej_pdu1
|
||||
#define llc_frmr_control llc_un.type_frmr.frmrinfo.frmr_control
|
||||
#define llc_frmr_control_ext llc_un.type_frmr.frmrinfo.frmr_control_ext
|
||||
#define llc_frmr_cause llc_un.type_frmr.frmrinfo.frmr_control_ext
|
||||
|
||||
/*
|
||||
* Don't use sizeof(struct llc_un) for LLC header sizes
|
||||
*/
|
||||
#define LLC_ISFRAMELEN 4
|
||||
#define LLC_UFRAMELEN 3
|
||||
#define LLC_FRMRLEN 7
|
||||
|
||||
/*
|
||||
* Unnumbered LLC format commands
|
||||
*/
|
||||
#define LLC_UI 0x3
|
||||
#define LLC_UI_P 0x13
|
||||
#define LLC_DISC 0x43
|
||||
#define LLC_DISC_P 0x53
|
||||
#define LLC_UA 0x63
|
||||
#define LLC_UA_P 0x73
|
||||
#define LLC_TEST 0xe3
|
||||
#define LLC_TEST_P 0xf3
|
||||
#define LLC_FRMR 0x87
|
||||
#define LLC_FRMR_P 0x97
|
||||
#define LLC_DM 0x0f
|
||||
#define LLC_DM_P 0x1f
|
||||
#define LLC_XID 0xaf
|
||||
#define LLC_XID_P 0xbf
|
||||
#define LLC_SABME 0x6f
|
||||
#define LLC_SABME_P 0x7f
|
||||
|
||||
/*
|
||||
* Supervisory LLC commands
|
||||
*/
|
||||
#define LLC_RR 0x01
|
||||
#define LLC_RNR 0x05
|
||||
#define LLC_REJ 0x09
|
||||
|
||||
/*
|
||||
* Info format - dummy only
|
||||
*/
|
||||
#define LLC_INFO 0x00
|
||||
|
||||
/*
|
||||
* ISO PDTR 10178 contains among others
|
||||
*/
|
||||
#define LLC_X25_LSAP 0x7e
|
||||
#define LLC_SNAP_LSAP 0xaa
|
||||
#define LLC_ISO_LSAP 0xfe
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,99 @@
|
||||
/* if_types.h - interface types header file */
|
||||
|
||||
/* Copyright 2001 - 2005 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)if_types.h 8.3 (Berkeley) 4/28/95
|
||||
* $FreeBSD: src/sys/net/if_types.h,v 1.8.2.4 2002/12/23 23:02:21 kbyanc Exp $
|
||||
* $FreeBSD: src/sys/net/if_types.h,v 1.8.2.3 2001/07/03 11:01:41 ume Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01o,09jan12,h_x Move extern "C" after last header file include.
|
||||
01n,20nov06,kch Updated interface types.
|
||||
01m,25oct06,kch Removed unsupported interface types. Also corrected macro
|
||||
mismatched for certain interface types.
|
||||
01l,24may05,kch Comment out IFT_IST define for now.
|
||||
01k,13may05,kch Merged from FreeBSD v 1.8.2.4.
|
||||
01j,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
01i,05nov03,cdw Removal of unnecessary _KERNEL guards.
|
||||
01h,04nov03,rlm Ran batch header path update for header re-org.
|
||||
01g,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
01f,08aug03,nee Merging from label ACCORDION_BASE6_MERGE_BASELINE in
|
||||
accordion codeline to Base6
|
||||
01e,10jun03,vvv include netVersion.h
|
||||
01d,15may03,spm Tornado 2.2 FCS merge (SPR #76443; ver 01d,16may02,vvv:
|
||||
TOR2_2-FCS-COPY label, tor2 branch, /wind/river VOB)
|
||||
01c,09may03,spm T2.2 FCS merge.
|
||||
01b,09sep02,hsh add c++ protection
|
||||
01a,16jul01,ham created from FreeBSD4.3-RELEASE(July-17-01).
|
||||
*/
|
||||
|
||||
#ifndef _NET_IF_TYPES_H_
|
||||
#define _NET_IF_TYPES_H_
|
||||
|
||||
#include <netVersion.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Interface types for benefit of parsing media address headers.
|
||||
* This list is derived from the SNMP list of ifTypes, originally
|
||||
* documented in RFC1573, now maintained as:
|
||||
*
|
||||
* ftp.isi.edu/in-notes/iana/assignments/smi-numbers
|
||||
*/
|
||||
|
||||
#define IFT_OTHER 0x1 /* none of the following */
|
||||
#define IFT_ETHER 0x6 /* Ethernet CSMA/CD */
|
||||
#define IFT_PPP 0x17 /* RFC 1331 */
|
||||
#define IFT_LOOP 0x18 /* loopback */
|
||||
#define IFT_IEEE80211 0x47 /* Radio spread spectrum */
|
||||
|
||||
#define IFT_MPLS_TUNNEL 0x83 /* MPLS tunnel interface */
|
||||
#define IFT_L2VLAN 0x87 /* Layer 2 Virtual LAN using 802.1Q */
|
||||
#define IFT_PPPOE 0xf0 /* PPPoE */
|
||||
#define IFT_TUNNEL 0xf1 /* IP over IP tunnel */
|
||||
#define IFT_SOCKDEV 0xf2 /* Device that has a 1-to-1 mapping to a
|
||||
socket in the IP_AF_SOCKDEV domain */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCif_typesh */
|
||||
@@ -0,0 +1,194 @@
|
||||
/* if_var.h - network interface variable header file */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2006 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* From: @(#)if.h 8.1 (Berkeley) 6/10/93
|
||||
* $FreeBSD: src/sys/net/if_var.h,v 1.98.2.5 2005/10/07 14:00:05 glebius Exp $
|
||||
* $FreeBSD: src/sys/net/if_var.h,v 1.62 2003/11/12 03:14:29 rwatson Exp $
|
||||
* $FreeBSD: src/sys/net/if_var.h,v 1.18.2.15 2002/06/28 12:36:54 luigi Exp $
|
||||
*/
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
02p,09jan12,h_x Move extern "C" after last header file include.
|
||||
02o,25oct06,kch Removed unused forward declarations.
|
||||
02n,28sep06,kch Removed struct ifnet since it is not supported by IPNet.
|
||||
02m,10sep06,kch Temporarily restore the ifnet structure.
|
||||
02l,10sep06,kch Restore all IF_XXX queue related macros.
|
||||
02k,09sep06,kch Cleanup for IPNet integration.
|
||||
02j,08feb06,kch Added IFQ_LOCK_ASSERT() macro and define it as noop.
|
||||
02i,06jan06,kch Integrated FreeBSD 6.0 ALTQ implementation.
|
||||
02h,21sep05,kch Added if_xname[] to ifnet structure, introduced if_name()
|
||||
macro to replace if_name() routine for backward compatibility.
|
||||
Also added if_initname() prototype (merged from FreeBSD 5.x
|
||||
if_var.h,v 1.84.2.6) (SPR #112724).
|
||||
02g,29aug05,kch Added if_nvlans counter to ifnet structure (SPR #112068).
|
||||
02f,26aug05,dlk Add section tags.
|
||||
02e,26aug05,kch Removed pTagData pointer from ifnet structure.
|
||||
02d,12aug05,kch Moved ifclone prototypes to if_clone.h.
|
||||
02c,04aug05,vvv clarified comments for if_index and ifIndex (SPR #106657)
|
||||
02b,16jul05,dlk Added intrqFlush() declaration for VIRTUAL_STACK case.
|
||||
02a,25jun05,dlk Added INTRQ_QJOB definition.
|
||||
01z,24jun05,wap Add link state support
|
||||
01y,09may05,vvv added include for if.h
|
||||
01x,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev
|
||||
01w,07feb05,vvv _KERNEL cleanup
|
||||
01v,10sep04,kc Added VLAN_TAG define to protect pTagData in ifnet structure.
|
||||
01u,12jul04,vvv fixed compiler warning
|
||||
01t,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver
|
||||
/main/vdt/base6_itn5_networking-int/1)
|
||||
01s,14may04,kc Added pTagData to struct ifnet for L2 VLAN Tagging support.
|
||||
01r,25feb04,nee Adding if6_resolve to ifnet
|
||||
01q,24feb04,dlk Add closing brace if __cplusplus is defined.
|
||||
01p,03feb04,wap Add extra structure fields for checksum offload support
|
||||
01o,02feb04,dlk Restore interface output queues (repair IF_ENQUEUE()).
|
||||
01n,20nov03,niq osdep.h cleanup
|
||||
01m,04nov03,rlm Ran batch header path update for header re-org.
|
||||
01l,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
01k,23oct03,rlm updated #includes for header re-org
|
||||
01j,24sep03,kkz Rebasing with BASE6_ITER2_FRZ7 - added IF_DEQUEUEIF macro
|
||||
01i,08aug03,nee Merging from label ACCORDION_BASE6_MERGE_BASELINE in
|
||||
accordion codeline to Base6
|
||||
01h,01feb03,pas merge from FreeBSD 4.7 - added clone support, polling;
|
||||
changed if_queue_drop() to if_handoff()
|
||||
01g,18sep02,nee removed ifr_type from ifreq structure
|
||||
01f,09sep02,hsh add c++ protection
|
||||
01e,24aug02,nee extended ifnet for admin control;defined admin states for
|
||||
boot/up/down
|
||||
01d,13feb02,ham changed for tornado build.
|
||||
01c,06oct01,ann removing the prototypes for ether_output and
|
||||
ether_output_frame
|
||||
01b,11sep01,ann adding the if_resolve func pointer that is missing
|
||||
01a,16jul01,ham created from FreeBSD4.3.
|
||||
*/
|
||||
|
||||
#ifndef _NET_IF_VAR_H_
|
||||
#define _NET_IF_VAR_H_
|
||||
|
||||
#include <sys/queue.h> /* get TAILQ macros */
|
||||
#include <net/mbuf.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Structure defining a queue for a network interface.
|
||||
*/
|
||||
struct ifqueue {
|
||||
struct mbuf *ifq_head;
|
||||
struct mbuf *ifq_tail;
|
||||
int ifq_len;
|
||||
int ifq_maxlen;
|
||||
int ifq_drops;
|
||||
};
|
||||
|
||||
/*
|
||||
* Output queues (ifp->if_snd) and slow device input queues (*ifp->if_slowq)
|
||||
* are queues of messages stored on ifqueue structures
|
||||
* (defined above). Entries are added to and deleted from these structures
|
||||
* by these macros, which should be called with ipl raised to splimp().
|
||||
*/
|
||||
#define IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen)
|
||||
#define IF_DROP(ifq) ((ifq)->ifq_drops++)
|
||||
|
||||
#define IF_ENQUEUE(ifq, m) \
|
||||
do { \
|
||||
(m)->m_nextpkt = 0; \
|
||||
if ((ifq)->ifq_tail == 0) \
|
||||
(ifq)->ifq_head = m; \
|
||||
else \
|
||||
(ifq)->ifq_tail->m_nextpkt = m; \
|
||||
(ifq)->ifq_tail = m; \
|
||||
(ifq)->ifq_len++; \
|
||||
} while (0)
|
||||
|
||||
#define IF_PREPEND(ifq, m) { \
|
||||
(m)->m_nextpkt = (ifq)->ifq_head; \
|
||||
if ((ifq)->ifq_tail == 0) \
|
||||
(ifq)->ifq_tail = (m); \
|
||||
(ifq)->ifq_head = (m); \
|
||||
(ifq)->ifq_len++; \
|
||||
}
|
||||
|
||||
#define IF_DEQUEUE(ifq, m) { \
|
||||
(m) = (ifq)->ifq_head; \
|
||||
if (m) { \
|
||||
if (((ifq)->ifq_head = (m)->m_nextpkt) == 0) \
|
||||
(ifq)->ifq_tail = 0; \
|
||||
(m)->m_nextpkt = 0; \
|
||||
(ifq)->ifq_len--; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#ifdef _WRS_KERNEL
|
||||
|
||||
/*
|
||||
* #define _IF_QFULL for compatibility with -current
|
||||
*/
|
||||
#define _IF_QFULL(ifq) IF_QFULL(ifq)
|
||||
|
||||
/*
|
||||
* The following macros are defined to eliminate direct references to the
|
||||
* interface output queue
|
||||
*/
|
||||
#define IFQ_IS_EMPTY(ifq) ((ifq)->ifq_len == 0)
|
||||
#define IFQ_INC_LEN(ifq) ((ifq)->ifq_len++)
|
||||
#define IFQ_DEC_LEN(ifq) (--(ifq)->ifq_len)
|
||||
#define IFQ_INC_DROPS(ifq) IF_DROP(ifq)
|
||||
#define IFQ_SET_MAXLEN(ifq, len) ((ifq)->ifq_maxlen = (len))
|
||||
|
||||
/*
|
||||
* 72 was chosen below because it is the size of a TCP/IP
|
||||
* header (40) + the minimum mss (32).
|
||||
*/
|
||||
#define IF_MINMTU 72
|
||||
#define IF_MAXMTU 65535
|
||||
|
||||
#endif /* _WRS_KERNEL */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_NET_IF_VAR_H_ */
|
||||
@@ -0,0 +1,87 @@
|
||||
/* ifaddrs.h - structure and routines for interface addresses */
|
||||
|
||||
/* Copyright 2001-2005 Wind River Systems, Inc. */
|
||||
|
||||
/* $KAME: ifaddrs.h,v 1.3 2001/01/26 08:14:55 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1999
|
||||
* Berkeley Software Design, Inc. 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``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 Berkeley Software Design, Inc. 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.
|
||||
*
|
||||
* BSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01f,20nov06,kch Added ifu_dstaddr to ifaddrs struct for compatibility with
|
||||
IPNET. Also restored getifaddrs and freeifaddrs prototypes.
|
||||
01e,28sep06,kch Removed unsupported prototypes for IPNet integration.
|
||||
01d,24may05,vvv updated for user-side builds
|
||||
01c,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
01b,06nov03,rlm Ran batch header update for header re-org.
|
||||
01a,29apr03,syy Added #ifdef for __cplusplus
|
||||
*/
|
||||
|
||||
#ifndef __INCifaddrsh
|
||||
#define __INCifaddrsh
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct ifaddrs {
|
||||
struct ifaddrs *ifa_next;
|
||||
char *ifa_name;
|
||||
u_int ifa_flags;
|
||||
struct sockaddr *ifa_addr;
|
||||
struct sockaddr *ifa_netmask;
|
||||
union {
|
||||
struct sockaddr *ifu_broadaddr;
|
||||
struct sockaddr *ifu_dstaddr;
|
||||
} ifa_ifu;
|
||||
#ifndef ifa_broadaddr
|
||||
#define ifa_broadaddr ifa_ifu.ifu_broadaddr
|
||||
#endif
|
||||
#ifndef ifa_dstaddr
|
||||
#define ifa_dstaddr ifa_ifu.ifu_dstaddr
|
||||
#endif
|
||||
void *ifa_data;
|
||||
};
|
||||
|
||||
/*
|
||||
* This may have been defined in <net/if.h>. Note that if <net/if.h> is
|
||||
* to be included it must be included before this header file.
|
||||
*/
|
||||
#ifndef ifa_broadaddr
|
||||
#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */
|
||||
#endif
|
||||
|
||||
extern int getifaddrs __P((struct ifaddrs **));
|
||||
extern void freeifaddrs __P((struct ifaddrs *));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! __INCifaddrsh */
|
||||
@@ -0,0 +1,566 @@
|
||||
/* mbuf.h - mbuf header file */
|
||||
|
||||
/* Copyright 2001-2006, 2008 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1988, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)mbuf.h 8.5 (Berkeley) 2/19/95
|
||||
* $FreeBSD: src/sys/sys/mbuf.h,v 1.44.2.26 2004/06/17 00:08:21 fjoe Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
02p,22may12,dhe M_COPY_PKTHDR() now copies also offset2 field.
|
||||
02o,09jan12,h_x Move extern "C" after last header file include.
|
||||
02n,18mar08,dlk Added CSUM_IPHDR_OFFSET(). Modified CSUM_IPHDR_LEN() to
|
||||
use mBlkHdr.offset2 instead of mBlkHdr.offset1.
|
||||
02m,27dec06,kch Removed references to the obsolete coreip virtual stack.
|
||||
02l,12sep06,kch Replaced (struct ifnet *) with (void *) for m_devget()
|
||||
prototype.
|
||||
02k,15sep05,kch Added CSUM_PTAGGED for 802.1P priority-tagged frame support
|
||||
(SPR #112513).
|
||||
02j,07sep05,kch Removed CSUM_NOVLAN (SPR #112068).
|
||||
02i,01sep05,sar Add M_WRITEABLE check to M_LEADINGSPACE and
|
||||
M_TRAILINGSPACE to ensure we don't overwrite
|
||||
part of a buffer that we shouldn't.
|
||||
02h,28jul05,dlk Added CSUM_VLAN and CSUM_NOVLAN.
|
||||
02g,12jul05,vvv merged M_NOTIFICATION from kame-20050404-freebsd411
|
||||
02f,17jun05,dlk Make m_copym(), m_copypacket(), and m_copydata() macros also.
|
||||
02e,16may05,dlk Make m_freem() and m_free() macros for better performance.
|
||||
02d,22apr05,kch Fixed diab compilation error for MCLGET1() macro.
|
||||
02c,07feb05,vvv _KERNEL cleanup
|
||||
02b,24jan05,vvv osdep.h cleanup
|
||||
02a,20jan05,sar Removal of unused m_dup routine.
|
||||
01z,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE
|
||||
01y,01jul04,vvv fixed warnings
|
||||
01x,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver
|
||||
/main/vdt/base6_itn5_networking-int/1)
|
||||
01w,05feb04,wap Make M_COPY_PKTHDR() preserve extra fields in mBlkHdr
|
||||
01v,06jan04,vvv removed dtom, modified allocation macros to not store mbuf
|
||||
back-pointer (SPR #88742)
|
||||
01u,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
01t,04nov03,rlm Ran batch header path update for header re-org.
|
||||
01s,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
01r,27oct03,cdw update include statements post header re-org.
|
||||
01q,18aug03,nee Merging from ACCORDION_BASE6_MERGE_BASELINE. Only
|
||||
virtualixation related changes are being merged in.
|
||||
01p,09jul03,syy Back out the previous fix to SPR#88742
|
||||
01o,06jun03,pas fix M_LEADINGSPACE to account for hidden back-ptr (SPR#88742)
|
||||
01n,14may03,vvv make routines available when _KERNEL is not defined
|
||||
01m,01may03,spm Tornado 2.2 CP1 merge (from ver 01n,21mar02,vvv:
|
||||
TOR2_2-CP1-F label, tor2_2-patch branch, /wind/river VOB)
|
||||
01l,15apr03,syy Fixed Diab compiler warnings
|
||||
01k,01feb03,pas merge from FreeBSD 4.7 - added packet tags
|
||||
01j,30sep02,sar Add M_SECURE_PKT to the list of mflags
|
||||
01i,23aug02,ann extended MGETHDR1 and MGET1 to recognize bestfit and closefit
|
||||
01h,20jun02,ann redefined MGET1/MGETHDR1/MCLGET1
|
||||
01g,07jun02,pas new version of MGET/MGETHDR/MCLGET takes size argument
|
||||
01f,29apr02,deg back to old netBufLib
|
||||
01e,22mar02,deg MFREE auxiliary chain freeing removed (moved to _mBlkFree())
|
||||
01d,06feb02,ham changed for tornado build.
|
||||
01c,05feb02,deg bugfix in MCLGET()
|
||||
01b,11dec01,ppp correcting m_pktdat
|
||||
01a,08sep01,qli fixed mtod
|
||||
01a,09aug01,deg written.
|
||||
*/
|
||||
|
||||
#ifndef __INCNewMbufh
|
||||
#define __INCNewMbufh
|
||||
|
||||
#ifdef _WRS_KERNEL
|
||||
|
||||
#include <netBufLib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Note that any file which uses _pNetDpool or _pNetSysPool, either directly
|
||||
* or via the macros (MGET1 etc) MUST include vsNetCore.h for Virtual Stack.
|
||||
*/
|
||||
|
||||
extern NET_POOL_ID _pNetDpool; /* network data pool */
|
||||
extern NET_POOL_ID _pNetSysPool; /* network system pool */
|
||||
|
||||
extern M_CL_CONFIG pktMblkClBlkDesc; /* mBlk, clBlk configuration */
|
||||
extern CL_DESC pktClDescTbl []; /* cluster configuration */
|
||||
extern UINT pktClDescTblNumEnt; /* no. elements in the table */
|
||||
|
||||
extern M_CL_CONFIG sysMblkClBlkDesc; /* mBlk, clBlk configuration */
|
||||
extern CL_DESC sysClDescTbl []; /* cluster configuration */
|
||||
extern UINT sysClDescTblNumEnt; /* no. elements in the table */
|
||||
|
||||
|
||||
/*
|
||||
* Mbufs are of a single size, MSIZE (machine/param.h), which
|
||||
* includes overhead. An mbuf may add a single "mbuf cluster" of size
|
||||
* MCLBYTES (also in machine/param.h), which has no additional overhead
|
||||
* and is used instead of the internal data area; this is done when
|
||||
* at least MINCLSIZE of data must be stored.
|
||||
*/
|
||||
|
||||
#define SIMCLSIZE 128 /* cluster size to simulate mbuf data space */
|
||||
|
||||
#define MCLBYTES 2048 /* mbuf cluster size */
|
||||
|
||||
|
||||
#define MLEN SIMCLSIZE
|
||||
#define MHLEN MLEN
|
||||
#define MINCLSIZE (MHLEN + 1) /* smallest amount to put in cluster */
|
||||
|
||||
/*
|
||||
* Macro for type conversion
|
||||
* mtod(m, t) - convert mbuf pointer to data pointer of correct type
|
||||
*/
|
||||
|
||||
#define mtod(m, t) ((t)((m)->m_data))
|
||||
|
||||
/* Clarinet defs */
|
||||
#define mbuf mBlk
|
||||
#define m_next mBlkHdr.mNext
|
||||
#define m_len mBlkHdr.mLen
|
||||
#define m_data mBlkHdr.mData
|
||||
#define m_type mBlkHdr.mType
|
||||
#define m_flags mBlkHdr.mFlags
|
||||
#define m_nextpkt mBlkHdr.mNextPkt
|
||||
#define m_act m_nextpkt
|
||||
#define m_pkthdr mBlkPktHdr
|
||||
#define m_ext pClBlk
|
||||
|
||||
#define m_hdr mHdr
|
||||
#define mh_next mNext
|
||||
#define mh_nextpkt mNextPkt
|
||||
#define mh_data mData
|
||||
#define mh_len mLen
|
||||
#define mh_type mType
|
||||
#define mh_flags mFlags
|
||||
|
||||
#define m_extBuf m_ext->clNode.pClBuf
|
||||
#define m_extSize m_ext->clSize
|
||||
#define m_extRefCnt m_ext->clRefCnt
|
||||
#define m_extFreeRtn m_ext->pClFreeRtn
|
||||
#define m_extArg1 m_ext->clFreeArg1
|
||||
#define m_extArg2 m_ext->clFreeArg2
|
||||
#define m_extArg3 m_ext->clFreeArg3
|
||||
|
||||
|
||||
/*
|
||||
* It is not possible to port m_ext.ext_buf and m_ext.ext_free
|
||||
* Change your code :
|
||||
* m_ext.ext_buf to m_extBuf
|
||||
* m_ext.ext_free to m_extFreeRtn
|
||||
*/
|
||||
#define m_pktdat m_ext->clNode.pClBuf
|
||||
#define m_dat m_ext->clNode.pClBuf
|
||||
|
||||
#define M_PROTO1 0x0008 /* protocol-specific */
|
||||
#define M_PROTO2 0x0010 /* protocol-specific */
|
||||
#define M_PROTO3 0x0020 /* protocol-specific */
|
||||
#define M_PROTO4 0x0040 /* protocol-specific */
|
||||
|
||||
/* The M_PROTO5 flag has been removed to allow the bit to be
|
||||
* used as the SECURE_PKT bit. The define has been left in
|
||||
* as part of the history of the file and should be removed
|
||||
* in the future.
|
||||
* sar
|
||||
*/
|
||||
#if 0
|
||||
#define M_PROTO5 0x0080 /* protocol-specific */
|
||||
#endif
|
||||
#define M_SECURE_PKT 0x0080 /* For use by Wind River IPSec product */
|
||||
|
||||
#define M_FRAG 0x0400 /* packet is a fragment of a larger packet */
|
||||
#define M_FIRSTFRAG 0x0800 /* packet is first fragment */
|
||||
#define M_LASTFRAG 0x1000 /* packet is last fragment */
|
||||
|
||||
#define M_NOTIFICATION 0x8000 /* notification event */
|
||||
|
||||
/* flags copied when copying m_pkthdr */
|
||||
#define M_COPYFLAGS (M_PKTHDR|M_EOR|M_PROTO1|M_PROTO1|M_PROTO2|M_PROTO3 | \
|
||||
M_PROTO4|M_SECURE_PKT|M_BCAST|M_MCAST|M_FRAG)
|
||||
|
||||
/* flags indicating hw checksum support and sw checksum requirements */
|
||||
#define CSUM_IP 0x0001 /* will csum IP */
|
||||
#define CSUM_TCP 0x0002 /* will csum TCP */
|
||||
#define CSUM_UDP 0x0004 /* will csum UDP */
|
||||
#define CSUM_IP_FRAGS 0x0008 /* will csum IP fragments */
|
||||
#define CSUM_FRAGMENT 0x0010 /* will do IP fragmentation */
|
||||
#define CSUM_TCP_SEG 0x0020 /* will segment TCP/IPv4 */
|
||||
#define CSUM_TCPv6 0x0040 /* will csum TCP/IPv6 */
|
||||
#define CSUM_UDPv6 0x0080 /* will csum UDP/IPv6 */
|
||||
#define CSUM_TCPv6_SEG 0x0100 /* will csum TCP/IPv6 */
|
||||
#define CSUM_VLAN 0x0200 /* insert or extracted VLAN */
|
||||
#define CSUM_PTAGGED 0x0400 /* send priority-tagged frame */
|
||||
|
||||
#define CSUM_IP_CHECKED 0x1000 /* did csum IP */
|
||||
#define CSUM_IP_VALID 0x2000 /* ... the csum is valid */
|
||||
#define CSUM_DATA_VALID 0x4000 /* csum_data field is valid */
|
||||
#define CSUM_PSEUDO_HDR 0x8000 /* csum_data has pseudo hdr */
|
||||
|
||||
#define CSUM_DELAY_DATA (CSUM_TCP | CSUM_UDP)
|
||||
#define CSUM_DELAY_IP (CSUM_IP) /* XXX add ipv6 here too? */
|
||||
#define CSUM_DELAY_DATA6 (CSUM_TCPv6 | CSUM_UDPv6)
|
||||
|
||||
#define CSUM_RESULTS (CSUM_IP_CHECKED | CSUM_IP_VALID | \
|
||||
CSUM_DATA_VALID | CSUM_PSEUDO_HDR)
|
||||
|
||||
/*
|
||||
* CSUM_IPHDR_OFFSET() is the network service offset, i.e. the
|
||||
* offset from the start of the link header to the start of the
|
||||
* network layer (IP) header. It includes LLC/SNAP if present.
|
||||
*/
|
||||
#define CSUM_IPHDR_OFFSET(pMblk) ((pMblk)->mBlkHdr.offset1)
|
||||
#define CSUM_IP_HDRLEN(pMblk) ((pMblk)->mBlkHdr.offset2)
|
||||
#define CSUM_XPORT_HDRLEN(pMblk) \
|
||||
(((pMblk)->mBlkPktHdr.csum_data & 0xff00) >> 8)
|
||||
#define CSUM_XPORT_CSUM_OFF(pMblk) ((pMblk)->mBlkPktHdr.csum_data & 0xff)
|
||||
|
||||
|
||||
/* malloc flags (sys/malloc.h) */
|
||||
#define M_NOWAIT M_DONTWAIT
|
||||
#define M_WAITOK M_WAIT
|
||||
#define M_CLOSEFIT 0x02
|
||||
|
||||
/*
|
||||
* mbuf allocation/deallocation macros:
|
||||
*
|
||||
* MGET(struct mbuf *m, int how, int type)
|
||||
* allocates an mbuf and initializes it to contain internal data.
|
||||
*
|
||||
* MGETHDR(struct mbuf *m, int how, int type)
|
||||
* allocates an mbuf and initializes it to contain a packet header
|
||||
* and internal data.
|
||||
*/
|
||||
|
||||
/* Clarinet: This one gets an mbuf with attached cluster, to replace
|
||||
* the MGET()/MCLGET() paired calls. This should save some time by
|
||||
* avoiding allocating a 128-byte cluster, freeing it, allocating a
|
||||
* larger cluster, and joining it to the clBlk.
|
||||
*/
|
||||
#define MGET1(m, size, how, type) \
|
||||
{ \
|
||||
(m) = netTupleGet (_pNetDpool, size < SIMCLSIZE ? SIMCLSIZE : size, \
|
||||
(how & M_NOWAIT), (type), \
|
||||
((how & M_CLOSEFIT) ? \
|
||||
FALSE : TRUE)); \
|
||||
}
|
||||
|
||||
/* Following change is to eliminate Diab compiler warning 1606 */
|
||||
|
||||
#define MGET(m, how, type) \
|
||||
{ \
|
||||
(m) = netTupleGet (_pNetDpool, SIMCLSIZE, \
|
||||
(how & M_NOWAIT), (type), \
|
||||
((how & M_CLOSEFIT) ? \
|
||||
FALSE : TRUE)); \
|
||||
}
|
||||
|
||||
#define MGETHDR1(m, size, how, type) \
|
||||
{ \
|
||||
int i = size; \
|
||||
\
|
||||
(m) = netTupleGet(_pNetDpool, i < SIMCLSIZE ? SIMCLSIZE : i, \
|
||||
(how & M_NOWAIT), (type), \
|
||||
((how & M_CLOSEFIT) ? FALSE : TRUE)); \
|
||||
if ((m) != NULL) \
|
||||
(m)->m_flags |= M_PKTHDR; \
|
||||
}
|
||||
|
||||
/* Following change is to eliminate Diab compiler warning 1606 */
|
||||
|
||||
#define MGETHDR(m, how, type) \
|
||||
{ \
|
||||
(m) = netTupleGet (_pNetDpool, SIMCLSIZE, \
|
||||
(how & M_NOWAIT), (type), \
|
||||
((how & M_CLOSEFIT) ? FALSE : TRUE)); \
|
||||
if ((m) != NULL) \
|
||||
(m)->m_flags |= M_PKTHDR; \
|
||||
}
|
||||
|
||||
#define MCLGET1(m, size, how) \
|
||||
{ \
|
||||
char * pClBuf; \
|
||||
CL_POOL_ID pClPool; \
|
||||
\
|
||||
if ((m)->m_flags & M_EXT) \
|
||||
{ \
|
||||
netClFree((m)->pClBlk->pNetPool, \
|
||||
(UCHAR *)(m)->pClBlk->clNode.pClBuf); \
|
||||
(m)->m_flags &= ~M_EXT; \
|
||||
} \
|
||||
\
|
||||
if ((pClPool = netClPoolIdGet(_pNetDpool, \
|
||||
(size), \
|
||||
TRUE)) != NULL) \
|
||||
{ \
|
||||
if ((pClBuf = netClusterGet(_pNetDpool, \
|
||||
pClPool)) != NULL) \
|
||||
{ \
|
||||
netClBlkJoin((m)->m_ext, \
|
||||
pClBuf, \
|
||||
(size), \
|
||||
0,0,0,0); \
|
||||
netMblkClJoin((m), (m)->m_ext); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define MCLGET(m, how) MCLGET1(m, MCLBYTES, how)
|
||||
|
||||
/*
|
||||
* MFREE(struct mbuf *m, struct mbuf *n)
|
||||
* Free a single mbuf and associated external storage.
|
||||
* Place the successor, if any, in n.
|
||||
*
|
||||
* we do need to check non-first mbuf for m_aux, since some of existing
|
||||
* code does not call M_PREPEND properly.
|
||||
* (example: call to bpf_mtap from drivers)
|
||||
*/
|
||||
#define MFREE(m, n) (n) = netMblkClFree((m))
|
||||
|
||||
/*
|
||||
* Copy mbuf pkthdr from "from" to "to".
|
||||
* from must have M_PKTHDR set, and to must be empty.
|
||||
* aux pointer will be moved to `to'.
|
||||
*/
|
||||
#define M_COPY_PKTHDR(to, from) \
|
||||
{ \
|
||||
struct mbuf *_mfrom = (from); \
|
||||
struct mbuf *_mto = (to); \
|
||||
_mto->mBlkHdr.reserved = _mfrom->mBlkHdr.reserved;\
|
||||
_mto->mBlkHdr.offset1 = _mfrom->mBlkHdr.offset1; \
|
||||
_mto->mBlkHdr.offset2 = _mfrom->mBlkHdr.offset2; \
|
||||
_mto->m_flags = _mfrom->m_flags; \
|
||||
_mto->m_pkthdr = _mfrom->m_pkthdr; \
|
||||
_mfrom->m_pkthdr.aux = (struct mbuf *)NULL; \
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the m_data pointer of a newly-allocated mbuf (m_get/MGET) to place
|
||||
* an object of the specified size at the end of the mbuf, longword aligned.
|
||||
*/
|
||||
#define M_ALIGN(m, len) ((m)->m_data += \
|
||||
((m)->m_extSize - (len)) &~ (sizeof(long) - 1))
|
||||
|
||||
/*
|
||||
* As above, for mbufs allocated with m_gethdr/MGETHDR
|
||||
* or initialized by M_COPY_PKTHDR.
|
||||
*/
|
||||
#define MH_ALIGN(m, len) (M_ALIGN((m),(len)))
|
||||
|
||||
/*
|
||||
* Check if we can write to an mbuf.
|
||||
*/
|
||||
#define M_WRITABLE(m) ((m)->m_extRefCnt == 1)
|
||||
|
||||
/* For M_LEADINGSPACE and M_TRAILINGSPACE the
|
||||
* M_WRITABLE() is a conservative safety measure. */
|
||||
|
||||
/*
|
||||
* Compute the amount of space available
|
||||
* before the current start of data in an mbuf.
|
||||
*/
|
||||
#define M_LEADINGSPACE(m) \
|
||||
(M_WRITABLE(m) ? ((m)->m_data - (m)->m_extBuf) : 0)
|
||||
/*
|
||||
* Compute the amount of space available
|
||||
* after the end of data in an mbuf.
|
||||
*/
|
||||
#define M_TRAILINGSPACE(m) \
|
||||
(M_WRITABLE(m) ? ((m)->m_extBuf + (m)->m_extSize - \
|
||||
(m)->m_data - (m)->m_len) \
|
||||
: 0)
|
||||
|
||||
/*
|
||||
* Arrange to prepend space of size plen to mbuf m.
|
||||
* If a new mbuf must be allocated, how specifies whether to wait.
|
||||
* If how is M_DONTWAIT and allocation fails, the original mbuf chain
|
||||
* is freed and m is set to NULL.
|
||||
*/
|
||||
|
||||
#ifndef STANDALONE_AGENT
|
||||
#define M_PREPEND(m, plen, how) \
|
||||
{ \
|
||||
if (M_LEADINGSPACE(m) >= (plen)) \
|
||||
{ \
|
||||
(m)->m_data -= (plen); \
|
||||
(m)->m_len += (plen); \
|
||||
} \
|
||||
else \
|
||||
(m) = m_prepend((m), (plen), (how)); \
|
||||
if ((m) && (m)->m_flags & M_PKTHDR) \
|
||||
(m)->m_pkthdr.len += (plen); \
|
||||
}
|
||||
#else /* STANDALONE_AGENT */
|
||||
/*
|
||||
* for standalone agent, the M_PREPEND routine does no try to allocate
|
||||
* a new buffer (there is no available). Anyway, this is not needed since
|
||||
* all the WDB packets can be stored in one buffer.
|
||||
*/
|
||||
|
||||
#define M_PREPEND(m, plen, how) \
|
||||
{ \
|
||||
if (M_LEADINGSPACE(m) >= (plen)) { \
|
||||
(m)->m_data -= (plen); \
|
||||
(m)->m_len += (plen); \
|
||||
} else \
|
||||
(m) = NULL; \
|
||||
if ((m) && (m)->m_flags & M_PKTHDR) \
|
||||
(m)->m_pkthdr.len += (plen); \
|
||||
}
|
||||
#endif /* STANDALONE_AGENT */
|
||||
|
||||
/* change mbuf to new type */
|
||||
#define MCHTYPE(m, t) (_pNetDpool->mBlkStat.types[(m)->m_type]--; \
|
||||
_pNetDpool->mBlkStat.types[(t)]++; \
|
||||
(m)->m_type = (t))
|
||||
|
||||
/* compatibility with 4.3 */
|
||||
|
||||
/*
|
||||
* pkthdr.aux type tags.
|
||||
*/
|
||||
struct mauxtag {
|
||||
int af;
|
||||
int type;
|
||||
void* p;
|
||||
};
|
||||
|
||||
/*
|
||||
* Some packet tags to identify different mbuf annotations.
|
||||
*
|
||||
* Eventually, these annotations will end up in an appropriate chain
|
||||
* (struct m_tag or similar, e.g. as in NetBSD) properly managed by
|
||||
* the mbuf handling routines.
|
||||
*
|
||||
* As a temporary and low impact solution to replace the even uglier
|
||||
* approach used so far in some parts of the network stack (which relies
|
||||
* on global variables), these annotations are stored in MT_TAG
|
||||
* mbufs (or lookalikes) prepended to the actual mbuf chain.
|
||||
*
|
||||
* m_type = MT_TAG
|
||||
* m_flags = m_tag_id
|
||||
* m_next = next buffer in chain.
|
||||
*
|
||||
* BE VERY CAREFUL not to pass these blocks to the mbuf handling routines.
|
||||
*
|
||||
*/
|
||||
|
||||
#define m_tag_id m_flags
|
||||
|
||||
/* Packet tag types -- first ones are from NetBSD */
|
||||
|
||||
#define PACKET_TAG_NONE 0 /* Nadda */
|
||||
#define PACKET_TAG_IPSEC_IN_DONE 1 /* IPsec applied, in */
|
||||
#define PACKET_TAG_IPSEC_OUT_DONE 2 /* IPsec applied, out */
|
||||
#define PACKET_TAG_IPSEC_IN_CRYPTO_DONE 3 /* NIC IPsec crypto done */
|
||||
#define PACKET_TAG_IPSEC_OUT_CRYPTO_NEEDED 4 /* NIC IPsec crypto req'ed */
|
||||
#define PACKET_TAG_IPSEC_IN_COULD_DO_CRYPTO 5 /* NIC notifies IPsec */
|
||||
#define PACKET_TAG_IPSEC_PENDING_TDB 6 /* Reminder to do IPsec */
|
||||
#define PACKET_TAG_BRIDGE 7 /* Bridge processing done */
|
||||
#define PACKET_TAG_GIF 8 /* GIF processing done */
|
||||
#define PACKET_TAG_GRE 9 /* GRE processing done */
|
||||
#define PACKET_TAG_IN_PACKET_CHECKSUM 10 /* NIC checksumming done */
|
||||
#define PACKET_TAG_ENCAP 11 /* Encap. processing */
|
||||
#define PACKET_TAG_IPSEC_SOCKET 12 /* IPSEC socket ref */
|
||||
#define PACKET_TAG_IPSEC_HISTORY 13 /* IPSEC history */
|
||||
#define PACKET_TAG_IPV6_INPUT 14 /* IPV6 input processing */
|
||||
|
||||
/* Packet tags used in the FreeBSD network stack
|
||||
* We don't support dummynet or divert, they are included for consistency */
|
||||
#define PACKET_TAG_DUMMYNET 15 /* dummynet info */
|
||||
#define PACKET_TAG_IPFW 16 /* ipfw classification */
|
||||
#define PACKET_TAG_DIVERT 17 /* divert info */
|
||||
#define PACKET_TAG_IPFORWARD 18 /* ipforward info */
|
||||
|
||||
#define PACKET_TAG_MAX 19
|
||||
|
||||
|
||||
extern int max_linkhdr; /* largest link-level header */
|
||||
extern int max_protohdr; /* largest protocol header */
|
||||
extern int max_hdr; /* largest link+protocol header */
|
||||
|
||||
void m_adj (struct mbuf *, int);
|
||||
void m_cat (struct mbuf *,struct mbuf *);
|
||||
|
||||
void m_copyback (struct mbuf *, int, int, caddr_t);
|
||||
void m_copydata (struct mbuf *,int,int,caddr_t);
|
||||
struct mbuf *m_copypacket (struct mbuf *, int);
|
||||
struct mbuf *m_devget (char *, int, int, void *,
|
||||
void (*copy)(char *, caddr_t, u_int));
|
||||
/* Removed m_dup as it wasn't being used */
|
||||
struct mbuf *m_free (struct mbuf *);
|
||||
void m_freem (struct mbuf *);
|
||||
|
||||
struct mbuf *m_get (int, int);
|
||||
struct mbuf *m_getclr (int, int);
|
||||
struct mbuf *m_gethdr (int, int);
|
||||
struct mbuf *m_getm (struct mbuf *, int, int, int);
|
||||
|
||||
struct mbuf *m_prepend (struct mbuf *,int,int);
|
||||
struct mbuf *m_pulldown (struct mbuf *, int, int, int *);
|
||||
|
||||
struct mbuf *m_pullup (struct mbuf *, int);
|
||||
|
||||
struct mbuf *m_split (struct mbuf *,int,int);
|
||||
|
||||
struct mbuf *m_aux_add2 (struct mbuf *, int, int, void *);
|
||||
struct mbuf *m_aux_find2 (struct mbuf *, int, int, void *);
|
||||
struct mbuf *m_aux_add (struct mbuf *, int, int);
|
||||
struct mbuf *m_aux_find (struct mbuf *, int, int);
|
||||
void m_aux_delete (struct mbuf *, struct mbuf *);
|
||||
|
||||
struct mbuf *m_copym (struct mbuf *, int, int, int);
|
||||
|
||||
/* Make m_freem() and m_free() macros for better performance */
|
||||
#define m_freem(m) (netMblkClChainFree (m))
|
||||
#define m_free(m) (netMblkClFree (m))
|
||||
|
||||
/* Make m_copydata(), m_copypacket(), and m_copym() macros also */
|
||||
#define m_copydata(m, off, len, cp) \
|
||||
((void)(netMblkOffsetToBufCopy((m), (off), (cp), (len), 0)))
|
||||
#define m_copym(m, off0, len, wait) \
|
||||
(netMblkChainDup(_pNetDpool, (m), (off0), (len), (wait)))
|
||||
#define m_copypacket(m, how) \
|
||||
(netMblkChainDup(_pNetDpool, (m), 0, M_COPYALL, (how)))
|
||||
#define m_copy(m, o, l) m_copym((m), (o), (l), M_DONTWAIT)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _WRS_KERNEL */
|
||||
|
||||
#endif /* __INCNewMbufh */
|
||||
@@ -0,0 +1,344 @@
|
||||
/* protosw.h - protocol switch table header file */
|
||||
|
||||
/* Copyright 2001 - 2005 Wind River Systems, Inc. */
|
||||
|
||||
/*-
|
||||
* 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.
|
||||
*
|
||||
* @(#)protosw.h 8.1 (Berkeley) 6/2/93
|
||||
* $FreeBSD: src/sys/sys/protosw.h,v 1.28.2.2 2001/07/03 11:02:01 ume Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01n,12sep06,kch Removed reference to struct ifnet. Also removed obsolete
|
||||
prototypes.
|
||||
01m,12jul05,vvv merged from kame-20050404-freebsd411
|
||||
01l,07feb05,vvv _KERNEL cleanup
|
||||
01k,24jan05,vvv osdep.h cleanup
|
||||
01j,19jan04,bwa added PRUS_EXP definition for COMP protocol
|
||||
01i,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
01h,04nov03,rlm Ran batch header path update for header re-org.
|
||||
01g,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
01f,07aug03,nee Merging to Base6 from ACCORDION_BASE6_MERGE_BASELINE label on
|
||||
Accordion codeline
|
||||
01e,15may03,spm Tornado 2.2 FCS merge (SPR #72213; from tcp_var.h
|
||||
ver 01g,05jun02,vvv: TOR2_2-FCS-COPY label, tor2 branch,
|
||||
/wind/river VOB)
|
||||
01d,09sep02,hsh add c++ protection
|
||||
01c,12jul02,hsh fix head file for ppc
|
||||
01b,21sep01,hsh uncomment pru_sense_null function point
|
||||
01a,18sep01,ham made pf* routines extern. diabled pru_sense_null.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_PROTOSW_H_
|
||||
#define _SYS_PROTOSW_H_
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Forward declare these structures referenced from prototypes below. */
|
||||
struct mbuf;
|
||||
struct proc;
|
||||
struct sockaddr;
|
||||
struct socket;
|
||||
struct sockopt;
|
||||
|
||||
#ifdef _WRS_KERNEL
|
||||
/*
|
||||
* Protocol switch table.
|
||||
*
|
||||
* Each protocol has a handle initializing one of these structures,
|
||||
* which is used for protocol-protocol and system-protocol communication.
|
||||
*
|
||||
* A protocol is called through the pr_init entry before any other.
|
||||
* Thereafter it is called every 200ms through the pr_fasttimo entry and
|
||||
* every 500ms through the pr_slowtimo for timer based actions.
|
||||
* The system will call the pr_drain entry if it is low on space and
|
||||
* this should throw away any non-critical data.
|
||||
*
|
||||
* Protocols pass data between themselves as chains of mbufs using
|
||||
* the pr_input and pr_output hooks. Pr_input passes data up (towards
|
||||
* the users) and pr_output passes it down (towards the interfaces); control
|
||||
* information passes up and down on pr_ctlinput and pr_ctloutput.
|
||||
* The protocol is responsible for the space occupied by any the
|
||||
* arguments to these entries and must dispose it.
|
||||
*
|
||||
* In retrospect, it would be a lot nicer to use an interface
|
||||
* similar to the vnode VOP interface.
|
||||
*/
|
||||
struct protosw {
|
||||
short pr_type; /* socket type used for */
|
||||
struct domain *pr_domain; /* domain protocol a member of */
|
||||
short pr_protocol; /* protocol number */
|
||||
short pr_flags; /* see below */
|
||||
/* protocol-protocol hooks */
|
||||
void (*pr_input) __P((struct mbuf *, int len));
|
||||
/* input to protocol (from below) */
|
||||
int (*pr_output) __P((struct mbuf *m, struct socket *so));
|
||||
/* output to protocol (from above) */
|
||||
void (*pr_ctlinput)__P((int, struct sockaddr *, void *));
|
||||
/* control input (from below) */
|
||||
int (*pr_ctloutput)__P((struct socket *, struct sockopt *));
|
||||
/* control output (from above) */
|
||||
/* user-protocol hook */
|
||||
void *pr_ousrreq;
|
||||
/* utility hooks */
|
||||
void (*pr_init) __P((void)); /* initialization hook */
|
||||
void (*pr_fasttimo) __P((void));
|
||||
/* fast timeout (200ms) */
|
||||
void (*pr_slowtimo) __P((void));
|
||||
/* slow timeout (500ms) */
|
||||
void (*pr_drain) __P((void));
|
||||
/* flush any excess space possible */
|
||||
struct pr_usrreqs *pr_usrreqs; /* supersedes pr_usrreq() */
|
||||
};
|
||||
#endif /* _WRS_KERNEL */
|
||||
|
||||
#define PR_SLOWHZ 2 /* 2 slow timeouts per second */
|
||||
#define PR_FASTHZ 5 /* 5 fast timeouts per second */
|
||||
|
||||
/*
|
||||
* Values for pr_flags.
|
||||
* PR_ADDR requires PR_ATOMIC;
|
||||
* PR_ADDR and PR_CONNREQUIRED are mutually exclusive.
|
||||
* PR_IMPLOPCL means that the protocol allows sendto without prior connect,
|
||||
* and the protocol understands the MSG_EOF flag. The first property is
|
||||
* is only relevant if PR_CONNREQUIRED is set (otherwise sendto is allowed
|
||||
* anyhow).
|
||||
* PR_ADDR_OPT requires PR_ATOMIC (like PR_ADDR)
|
||||
*/
|
||||
#define PR_ATOMIC 0x01 /* exchange atomic messages only */
|
||||
#define PR_ADDR 0x02 /* addresses given with messages */
|
||||
#define PR_CONNREQUIRED 0x04 /* connection required by protocol */
|
||||
#define PR_WANTRCVD 0x08 /* want PRU_RCVD calls */
|
||||
#define PR_RIGHTS 0x10 /* passes capabilities */
|
||||
#define PR_IMPLOPCL 0x20 /* implied open/close */
|
||||
#define PR_LASTHDR 0x40 /* enforce ipsec policy; last header */
|
||||
#define PR_ADDR_OPT 0x80 /* allow addresses during delivery */
|
||||
|
||||
/*
|
||||
* The arguments to usrreq are:
|
||||
* (*protosw[].pr_usrreq)(up, req, m, nam, opt);
|
||||
* where up is a (struct socket *), req is one of these requests,
|
||||
* m is a optional mbuf chain containing a message,
|
||||
* nam is an optional mbuf chain containing an address,
|
||||
* and opt is a pointer to a socketopt structure or nil.
|
||||
* The protocol is responsible for disposal of the mbuf chain m,
|
||||
* the caller is responsible for any space held by nam and opt.
|
||||
* A non-zero return from usrreq gives an
|
||||
* UNIX error number which should be passed to higher level software.
|
||||
*/
|
||||
#define PRU_ATTACH 0 /* attach protocol to up */
|
||||
#define PRU_DETACH 1 /* detach protocol from up */
|
||||
#define PRU_BIND 2 /* bind socket to address */
|
||||
#define PRU_LISTEN 3 /* listen for connection */
|
||||
#define PRU_CONNECT 4 /* establish connection to peer */
|
||||
#define PRU_ACCEPT 5 /* accept connection from peer */
|
||||
#define PRU_DISCONNECT 6 /* disconnect from peer */
|
||||
#define PRU_SHUTDOWN 7 /* won't send any more data */
|
||||
#define PRU_RCVD 8 /* have taken data; more room now */
|
||||
#define PRU_SEND 9 /* send this data */
|
||||
#define PRU_ABORT 10 /* abort (fast DISCONNECT, DETATCH) */
|
||||
#define PRU_CONTROL 11 /* control operations on protocol */
|
||||
#define PRU_SENSE 12 /* return status into m */
|
||||
#define PRU_RCVOOB 13 /* retrieve out of band data */
|
||||
#define PRU_SENDOOB 14 /* send out of band data */
|
||||
#define PRU_SOCKADDR 15 /* fetch socket's address */
|
||||
#define PRU_PEERADDR 16 /* fetch peer's address */
|
||||
#define PRU_CONNECT2 17 /* connect two sockets */
|
||||
/* begin for protocols internal use */
|
||||
#define PRU_FASTTIMO 18 /* 200ms timeout */
|
||||
#define PRU_SLOWTIMO 19 /* 500ms timeout */
|
||||
#define PRU_PROTORCV 20 /* receive from below */
|
||||
#define PRU_PROTOSEND 21 /* send to below */
|
||||
/* end for protocol's internal use */
|
||||
#define PRU_SEND_EOF 22 /* send and close */
|
||||
#define PRU_NREQ 22
|
||||
|
||||
#ifdef PRUREQUESTS
|
||||
char *prurequests[] = {
|
||||
"ATTACH", "DETACH", "BIND", "LISTEN",
|
||||
"CONNECT", "ACCEPT", "DISCONNECT", "SHUTDOWN",
|
||||
"RCVD", "SEND", "ABORT", "CONTROL",
|
||||
"SENSE", "RCVOOB", "SENDOOB", "SOCKADDR",
|
||||
"PEERADDR", "CONNECT2", "FASTTIMO", "SLOWTIMO",
|
||||
"PROTORCV", "PROTOSEND",
|
||||
"SEND_EOF",
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef _WRS_KERNEL /* users shouldn't see this decl */
|
||||
|
||||
struct stat;
|
||||
struct ucred;
|
||||
struct uio;
|
||||
|
||||
/*
|
||||
* If the ordering here looks odd, that's because it's alphabetical.
|
||||
* Having this structure separated out from the main protoswitch is allegedly
|
||||
* a big (12 cycles per call) lose on high-end CPUs. We will eventually
|
||||
* migrate this stuff back into the main structure.
|
||||
*/
|
||||
struct pr_usrreqs {
|
||||
int (*pru_abort) __P((struct socket *so));
|
||||
int (*pru_accept) __P((struct socket *so, struct sockaddr **nam));
|
||||
int (*pru_attach) __P((struct socket *so, int proto,
|
||||
struct proc *p));
|
||||
int (*pru_bind) __P((struct socket *so, struct sockaddr *nam,
|
||||
struct proc *p));
|
||||
int (*pru_connect) __P((struct socket *so, struct sockaddr *nam,
|
||||
struct proc *p));
|
||||
int (*pru_connect2) __P((struct socket *so1, struct socket *so2));
|
||||
int (*pru_control) __P((struct socket *so, u_long cmd, caddr_t data,
|
||||
void *ifp, struct proc *p));
|
||||
int (*pru_detach) __P((struct socket *so));
|
||||
int (*pru_disconnect) __P((struct socket *so));
|
||||
int (*pru_listen) __P((struct socket *so, struct proc *p));
|
||||
int (*pru_peeraddr) __P((struct socket *so,
|
||||
struct sockaddr **nam));
|
||||
int (*pru_rcvd) __P((struct socket *so, int flags));
|
||||
int (*pru_rcvoob) __P((struct socket *so, struct mbuf *m,
|
||||
int flags));
|
||||
int (*pru_send) __P((struct socket *so, int flags, struct mbuf *m,
|
||||
struct sockaddr *addr, struct mbuf *control,
|
||||
struct proc *p));
|
||||
#define PRUS_OOB 0x01
|
||||
#define PRUS_EOF 0x02
|
||||
#define PRUS_MORETOCOME 0x04
|
||||
#define PRUS_EOB 0x08
|
||||
#define PRUS_EXP 0x10
|
||||
|
||||
int (*pru_sense) __P((struct socket *so, struct stat *sb));
|
||||
int (*pru_shutdown) __P((struct socket *so));
|
||||
int (*pru_sockaddr) __P((struct socket *so,
|
||||
struct sockaddr **nam));
|
||||
|
||||
/*
|
||||
* These three added later, so they are out of order. They are used
|
||||
* for shortcutting (fast path input/output) in some protocols.
|
||||
* XXX - that's a lie, they are not implemented yet
|
||||
* Rather than calling sosend() etc. directly, calls are made
|
||||
* through these entry points. For protocols which still use
|
||||
* the generic code, these just point to those routines.
|
||||
*/
|
||||
int (*pru_sosend) __P((struct socket *so, struct sockaddr *addr,
|
||||
struct uio *uio, struct mbuf *top,
|
||||
struct mbuf *control, int flags,
|
||||
struct proc *p));
|
||||
int (*pru_soreceive) __P((struct socket *so,
|
||||
struct sockaddr **paddr,
|
||||
struct uio *uio, struct mbuf **mp0,
|
||||
struct mbuf **controlp, int *flagsp));
|
||||
int (*pru_sopoll) __P((struct socket *so, int events,
|
||||
struct ucred *cred, struct proc *p));
|
||||
};
|
||||
|
||||
#endif /* _WRS_KERNEL */
|
||||
|
||||
/*
|
||||
* The arguments to the ctlinput routine are
|
||||
* (*protosw[].pr_ctlinput)(cmd, sa, arg);
|
||||
* where cmd is one of the commands below, sa is a pointer to a sockaddr,
|
||||
* and arg is a `void *' argument used within a protocol family.
|
||||
*/
|
||||
#define PRC_IFDOWN 0 /* interface transition */
|
||||
#define PRC_ROUTEDEAD 1 /* select new route if possible ??? */
|
||||
#define PRC_IFUP 2 /* interface has come back up */
|
||||
#define PRC_QUENCH2 3 /* DEC congestion bit says slow down */
|
||||
#define PRC_QUENCH 4 /* some one said to slow down */
|
||||
#define PRC_MSGSIZE 5 /* message size forced drop */
|
||||
#define PRC_HOSTDEAD 6 /* host appears to be down */
|
||||
#define PRC_HOSTUNREACH 7 /* deprecated (use PRC_UNREACH_HOST) */
|
||||
#define PRC_UNREACH_NET 8 /* no route to network */
|
||||
#define PRC_UNREACH_HOST 9 /* no route to host */
|
||||
#define PRC_UNREACH_PROTOCOL 10 /* dst says bad protocol */
|
||||
#define PRC_UNREACH_PORT 11 /* bad port # */
|
||||
/* was PRC_UNREACH_NEEDFRAG 12 (use PRC_MSGSIZE) */
|
||||
#define PRC_UNREACH_SRCFAIL 13 /* source route failed */
|
||||
#define PRC_REDIRECT_NET 14 /* net routing redirect */
|
||||
#define PRC_REDIRECT_HOST 15 /* host routing redirect */
|
||||
#define PRC_REDIRECT_TOSNET 16 /* redirect for type of service & net */
|
||||
#define PRC_REDIRECT_TOSHOST 17 /* redirect for tos & host */
|
||||
#define PRC_TIMXCEED_INTRANS 18 /* packet lifetime expired in transit */
|
||||
#define PRC_TIMXCEED_REASS 19 /* lifetime expired on reass q */
|
||||
#define PRC_PARAMPROB 20 /* header incorrect */
|
||||
#define PRC_UNREACH_ADMIN_PROHIB 21 /* packet administrativly prohibited */
|
||||
|
||||
#define PRC_NCMDS 22
|
||||
|
||||
#define PRC_IS_REDIRECT(cmd) \
|
||||
((cmd) >= PRC_REDIRECT_NET && (cmd) <= PRC_REDIRECT_TOSHOST)
|
||||
|
||||
#ifdef PRCREQUESTS
|
||||
char *prcrequests[] = {
|
||||
"IFDOWN", "ROUTEDEAD", "IFUP", "DEC-BIT-QUENCH2",
|
||||
"QUENCH", "MSGSIZE", "HOSTDEAD", "#7",
|
||||
"NET-UNREACH", "HOST-UNREACH", "PROTO-UNREACH", "PORT-UNREACH",
|
||||
"#12", "SRCFAIL-UNREACH", "NET-REDIRECT", "HOST-REDIRECT",
|
||||
"TOSNET-REDIRECT", "TOSHOST-REDIRECT", "TX-INTRANS", "TX-REASS",
|
||||
"PARAMPROB", "ADMIN-UNREACH"
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The arguments to ctloutput are:
|
||||
* (*protosw[].pr_ctloutput)(req, so, level, optname, optval, p);
|
||||
* req is one of the actions listed below, so is a (struct socket *),
|
||||
* level is an indication of which protocol layer the option is intended.
|
||||
* optname is a protocol dependent socket option request,
|
||||
* optval is a pointer to a mbuf-chain pointer, for value-return results.
|
||||
* The protocol is responsible for disposal of the mbuf chain *optval
|
||||
* if supplied,
|
||||
* the caller is responsible for any space held by *optval, when returned.
|
||||
* A non-zero return from usrreq gives an
|
||||
* UNIX error number which should be passed to higher level software.
|
||||
*/
|
||||
#define PRCO_GETOPT 0
|
||||
#define PRCO_SETOPT 1
|
||||
|
||||
#define PRCO_NCMDS 2
|
||||
|
||||
#ifdef PRCOREQUESTS
|
||||
char *prcorequests[] = {
|
||||
"GETOPT", "SETOPT",
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,237 @@
|
||||
/* route.h - routing table */
|
||||
|
||||
/* Copyright 2001-2005 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)route.h 8.4 (Berkeley) 1/9/95
|
||||
* $FreeBSD: src/sys/net/route.h,v 1.36.2.5 2002/02/01 11:48:01 ru Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
02d,09jan12,h_x Move extern "C" after last header file include.
|
||||
02c,25oct06,kch Removed route structure as well as unsupported members from
|
||||
rt_metrics.
|
||||
02b,04oct06,kch Updated rt_msghdr structure for IPNet integration.
|
||||
02a,05sep06,kch Cleanup for IPNet integration.
|
||||
01z,19may05,rp added RTM_ADDRINFO
|
||||
01y,01mar05,niq Include in6.h
|
||||
01x,24feb05,spm removed unneeded route format storage (SPR #100995)
|
||||
01w,24feb05,spm performance updates and code cleanup (SPR #100995)
|
||||
01v,08feb05,vvv _KERNEL cleanup
|
||||
01u,17sep04,niq Scale out routing sockets
|
||||
01t,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE
|
||||
01s,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver
|
||||
/main/vdt/base6_itn5_networking-int/2)
|
||||
01r,06dec03,niq Add the RTF_PRIMARY flag
|
||||
01q,24nov03,vvv updated for RTP support
|
||||
01p,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
01o,10nov03,cdw Rebase from base6 iteration 1 view
|
||||
01n,04nov03,rlm Ran batch header path update for header re-org.
|
||||
01m,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
01l,27sep03,vvv moved RTFREE out of #ifdef _KERNEL
|
||||
01k,23sep03,asr Moved the #include <route/ipRouteLib.h> outside of #ifdef _KERNEL
|
||||
01j,06aug03,niq Merge from Accordion into Base6 Iteration 1 branch
|
||||
01i,10jun03,vvv include netVersion.h
|
||||
01h,01feb03,pas merge from FreeBSD 4.7 - added rt_getifa(),
|
||||
rt_ifannouncemsg(), rtrequest1()
|
||||
01g,05sep02,hsh add cplusplus protection
|
||||
01f,16may02,ant field rmx_filler[4] in the struct rt_metrics expand to
|
||||
rmx_filler[5]. New definitions rt_mod and RTF_MGMT
|
||||
01e,11mar02,ham reverted previous checkin 01d
|
||||
01d,27feb02,nee extending the rt_metrics for rip
|
||||
01c,02feb02,ham changed for tornado build.
|
||||
01b,19dec01,nee Adding multipath capability
|
||||
01a,08sep01,qli 1st round of porting
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NET_ROUTE_H_
|
||||
#define _NET_ROUTE_H_
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netVersion.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Kernel resident routing tables.
|
||||
*
|
||||
* The routing tables are initialized when interface addresses
|
||||
* are set by making entries for all directly connected interfaces.
|
||||
*/
|
||||
|
||||
/*
|
||||
* We distinguish between routes to hosts and routes to networks,
|
||||
* preferring the former if available. For each route we infer
|
||||
* the interface to use from the gateway address supplied when
|
||||
* the route was entered. Routes that forward packets through
|
||||
* gateways are marked so that the output routines know to address the
|
||||
* gateway rather than the ultimate destination.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Following structure necessary for 4.3 compatibility;
|
||||
* We should eventually move it to a compat file.
|
||||
*/
|
||||
struct ortentry {
|
||||
struct sockaddr ort_dst; /* key */
|
||||
struct sockaddr ort_gateway; /* value */
|
||||
short ort_flags; /* up/down?, host/net */
|
||||
};
|
||||
|
||||
/*
|
||||
* These numbers are used by reliable protocols for determining
|
||||
* retransmission behavior and are included in the routing structure.
|
||||
*/
|
||||
struct rt_metrics {
|
||||
u_long rmx_mtu; /* MTU for this path */
|
||||
u_long rmx_hopcount; /* max hops expected */
|
||||
u_long rmx_expire; /* lifetime for route, e.g. redirect */
|
||||
u_long rmx_rtt; /* estimated round trip time */
|
||||
u_long rmx_rttvar; /* estimated rtt variance */
|
||||
};
|
||||
|
||||
/*
|
||||
* 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))
|
||||
|
||||
/*
|
||||
* XXX kernel function pointer `rt_output' is visible to applications.
|
||||
*/
|
||||
|
||||
/* Values for rt_flags */
|
||||
#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 link layer (e.g. ARP)*/
|
||||
#define RTF_STATIC 0x800 /* manually added */
|
||||
#define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates)*/
|
||||
#define RTF_LOCAL 0x2000 /* route represents a local address */
|
||||
#define RTF_PROTO2 0x4000 /* protocol specific routing flag */
|
||||
#define RTF_PROTO1 0x8000 /* protocol specific routing flag */
|
||||
#define RTF_PREF 0x10000 /* Add route first, no ECMP */
|
||||
#define RTF_SRCADDR 0x20000 /* The gateway field specifies the default source address */
|
||||
#define RTF_MBINDING 0x40000 /* This route is part of multiple binding */
|
||||
#define RTF_SKIP 0x80000 /* Treat this route as a routing lookup failure */
|
||||
|
||||
/*
|
||||
* Structures for routing messages.
|
||||
*/
|
||||
struct rt_msghdr {
|
||||
u_short rtm_msglen; /* to skip over non-understood messages */
|
||||
u_char rtm_version; /* future binary compatibility */
|
||||
u_char rtm_type; /* message type */
|
||||
u_long rtm_index; /* index for associated ifp */
|
||||
int rtm_flags; /* flags, incl. kern & message, e.g. DONE */
|
||||
int rtm_addrs; /* bitmask identifying sockaddrs in msg */
|
||||
pid_t rtm_pid; /* identify sender */
|
||||
int rtm_seq; /* for sender to identify action */
|
||||
int rtm_errno; /* why failed */
|
||||
int rtm_use; /* from rtentry */
|
||||
u_long rtm_inits; /* which metrics we are initializing */
|
||||
u_long rtm_table; /* Route table index (IPCOM_ROUTE_TABLE_DEFAULT = default) */
|
||||
struct rt_metrics rtm_rmx; /* metrics themselves */
|
||||
};
|
||||
|
||||
/*
|
||||
* Message types. The message numbers should be continous as their
|
||||
* values are used as array indices
|
||||
*/
|
||||
#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 RTM_IFANNOUNCE 0x10 /* iface arrival/departure */
|
||||
|
||||
/* IPNet extension for Virtual Router */
|
||||
#define RTM_NEWVR 0xf1 /* TF1 Add a new virtual router */
|
||||
#define RTM_DELVR 0xf2 /* TF1 Delete a virtual router, the default (0)
|
||||
route table cannot be remmoved */
|
||||
|
||||
/*
|
||||
* Bitmask values for rtm_addrs.
|
||||
*/
|
||||
#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 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _NET_ROUTE_H_ */
|
||||
@@ -0,0 +1,357 @@
|
||||
/* socketvar.h - internal socket structures and definitions */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2007 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)socketvar.h 8.3 (Berkeley) 2/19/95
|
||||
* $FreeBSD: src/sys/sys/socketvar.h,v 1.46.2.9 2002/08/14 22:23:10 dg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
02j,10jul07,ebh Remove socketvar refcount for SMP as it is not used
|
||||
02i,27dec06,wap Add socketvar refcount for SMP
|
||||
02h,20dec06,kch Added so_bkendaux member to socket structure to support
|
||||
backend auxiliary data. Also removes the obsolete socket
|
||||
vlan members from socket structure.
|
||||
02g,28sep06,kch Cleanup unsupported prototypes for IPNet integration.
|
||||
02f,09jan06,hya Added soo_stat().
|
||||
02e,15sep05,kch Added so_vlan_options to socket structure. Modified
|
||||
SO_VLAN_ADD() macro to use the so_vlan_options (SPR #112513).
|
||||
02d,23aug05,kch Keep the vlan in m_pkthdr in host byte order.
|
||||
02c,09aug05,kch Added so_vlan to socket structure.
|
||||
02b,27feb05,dlk Make so_linger an unsigned short; part of linger time-out
|
||||
support.
|
||||
02a,09feb05,dlk Embed socket semaphores in struct socket. Remove
|
||||
excess semaphores. Added unixIoctlMemValidate() routine.
|
||||
01z,07feb05,vvv _KERNEL cleanup
|
||||
01y,02feb05,vvv replaced _WRS_KERNEL with _KERNEL to fix build error
|
||||
01x,24jan05,dlk Remove sb_sel member of struct sockbuf; use SB_SEL flag
|
||||
(SPR #105576).
|
||||
01x,14jan05,vvv osdep.h cleanup
|
||||
01w,19sep04,ann removed usage of the SELECT_LIST macro defined in osdep.h.
|
||||
01v,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE
|
||||
01u,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver
|
||||
/main/vdt/base6_itn5_networking-int/1)
|
||||
01t,07jan04,ann fixed sblock definition (SPR #92509)
|
||||
01s,02jan04,vvv added pSoConnTimo field in socket structure
|
||||
01r,08dec03,vvv updated based on inspection comments
|
||||
01q,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
01p,17nov03,nee Added socket backend table pointer
|
||||
01o,05nov03,cdw Removal of unnecessary _KERNEL guards.
|
||||
01n,04nov03,rlm Ran batch header path update for header re-org.
|
||||
01m,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
01l,24oct03,cdw update include statements post header re-org.
|
||||
01k,06aug03,nee Accordion Base6 merge from ACCORDION_BASE6_MERGE_BASELINE
|
||||
label
|
||||
01j,09may03,vvv included semLib.h and selectLib.h
|
||||
01i,01feb03,pas merge from FreeBSD 4.7 - added sf_buf functions
|
||||
01h,06sep02,hsh add c++ protection
|
||||
01g,02feb02,ham changed for tornado build.
|
||||
01f,13dec01,ann enabling the xsockets for sysctl
|
||||
01e,29oct01,ann fixing bugs from the test mode
|
||||
01d,12sep01,ann changing the sbfree macro based on new buffer library
|
||||
01c,24aug01,ann changing the path for protosw.h
|
||||
01b,10aug01,ann more porting stuff
|
||||
01a,02aug01,ann performed the WRS-port from FreeBSD 4.3 v 1.46.2.5
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _SYS_SOCKETVAR_H_
|
||||
#define _SYS_SOCKETVAR_H_
|
||||
|
||||
#include <net/protosw.h>
|
||||
#include <sys/queue.h>
|
||||
#include <semLib.h>
|
||||
#include <selectLib.h>
|
||||
#include <sockFunc.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Kernel structure per socket.
|
||||
* Contains send and receive buffer queues,
|
||||
* handle on protocol and pointer to protocol
|
||||
* private data and error information.
|
||||
*/
|
||||
typedef u_quad_t so_gen_t;
|
||||
|
||||
/*
|
||||
* WRS-port
|
||||
* - if 0'd so_zone, and the accept filter members
|
||||
*/
|
||||
|
||||
#ifdef _WRS_KERNEL
|
||||
struct socket {
|
||||
struct sockFunc *pSockFuncTbl; /* socket backend function table */
|
||||
short so_type; /* generic type, see socket.h */
|
||||
short so_options; /* from socket call, see socket.h */
|
||||
u_short so_linger; /* time to linger while closing */
|
||||
short so_state; /* internal state flags SS_*, below */
|
||||
caddr_t so_pcb; /* protocol control block */
|
||||
struct protosw *so_proto; /* protocol handle */
|
||||
|
||||
/*
|
||||
* Variables for connection queuing.
|
||||
* Socket where accepts occur is so_head in all subsidiary sockets.
|
||||
* If so_head is 0, socket is not related to an accept.
|
||||
* For head socket so_incomp queues partially completed connections,
|
||||
* while so_comp is a queue of connections ready to be accepted.
|
||||
* If a connection is aborted and it has so_head set, then
|
||||
* it has to be pulled out of either so_incomp or so_comp.
|
||||
* We allow connections to queue up based on current queue lengths
|
||||
* and limit on number of queued connections for this socket.
|
||||
*/
|
||||
struct socket *so_head; /* back pointer to accept socket */
|
||||
TAILQ_HEAD(, socket) so_incomp; /* queue of partial unaccepted connections */
|
||||
TAILQ_HEAD(, socket) so_comp; /* queue of complete unaccepted connections */
|
||||
TAILQ_ENTRY(socket) so_list; /* list of unaccepted connections */
|
||||
short so_qlen; /* number of unaccepted connections */
|
||||
short so_incqlen; /* number of unaccepted incomplete
|
||||
connections */
|
||||
short so_qlimit; /* max number queued connections */
|
||||
short so_timeo; /* connection timeout */
|
||||
u_short so_error; /* error affecting connection */
|
||||
u_long so_oobmark; /* chars to oob mark */
|
||||
|
||||
short so_pgrp; /* WRS extension for ASYNC oper */
|
||||
int so_fd; /* WRS extension for storing FD */
|
||||
|
||||
SEL_WAKEUP_LIST so_selWakeupList; /* WRS extension for select */
|
||||
|
||||
/*
|
||||
* Variables for socket buffering.
|
||||
*/
|
||||
struct sockbuf {
|
||||
u_long sb_cc; /* actual chars in buffer */
|
||||
u_long sb_hiwat; /* max actual char count */
|
||||
u_long sb_mbcnt; /* chars of mbufs used */
|
||||
u_long sb_mbmax; /* max chars of mbufs to use */
|
||||
long sb_lowat; /* low water mark */
|
||||
struct mbuf *sb_mb; /* the mbuf chain */
|
||||
|
||||
short sb_flags; /* flags, see below */
|
||||
short sb_timeo; /* timeout for read/write */
|
||||
u_long sb_selCount;
|
||||
|
||||
SEMAPHORE sb_Sem; /* WRS extension for sb semaphore */
|
||||
} so_rcv, so_snd;
|
||||
#define SB_MAX (256*1024) /* default for max chars in sockbuf */
|
||||
#define SB_LOCK 0x01 /* lock on data queue */
|
||||
#define SB_WANT 0x02 /* someone is waiting to lock */
|
||||
#define SB_WAIT 0x04 /* someone is waiting for data/space */
|
||||
#define SB_SEL 0x08 /* someone is selecting */
|
||||
#define SB_ASYNC 0x10 /* ASYNC I/O, need signals */
|
||||
#define SB_UPCALL 0x20 /* someone wants an upcall */
|
||||
#define SB_NOINTR 0x40 /* operations not interruptible */
|
||||
#define SB_AIO 0x80 /* AIO operations queued */
|
||||
#define SB_KNOTE 0x100 /* kernel note attached */
|
||||
|
||||
void (*so_upcall) __P((struct socket *, void *, int));
|
||||
void *so_upcallarg;
|
||||
|
||||
/* NB: generation count must not be first; easiest to make it last. */
|
||||
so_gen_t _so_gencnt; /* generation count */
|
||||
void *so_emuldata; /* private data for emulators */
|
||||
|
||||
int connTimeo; /* connection establishment timeout */
|
||||
|
||||
void *so_bkendaux; /* socket backend auxiliary data */
|
||||
};
|
||||
#endif /* _WRS_KERNEL */
|
||||
|
||||
/*
|
||||
* Socket state bits.
|
||||
*/
|
||||
#define SS_NOFDREF 0x0001 /* no file table ref any more */
|
||||
#define SS_ISCONNECTED 0x0002 /* socket connected to a peer */
|
||||
#define SS_ISCONNECTING 0x0004 /* in process of connecting to peer */
|
||||
#define SS_ISDISCONNECTING 0x0008 /* in process of disconnecting */
|
||||
#define SS_CANTSENDMORE 0x0010 /* can't send more data to peer */
|
||||
#define SS_CANTRCVMORE 0x0020 /* can't receive more data from peer */
|
||||
#define SS_RCVATMARK 0x0040 /* at mark on input */
|
||||
|
||||
#define SS_PRIV 0x0080 /* privileged for broadcast, raw... */
|
||||
|
||||
#define SS_NBIO 0x0100 /* non-blocking ops */
|
||||
#define SS_ASYNC 0x0200 /* async i/o notify */
|
||||
#define SS_ISCONFIRMING 0x0400 /* deciding to accept connection req */
|
||||
|
||||
#define SS_INCOMP 0x0800 /* unaccepted, incomplete connection */
|
||||
#define SS_COMP 0x1000 /* unaccepted, complete connection */
|
||||
#define SS_ISDISCONNECTED 0x2000 /* socket disconnected from peer */
|
||||
|
||||
|
||||
/*
|
||||
* Externalized form of struct socket used by the sysctl(3) interface.
|
||||
*/
|
||||
struct xsocket {
|
||||
size_t xso_len; /* length of this structure */
|
||||
struct socket *xso_so; /* makes a convenient handle sometimes */
|
||||
short so_type;
|
||||
short so_options;
|
||||
u_short so_linger;
|
||||
short so_state;
|
||||
caddr_t so_pcb; /* another convenient handle */
|
||||
int xso_protocol;
|
||||
int xso_family;
|
||||
short so_qlen;
|
||||
short so_incqlen;
|
||||
short so_qlimit;
|
||||
short so_timeo;
|
||||
u_short so_error;
|
||||
u_long so_oobmark;
|
||||
struct xsockbuf {
|
||||
u_long sb_cc;
|
||||
u_long sb_hiwat;
|
||||
u_long sb_mbcnt;
|
||||
u_long sb_mbmax;
|
||||
long sb_lowat;
|
||||
short sb_flags;
|
||||
short sb_timeo;
|
||||
} so_rcv, so_snd;
|
||||
uid_t so_uid; /* XXX */
|
||||
};
|
||||
|
||||
/*
|
||||
* Macros for sockets and socket buffering.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Do we need to notify the other side when I/O is possible?
|
||||
*/
|
||||
#define sb_notify(sb) (((sb)->sb_flags & (SB_WAIT | SB_SEL | SB_ASYNC | \
|
||||
SB_UPCALL | SB_AIO | SB_KNOTE)) != 0)
|
||||
|
||||
/*
|
||||
* How much space is there in a socket buffer (so->so_snd or so->so_rcv)?
|
||||
* This is problematical if the fields are unsigned, as the space might
|
||||
* still be negative (cc > hiwat or mbcnt > mbmax). Should detect
|
||||
* overflow and return 0. Should use "lmin" but it doesn't exist now.
|
||||
*/
|
||||
#define sbspace(sb) \
|
||||
((long) imin((int)((sb)->sb_hiwat - (sb)->sb_cc), \
|
||||
(int)((sb)->sb_mbmax - (sb)->sb_mbcnt)))
|
||||
|
||||
/* do we have to send all at once on a socket? */
|
||||
#define sosendallatonce(so) \
|
||||
((so)->so_proto->pr_flags & PR_ATOMIC)
|
||||
|
||||
/* can we read something from so? */
|
||||
#define soreadable(so) \
|
||||
((so)->so_rcv.sb_cc >= (so)->so_rcv.sb_lowat || \
|
||||
((so)->so_state & SS_CANTRCVMORE) || \
|
||||
(so)->so_comp.tqh_first || (so)->so_error)
|
||||
|
||||
/* can we write something to so? */
|
||||
#define sowriteable(so) \
|
||||
((sbspace(&(so)->so_snd) >= (so)->so_snd.sb_lowat && \
|
||||
(((so)->so_state&SS_ISCONNECTED) || \
|
||||
((so)->so_proto->pr_flags&PR_CONNREQUIRED)==0)) || \
|
||||
((so)->so_state & SS_CANTSENDMORE) || \
|
||||
(so)->so_error)
|
||||
|
||||
/* adjust counters in sb reflecting allocation of m */
|
||||
#define sballoc(sb, m) { \
|
||||
(sb)->sb_cc += (m)->m_len; \
|
||||
(sb)->sb_mbcnt += MSIZE; \
|
||||
if ((m)->m_flags & M_EXT) \
|
||||
(sb)->sb_mbcnt += (m)->m_extSize; \
|
||||
}
|
||||
|
||||
/* adjust counters in sb reflecting freeing of m */
|
||||
#define sbfree(sb, m) { \
|
||||
(sb)->sb_cc -= (m)->m_len; \
|
||||
(sb)->sb_mbcnt -= MSIZE; \
|
||||
if ((m)->m_flags & M_EXT) \
|
||||
(sb)->sb_mbcnt -= (m)->m_extSize; \
|
||||
}
|
||||
|
||||
#ifdef _WRS_KERNEL
|
||||
|
||||
/*
|
||||
* Macro to add the socket-based VLAN to the m_pkthdr. This is in the
|
||||
* _WRS_KERNEL section because it will never be used by user code.
|
||||
*/
|
||||
#ifdef SOCKET_VLAN
|
||||
/*
|
||||
* Keep the vlan in the m_pkthdr in host byte order until it needs to be
|
||||
* put into the packet (by the MUX-L2 egress code).
|
||||
*/
|
||||
#define SO_VLAN_ADD(m, so) \
|
||||
if ((so)->so_options & SO_VLAN) \
|
||||
{ \
|
||||
(m)->m_pkthdr.vlan = (so)->so_vlan; \
|
||||
(m)->m_pkthdr.csum_flags |= (so)->so_vlan_options; \
|
||||
}
|
||||
#endif /* SOCKET_VLAN */
|
||||
|
||||
/*
|
||||
* Argument structure for sosetopt et seq. This is in the _WRS_KERNEL
|
||||
* section because it will never be visible to user code.
|
||||
*/
|
||||
|
||||
enum sopt_dir { SOPT_GET, SOPT_SET };
|
||||
struct sockopt {
|
||||
enum sopt_dir sopt_dir; /* is this a get or a set? */
|
||||
int sopt_level; /* second arg of [gs]etsockopt */
|
||||
int sopt_name; /* third arg of [gs]etsockopt */
|
||||
void *sopt_val; /* fourth arg of [gs]etsockopt */
|
||||
size_t sopt_valsize; /* (almost) fifth arg of [gs]etsockopt */
|
||||
struct proc *sopt_p; /* calling process or null if kernel */
|
||||
};
|
||||
|
||||
struct sf_buf {
|
||||
SLIST_ENTRY(sf_buf) free_list; /* list of free buffer slots */
|
||||
int refcnt; /* reference count */
|
||||
};
|
||||
|
||||
extern STATUS unixIoctlMemValidate (unsigned int cmd, const void * pData);
|
||||
|
||||
#endif /* _WRS_KERNEL */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_SYS_SOCKETVAR_H_ */
|
||||
@@ -0,0 +1,107 @@
|
||||
/* systm.h */
|
||||
|
||||
/* Copyright 2001-2005 Wind River Systems, Inc. */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1982, 1988, 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
* (c) UNIX System Laboratories, Inc.
|
||||
* All or some portions of this file are derived from material licensed
|
||||
* to the University of California by American Telephone and Telegraph
|
||||
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
* the permission of UNIX System Laboratories, Inc.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @(#)systm.h 8.7 (Berkeley) 3/29/95
|
||||
* $FreeBSD: src/sys/sys/systm.h,v 1.111.2.5 2001/01/16 12:26:21 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01u,09jan12,h_x Move extern "C" after last header file include.
|
||||
01t,11apr05,sar Use gtfTimeout and gtfUntimeout directly instead of via
|
||||
macros and replace global tm with gtfTimerMangaerCB
|
||||
Removed timeout and untimeout.
|
||||
01s,06apr05,vvv restored copyin/copyout to macros to fix warnings
|
||||
(SPR #106982)
|
||||
01r,09feb05,sar Move gtf include files per GTF code inspection of 10/26/2004
|
||||
01q,07feb05,vvv _KERNEL cleanup
|
||||
01p,17mar04,rp updated to build for 5.5
|
||||
01o,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
01n,05nov03,cdw Removal of unnecessary _KERNEL guards.
|
||||
01m,04nov03,rlm Ran batch header path update for header re-org.
|
||||
01l,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
01k,27oct03,cdw update include statements post header re-org.
|
||||
01j,02jul03,vvv added _KERNEL protection for copyin and copyout
|
||||
01i,14may03,vvv included taskLib.h
|
||||
01h,09may03,vvv included string.h
|
||||
01g,24apr03,syy Make copyin() and copyout() static to avoid duplicated
|
||||
symbols
|
||||
01f,18apr03,syy Fixed compiler warnings
|
||||
01e,10sep02,hsh add c++ protection
|
||||
01d,28mar02,ppp changing it for tornado build environment
|
||||
01c,17sep01,ppp adding the macro for lmin
|
||||
01b,13sep01,ann un commenting certain defines that will be needed
|
||||
01a,06jun01,deg ported.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _SYS_SYSTM_H_
|
||||
#define _SYS_SYSTM_H_
|
||||
|
||||
#include <string.h>
|
||||
#include <private/gtf_wrapper.h>
|
||||
|
||||
#include "taskLib.h"
|
||||
#include "semLib.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _WRS_KERNEL
|
||||
extern GTF_TIMER_MANAGER * gtfTimerManagerCB;
|
||||
|
||||
#define ovbcopy bcopy /* overlapped buffer copy */
|
||||
|
||||
#define copyout(from, to, len) (bcopy (from, to, len), OK)
|
||||
#define copyin(from, to, len) (bcopy (from, to, len), OK)
|
||||
|
||||
#define imin(a,b) (((a) < (b)) ? (a) : (b)) /* interger min */
|
||||
#define lmin(a,b) ((a) < (b) ? (a) : (b)) /* long min */
|
||||
|
||||
#endif /* _WRS_KERNEL */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_SYS_SYSTM_H_ */
|
||||
@@ -0,0 +1,128 @@
|
||||
/* uio.h - i/o vectors for reading and writing */
|
||||
|
||||
/* Copyright 2001-2006, 2009 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)uio.h 8.5 (Berkeley) 2/22/94
|
||||
* $FreeBSD: src/sys/sys/uio.h,v 1.11.2.1 2001/09/28 16:58:35 dillon Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01n,09jan12,h_x Move extern "C" after last header file include.
|
||||
01m,03jul09,zly LP64-bit support
|
||||
01l,06apr06,jlk SPR 119965. Changed uio->uio_offset to an off_t64.
|
||||
01k,15feb05,vvv include cdefs.h only in kernel
|
||||
01j,24jan05,vvv osdep.h cleanup
|
||||
01i,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE
|
||||
01h,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
01g,04nov03,rlm Ran batch header path update for header re-org.
|
||||
01f,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
01e,27oct03,cdw update include statements post header re-org.
|
||||
01d,01feb03,pas merge from FreeBSD 4.7 - added uio_yield()
|
||||
01c,06sep02,hsh add c++ protection
|
||||
01b,02feb02,ham changed for tornado build.
|
||||
01a,15aug01,ann ported to clarinet from FreeBSD 4.3 ver 1.11
|
||||
*/
|
||||
|
||||
#ifndef _SYS_UIO_H_
|
||||
#define _SYS_UIO_H_
|
||||
|
||||
#include <vxWorks.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* iov_base should be a void *.
|
||||
*/
|
||||
struct iovec {
|
||||
char *iov_base; /* Base address. */
|
||||
size_t iov_len; /* Length. */
|
||||
};
|
||||
|
||||
/*
|
||||
* Limits. Note, the maximum size of cluster in the network stack system
|
||||
* buffer pool may impose a more stringent limit than UIO_MAXIOV.
|
||||
*/
|
||||
#define UIO_MAXIOV 1024 /* max 1K of iov's */
|
||||
#define UIO_SMALLIOV 8 /* 8 on stack, else malloc */
|
||||
|
||||
#ifdef _WRS_KERNEL
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
enum uio_rw { UIO_READ, UIO_WRITE };
|
||||
|
||||
/* Segment flag values. */
|
||||
enum uio_seg {
|
||||
UIO_USERSPACE, /* from user data space */
|
||||
UIO_SYSSPACE, /* from system space */
|
||||
UIO_USERISPACE, /* from user I space */
|
||||
UIO_NOCOPY /* don't copy, already in object */
|
||||
};
|
||||
|
||||
struct uio {
|
||||
struct iovec *uio_iov;
|
||||
int uio_iovcnt;
|
||||
off_t64 uio_offset;
|
||||
size_t uio_resid;
|
||||
enum uio_seg uio_segflg;
|
||||
enum uio_rw uio_rw;
|
||||
struct proc *uio_procp;
|
||||
};
|
||||
|
||||
struct vm_object;
|
||||
|
||||
void uio_yield __P((void));
|
||||
|
||||
#if defined(RUNTIME_64BIT_NAME) /* FIXME */ || \
|
||||
(_WRS_VXWORKS_MAJOR >= 6 && _WRS_VXWORKS_MINOR >= 9)
|
||||
int uiomove __P((caddr_t, size_t, struct uio *));
|
||||
#else
|
||||
int uiomove __P((caddr_t, int, struct uio *));
|
||||
#endif
|
||||
|
||||
int uiomoveco __P((caddr_t, int, struct uio *, struct vm_object *));
|
||||
int uioread __P((int, struct uio *, struct vm_object *, int *));
|
||||
|
||||
#endif /* _WRS_KERNEL */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_SYS_UIO_H_ */
|
||||
@@ -0,0 +1,97 @@
|
||||
/* unixLib.h - UNIX kernel compatability library header file */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1984-2006 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01v,09jan12,h_x Move extern "C" after last header file include.
|
||||
01u,06sep06,kch Removed unsupported prototypes for IPNet integration.
|
||||
01t,19jun06,jpb Removed I960 check
|
||||
01s,26aug05,dlk Add section tags.
|
||||
01r,12jul05,kch Removed _netMalloc() and _netFree() prototypes.
|
||||
01q,07jul05,dlk Balance parenthesis in wakeup_one().
|
||||
01p,18may05,rp moved ppsratecheck from icmp6.c to unixLib
|
||||
01o,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev
|
||||
01n,23aug04,rp merged from COMP_WN_IPV6_BASE6_ITER5_TO_UNIFIED_PRE_MERGE
|
||||
01m,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE (ver
|
||||
/main/vdt/base6_itn5_networking-int/1)
|
||||
01l,03dec03,asr Fix compile errors after dinkum libc check-in
|
||||
01k,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
01j,05nov03,cdw Removal of unnecessary _KERNEL guards.
|
||||
01i,04nov03,rlm Ran batch header path update for header re-org.
|
||||
01h,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
01g,10jun03,vvv include netVersion.h
|
||||
01f,09may03,vvv included semLib.h and times.h
|
||||
01e,09oct01,hsh add phashinit routine
|
||||
01d,26sep01,qli chaning the prototype for "panic"
|
||||
01c,18sep01,ann adding the prototype of tvToTicks
|
||||
01b,05sep01,ham corrected microtime's prototype.
|
||||
01a,01sep01,ann ported to clarinet from AE1.1 version 01f,
|
||||
added the prototypes for microtime()
|
||||
*/
|
||||
|
||||
#ifndef __INCunixLibh
|
||||
#define __INCunixLibh
|
||||
|
||||
#include <netVersion.h>
|
||||
#ifdef _WRS_KERNEL
|
||||
#include <sys/times.h>
|
||||
#else
|
||||
#include <sys/time.h> /* For RTP, it is sys/time.h */
|
||||
#endif
|
||||
#include <semLib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MALLOC(space, cast, size, type, flags) { \
|
||||
(space) = (cast) netClusterGet (_pNetSysPool, \
|
||||
netClPoolIdGet (_pNetSysPool, \
|
||||
size, TRUE)); \
|
||||
}
|
||||
|
||||
#define FREE(addr, type) { \
|
||||
netClFree (_pNetSysPool, (unsigned char *) addr); \
|
||||
}
|
||||
|
||||
#define DATA_TO_MBLK(pBuf) \
|
||||
(*((struct mbuf **)((char *)(pBuf) - sizeof(struct mbuf **))))
|
||||
|
||||
/* Function declarations */
|
||||
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
|
||||
extern void panic(const char *, ...);
|
||||
|
||||
#else /* __STDC__ */
|
||||
|
||||
extern void panic ();
|
||||
|
||||
#endif /* __STDC__ */
|
||||
|
||||
/*
|
||||
* BSD defines wakeup() to wake up all tasks sleeping on
|
||||
* the specified channel. wakeup_one() wakes up a single process
|
||||
* (more or less). VxWorks' tsleep() and ksleep() have been modified to
|
||||
* give up splSemId and take the awaited semaphore atomically, which is
|
||||
* necessary whether semFlush() or semGive() is used.
|
||||
* Note, VxWorks has in the past incorrectly made wakeup() equivalent
|
||||
* to semGive() rather than semFlush().
|
||||
*/
|
||||
|
||||
#define wakeup(semId) ((void)semFlush((semId)))
|
||||
#define wakeup_one(semId) ((void)semGive((semId)))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCunixLibh */
|
||||
@@ -0,0 +1,76 @@
|
||||
/* ifconfig.h - interface configuation */
|
||||
|
||||
/* Copyright 2002 - 2006 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Peter Wemm.
|
||||
* 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 for the FreeBSD Project
|
||||
* by Peter Wemm.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* so there!
|
||||
*
|
||||
* $FreeBSD: src/sbin/ifconfig/ifconfig.h,v 1.5.2.2 2001/07/04 20:49:20 brooks Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01n,09jan12,h_x Move extern "C" after last header file include.
|
||||
01m,04oct06,kch Removed unsupported prefix prototype.
|
||||
01l,07sep05,kch Removed prototypes for vlan pseudo interface.
|
||||
01k,27aug05,kch Added setvlanpriority() prototype.
|
||||
01j,23aug05,dlk Fix compiler warning.
|
||||
01i,04aug05,kch Added ifconfig_vlan.c prototypes.
|
||||
01h,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
01g,05nov03,cdw Removal of unnecessary _KERNEL guards.
|
||||
01f,04nov03,rlm Ran batch header path update for header re-org.
|
||||
01e,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
01d,10jun03,vvv include netVersion.h
|
||||
01c,14may03,vvv added ifconfig()
|
||||
01b,29apr03,syy Added #ifdef's for inclusion and __cplusplus
|
||||
01a,23jan02,deg ported from FreeBSD
|
||||
*/
|
||||
|
||||
#ifndef __INCifconfigh
|
||||
#define __INCifconfigh
|
||||
|
||||
#include <netVersion.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int ifconfig (char *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! __INCifconfigh */
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/* netstat.h - network information display header file */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1984-2005 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute or otherwise make use of this software
|
||||
* may be licensed only pursuant to the terms of an applicable Wind River
|
||||
* license agreement. No license to Wind River intellectual property rights
|
||||
* is granted herein. All rights not licensed by Wind River are reserved
|
||||
* by Wind River.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01o,05sep06,kch Cleanup for IPNet integration.
|
||||
01n,29jun05,kch Added sctp_protopr() and sctp_stats() prototypes.
|
||||
01m,19apr05,rp merged from comp_wn_ipv6_mld_interim-dev
|
||||
01l,25feb05,niq merge mroute changes from comp_wn_ipv6_multicast_interim-dev
|
||||
branch (ver 1)
|
||||
01k,07feb05,vvv _KERNEL cleanup
|
||||
01j,20nov03,niq Remove copyright_wrs.h file inclusion
|
||||
01i,05nov03,cdw Removal of unnecessary _KERNEL guards.
|
||||
01h,04nov03,rlm Ran batch header path update for header re-org.
|
||||
01g,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
01f,10jun03,vvv include netVersion.h
|
||||
01e,11apr03,ijm fixed diab compiler warnings
|
||||
01d,03apr03,vvv modified for componentization (SPR #87352)
|
||||
01c,26sep02,ppp changing the return type for routepr from void to int
|
||||
01b,09apr02,ppp changing/ enabling a few prototypes; adding the prototype for
|
||||
netstat
|
||||
01a,02feb02,ppp ported from kame
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* 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.
|
||||
*
|
||||
* @(#)netstat.h 8.2 (Berkeley) 1/4/94
|
||||
* $FreeBSD: src/usr.bin/netstat/netstat.h,v 1.16.2.4 2001/08/10 09:07:09 ru Exp $
|
||||
*/
|
||||
|
||||
#ifndef __INCnetstath
|
||||
#define __INCnetstath
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _WRS_KERNEL
|
||||
extern int netstat (char * options);
|
||||
#endif /* _WRS_KERNEL*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __INCnetstath */
|
||||
@@ -0,0 +1,39 @@
|
||||
/* rtadvLib.h - Router Advertisement for IPv6 */
|
||||
|
||||
/* Copyright 1992-2003 Wind River Systems, Inc. */
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01f,09jan12,h_x Move extern "C" after last header file include.
|
||||
01e,05nov03,cdw Removal of unnecessary _KERNEL guards.
|
||||
01d,04nov03,rlm Ran batch header path update for header re-org.
|
||||
01c,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.
|
||||
01b,10jun03,vvv include netVersion.h
|
||||
01a,09Apr02,nee written.
|
||||
*/
|
||||
|
||||
#ifndef __INCrouteCmdh
|
||||
#define __INCrouteCmdh
|
||||
|
||||
#include <netVersion.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
|
||||
extern int routec (char *options);
|
||||
|
||||
#else /* __STDC__ */
|
||||
|
||||
extern int routec ();
|
||||
|
||||
#endif /* __STDC__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCrouteCmdh */
|
||||
Reference in New Issue
Block a user