Blob
2 enum3 {4 OfferTimeout= 60, /* when an offer times out */5 MaxLease= 60*60, /* longest lease for dynamic binding */6 MinLease= 15*60, /* shortest lease for dynamic binding */7 StaticLease= 30*60, /* lease for static binding */9 IPUDPHDRSIZE= 28, /* size of an IP plus UDP header */10 MINSUPPORTED= 576, /* biggest IP message the client must support */12 /* lengths of some bootp fields */13 Maxhwlen= 16,14 Maxfilelen= 128,15 Maxoptlen= 312-4,17 /* bootp types */18 Bootrequest= 1,19 Bootreply= 2,21 /* bootp flags */22 Fbroadcast= 1<<15,24 /* dhcp types */25 Discover= 1,26 Offer= 2,27 Request= 3,28 Decline= 4,29 Ack= 5,30 Nak= 6,31 Release= 7,32 Inform= 8,34 /* bootp option types */35 OBend= 255,36 OBpad= 0,37 OBmask= 1,38 OBtimeoff= 2,39 OBrouter= 3,40 OBtimeserver= 4,41 OBnameserver= 5,42 OBdnserver= 6,43 OBlogserver= 7,44 OBcookieserver= 8,45 OBlprserver= 9,46 OBimpressserver= 10,47 OBrlserver= 11,48 OBhostname= 12, /* 0xc0 */49 OBbflen= 13,50 OBdumpfile= 14,51 OBdomainname= 15,52 OBswapserver= 16, /* 0x10 */53 OBrootpath= 17,54 OBextpath= 18,55 OBipforward= 19,56 OBnonlocal= 20,57 OBpolicyfilter= 21,58 OBmaxdatagram= 22,59 OBttl= 23,60 OBpathtimeout= 24,61 OBpathplateau= 25,62 OBmtu= 26,63 OBsubnetslocal= 27,64 OBbaddr= 28,65 OBdiscovermask= 29,66 OBsupplymask= 30,67 OBdiscoverrouter= 31,68 OBrsserver= 32, /* 0x20 */69 OBstaticroutes= 33,70 OBtrailerencap= 34,71 OBarptimeout= 35,72 OBetherencap= 36,73 OBtcpttl= 37,74 OBtcpka= 38,75 OBtcpkag= 39,76 OBnisdomain= 40,77 OBniserver= 41,78 OBntpserver= 42,79 OBvendorinfo= 43, /* 0x2b */80 OBnetbiosns= 44,81 OBnetbiosdds= 45,82 OBnetbiostype= 46,83 OBnetbiosscope= 47,84 OBxfontserver= 48, /* 0x30 */85 OBxdispmanager= 49,86 OBnisplusdomain= 64, /* 0x40 */87 OBnisplusserver= 65,88 OBhomeagent= 68,89 OBsmtpserver= 69,90 OBpop3server= 70,91 OBnntpserver= 71,92 OBwwwserver= 72,93 OBfingerserver= 73,94 OBircserver= 74,95 OBstserver= 75,96 OBstdaserver= 76,98 /* dhcp options */99 ODipaddr= 50, /* 0x32 */100 ODlease= 51,101 ODoverload= 52,102 ODtype= 53, /* 0x35 */103 ODserverid= 54, /* 0x36 */104 ODparams= 55, /* 0x37 */105 ODmessage= 56,106 ODmaxmsg= 57,107 ODrenewaltime= 58,108 ODrebindingtime= 59,109 ODvendorclass= 60,110 ODclientid= 61, /* 0x3d */111 ODtftpserver= 66,112 ODbootfile= 67,114 /* plan9 vendor info options */115 OP9fs= 128, // plan9 file servers116 OP9auth= 129, // plan9 auth servers117 };119 /* a lease that never expires */120 #define Lforever 0xffffffffU122 /* dhcp states */123 enum {124 Sinit,125 Sselecting,126 Srequesting,127 Sbound,128 Srenewing,129 Srebinding,130 };132 typedef struct Bootp Bootp;133 struct Bootp134 {135 uchar op; /* opcode */136 uchar htype; /* hardware type */137 uchar hlen; /* hardware address len */138 uchar hops; /* hops */139 uchar xid[4]; /* a random number */140 uchar secs[2]; /* elapsed since client started booting */141 uchar flags[2];142 uchar ciaddr[IPv4addrlen]; /* client IP address (client tells server) */143 uchar yiaddr[IPv4addrlen]; /* client IP address (server tells client) */144 uchar siaddr[IPv4addrlen]; /* server IP address */145 uchar giaddr[IPv4addrlen]; /* gateway IP address */146 uchar chaddr[Maxhwlen]; /* client hardware address */147 char sname[64]; /* server host name (optional) */148 char file[Maxfilelen]; /* boot file name */149 uchar optmagic[4];150 uchar optdata[Maxoptlen];151 };