1 /* from <ip.h> */ 2 3 enum 4 { 5 ETHER_HDR = 14, 6 ET_IP = 0x800, 7 8 IP_VER = 0x40, 9 IP_HLEN = 0x05, 10 IP_UDPPROTO = 17, 11 12 UDP_EHSIZE = 22, 13 UDP_PHDRSIZE = 12, 14 UDP_HDRSIZE = 20, 15 16 BPportsrc = 68, 17 BPportdst = 67, 18 Bootrequest = 1, 19 Bootreply = 2, 20 21 TFTPport = 69, 22 // Timeout = 5000, /* milliseconds */ 23 Timeout = 2000, /* milliseconds */ 24 Tftp_READ = 1, 25 Tftp_WRITE = 2, 26 Tftp_DATA = 3, 27 Tftp_ACK = 4, 28 Tftp_ERROR = 5, 29 Tftp_OACK = 6, /* extension: option(s) ack */ 30 Defsegsize = 512, 31 32 /* lengths of some bootp fields */ 33 Maxhwlen= 16, 34 Maxfilelen= 128, 35 Maxoptlen= 312-4, 36 37 /* bootp option types */ 38 OBend= 255, 39 OBpad= 0, 40 OBmask= 1, 41 }; 42 43 /* 44 * user level udp headers with control message "headers" 45 */ 46 enum 47 { 48 Udphdrsize= 52, /* size of a Udphdr */ 49 }; 50 51 typedef struct Udphdr Udphdr; 52 struct Udphdr 53 { 54 uchar raddr[IPaddrlen]; /* V6 remote address */ 55 uchar laddr[IPaddrlen]; /* V6 local address */ 56 uchar ifcaddr[IPaddrlen]; /* V6 ifc addr msg was received on */ 57 uchar rport[2]; /* remote port */ 58 uchar lport[2]; /* local port */ 59 }; 60 61 /* 62 * from 9load 63 */ 64 typedef struct Bootp Bootp; 65 struct Bootp 66 { 67 uchar op; /* opcode */ 68 uchar htype; /* hardware type */ 69 uchar hlen; /* hardware address len */ 70 uchar hops; /* hops */ 71 uchar xid[4]; /* a random number */ 72 uchar secs[2]; /* elapsed since client started booting */ 73 uchar flags[2]; /* unused in bootp, flags in dhcp */ 74 uchar ciaddr[4]; /* client IP address (client tells server) */ 75 uchar yiaddr[4]; /* client IP address (server tells client) */ 76 uchar siaddr[4]; /* server IP address */ 77 uchar giaddr[4]; /* gateway IP address */ 78 uchar chaddr[16]; /* client hardware address */ 79 char sname[64]; /* server host name (optional) */ 80 char file[128]; /* boot file name */ 81 82 // char vend[128]; /* vendor-specific goo */ 83 uchar optmagic[4]; 84 uchar optdata[Maxoptlen]; 85 }; 86 87 typedef struct Pxenetaddr Pxenetaddr; 88 struct Pxenetaddr 89 { 90 uchar ip[IPaddrlen]; 91 ushort port; 92 }; 93 94 extern int chatty; 95