New sources layout

Change-Id: Ic716f336b7071063997cf5b4dae6d50e0b4631e9
This commit is contained in:
2014-07-31 16:00:30 +02:00
parent 428aa25dc6
commit 433d6423c3
3138 changed files with 693 additions and 606 deletions
+15
View File
@@ -0,0 +1,15 @@
INCSDIR= /usr/include/net/gen
INCS+= arp_io.h dhcp.h ether.h \
eth_hdr.h eth_io.h icmp.h \
icmp_hdr.h if_ether.h inet.h \
in.h ip_hdr.h ip_io.h \
oneCsum.h psip_hdr.h psip_io.h \
rip.h route.h socket.h \
tcp.h tcp_hdr.h tcp_io.h \
udp.h udp_hdr.h udp_io.h \
udp_io_hdr.h vjhc.h
.include <bsd.kinc.mk>
+23
View File
@@ -0,0 +1,23 @@
/*
net/gen/arp_io.h
Created: Jan 2001 by Philip Homburg <philip@f-mnx.phicoh.com>
*/
typedef struct nwio_arp
{
int nwa_entno;
u32_t nwa_flags;
ipaddr_t nwa_ipaddr;
ether_addr_t nwa_ethaddr;
} nwio_arp_t;
#define NWAF_EMPTY 0
#define NWAF_INCOMPLETE 1
#define NWAF_DEAD 2
#define NWAF_PERM 4
#define NWAF_PUB 8
/*
* $PchId: arp_io.h,v 1.2 2004/08/03 11:01:59 philip Exp $
*/
+73
View File
@@ -0,0 +1,73 @@
/* net/gen/dhcp.h - DHCP packet format Author: Kees J. Bot
* 1 Dec 2000
*/
#ifndef __NET__GEN__DHCP_H__
#define __NET__GEN__DHCP_H__
typedef struct dhcp {
u8_t op; /* Message opcode/type. */
u8_t htype; /* Hardware address type. */
u8_t hlen; /* Hardware address length. */
u8_t hops; /* Hop count when relaying. */
u32_t xid; /* Transaction ID. */
u16_t secs; /* Seconds past since client began. */
u16_t flags; /* Flags. */
ipaddr_t ciaddr; /* Client IP address. */
ipaddr_t yiaddr; /* "Your" IP address. */
ipaddr_t siaddr; /* Boot server IP address. */
ipaddr_t giaddr; /* Relay agent (gateway) IP address. */
u8_t chaddr[16]; /* Client hardware address. */
u8_t sname[64]; /* Server host name. */
u8_t file[128]; /* Boot file. */
u32_t magic; /* Magic number. */
u8_t options[308]; /* Optional parameters. */
} dhcp_t;
/* DHCP operations and stuff: */
#define DHCP_BOOTREQUEST 1 /* Boot request message. */
#define DHCP_BOOTREPLY 2 /* Boot reply message. */
#define DHCP_HTYPE_ETH 1 /* Ethernet hardware type. */
#define DHCP_HLEN_ETH 6 /* Ethernet hardware address length. */
#define DHCP_FLAGS_BCAST 0x8000U /* Reply must be broadcast to client. */
/* "Magic" first four option bytes. */
#define DHCP_MAGIC htonl(0x63825363UL)
/* DHCP common tags: */
#define DHCP_TAG_NETMASK 1 /* Netmask. */
#define DHCP_TAG_GATEWAY 3 /* Gateway list. */
#define DHCP_TAG_DNS 6 /* DNS Nameserver list. */
#define DHCP_TAG_HOSTNAME 12 /* Host name. */
#define DHCP_TAG_DOMAIN 15 /* Domain. */
#define DHCP_TAG_IPMTU 26 /* Interface MTU. */
/* DHCP protocol tags: */
#define DHCP_TAG_REQIP 50 /* Request this IP. */
#define DHCP_TAG_LEASE 51 /* Lease time requested/offered. */
#define DHCP_TAG_OVERLOAD 52 /* Options continued in file/sname. */
#define DHCP_TAG_TYPE 53 /* DHCP message (values below). */
#define DHCP_TAG_SERVERID 54 /* Server identifier. */
#define DHCP_TAG_REQPAR 55 /* Parameters requested. */
#define DHCP_TAG_MESSAGE 56 /* Error message. */
#define DHCP_TAG_MAXDHCP 57 /* Max DHCP packet size. */
#define DHCP_TAG_RENEWAL 58 /* Time to go into renewal state. */
#define DHCP_TAG_REBINDING 59 /* Time to go into rebinding state. */
#define DHCP_TAG_CLASSID 60 /* Class identifier. */
#define DHCP_TAG_CLIENTID 61 /* Client identifier. */
/* DHCP messages: */
#define DHCP_DISCOVER 1 /* Locate available servers. */
#define DHCP_OFFER 2 /* Parameters offered to client. */
#define DHCP_REQUEST 3 /* (Re)request offered parameters. */
#define DHCP_DECLINE 4 /* Client declines offer. */
#define DHCP_ACK 5 /* Server acknowlegdes request. */
#define DHCP_NAK 6 /* Server denies request. */
#define DHCP_RELEASE 7 /* Client relinguishes address. */
#define DHCP_INFORM 8 /* Client requests just local config. */
void dhcp_init(dhcp_t *_dp);
int dhcp_settag(dhcp_t *_dp, int _tag, void *_data, size_t _len);
int dhcp_gettag(dhcp_t *_dp, int _searchtag, u8_t **_pdata, size_t *_plen);
#endif /* __NET__GEN__DHCP_H__ */
+17
View File
@@ -0,0 +1,17 @@
/*
server/ip/gen/eth_hdr.h
*/
#ifndef __SERVER__IP__GEN__ETH_HDR_H__
#define __SERVER__IP__GEN__ETH_HDR_H__
#include <net/if_ether.h>
typedef struct eth_hdr
{
ether_addr_t eh_dst;
ether_addr_t eh_src;
ether_type_t eh_proto;
} eth_hdr_t;
#endif /* __SERVER__IP__GEN__ETH_HDR_H__ */
+81
View File
@@ -0,0 +1,81 @@
/*
server/gen/ip/eth_io.h
*/
#ifndef __SERVER__IP__GEN__ETH_IO_H__
#define __SERVER__IP__GEN__ETH_IO_H__
#include <net/if_ether.h>
typedef struct nwio_ethopt
{
u32_t nweo_flags;
ether_addr_t nweo_multi, nweo_rem;
ether_type_t nweo_type;
} nwio_ethopt_t;
#define NWEO_NOFLAGS 0x0000L
#define NWEO_ACC_MASK 0x0003L
# define NWEO_EXCL 0x00000001L
# define NWEO_SHARED 0x00000002L
# define NWEO_COPY 0x00000003L
#define NWEO_LOC_MASK 0x0010L
# define NWEO_EN_LOC 0x00000010L
# define NWEO_DI_LOC 0x00100000L
#define NWEO_BROAD_MASK 0x0020L
# define NWEO_EN_BROAD 0x00000020L
# define NWEO_DI_BROAD 0x00200000L
#define NWEO_MULTI_MASK 0x0040L
# define NWEO_EN_MULTI 0x00000040L
# define NWEO_DI_MULTI 0x00400000L
#define NWEO_PROMISC_MASK 0x0080L
# define NWEO_EN_PROMISC 0x00000080L
# define NWEO_DI_PROMISC 0x00800000L
#define NWEO_REM_MASK 0x0100L
# define NWEO_REMSPEC 0x00000100L
# define NWEO_REMANY 0x01000000L
#define NWEO_TYPE_MASK 0x0200L
# define NWEO_TYPESPEC 0x00000200L
# define NWEO_TYPEANY 0x02000000L
#define NWEO_RW_MASK 0x1000L
# define NWEO_RWDATONLY 0x00001000L
# define NWEO_RWDATALL 0x10000000L
typedef struct eth_stat
{
unsigned long ets_recvErr, /* # receive errors */
ets_sendErr, /* # send error */
ets_OVW, /* # buffer overwrite warnings,
(packets arrive faster than
can be processed) */
ets_CRCerr, /* # crc errors of read */
ets_frameAll, /* # frames not alligned (# bits
not a mutiple of 8) */
ets_missedP, /* # packets missed due to too
slow packet processing */
ets_packetR, /* # packets received */
ets_packetT, /* # packets transmitted */
ets_transDef, /* # transmission defered (there
was a transmission of an
other station in progress */
ets_collision, /* # collissions */
ets_transAb, /* # transmissions aborted due
to accesive collisions */
ets_carrSense, /* # carrier sense lost */
ets_fifoUnder, /* # fifo underruns (processor
is too busy) */
ets_fifoOver, /* # fifo overruns (processor is
too busy) */
ets_CDheartbeat, /* # times unable to transmit
collision signal */
ets_OWC; /* # times out of window
collision */
} eth_stat_t;
typedef struct nwio_ethstat
{
ether_addr_t nwes_addr;
eth_stat_t nwes_stat;
} nwio_ethstat_t;
#endif /* __SERVER__IP__GEN__ETH_IO_H__ */
+29
View File
@@ -0,0 +1,29 @@
/*
server/ip/gen/ether.h
*/
#ifndef __SERVER__IP__GEN__ETHER_H__
#define __SERVER__IP__GEN__ETHER_H__
#define ETH_MIN_PACK_SIZE 60
#define ETH_MAX_PACK_SIZE 1514
#define ETH_MAX_PACK_SIZE_TAGGED 1518
#define ETH_HDR_SIZE 14
#define ETH_CRC_SIZE 4
typedef u16_t ether_type_t;
#define ETH_ARP_PROTO 0x806
#define ETH_IP_PROTO 0x800
#define ETH_VLAN_PROTO 0x8100
/* Tag Control Information field for VLAN and Priority tagging */
#define ETH_TCI_PRIO_MASK 0xe000
#define ETH_TCI_CFI 0x1000 /* Canonical Formal Indicator */
#define ETH_TCI_VLAN_MASK 0x0fff /* 12-bit vlan number */
#endif /* __SERVER__IP__GEN__ETHER_H__ */
/*
* $PchId: ether.h,v 1.6 2005/01/27 17:33:35 philip Exp $
*/
+49
View File
@@ -0,0 +1,49 @@
/*
server/ip/gen/icmp.h
*/
#ifndef __SERVER__IP__GEN__ICMP_H__
#define __SERVER__IP__GEN__ICMP_H__
#define ICMP_MIN_HDR_SIZE 4
#define ICMP_TYPE_ECHO_REPL 0
#define ICMP_TYPE_DST_UNRCH 3
# define ICMP_NET_UNRCH 0
# define ICMP_HOST_UNRCH 1
# define ICMP_PROTOCOL_UNRCH 2
# define ICMP_PORT_UNRCH 3
# define ICMP_FRAGM_AND_DF 4
# define ICMP_SOURCE_ROUTE_FAILED 5
#define ICMP_TYPE_SRC_QUENCH 4
#define ICMP_TYPE_REDIRECT 5
# define ICMP_REDIRECT_NET 0
# define ICMP_REDIRECT_HOST 1
# define ICMP_REDIRECT_TOS_AND_NET 2
# define ICMP_REDIRECT_TOS_AND_HOST 3
#define ICMP_TYPE_ECHO_REQ 8
#define ICMP_TYPE_ROUTER_ADVER 9
#define ICMP_TYPE_ROUTE_SOL 10
#define ICMP_TYPE_TIME_EXCEEDED 11
# define ICMP_TTL_EXC 0
# define ICMP_FRAG_REASSEM 1
#define ICMP_TYPE_PARAM_PROBLEM 12
#define ICMP_TYPE_TS_REQ 13
#define ICMP_TYPE_TS_REPL 14
#define ICMP_TYPE_INFO_REQ 15
#define ICMP_TYPE_INFO_REPL 16
/* Preferences for router advertisements. A router daemon installs itself
* as the default router in the router's interfaces by sending router
* advertisements to localhost with preference ICMP_RA_LOCAL_PREF.
*/
#define ICMP_RA_DEFAULT_PREF 0x00000000
#define ICMP_RA_INVAL_PREF 0x80000000
#define ICMP_RA_MAX_PREF 0x7fffffff
#define ICMP_RA_LOCAL_PREF 0x10000000
#endif /* __SERVER__IP__GEN__ICMP_H__ */
/*
* $PchId: icmp.h,v 1.6 2002/06/10 07:10:26 philip Exp $
*/
+62
View File
@@ -0,0 +1,62 @@
/*
server/ip/gen/icmp_hdr.h
*/
#ifndef __SERVER__IP__GEN__ICMP_HDR_H__
#define __SERVER__IP__GEN__ICMP_HDR_H__
typedef struct icmp_id_seq
{
u16_t iis_id, iis_seq;
} icmp_id_seq_t;
typedef struct icmp_ip_id
{
ip_hdr_t iii_hdr;
/* ip_hdr_options and 64 bytes of data */
} icmp_ip_id_t;
typedef struct icmp_ram /* RFC 1256 */
{
u8_t iram_na;
u8_t iram_aes;
u16_t iram_lt;
} icmp_ram_t;
typedef struct icmp_pp
{
u8_t ipp_ptr;
u8_t ipp_unused[3];
} icmp_pp_t;
typedef struct icmp_mtu /* RFC 1191 */
{
u16_t im_unused;
u16_t im_mtu;
} icmp_mtu_t;
typedef struct icmp_hdr
{
u8_t ih_type, ih_code;
u16_t ih_chksum;
union
{
u32_t ihh_unused;
icmp_id_seq_t ihh_idseq;
ipaddr_t ihh_gateway;
icmp_ram_t ihh_ram;
icmp_pp_t ihh_pp;
icmp_mtu_t ihh_mtu;
} ih_hun;
union
{
icmp_ip_id_t ihd_ipid;
u8_t uhd_data[1];
} ih_dun;
} icmp_hdr_t;
#endif /* __SERVER__IP__GEN__ICMP_HDR_H__ */
/*
* $PchId: icmp_hdr.h,v 1.5 2002/06/10 07:10:48 philip Exp $
*/
+1
View File
@@ -0,0 +1 @@
#include <net/if_ether.h>
+40
View File
@@ -0,0 +1,40 @@
/*
server/ip/gen/in.h
*/
#ifndef __SERVER__IP__GEN__IN_H__
#define __SERVER__IP__GEN__IN_H__
#include <net/gen/in.h>
#include <sys/types.h>
#define IP_MIN_HDR_SIZE 20
#define IP_MAX_HDR_SIZE 60 /* 15 * 4 */
#define IP_VERSION 4
#define IP_DEF_TTL 64
#define IP_MAX_TTL 255
#define IP_DEF_MTU 576
#define IP_MIN_MTU (IP_MAX_HDR_SIZE+8)
#define IP_MAX_PACKSIZE 40000
/* Note: this restriction is not part of the IP-protocol but
introduced by this implementation. */
#define IPPROTO_ICMP 1
#define IPPROTO_TCP 6
#define IPPROTO_UDP 17
#define IP_MC_ALL_SYSTEMS 0xE0000001 /* 224.0.0.1 */
typedef u32_t ipaddr_t;
typedef u8_t ipproto_t;
typedef struct ip_hdropt
{
u8_t iho_opt_siz;
u8_t iho_data[IP_MAX_HDR_SIZE-IP_MIN_HDR_SIZE];
} ip_hdropt_t;
#endif /* __SERVER__IP__GEN__IN_H__ */
/*
* $PchId: in.h,v 1.6 2002/06/10 07:11:15 philip Exp $
*/
+15
View File
@@ -0,0 +1,15 @@
/*
server/ip/gen/inet.h
*/
#ifndef __SERVER__IP__GEN__INET_H__
#define __SERVER__IP__GEN__INET_H__
#include <net/gen/in.h>
ipaddr_t inet_addr( const char *addr );
ipaddr_t inet_network( const char *addr );
char *inet_ntoa( ipaddr_t addr );
int inet_aton( const char *cp, ipaddr_t *pin );
#endif /* __SERVER__IP__GEN__INET_H__ */
+47
View File
@@ -0,0 +1,47 @@
/*
server/ip/gen/ip_hdr.h
*/
#ifndef __SERVER__IP__GEN__HDR_H__
#define __SERVER__IP__GEN__HDR_H__
typedef struct ip_hdr
{
u8_t ih_vers_ihl,
ih_tos;
u16_t ih_length,
ih_id,
ih_flags_fragoff;
u8_t ih_ttl,
ih_proto;
u16_t ih_hdr_chk;
ipaddr_t ih_src,
ih_dst;
} ip_hdr_t;
#define IH_IHL_MASK 0xf
#define IH_VERSION_MASK 0xf
#define IH_FRAGOFF_MASK 0x1fff
#define IH_MORE_FRAGS 0x2000
#define IH_DONT_FRAG 0x4000
#define IH_FLAGS_UNUSED 0x8000
#define IP_OPT_COPIED 0x80
#define IP_OPT_NUMBER 0x1f
#define IP_OPT_EOL 0x00 /* End of Options List, RFC-791 */
#define IP_OPT_NOP 0x01 /* No Operation, RFC-791 */
#define IP_OPT_RR 0x07 /* Record Route, RFC-791 */
#define IP_OPT_TS 0x44 /* Timestamp, RFC-791 */
#define IP_OPT_SEC 0x82 /* Security, RFC-1108 */
#define IP_OPT_LSRR 0x83 /* Loose Source Route, RFC-791 */
#define IP_OPT_SSRR 0x89 /* Strict Source Route, RFC-791 */
#define IP_OPT_RTRALT 0x94 /* Router Alert, RFC-2113 */
#define IP_OPT_RR_MIN 4
#endif /* __SERVER__IP__GEN__HDR_H__ */
/*
* $PchId: ip_hdr.h,v 1.5 2002/06/10 07:11:46 philip Exp $
*/
+68
View File
@@ -0,0 +1,68 @@
/*
server/ip/gen/ip_io.h
*/
#ifndef __SERVER__IP__GEN__IP_IO_H__
#define __SERVER__IP__GEN__IP_IO_H__
typedef struct nwio_ipconf2
{
u32_t nwic_flags;
ipaddr_t nwic_ipaddr;
ipaddr_t nwic_netmask;
} nwio_ipconf2_t;
typedef struct nwio_ipconf
{
u32_t nwic_flags;
ipaddr_t nwic_ipaddr;
ipaddr_t nwic_netmask;
u16_t nwic_mtu;
} nwio_ipconf_t;
#define NWIC_NOFLAGS 0x0
#define NWIC_FLAGS 0x7
# define NWIC_IPADDR_SET 0x1
# define NWIC_NETMASK_SET 0x2
# define NWIC_MTU_SET 0x4
typedef struct nwio_ipopt
{
u32_t nwio_flags;
ipaddr_t nwio_rem;
ip_hdropt_t nwio_hdropt;
u8_t nwio_tos;
u8_t nwio_ttl;
u8_t nwio_df;
ipproto_t nwio_proto;
} nwio_ipopt_t;
#define NWIO_NOFLAGS 0x0000l
#define NWIO_ACC_MASK 0x0003l
# define NWIO_EXCL 0x00000001l
# define NWIO_SHARED 0x00000002l
# define NWIO_COPY 0x00000003l
#define NWIO_LOC_MASK 0x0010l
# define NWIO_EN_LOC 0x00000010l
# define NWIO_DI_LOC 0x00100000l
#define NWIO_BROAD_MASK 0x0020l
# define NWIO_EN_BROAD 0x00000020l
# define NWIO_DI_BROAD 0x00200000l
#define NWIO_REM_MASK 0x0100l
# define NWIO_REMSPEC 0x00000100l
# define NWIO_REMANY 0x01000000l
#define NWIO_PROTO_MASK 0x0200l
# define NWIO_PROTOSPEC 0x00000200l
# define NWIO_PROTOANY 0x02000000l
#define NWIO_HDR_O_MASK 0x0400l
# define NWIO_HDR_O_SPEC 0x00000400l
# define NWIO_HDR_O_ANY 0x04000000l
#define NWIO_RW_MASK 0x1000l
# define NWIO_RWDATONLY 0x00001000l
# define NWIO_RWDATALL 0x10000000l
#endif /* __SERVER__IP__GEN__IP_IO_H__ */
/*
* $PchId: ip_io.h,v 1.5 2001/03/12 22:17:25 philip Exp $
*/
+10
View File
@@ -0,0 +1,10 @@
/*
server/ip/gen/oneCsum.h
*/
#ifndef __SERVER__IP__GEN__ONECSUM_H__
#define __SERVER__IP__GEN__ONECSUM_H__
u16_t oneC_sum( u16_t prev, void *data, size_t data_len );
#endif /* __SERVER__IP__GEN__ONECSUM_H__ */
+23
View File
@@ -0,0 +1,23 @@
/*
server/ip/gen/psip_hdr.h
*/
#ifndef __SERVER__IP__GEN__PSIP_HDR_H__
#define __SERVER__IP__GEN__PSIP_HDR_H__
typedef struct psip_io_hdr
{
u8_t pih_flags;
u8_t pih_dummy[3];
u32_t pih_nexthop;
} psip_io_hdr_t;
#define PF_LOC_REM_MASK 1
#define PF_LOC2REM 0
#define PF_REM2LOC 1
#endif /* __SERVER__IP__GEN__PSIP_HDR_H__ */
/*
* $PchId: psip_hdr.h,v 1.3 2001/02/19 07:35:38 philip Exp $
*/
+24
View File
@@ -0,0 +1,24 @@
/*
server/ip/gen/psip_io.h
*/
#ifndef __SERVER__IP__GEN__PSIP_IO_H__
#define __SERVER__IP__GEN__PSIP_IO_H__
typedef struct nwio_psipopt
{
unsigned long nwpo_flags;
} nwio_psipopt_t;
#define NWPO_PROMISC_MASK 0x0001L
#define NWPO_EN_PROMISC 0x00000001L
#define NWUO_DI_PROMISC 0x00010000L
#define NWPO_NEXTHOP_MASK 0x0002L
#define NWPO_EN_NEXTHOP 0x00000002L
#define NWUO_DI_NEXTHOP 0x00020000L
#endif /* __SERVER__IP__GEN__PSIP_IO_H__ */
/*
* $PchId: psip_io.h,v 1.3 2001/02/19 07:35:58 philip Exp $
*/
+77
View File
@@ -0,0 +1,77 @@
/*
net/gen/rip.h
Definitions for the Routing Information Protocol (RFC-1058).
Created: Aug 16, 1993 by Philip Homburg <philip@cs.vu.nl>
*/
#ifndef NET__GEN__RIP_H
#define NET__GEN__RIP_H
typedef struct rip_hdr
{
u8_t rh_command;
u8_t rh_version;
u16_t rh_zero;
} rip_hdr_t;
#define RHC_REQUEST 1
#define RHC_RESPONSE 2
#define RIP_ENTRY_MAX 25
typedef struct rip_entry
{
union
{
struct rip_entry_v1
{
u16_t re_family;
u16_t re_zero0;
u32_t re_address;
u32_t re_zero1;
u32_t re_zero2;
u32_t re_metric;
} v1;
struct rip_entry_v2
{
u16_t re_family;
u16_t re_tag;
u32_t re_address;
u32_t re_mask;
u32_t re_nexthop;
u32_t re_metric;
} v2;
} u;
} rip_entry_t;
#define RIP_FAMILY_IP 2
#define RIP_INFINITY 16
#define RIP_UDP_PORT 520
#define RIP_PERIOD 30 /* A responce is sent once every
* RIP_PERIOD seconds
*/
#define RIP_FUZZ 10 /* The actual value used is RIP_FREQUENCE -
* a random number of at most RIP_FUZZ.
*/
#define RIP_TIMEOUT 180 /* A route is dead after RIP_TIMEOUT seconds */
#define RIP_DELETE_TO 120 /* A dead route is removed after RIP_DELETE_TO
* seconds
*/
#ifdef __RIP_DEBUG
#undef RIP_PERIOD
#define RIP_PERIOD 15
#undef RIP_TIMEOUT
#define RIP_TIMEOUT 10
#undef RIP_DELETE_TO
#define RIP_DELETE_TO 10
#endif /* __RIP_DEBUG */
#endif /* NET__GEN__RIP_H */
/*
* $PchId: rip.h,v 1.3 1995/11/17 22:21:16 philip Exp $
*/
+31
View File
@@ -0,0 +1,31 @@
/*
server/ip/gen/route.h
*/
#ifndef __SERVER__IP__GEN__ROUTE_H__
#define __SERVER__IP__GEN__ROUTE_H__
typedef struct nwio_route
{
u32_t nwr_ent_no;
u32_t nwr_ent_count;
ipaddr_t nwr_dest;
ipaddr_t nwr_netmask;
ipaddr_t nwr_gateway;
u32_t nwr_dist;
u32_t nwr_flags;
u32_t nwr_pref;
u32_t nwr_mtu; /* Ignored, compatibility with VMD */
ipaddr_t nwr_ifaddr;
} nwio_route_t;
#define NWRF_EMPTY 0
#define NWRF_INUSE 1
#define NWRF_STATIC 2
#define NWRF_UNREACHABLE 4
#endif /* __SERVER__IP__GEN__ROUTE_H__ */
/*
* $PchId: route.h,v 1.3 1995/11/17 22:19:50 philip Exp $
*/
+42
View File
@@ -0,0 +1,42 @@
/*
server/ip/gen/socket.h
*/
#ifndef __SERVER__IP__GEN__SOCKET_H__
#define __SERVER__IP__GEN__SOCKET_H__
/* From SunOS: /usr/include/sys/socketh */
/*
* Address families.
*/
#define AF_UNSPEC 0 /* unspecified */
#define AF_UNIX 1 /* local to host (pipes, portals) */
#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
#define AF_IMPLINK 3 /* arpanet imp addresses */
#define AF_PUP 4 /* pup protocols: e.g. BSP */
#define AF_CHAOS 5 /* mit CHAOS protocols */
#define AF_NS 6 /* XEROX NS protocols */
#define AF_NBS 7 /* nbs protocols */
#define AF_ECMA 8 /* european computer manufacturers */
#define AF_DATAKIT 9 /* datakit protocols */
#define AF_CCITT 10 /* CCITT protocols, X.25 etc */
#define AF_SNA 11 /* IBM SNA */
#define AF_DECnet 12 /* DECnet */
#define AF_DLI 13 /* Direct data link interface */
#define AF_LAT 14 /* LAT */
#define AF_HYLINK 15 /* NSC Hyperchannel */
#define AF_APPLETALK 16 /* Apple Talk */
#define AF_NIT 17 /* Network Interface Tap */
#define AF_802 18 /* IEEE 802.2, also ISO 8802 */
#define AF_OSI 19 /* umbrella for all families used
* by OSI (e.g. protosw lookup) */
#define AF_X25 20 /* CCITT X.25 in particular */
#define AF_OSINET 21 /* AFI = 47, IDI = 4 */
#define AF_GOSIP 22 /* U.S. Government OSI */
#define AF_INET6 23 /* IP version 6 */
#define AF_MAX 23
#endif /* __SERVER__IP__GEN__SOCKET_H__ */
+18
View File
@@ -0,0 +1,18 @@
/*
server/ip/gen/tcp.h
*/
#ifndef __SERVER__IP__GEN__TCP_H__
#define __SERVER__IP__GEN__TCP_H__
#define TCP_MIN_HDR_SIZE 20
#define TCP_MAX_HDR_SIZE 60
#define TCPPORT_TELNET 23
#define TCPPORT_FINGER 79
#define TCPPORT_RESERVED 1024
typedef u16_t tcpport_t;
#endif /* __SERVER__IP__GEN__TCP_H__ */
+49
View File
@@ -0,0 +1,49 @@
/*
server/ip/gen/tcp_hdr.h
*/
#ifndef __SERVER__IP__GEN__TCP_HDR_H__
#define __SERVER__IP__GEN__TCP_HDR_H__
typedef struct tcp_hdr
{
tcpport_t th_srcport;
tcpport_t th_dstport;
u32_t th_seq_nr;
u32_t th_ack_nr;
u8_t th_data_off;
u8_t th_flags;
u16_t th_window;
u16_t th_chksum;
u16_t th_urgptr;
} tcp_hdr_t;
#define TH_DO_MASK 0xf0
#define TH_FLAGS_MASK 0x3f
#define THF_FIN 0x1
#define THF_SYN 0x2
#define THF_RST 0x4
#define THF_PSH 0x8
#define THF_ACK 0x10
#define THF_URG 0x20
typedef struct tcp_hdropt
{
int tho_opt_siz;
u8_t tho_data[TCP_MAX_HDR_SIZE-TCP_MIN_HDR_SIZE];
} tcp_hdropt_t;
#define TCP_OPT_EOL 0
#define TCP_OPT_NOP 1
#define TCP_OPT_MSS 2
#define TCP_OPT_WSOPT 3 /* RFC-1323, window scale option */
#define TCP_OPT_SACKOK 4 /* RFC-2018, SACK permitted */
#define TCP_OPT_TS 8 /* RFC-1323, Timestamps option */
#define TCP_OPT_CCNEW 12 /* RFC-1644, new connection count */
#endif /* __SERVER__IP__GEN__TCP_HDR_H__ */
/*
* $PchId: tcp_hdr.h,v 1.4 2002/06/10 07:12:22 philip Exp $
*/
+82
View File
@@ -0,0 +1,82 @@
/*
server/ip/gen/tcp_io.h
*/
#ifndef __SERVER__IP__GEN__TCP_IO_H__
#define __SERVER__IP__GEN__TCP_IO_H__
typedef struct nwio_tcpconf
{
u32_t nwtc_flags;
ipaddr_t nwtc_locaddr;
ipaddr_t nwtc_remaddr;
tcpport_t nwtc_locport;
tcpport_t nwtc_remport;
} nwio_tcpconf_t;
#define NWTC_NOFLAGS 0x0000L
#define NWTC_ACC_MASK 0x0003L
# define NWTC_EXCL 0x00000001L
# define NWTC_SHARED 0x00000002L
# define NWTC_COPY 0x00000003L
#define NWTC_LOCPORT_MASK 0x0030L
# define NWTC_LP_UNSET 0x00000010L
# define NWTC_LP_SET 0x00000020L
# define NWTC_LP_SEL 0x00000030L
#define NWTC_REMADDR_MASK 0x0100L
# define NWTC_SET_RA 0x00000100L
# define NWTC_UNSET_RA 0x01000000L
#define NWTC_REMPORT_MASK 0x0200L
# define NWTC_SET_RP 0x00000200L
# define NWTC_UNSET_RP 0x02000000L
typedef struct nwio_tcpcl
{
long nwtcl_flags;
long nwtcl_ttl;
} nwio_tcpcl_t;
#define TCF_DEFAULT 0 /* Default parameters */
#define TCF_ASYNCH 1 /* Asynchronous connect for non-blocking
* socket emulation.
*/
typedef struct nwio_tcpatt
{
long nwta_flags;
} nwio_tcpatt_t;
typedef struct nwio_tcpopt
{
u32_t nwto_flags;
} nwio_tcpopt_t;
#define NWTO_NOFLAG 0x0000L
#define NWTO_SND_URG_MASK 0x0001L
# define NWTO_SND_URG 0x00000001L
# define NWTO_SND_NOTURG 0x00010000L
#define NWTO_RCV_URG_MASK 0x0002L
# define NWTO_RCV_URG 0x00000002L
# define NWTO_RCV_NOTURG 0x00020000L
#define NWTO_BSD_URG_MASK 0x0004L
# define NWTO_BSD_URG 0x00000004L
# define NWTO_NOTBSD_URG 0x00040000L
#define NWTO_DEL_RST_MASK 0x0008L
# define NWTO_DEL_RST 0x00000008L
#define NWTO_BULK_MASK 0x0010L
# define NWTO_BULK 0x00000010L
# define NWTO_NOBULK 0x00100000L
#define TC_SECRET_SIZE 12
typedef struct tcp_cookie
{
u32_t tc_ref;
u8_t tc_secret[TC_SECRET_SIZE];
} tcp_cookie_t;
#endif /* __SERVER__IP__GEN__TCP_IO_H__ */
/*
* $PchId: tcp_io.h,v 1.5 2001/02/19 07:36:55 philip Exp $
*/
+13
View File
@@ -0,0 +1,13 @@
/*
server/ip/gen/udp.h
*/
#ifndef __SERVER__IP__GEN__UDP_H__
#define __SERVER__IP__GEN__UDP_H__
typedef u16_t udpport_t;
#define UDP_HDR_SIZE 8
#define UDP_IO_HDR_SIZE 16
#endif /* __SERVER__IP__GEN__UDP_H__ */
+22
View File
@@ -0,0 +1,22 @@
/*
server/ip/gen/udp_hdr.h
*/
#ifndef __SERVER__IP__GEN__UDP_HDR_H__
#define __SERVER__IP__GEN__UDP_HDR_H__
/*
* Included for compatibility with programs which assume udp_io_hdr_t to be
* defined in this header file
*/
#include "udp_io_hdr.h"
typedef struct udp_hdr
{
udpport_t uh_src_port;
udpport_t uh_dst_port;
u16_t uh_length;
u16_t uh_chksum;
} udp_hdr_t;
#endif /* __SERVER__IP__GEN__UDP_HDR_H__ */
+45
View File
@@ -0,0 +1,45 @@
/*
server/ip/gen/udp_io.h
*/
#ifndef __SERVER__IP__GEN__UDP_IO_H__
#define __SERVER__IP__GEN__UDP_IO_H__
typedef struct nwio_udpopt
{
unsigned long nwuo_flags;
udpport_t nwuo_locport;
udpport_t nwuo_remport;
ipaddr_t nwuo_locaddr;
ipaddr_t nwuo_remaddr;
} nwio_udpopt_t;
#define NWUO_NOFLAGS 0x0000L
#define NWUO_ACC_MASK 0x0003L
#define NWUO_EXCL 0x00000001L
#define NWUO_SHARED 0x00000002L
#define NWUO_COPY 0x00000003L
#define NWUO_LOCPORT_MASK 0x000CL
#define NWUO_LP_SEL 0x00000004L
#define NWUO_LP_SET 0x00000008L
#define NWUO_LP_ANY 0x0000000CL
#define NWUO_LOCADDR_MASK 0x0010L
#define NWUO_EN_LOC 0x00000010L
#define NWUO_DI_LOC 0x00100000L
#define NWUO_BROAD_MASK 0x0020L
#define NWUO_EN_BROAD 0x00000020L
#define NWUO_DI_BROAD 0x00200000L
#define NWUO_REMPORT_MASK 0x0100L
#define NWUO_RP_SET 0x00000100L
#define NWUO_RP_ANY 0x01000000L
#define NWUO_REMADDR_MASK 0x0200L
#define NWUO_RA_SET 0x00000200L
#define NWUO_RA_ANY 0x02000000L
#define NWUO_RW_MASK 0x1000L
#define NWUO_RWDATONLY 0x00001000L
#define NWUO_RWDATALL 0x10000000L
#define NWUO_IPOPT_MASK 0x2000L
#define NWUO_EN_IPOPT 0x00002000L
#define NWUO_DI_IPOPT 0x20000000L
#endif /* __SERVER__IP__GEN__UDP_IO_H__ */
+16
View File
@@ -0,0 +1,16 @@
#ifndef __SERVER__IP__GEN__UDP_IO_HDR_H__
#define __SERVER__IP__GEN__UDP_IO_HDR_H__
typedef struct udp_io_hdr
{
ipaddr_t uih_src_addr;
ipaddr_t uih_dst_addr;
udpport_t uih_src_port;
udpport_t uih_dst_port;
u16_t uih_ip_opt_len;
u16_t uih_data_len;
} udp_io_hdr_t;
#endif /* __SERVER__IP__GEN__UDP_IO_HDR_H__ */
+85
View File
@@ -0,0 +1,85 @@
/*
net/gen/vjhc.h
Defines for Van Jacobson TCP/IP Header Compression as defined in RFC-1144
Created: Nov 15, 1993 by Philip Homburg <philip@cs.vu.nl>
*/
#ifndef __NET__GEN__VJHC_H__
#define __NET__GEN__VJHC_H__
#define VJHC_FLAG_U 0x01
#define VJHC_FLAG_W 0x02
#define VJHC_FLAG_A 0x04
#define VJHC_FLAG_S 0x08
#define VJHC_FLAG_P 0x10
#define VJHC_FLAG_I 0x20
#define VJHC_FLAG_C 0x40
#define VJHC_SPEC_I (VJHC_FLAG_S | VJHC_FLAG_W | VJHC_FLAG_U)
#define VJHC_SPEC_D (VJHC_FLAG_S | VJHC_FLAG_A | VJHC_FLAG_W | VJHC_FLAG_U)
#define VJHC_SPEC_MASK (VJHC_FLAG_S | VJHC_FLAG_A | VJHC_FLAG_W | VJHC_FLAG_U)
#define VJHC_ENCODE(cp, n) \
{ \
if ((u16_t)(n) >= 256) \
{ \
*(cp)++= 0; \
*(cp)++= (n >> 8); \
*(cp)++= (n); \
} \
else \
*(cp)++= (n); \
}
#define VJHC_ENCODEZ(cp, n) \
{ \
if ((u16_t)(n) == 0 || (u16_t)(n) >= 256) \
{ \
*(cp)++= 0; \
*(cp)++= (n >> 8); \
*(cp)++= (n); \
} \
else \
*(cp)++= (n); \
}
#define VJHC_DECODEL(cp, l) \
{ \
if (*(cp) == 0) \
{ \
(l)= htonl(ntohl((l)) + (((cp)[1] << 8) | (cp)[2])); \
(cp) += 3; \
} \
else \
(l)= htonl(ntohl((l)) + (u32_t)*(cp)++); \
}
#define VJHC_DECODES(cp, s) \
{ \
if (*(cp) == 0) \
{ \
(s)= htons(ntohs((s)) + (((cp)[1] << 8) | (cp)[2])); \
(cp) += 3; \
} \
else \
(s)= htons(ntohs((s)) + (u16_t)*(cp)++); \
}
#define VJHC_DECODEU(cp, s) \
{ \
if (*(cp) == 0) \
{ \
(s)= htons(((cp)[1] << 8) | (cp)[2]); \
(cp) += 3; \
} \
else \
(s)= htons((u16_t)*(cp)++); \
}
#endif /* __NET__GEN__VJHC_H__ */
/*
* $PchId: vjhc.h,v 1.2 1995/11/17 22:14:46 philip Exp $
*/