XINU
include
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 */
netpacket::net_udpcksum
uint16 net_udpcksum
Definition:
net.h:35
netpacket::net_ictype
byte net_ictype
Definition:
net.h:39
network::ipucast
uint32 ipucast
Definition:
net.h:55
byte
unsigned char byte
符号なし8ビット値(unsigned char)
Definition:
kernel.h:7
network::ipmask
uint32 ipmask
Definition:
net.h:57
netpacket::net_ethtype
uint16 net_ethtype
Definition:
net.h:19
netpacket::net_iccksum
uint16 net_iccksum
Definition:
net.h:41
NetData
struct network NetData
Definition:
net.c:6
netpacket::net_ethdst
byte net_ethdst[ETH_ADDR_LEN]
Definition:
net.h:17
netpacket::net_ipid
uint16 net_ipid
Definition:
net.h:23
netpacket::net_ipfrag
uint16 net_ipfrag
Definition:
net.h:24
netpacket::net_udpsport
uint16 net_udpsport
Definition:
net.h:32
bool8
byte bool8
Boolean値
Definition:
kernel.h:36
netpacket::net_ethsrc
byte net_ethsrc[ETH_ADDR_LEN]
Definition:
net.h:18
NETBOOTFILE
#define NETBOOTFILE
Definition:
net.h:5
netpacket::net_iplen
uint16 net_iplen
Definition:
net.h:22
netpacket::net_iccode
byte net_iccode
Definition:
net.h:40
netpacket::net_icdata
byte net_icdata[1500-28]
Definition:
net.h:44
network
Definition:
net.h:54
bpid32
int32 bpid32
バッファプールID
Definition:
kernel.h:34
netpacket::net_icseq
uint16 net_icseq
Definition:
net.h:43
network::iprouter
uint32 iprouter
Definition:
net.h:59
netpacket::net_udplen
uint16 net_udplen
Definition:
net.h:34
netpacket::net_ipcksum
uint16 net_ipcksum
Definition:
net.h:27
netpacket::net_udpdata
byte net_udpdata[1500-28]
Definition:
net.h:36
netbufpool
bpid32 netbufpool
Definition:
net.c:7
uint16
unsigned short uint16
符号なし16ビット整数(unsigned short)
Definition:
kernel.h:17
network::ipprefix
uint32 ipprefix
Definition:
net.h:58
network::ipbcast
uint32 ipbcast
Definition:
net.h:56
netpacket::net_iptos
byte net_iptos
Definition:
net.h:21
netpacket
Definition:
net.h:16
netpacket::net_ipvh
byte net_ipvh
Definition:
net.h:20
netpacket::net_ipsrc
uint32 net_ipsrc
Definition:
net.h:28
netpacket::net_ipdst
uint32 net_ipdst
Definition:
net.h:29
netpacket::net_udpdport
uint16 net_udpdport
Definition:
net.h:33
netpacket::net_icident
uint16 net_icident
Definition:
net.h:42
network::bootserver
uint32 bootserver
Definition:
net.h:60
ETH_ADDR_LEN
#define ETH_ADDR_LEN
Definition:
ether.h:10
netpacket::net_ipproto
byte net_ipproto
Definition:
net.h:26
network::ntpserver
uint32 ntpserver
Definition:
net.h:62
netpacket::net_ipttl
byte net_ipttl
Definition:
net.h:25
uint32
unsigned int uint32
符号なし32ビット整数(unsigned int)
Definition:
kernel.h:15
network::dnsserver
uint32 dnsserver
Definition:
net.h:61
network::ipvalid
bool8 ipvalid
Definition:
net.h:63
Generated by
1.8.13