XINU
net.h
Go to the documentation of this file.
1 /* net.h */
2 
3 #define NETSTK 8192 /* Stack size for network setup */
4 #define NETPRIO 500 /* Network startup priority */
5 #define NETBOOTFILE 128 /* Size of the netboot filename */
6 
7 /* Constants used in the networking code */
8 
9 #define ETH_ARP 0x0806 /* Ethernet type for ARP */
10 #define ETH_IP 0x0800 /* Ethernet type for IP */
11 #define ETH_IPv6 0x86DD /* Ethernet type for IPv6 */
12 
13 /* Format of an Ethernet packet carrying IPv4 and UDP */
14 
15 #pragma pack(2)
16 struct netpacket {
17  byte net_ethdst[ETH_ADDR_LEN];/* Ethernet dest. MAC address */
18  byte net_ethsrc[ETH_ADDR_LEN];/* Ethernet source MAC address */
19  uint16 net_ethtype; /* Ethernet type field */
20  byte net_ipvh; /* IP version and hdr length */
21  byte net_iptos; /* IP type of service */
22  uint16 net_iplen; /* IP total packet length */
23  uint16 net_ipid; /* IP datagram ID */
24  uint16 net_ipfrag; /* IP flags & fragment offset */
25  byte net_ipttl; /* IP time-to-live */
26  byte net_ipproto; /* IP protocol (actually type) */
27  uint16 net_ipcksum; /* IP checksum */
28  uint32 net_ipsrc; /* IP source address */
29  uint32 net_ipdst; /* IP destination address */
30  union {
31  struct {
32  uint16 net_udpsport; /* UDP source protocol port */
33  uint16 net_udpdport; /* UDP destination protocol port*/
34  uint16 net_udplen; /* UDP total length */
35  uint16 net_udpcksum; /* UDP checksum */
36  byte net_udpdata[1500-28];/* UDP payload (1500-above)*/
37  };
38  struct {
39  byte net_ictype; /* ICMP message type */
40  byte net_iccode; /* ICMP code field (0 for ping) */
41  uint16 net_iccksum; /* ICMP message checksum */
42  uint16 net_icident; /* ICMP identifier */
43  uint16 net_icseq; /* ICMP sequence number */
44  byte net_icdata[1500-28];/* ICMP payload (1500-above)*/
45  };
46  };
47 };
48 #pragma pack()
49 
50 #define PACKLEN sizeof(struct netpacket)
51 
52 extern bpid32 netbufpool; /* ID of net packet buffer pool */
53 
54 struct network { /* Network information */
55  uint32 ipucast; /* Computer's IP unicast address*/
56  uint32 ipbcast; /* IP broadcast address */
57  uint32 ipmask; /* IP address mask */
58  uint32 ipprefix; /* IP (network) prefix */
59  uint32 iprouter; /* Default router address */
60  uint32 bootserver; /* Boot server address */
61  uint32 dnsserver; /* DNS server address */
62  uint32 ntpserver; /* NTP (time) server address */
63  bool8 ipvalid; /* nonzero => above are valid */
64  byte ethucast[ETH_ADDR_LEN]; /* Ethernet multicast address */
65  byte ethbcast[ETH_ADDR_LEN]; /* Ethernet broadcast address */
66  char bootfile[NETBOOTFILE]; /* Name of boot file */
67 };
68 
69 extern struct network NetData; /* Local Network Interface info */
uint16 net_udpcksum
Definition: net.h:35
byte net_ictype
Definition: net.h:39
uint32 ipucast
Definition: net.h:55
unsigned char byte
符号なし8ビット値(unsigned char)
Definition: kernel.h:7
uint32 ipmask
Definition: net.h:57
uint16 net_ethtype
Definition: net.h:19
uint16 net_iccksum
Definition: net.h:41
struct network NetData
Definition: net.c:6
byte net_ethdst[ETH_ADDR_LEN]
Definition: net.h:17
uint16 net_ipid
Definition: net.h:23
uint16 net_ipfrag
Definition: net.h:24
uint16 net_udpsport
Definition: net.h:32
byte bool8
Boolean値
Definition: kernel.h:36
byte net_ethsrc[ETH_ADDR_LEN]
Definition: net.h:18
#define NETBOOTFILE
Definition: net.h:5
uint16 net_iplen
Definition: net.h:22
byte net_iccode
Definition: net.h:40
byte net_icdata[1500-28]
Definition: net.h:44
Definition: net.h:54
int32 bpid32
バッファプールID
Definition: kernel.h:34
uint16 net_icseq
Definition: net.h:43
uint32 iprouter
Definition: net.h:59
uint16 net_udplen
Definition: net.h:34
uint16 net_ipcksum
Definition: net.h:27
byte net_udpdata[1500-28]
Definition: net.h:36
bpid32 netbufpool
Definition: net.c:7
unsigned short uint16
符号なし16ビット整数(unsigned short)
Definition: kernel.h:17
uint32 ipprefix
Definition: net.h:58
uint32 ipbcast
Definition: net.h:56
byte net_iptos
Definition: net.h:21
Definition: net.h:16
byte net_ipvh
Definition: net.h:20
uint32 net_ipsrc
Definition: net.h:28
uint32 net_ipdst
Definition: net.h:29
uint16 net_udpdport
Definition: net.h:33
uint16 net_icident
Definition: net.h:42
uint32 bootserver
Definition: net.h:60
#define ETH_ADDR_LEN
Definition: ether.h:10
byte net_ipproto
Definition: net.h:26
uint32 ntpserver
Definition: net.h:62
byte net_ipttl
Definition: net.h:25
unsigned int uint32
符号なし32ビット整数(unsigned int)
Definition: kernel.h:15
uint32 dnsserver
Definition: net.h:61
bool8 ipvalid
Definition: net.h:63