#define MAX_DATA 1024 enum dhcpfieldtype {string, ip, multi, offset, time, number, opt_switch, node_type, bin}; /* * string = \0 terminated char[] * ip = 4 byte IP Address * multi = vendor defined data with multiple entry pairs (length, data)+ * time = 4 byte unsinged int in seconds * offset = 32-bit int, positive means east of the meridian, negative west * number = unsigned int * opt_switch = 0/1 switch * node_type = 0x1 B-node * 0x2 P-node * 0x4 M-node * 0x8 H-node * bin = don't interpret at all - char */ struct dhcpoption { char name[50]; enum dhcpfieldtype type; unsigned char min_len; unsigned char max_len; } DHCPOPT [256]; DHCPOPT[0] = {"Subnet Mask", ip, 4, 4}; DHCPOPT[1] = {"Time Offset", offset, 4, 4}; DHCPOPT[2] = {"Router Option", ip, 4, 0}; DHCPOPT[3] = {"Time Server Option", ip, 4, 0}; DHCPOPT[4] = {"Name Server Option", ip, 4, 0}; DHCPOPT[5] = {"Domain Name Server Option", ip, 4, 0}; DHCPOPT[6] = {"Log Server Option", ip, 4, 0}; DHCPOPT[7] = {"Cookie Server Option", ip, 4, 0}; DHCPOPT[8] = {"LPR Server Option", ip, 4, 0}; DHCPOPT[9] = {"Impress Server Option", ip, 4, 0}; DHCPOPT[10] = {"Resource Location Server Option", ip, 4, 0}; DHCPOPT[11] = {"Host Name Option", string, 1, 0}; DHCPOPT[12] = {"Boot File Size Option", number, 2, 2}; // unsigned 16-bit integer DHCPOPT[13] = {"Merit Dump File", string, 1, 0}; DHCPOPT[14] = {"Domain Name", string, 1, 0}; DHCPOPT[15] = {"Swap Server", ip, 4, 4}; DHCPOPT[16] = {"Root Path", string, 1, 0}; DHCPOPT[17] = {"Extensions Path", string, 1, 0}; DHCPOPT[18] = {"IP Forwarding Enable/Disable Option", opt_switch, 1, 1}; DHCPOPT[19] = {"Non-Local Source Routing Enable/Disable Option", opt_switch, 1, 1}; DHCPOPT[20] = {"Policy Filter Option", ip, 8, 0}; DHCPOPT[21] = {"Maximum Datagram Reassembly Size", number, 2, 2}; DHCPOPT[22] = {"Default IP Time-to-live", number, 1, 1}; DHCPOPT[23] = {"Path MTU Aging Timeout Option", time, 4, 4}; DHCPOPT[24] = {"Path MTU Plateau Table Option", number, 2, 0}; // minimum mtu 68 DHCPOPT[25] = {"Interface MTU Option", number, 2, 2}; DHCPOPT[26] = {"All Subnets are Local Option", opt_switch, 1, 1}; DHCPOPT[27] = {"Broadcast Address Option", ip, 4, 4}; DHCPOPT[28] = {"Perform Mask Discovery Option", opt_switch, 1, 1}; DHCPOPT[29] = {"Mask Supplier Option", opt_switch, 1, 1}; DHCPOPT[30] = {"Perform Router Discovery Option", opt_switch, 1, 1}; DHCPOPT[31] = {"Router Solicitation Address Option", ip, 4, 4}; DHCPOPT[32] = {"Static Route Option", ip, 8, 0}; // Default Route 0.0.0.0 is illegal here DHCPOPT[33] = {"Trailer Encapsulation Option", opt_switch, 1, 1}; DHCPOPT[34] = {"ARP Cache Timeout Option", time, 4, 4}; DHCPOPT[35] = {"Ethernet Encapsulation Option", opt_switch, 1, 1}; DHCPOPT[36] = {"TCP Default TTL Option", number, 1, 1}; DHCPOPT[37] = {"TCP Keepalive Interval Option", time, 4, 4}; DHCPOPT[38] = {"TCP Keepalive Garbage Option", opt_switch, 1, 1}; DHCPOPT[39] = {"Network Information Service Domain Option", string, 1, 0}; DHCPOPT[40] = {"Network Information Servers Option", ip, 4, 0}; DHCPOPT[41] = {"Network Time Protocol Servers Option", ip, 4, 0}; DHCPOPT[42] = {"Vendor Specific Information", multi, 0, 0}; DHCPOPT[43] = {"NetBIOS over TCP/IP Name Server Option", ip, 4, 0}; DHCPOPT[44] = {"NetBIOS over TCP/IP Datagram Distribution Server Option", ip, 4, 0}; DHCPOPT[45] = {"NetBIOS over TCP/IP Node Type Option", node_type, 1, 1}; DHCPOPT[46] = {"NetBIOS over TCP/IP Scope Option", string, 1, 0}; DHCPOPT[47] = {"X Window System Font Server Option", ip, 4, 0}; DHCPOPT[48] = {"X Window System Display Manager Option", ip, 4, 0}; DHCPOPT[49] = {"Requested IP Address", ip, 4, 4}; DHCPOPT[50] = {"IP Address Lease Time", time, 4, 4}; DHCPOPT[51] = {"Option Overload", opt_switch, 1, 1}; // values: 1,2,3 DHCPOPT[52] = {"DHCP Message Type", opt_switch, 1, 1}; // values: 1-8 DHCPOPT[53] = {"Server Identifier", ip, 4, 4}; DHCPOPT[54] = {"Parameter Request List", number, 1, 0}; DHCPOPT[55] = {"Message", string, 1, 0}; DHCPOPT[56] = {"Maximum DHCP Message Size", number, 2, 2}; DHCPOPT[57] = {"Renewal (T1) Time Value", time, 4, 4}; DHCPOPT[58] = {"Rebinding (T2) Time Value", time, 4, 4}; DHCPOPT[59] = {"Vendor class identifier", bin, 1, 0}; DHCPOPT[60] = {"Client-identifier", bin, 2, 0}; // first field: type then data DHCPOPT[63] = {"Network Information Service+ Domain Option", string, 1, 0}; DHCPOPT[65] = {"TFTP server name", string, 1, 0}; DHCPOPT[66] = {"Bootfile name", string, 1, 0}; DHCPOPT[67] = {"Mobile IP Home Agent option", ip, 4, 0}; DHCPOPT[68] = {"Simple Mail Transport Protocol (SMTP) Server Option", ip, 4, 0}; DHCPOPT[69] = {"Post Office Protocol (POP3) Server Option", ip, 4, 0}; DHCPOPT[70] = {"Network News Transport Protocol (NNTP) Server Option", ip, 4, 0}; DHCPOPT[71] = {"Default World Wide Web (WWW) Server Option", ip, 4, 0}; DHCPOPT[72] = {"Default Finger Server Option", ip, 4, 0}; DHCPOPT[73] = {"Default Internet Relay Chat (IRC) Server Option", ip, 4, 0}; DHCPOPT[74] = {"StreetTalk Server Option", ip, 4, 0}; DHCPOPT[75] = {"StreetTalk Directory Assistance (STDA) Server Option", ip, 4, 0};