New inet with partial select implementation

This commit is contained in:
Philip Homburg
2005-06-28 15:19:58 +00:00
parent 013f484525
commit 0f26898f82
71 changed files with 7506 additions and 2130 deletions

23
include/net/gen/arp_io.h Normal file
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 $
*/

View File

@@ -19,7 +19,17 @@ typedef struct ether_addr
typedef u16_t ether_type_t;
typedef U16_t Ether_type_t;
#define ETH_ARP_PROTO 0x806
#define ETH_IP_PROTO 0x800
#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 $
*/

View File

@@ -5,7 +5,7 @@ server/ip/gen/icmp.h
#ifndef __SERVER__IP__GEN__ICMP_H__
#define __SERVER__IP__GEN__ICMP_H__
#define ICMP_MIN_HDR_LEN 4
#define ICMP_MIN_HDR_SIZE 4
#define ICMP_TYPE_ECHO_REPL 0
#define ICMP_TYPE_DST_UNRCH 3
@@ -33,8 +33,17 @@ server/ip/gen/icmp.h
#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.5 1995/11/17 22:38:46 philip Exp $
* $PchId: icmp.h,v 1.6 2002/06/10 07:10:26 philip Exp $
*/

View File

@@ -29,6 +29,12 @@ typedef struct icmp_pp
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;
@@ -40,6 +46,7 @@ typedef struct icmp_hdr
ipaddr_t ihh_gateway;
icmp_ram_t ihh_ram;
icmp_pp_t ihh_pp;
icmp_mtu_t ihh_mtu;
} ih_hun;
union
{
@@ -51,5 +58,5 @@ typedef struct icmp_hdr
#endif /* __SERVER__IP__GEN__ICMP_HDR_H__ */
/*
* $PchId: icmp_hdr.h,v 1.4 1995/11/17 22:28:58 philip Exp $
* $PchId: icmp_hdr.h,v 1.5 2002/06/10 07:10:48 philip Exp $
*/

View File

@@ -8,9 +8,11 @@ server/ip/gen/in.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_MSS 576
#define IP_MAX_PACKSIZE 40000 /* 8192 */
#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. */
@@ -18,6 +20,8 @@ server/ip/gen/in.h
#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
@@ -29,5 +33,5 @@ typedef struct ip_hdropt
#endif /* __SERVER__IP__GEN__IN_H__ */
/*
* $PchId: in.h,v 1.3 1995/11/17 22:27:50 philip Exp $
* $PchId: in.h,v 1.6 2002/06/10 07:11:15 philip Exp $
*/

View File

@@ -29,14 +29,19 @@ typedef struct ip_hdr
#define IP_OPT_COPIED 0x80
#define IP_OPT_NUMBER 0x1f
#define IP_OPT_EOL 0x00
#define IP_OPT_NOP 0x01
#define IP_OPT_LSRR 0x83
#define IP_OPT_RR 0x07
#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.4 1995/11/17 22:26:00 philip Exp $
* $PchId: ip_hdr.h,v 1.5 2002/06/10 07:11:46 philip Exp $
*/

View File

@@ -5,17 +5,26 @@ 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 0x3
#define NWIC_FLAGS 0x7
# define NWIC_IPADDR_SET 0x1
# define NWIC_NETMASK_SET 0x2
# define NWIC_MTU_SET 0x4
typedef struct nwio_ipopt
{
@@ -53,3 +62,7 @@ typedef struct nwio_ipopt
# 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 $
*/

View File

@@ -9,6 +9,7 @@ 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
@@ -18,5 +19,5 @@ typedef struct psip_io_hdr
#endif /* __SERVER__IP__GEN__PSIP_HDR_H__ */
/*
* $PchId: psip_hdr.h,v 1.2 1995/11/17 22:22:35 philip Exp $
* $PchId: psip_hdr.h,v 1.3 2001/02/19 07:35:38 philip Exp $
*/

View File

@@ -13,9 +13,12 @@ typedef struct nwio_psipopt
#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.2 1995/11/17 22:22:16 philip Exp $
* $PchId: psip_io.h,v 1.3 2001/02/19 07:35:58 philip Exp $
*/

View File

@@ -34,12 +34,16 @@ typedef struct tcp_hdropt
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_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.3 1995/11/17 22:18:13 philip Exp $
* $PchId: tcp_hdr.h,v 1.4 2002/06/10 07:12:22 philip Exp $
*/

View File

@@ -58,9 +58,12 @@ typedef struct nwio_tcpopt
# 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
#endif /* __SERVER__IP__GEN__TCP_IO_H__ */
/*
* $PchId: tcp_io.h,v 1.4 1995/11/17 22:17:47 philip Exp $
* $PchId: tcp_io.h,v 1.5 2001/02/19 07:36:55 philip Exp $
*/

View File

@@ -13,7 +13,14 @@
#define NWIOGETHOPT _IOR('n', 17, struct nwio_ethopt)
#define NWIOGETHSTAT _IOR('n', 18, struct nwio_ethstat)
#define NWIOARPGIP _IORW('n',20, struct nwio_arp)
#define NWIOARPGNEXT _IORW('n',21, struct nwio_arp)
#define NWIOARPSIP _IOW ('n',22, struct nwio_arp)
#define NWIOARPDIP _IOW ('n',23, struct nwio_arp)
#define NWIOSIPCONF2 _IOW('n', 32, struct nwio_ipconf2)
#define NWIOSIPCONF _IOW('n', 32, struct nwio_ipconf)
#define NWIOGIPCONF2 _IOR('n', 33, struct nwio_ipconf2)
#define NWIOGIPCONF _IOR('n', 33, struct nwio_ipconf)
#define NWIOSIPOPT _IOW('n', 34, struct nwio_ipopt)
#define NWIOGIPOPT _IOR('n', 35, struct nwio_ipopt)
@@ -21,7 +28,6 @@
#define NWIOGIPOROUTE _IORW('n', 40, struct nwio_route)
#define NWIOSIPOROUTE _IOW ('n', 41, struct nwio_route)
#define NWIODIPOROUTE _IOW ('n', 42, struct nwio_route)
#define NWIOGIPIROUTE _IORW('n', 43, struct nwio_route)
#define NWIOSIPIROUTE _IOW ('n', 44, struct nwio_route)
#define NWIODIPIROUTE _IOW ('n', 45, struct nwio_route)
@@ -34,11 +40,19 @@
#define NWIOTCPSHUTDOWN _IO ('n', 53)
#define NWIOSTCPOPT _IOW('n', 54, struct nwio_tcpopt)
#define NWIOGTCPOPT _IOR('n', 55, struct nwio_tcpopt)
#define NWIOTCPPUSH _IO ('n', 56)
#define NWIOSUDPOPT _IOW('n', 64, struct nwio_udpopt)
#define NWIOGUDPOPT _IOR('n', 65, struct nwio_udpopt)
#define NWIOUDPPEEK _IOR('n', 66, struct udp_io_hdr)
#define NWIOSPSIPOPT _IOW('n', 80, struct nwio_psipopt)
#define NWIOGPSIPOPT _IOR('n', 81, struct nwio_psipopt)
#define NWIOQUERYPARAM _IORW('n',96, struct svrqueryparam)
#endif /* _NET__IOCTL_H */
/*
* $PchId: ioctl.h,v 1.2 2003/07/25 14:34:03 philip Exp $
*/