|
|
1.1 root 1: typedef struct Udphdr Udphdr;
2: struct Udphdr
3: {
4: uchar d[6]; /* Ethernet destination */
5: uchar s[6]; /* Ethernet source */
6: uchar type[2]; /* Ethernet packet type */
7:
8: uchar vihl; /* Version and header length */
9: uchar tos; /* Type of service */
10: uchar length[2]; /* packet length */
11: uchar id[2]; /* Identification */
12: uchar frag[2]; /* Fragment information */
13:
14: /* Udp pseudo ip really starts here */
15: uchar ttl;
16: uchar udpproto; /* Protocol */
17: uchar udpplen[2]; /* Header plus data length */
18: uchar udpsrc[4]; /* Ip source */
19: uchar udpdst[4]; /* Ip destination */
20: uchar udpsport[2]; /* Source port */
21: uchar udpdport[2]; /* Destination port */
22: uchar udplen[2]; /* data length */
23: uchar udpcksum[2]; /* Checksum */
24: };
25:
26: typedef struct Etherhdr Etherhdr;
27: struct Etherhdr
28: {
29: uchar d[6];
30: uchar s[6];
31: uchar type[2];
32:
33: /* Now we have the ip fields */
34: uchar vihl; /* Version and header length */
35: uchar tos; /* Type of service */
36: uchar length[2]; /* packet length */
37: uchar id[2]; /* Identification */
38: uchar frag[2]; /* Fragment information */
39: uchar ttl; /* Time to live */
40: uchar proto; /* Protocol */
41: uchar cksum[2]; /* Header checksum */
42: uchar src[4]; /* Ip source */
43: uchar dst[4]; /* Ip destination */
44: };
45:
46: enum
47: {
48: IP_VER = 0x40,
49: IP_HLEN = 0x05,
50: UDP_EHSIZE = 22,
51: UDP_PHDRSIZE = 12,
52: UDP_HDRSIZE = 20,
53: ETHER_HDR = 14,
54: IP_UDPPROTO = 17,
55: ET_IP = 0x800,
56: Bcastip = 0xffffffff,
57: BPportsrc = 68,
58: BPportdst = 67,
59: TFTPport = 69,
60: Timeout = 5000, /* milliseconds */
61: Bootrequest = 1,
62: Bootreply = 2,
63: Tftp_READ = 1,
64: Tftp_WRITE = 2,
65: Tftp_DATA = 3,
66: Tftp_ACK = 4,
67: Tftp_ERROR = 5,
68: Segsize = 512,
69: TFTPSZ = Segsize+10,
70: };
71:
72: typedef struct Bootp Bootp;
73: struct Bootp
74: {
75: uchar op; /* opcode */
76: uchar htype; /* hardware type */
77: uchar hlen; /* hardware address len */
78: uchar hops; /* hops */
79: uchar xid[4]; /* a random number */
80: uchar secs[2]; /* elapsed snce client started booting */
81: uchar pad[2];
82: uchar ciaddr[4]; /* client IP address (client tells server) */
83: uchar yiaddr[4]; /* client IP address (server tells client) */
84: uchar siaddr[4]; /* server IP address */
85: uchar giaddr[4]; /* gateway IP address */
86: uchar chaddr[16]; /* client hardware address */
87: char sname[64]; /* server host name (optional) */
88: char file[128]; /* boot file name */
89: char vend[128]; /* vendor-specific goo */
90: };
91:
92: typedef struct Netaddr Netaddr;
93: struct Netaddr
94: {
95: ulong ip;
96: ushort port;
97: char ea[6];
98: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.