File Coverage

blib/lib/Net/DHCP/Constants.pm
Criterion Covered Total %
statement 64 64 100.0
branch n/a
condition n/a
subroutine 20 20 100.0
pod n/a
total 84 84 100.0


line stmt bran cond sub pod time code
1             #!/bin/false
2             # PODNAME: Net::DHCP::Constants
3             # Author: Dean Hamstead, Stephan Hadinger
4             # ABSTRACT: Constants for DHCP codes and options
5 13     13   15669 use strict;
  13         16  
  13         274  
6 13     13   36 use warnings;
  13         13  
  13         254  
7 13     13   91 use 5.8.0;
  13         27  
8              
9             package Net::DHCP::Constants;
10             $Net::DHCP::Constants::VERSION = '0.7_007'; # TRIAL
11              
12             $Net::DHCP::Constants::VERSION = '0.7007';# standard module declaration
13             our ( @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS );
14 13     13   43 use Exporter;
  13         21  
  13         3384  
15             @ISA = qw(Exporter);
16              
17             @EXPORT = qw(MAGIC_COOKIE);
18              
19             # Constants
20             our ( %DHO_CODES, %REV_DHO_CODES );
21             our ( %DHCP_MESSAGE, %REV_DHCP_MESSAGE );
22             our ( %BOOTP_CODES, %REV_BOOTP_CODES );
23             our ( %HTYPE_CODES, %REV_HTYPE_CODES );
24             our ( %NWIP_CODES, %REV_NWIP_CODES );
25             our ( %CCC_CODES, %REV_CCC_CODES );
26             our ( %GEOCONF_CODES, %REV_GEOCONF_CODES );
27             our ( %RELAYAGENT_CODES, %REV_RELAYAGENT_CODES );
28             our ( %RELAYAGENT_FORMATS, %REV_RELAYAGENT_FORMATS );
29             our ( %SUBOPTION_CODES, %REV_SUBOPTION_CODES );
30              
31             %EXPORT_TAGS = (
32             dho_codes => [ keys %DHO_CODES ],
33             dhcp_message => [ keys %DHCP_MESSAGE ],
34             bootp_codes => [ keys %BOOTP_CODES ],
35             htype_codes => [ keys %HTYPE_CODES ],
36             nwip_codes => [ keys %NWIP_CODES ],
37             ccc_codes => [ keys %CCC_CODES ],
38             geoconf_codes => [ keys %GEOCONF_CODES ],
39             ra_codes => [ keys %RELAYAGENT_CODES ],
40             dhcp_hashes => [
41             qw(
42             %DHO_CODES %REV_DHO_CODES
43             %DHCP_MESSAGE %REV_DHCP_MESSAGE
44             %BOOTP_CODES %REV_BOOTP_CODES
45             %NWIP_CODES %REV_NWIP_CODES
46             %CCC_CODES %REV_CCC_CODES
47             %HTYPE_CODES %REV_HTYPE_CODES
48             %GEOCONF_CODES %REV_GEOCONF_CODES
49             %RELAYAGENT_CODES %REV_RELAYAGENT_CODES
50             %SUBOPTION_CODES %REV_SUBOPTION_CODES
51             )
52             ],
53             dhcp_other => [
54             qw(MAGIC_COOKIE DHCP_UDP_OVERHEAD DHCP_MAX_MTU BOOTP_MIN_LEN BOOTP_ABSOLUTE_MIN_LEN DHCP_MIN_LEN)
55             ]
56             );
57              
58             @EXPORT_OK = qw(
59             %DHO_CODES %REV_DHO_CODES
60             %DHCP_MESSAGE %REV_DHCP_MESSAGE
61             %BOOTP_CODES %REV_BOOTP_CODES
62             %NWIP_CODES %REV_NWIP_CODES
63             %HTYPE_CODES %REV_HTYPE_CODES
64             %CCC_CODES %REV_CCC_CODES
65             %DHO_FORMATS
66             %SUBOPTION_FORMATS
67             %GEOCONF_CODES %REV_GEOCONF_CODES
68             %RELAYAGENT_CODES %REV_RELAYAGENT_CODES
69             %SUBOPTION_CODES %REV_SUBOPTION_CODES
70              
71             );
72             Exporter::export_tags('dho_codes');
73             Exporter::export_tags('dhcp_message');
74             Exporter::export_tags('bootp_codes');
75             Exporter::export_tags('htype_codes');
76             Exporter::export_tags('nwip_codes');
77             Exporter::export_tags('ccc_codes');
78             Exporter::export_tags('geoconf_codes');
79             Exporter::export_ok_tags('dhcp_other');
80             Exporter::export_ok_tags('ra_codes');
81              
82             # MAGIC_COOKIE for DHCP (otherwise it is BOOTP)
83 13     13   51 use constant MAGIC_COOKIE => "\x63\x82\x53\x63";
  13         13  
  13         814  
84              
85 13     13   42 use constant DHCP_UDP_OVERHEAD => ( 14 + 20 + 8 ); # Ethernet + IP + UDP
  13         13  
  13         525  
86 13     13   45 use constant DHCP_MAX_MTU => 1500;
  13         15  
  13         472  
87 13     13   83 use constant BOOTP_ABSOLUTE_MIN_LEN => 236;
  13         13  
  13         469  
88 13     13   37 use constant BOOTP_MIN_LEN => 300;
  13         11  
  13         443  
89 13     13   48 use constant DHCP_MIN_LEN => 548;
  13         13  
  13         4616  
90              
91             BEGIN {
92 13     13   41 %BOOTP_CODES = (
93             'BOOTREQUEST' => 1,
94             'BOOTREPLY' => 2,
95             );
96              
97 13         34 %HTYPE_CODES = (
98             'HTYPE_ETHER' => 1,
99             'HTYPE_IEEE802' => 6,
100             'HTYPE_FDDI' => 8,
101             'HTYPE_INFINIBAND' => 32,
102             );
103              
104 13         1339 %DHO_CODES = ( # RFC 2132
105             'DHO_PAD' => 0,
106             'DHO_SUBNET_MASK' => 1,
107             'DHO_TIME_OFFSET' => 2,
108             'DHO_ROUTERS' => 3,
109             'DHO_TIME_SERVERS' => 4,
110             'DHO_NAME_SERVERS' => 5,
111             'DHO_DOMAIN_NAME_SERVERS' => 6,
112             'DHO_LOG_SERVERS' => 7,
113             'DHO_COOKIE_SERVERS' => 8,
114             'DHO_LPR_SERVERS' => 9,
115             'DHO_IMPRESS_SERVERS' => 10,
116             'DHO_RESOURCE_LOCATION_SERVERS' => 11,
117             'DHO_HOST_NAME' => 12,
118             'DHO_BOOT_SIZE' => 13,
119             'DHO_MERIT_DUMP' => 14,
120             'DHO_DOMAIN_NAME' => 15,
121             'DHO_SWAP_SERVER' => 16,
122             'DHO_ROOT_PATH' => 17,
123             'DHO_EXTENSIONS_PATH' => 18,
124             'DHO_IP_FORWARDING' => 19,
125             'DHO_NON_LOCAL_SOURCE_ROUTING' => 20,
126             'DHO_POLICY_FILTER' => 21,
127             'DHO_MAX_DGRAM_REASSEMBLY' => 22,
128             'DHO_DEFAULT_IP_TTL' => 23,
129             'DHO_PATH_MTU_AGING_TIMEOUT' => 24,
130             'DHO_PATH_MTU_PLATEAU_TABLE' => 25,
131             'DHO_INTERFACE_MTU' => 26,
132             'DHO_ALL_SUBNETS_LOCAL' => 27,
133             'DHO_BROADCAST_ADDRESS' => 28,
134             'DHO_PERFORM_MASK_DISCOVERY' => 29,
135             'DHO_MASK_SUPPLIER' => 30,
136             'DHO_ROUTER_DISCOVERY' => 31,
137             'DHO_ROUTER_SOLICITATION_ADDRESS' => 32,
138             'DHO_STATIC_ROUTES' => 33,
139             'DHO_TRAILER_ENCAPSULATION' => 34,
140             'DHO_ARP_CACHE_TIMEOUT' => 35,
141             'DHO_IEEE802_3_ENCAPSULATION' => 36,
142             'DHO_DEFAULT_TCP_TTL' => 37,
143             'DHO_TCP_KEEPALIVE_INTERVAL' => 38,
144             'DHO_TCP_KEEPALIVE_GARBAGE' => 39,
145             'DHO_NIS_DOMAIN' => 40,
146             'DHO_NIS_SERVERS' => 41,
147             'DHO_NTP_SERVERS' => 42,
148             'DHO_VENDOR_ENCAPSULATED_OPTIONS' => 43,
149             'DHO_NETBIOS_NAME_SERVERS' => 44,
150             'DHO_NETBIOS_DD_SERVER' => 45,
151             'DHO_NETBIOS_NODE_TYPE' => 46,
152             'DHO_NETBIOS_SCOPE' => 47,
153             'DHO_FONT_SERVERS' => 48,
154             'DHO_X_DISPLAY_MANAGER' => 49,
155             'DHO_DHCP_REQUESTED_ADDRESS' => 50,
156             'DHO_DHCP_LEASE_TIME' => 51,
157             'DHO_DHCP_OPTION_OVERLOAD' => 52,
158             'DHO_DHCP_MESSAGE_TYPE' => 53,
159             'DHO_DHCP_SERVER_IDENTIFIER' => 54,
160             'DHO_DHCP_PARAMETER_REQUEST_LIST' => 55,
161             'DHO_DHCP_MESSAGE' => 56,
162             'DHO_DHCP_MAX_MESSAGE_SIZE' => 57,
163             'DHO_DHCP_RENEWAL_TIME' => 58,
164             'DHO_DHCP_REBINDING_TIME' => 59,
165             'DHO_VENDOR_CLASS_IDENTIFIER' => 60,
166             'DHO_DHCP_CLIENT_IDENTIFIER' => 61,
167             'DHO_NWIP_DOMAIN_NAME' => 62,
168             'DHO_NWIP_SUBOPTIONS' => 63,
169             'DHO_NISV3_DOMAIN' => 64,
170             'DHO_NISV3_SERVER' => 65,
171             'DHO_TFTP_SERVER' => 66, # actually named 'server name' by IANA
172             'DHO_BOOTFILE' => 67,
173             'DHO_MOBILE_IP_HOME_AGENT' => 68,
174             'DHO_SMTP_SERVER' => 69,
175             'DHO_POP3_SERVER' => 70,
176             'DHO_NNTP_SERVER' => 71,
177             'DHO_WWW_SERVER' => 72,
178             'DHO_FINGER_SERVER' => 73,
179             'DHO_IRC_SERVER' => 74,
180             'DHO_STREETTALK_SERVER' => 75,
181             'DHO_STDA_SERVER' => 76,
182             'DHO_USER_CLASS' => 77,
183             'DHO_DIRECTORY_AGENT' => 78,
184             'DHO_SERVICE_SCOPE' => 79,
185             'DHO_RAPID_COMMIT' => 80,
186             'DHO_FQDN' => 81,
187             'DHO_DHCP_AGENT_OPTIONS' => 82,
188             'DHO_ISNS' => 83,
189             'DHO_NDS_SERVERS' => 85,
190             'DHO_NDS_TREE_NAME' => 86,
191             'DHO_NDS_CONTEXT' => 87,
192             'DHO_BCMCS_CONTROLLER_DOMAIN_NAME_LIST' => 88,
193             'DHO_BCMCS_CONTROLLER_IPV4_ADDRESS' => 89,
194             'DHO_AUTHENTICATION' => 90,
195             'DHO_CLIENT_LAST_TRANSACTION_TIME' => 91,
196             'DHO_ASSOCIATED_IP' => 92,
197             'DHO_CLIENT_SYSTEM' => 93,
198             'DHO_CLIENT_NDI' => 94,
199             'DHO_LDAP' => 95,
200             'DHO_UUID_GUID' => 97,
201             'DHO_USER_AUTHENTICATION_PROTOCOL' => 98,
202             'DHO_GEOCONF_CIVIC' => 99,
203             'DHO_PCODE' => 100,
204             'DHO_TCODE' => 101,
205             'DHO_NETINFO_ADDRESS' => 112,
206             'DHO_NETINFO_TAG' => 113,
207             'DHO_URL' => 114,
208             'DHO_AUTO_CONFIGURE' => 116,
209             'DHO_NAME_SERVICE_SEARCH' => 117,
210             'DHO_SUBNET_SELECTION' => 118,
211             'DHO_DOMAIN_SEARCH' => 119,
212             'DHO_SIP_SERVERS' => 120,
213             'DHO_CLASSLESS_STATIC_ROUTE' => 121,
214             'DHO_CCC' => 122,
215             'DHO_GEOCONF' => 123,
216             'DHO_VI_VENDOR_CLASS' => 124,
217             'DHO_VI_VENDOR_SPECIFIC_INFOMATION' => 125,
218             'DHO_DOCSIS_FULL_SECURITY_SERVER_ADDRESS' => 128,
219             'DHO_TFTP_SERVER_IPPHONE' => 128,
220             'DHO_ETHERBOOT_SIGNATURE' => 128,
221             'DHO_CALL_SERVER_ADDRESS' => 129,
222             'DHO_KERNEL_OPTIONS' => 129,
223             'DHO_DISCRIMINATION_STRING' => 130,
224             'DHO_ETHERNET_INTERFACE' => 130,
225             'DHO_REMOTE_STATISTICS_SERVER' => 131,
226             'DHO_VLAN_ID' => 132,
227             'DHO_L2_PRIORITY' => 133,
228             'DHO_DSCP' => 134,
229             'DHO_PXE' => 135,
230             'DHO_HTTP_PROXY_FORPHONES' => 135,
231              
232             'DHO_OPTION_PANA_AGENT' => 136,
233             'DHO_OPTION_PANA_V4_LOST' => 137,
234             'DHO_OPTION_CAPWAP_AC_V4' => 138,
235             'DHO_OPTION_IPV4_ADDRESS_MOS' => 139,
236             'DHO_OPTION_IPV4_FQDN_MOS' => 140,
237             'DHO_SIP_UA_CONFIGURATION_SERVICE_DOMAINS' => 141,
238             'DHO_GRUB_CONF_PATH' => 150,
239             'DHO_TFTP_SERVER_ADDRESS' => 150, # not to be confused with 66
240             'DHO_ETHERBOOT' => 150,
241             'DHO_IP_TELEPHONE' => 176,
242             'DHO_PACKETCABLE_DEPRECATED' => 177,
243             'DHO_ETHERBOOT_TENTATIVE' => 177,
244             'DHO_PXELINUX_MAGIC' => 208,
245             'DHO_CONFIGURATION_FILE' => 209,
246             'DHO_PATH_PREFIX' => 210,
247             'DHO_REBOOT_TIME' => 211,
248             'DHO_OPTION_6RD' => 212,
249             'DHO_OPTION_V4_ACCESS_DOMAIN' => 213,
250             'DHO_SUBNET_ALLOCATION' => 220,
251             'DHO_VIRTUAL_SUBNET' => 221,
252              
253             'DHO_CLASSLESS_STATIC_ROUTE_MS' => 249,
254              
255             'DHO_END' => 255
256             );
257              
258             # Type 53 codes...
259 13         1597 %DHCP_MESSAGE = (
260              
261             # RFC2132
262             'DHCPDISCOVER' => 1,
263             'DHCPOFFER' => 2,
264             'DHCPREQUEST' => 3,
265             'DHCPDECLINE' => 4,
266             'DHCPACK' => 5,
267             'DHCPNAK' => 6,
268             'DHCPRELEASE' => 7,
269             'DHCPINFORM' => 8,
270             'DHCPFORCERENEW' => 9,
271              
272             # RFC4388
273             'DHCPLEASEQUERY' => 10
274             , # This is now ratified in RFC4388. If you have an old crappy CMTS you might need to change it with 13
275             'DHCPLEASEUNASSIGNED' => 11,
276             'DHCPLEASEUNKNOWN' => 12,
277             'DHCPLEASEACTIVE' => 13,
278              
279             );
280              
281             # Type 63 sub-option codes...
282 13         68 %NWIP_CODES = (
283             'NWIP_DOES_NOT_EXIST' => 1,
284             'NWIP_EXIST_IN_OPTIONS_AREA' => 2,
285             'NWIP_EXIST_IN_SNAME_FILE' => 3,
286             'NWIP_EXIST_BUT_TOO_BIG' => 4,
287             'NWIP_NSQ_BROADCAST' => 5,
288             'NWIP_PREFERRED_DSS' => 6,
289             'NWIP_NEAREST_NWIP_SERVER' => 7,
290             'NWIP_AUTORETRIES' => 8,
291             'NWIP_AUTORETRY_SECS' => 9,
292             'NWIP_1_1' => 10,
293             'NWIP_PRIMARY_DSS' => 11,
294              
295             #'Unassigned' => '12-255'
296             );
297              
298             # Type 122 sub option codes
299 13         355 %CCC_CODES = (
300             'CCC_PRIMARY_DHCP_SERVER' => 1,
301             'CCC_SECONDARY_DHCP_SERVER' => 2,
302             'CCC_PROVISIONING_SERVER' => 3,
303             'CCC_AS_REQ_AS_REP_BACKOFFRETRY' => 4,
304             'CCC_AP_REQ_AS_REP_BACKOFFRETRY' => 5,
305             'CCC_KERBEROS_REALM' => 6,
306             'CCC_TICKET_SERVER_UTILIZATION' => 7,
307             'CCC_PROVISIONING_TIMER' => 8,
308             'CCC_SECURITY_TICKET_CONTROL' => 9,
309             'CCC_KDC_SERVER' => 10,
310             );
311              
312             # Type 123 sub option codes (there are more, but im not sure how to deal with them)
313 13         24 %GEOCONF_CODES = (
314             'GEO_METERS' => 1,
315             'GEO_FLOORS' => 2,
316             );
317              
318             # Type 82 sub option codes
319 13         649 %RELAYAGENT_CODES = (
320             'RAI_CIRCUIT_ID' => 1,
321             'RAI_REMOTE_ID' => 2,
322             'RAI_AGENT_ID' => 3,
323             'RAI_DOCSIS_CLASS' => 4,
324             'RAI_LINK_SELECTION' => 5,
325             'RAI_SUBSCRIBER_ID' => 6,
326             'RAI_RADIUS_ATTRIBUTES' => 7,
327             'RAI_AUTHENTICATION' => 8,
328             'RAI_VENDOR_INFO' => 9,
329             'RAI_FLAGS' => 10,
330             'RAI_SERVER_ID_OVERRIDE' => 11,
331             'RAI_DHCPV4_VIRTUAL_SUBNET_SELECTION' => 151, # rfc 6607
332             'RAI_DHCPV4_VIRTUAL_SUBNET_SELECTION_CONTROL' => 152, # rfc 6607
333             );
334             }
335              
336 13     13   51 use constant \%DHO_CODES;
  13         10  
  13         13189  
337             %REV_DHO_CODES = reverse %DHO_CODES;
338              
339 13     13   51 use constant \%DHCP_MESSAGE;
  13         12  
  13         1451  
340             %REV_DHCP_MESSAGE = reverse %DHCP_MESSAGE;
341              
342 13     13   49 use constant \%BOOTP_CODES;
  13         12  
  13         634  
343             %REV_BOOTP_CODES = reverse %BOOTP_CODES; # for reverse lookup
344              
345 13     13   42 use constant \%HTYPE_CODES;
  13         8  
  13         722  
346             %REV_HTYPE_CODES = reverse %HTYPE_CODES; # for reverse lookup
347              
348 13     13   39 use constant \%NWIP_CODES;
  13         13  
  13         1283  
349             %REV_NWIP_CODES = reverse %NWIP_CODES;
350              
351 13     13   40 use constant \%CCC_CODES;
  13         12  
  13         1226  
352             %REV_CCC_CODES = reverse %CCC_CODES;
353              
354 13     13   41 use constant \%GEOCONF_CODES;
  13         11  
  13         627  
355             %REV_GEOCONF_CODES = reverse %GEOCONF_CODES;
356              
357 13     13   40 use constant \%RELAYAGENT_CODES;
  13         11  
  13         1457  
358             %REV_RELAYAGENT_CODES = reverse %RELAYAGENT_CODES;
359              
360 13     13   50 use constant \%RELAYAGENT_FORMATS;
  13         11  
  13         4934  
361             %REV_RELAYAGENT_FORMATS = reverse %RELAYAGENT_FORMATS;
362              
363             #
364             # Format of DHCP options : for pretty-printing
365             # void : no parameter
366             # inet : 4 bytes IP address
367             # inets : list of 4 bytes IP addresses
368             # inets2 : list of 4 bytes IP addresses pairs (multiple of 8 bytes)
369             # int : 4 bytes integer
370             # short : 2 bytes integer
371             # shorts : list of 2 bytes integers
372             # byte : 1 byte int
373             # bytes : list of 1 byte code
374             # string : char* (just kidding)
375             # relays : DHCP sub-options (rfc 3046)
376             # ids : client identifier : byte (htype) + string (chaddr)
377             # csr : classless static routes (rfc 3442)
378             # suboptions : hex encoded sub options
379             #
380             our %DHO_FORMATS = (
381             DHO_PAD() => 'void',
382             DHO_SUBNET_MASK() => 'inet',
383             DHO_TIME_OFFSET() => 'int',
384             DHO_ROUTERS() => 'inets',
385             DHO_TIME_SERVERS() => 'inets',
386             DHO_NAME_SERVERS() => 'inets',
387             DHO_DOMAIN_NAME_SERVERS() => 'inets',
388             DHO_LOG_SERVERS() => 'inets',
389             DHO_COOKIE_SERVERS() => 'inets',
390             DHO_LPR_SERVERS() => 'inets',
391             DHO_IMPRESS_SERVERS() => 'inets',
392             DHO_RESOURCE_LOCATION_SERVERS() => 'inets',
393             DHO_HOST_NAME() => 'string',
394             DHO_BOOT_SIZE() => 'short',
395             DHO_MERIT_DUMP() => 'string',
396             DHO_DOMAIN_NAME() => 'string',
397             DHO_SWAP_SERVER() => 'inet',
398             DHO_ROOT_PATH() => 'string',
399             DHO_EXTENSIONS_PATH() => 'string',
400             DHO_IP_FORWARDING() => 'byte',
401             DHO_NON_LOCAL_SOURCE_ROUTING() => 'byte',
402             DHO_POLICY_FILTER() => 'inets2',
403             DHO_MAX_DGRAM_REASSEMBLY() => 'short',
404             DHO_DEFAULT_IP_TTL() => 'byte',
405             DHO_PATH_MTU_AGING_TIMEOUT() => 'int',
406             DHO_PATH_MTU_PLATEAU_TABLE() => 'shorts',
407             DHO_INTERFACE_MTU() => 'short',
408             DHO_ALL_SUBNETS_LOCAL() => 'byte',
409             DHO_BROADCAST_ADDRESS() => 'inet',
410             DHO_PERFORM_MASK_DISCOVERY() => 'byte',
411             DHO_MASK_SUPPLIER() => 'byte',
412             DHO_ROUTER_DISCOVERY() => 'byte',
413             DHO_ROUTER_SOLICITATION_ADDRESS() => 'inet',
414             DHO_STATIC_ROUTES() => 'inets2',
415             DHO_TRAILER_ENCAPSULATION() => 'byte',
416             DHO_ARP_CACHE_TIMEOUT() => 'int',
417             DHO_IEEE802_3_ENCAPSULATION() => 'byte',
418             DHO_DEFAULT_TCP_TTL() => 'byte',
419             DHO_TCP_KEEPALIVE_INTERVAL() => 'int',
420             DHO_TCP_KEEPALIVE_GARBAGE() => 'byte',
421             DHO_NIS_DOMAIN() => 'string',
422             DHO_NIS_SERVERS() => 'inets',
423             DHO_NTP_SERVERS() => 'inets',
424              
425             DHO_VENDOR_ENCAPSULATED_OPTIONS() => 'suboptions',
426             DHO_NETBIOS_NAME_SERVERS() => 'inets',
427             DHO_NETBIOS_DD_SERVER() => 'inets',
428             DHO_NETBIOS_NODE_TYPE() => 'byte',
429             DHO_NETBIOS_SCOPE() => 'string',
430             DHO_FONT_SERVERS() => 'inets',
431             DHO_X_DISPLAY_MANAGER() => 'inets',
432             DHO_DHCP_REQUESTED_ADDRESS() => 'inet',
433             DHO_DHCP_LEASE_TIME() => 'int',
434             DHO_DHCP_OPTION_OVERLOAD() => 'byte',
435             DHO_DHCP_MESSAGE_TYPE() => 'byte',
436             DHO_DHCP_SERVER_IDENTIFIER() => 'inet',
437             DHO_DHCP_PARAMETER_REQUEST_LIST() => 'bytes',
438             DHO_DHCP_MESSAGE() => 'string',
439             DHO_DHCP_MAX_MESSAGE_SIZE() => 'short',
440             DHO_DHCP_RENEWAL_TIME() => 'int',
441             DHO_DHCP_REBINDING_TIME() => 'int',
442             DHO_VENDOR_CLASS_IDENTIFIER() => 'string',
443              
444             DHO_DHCP_CLIENT_IDENTIFIER() => 'clientid',
445             DHO_NWIP_DOMAIN_NAME() => 'string', # rfc 2242
446              
447             DHO_NWIP_SUBOPTIONS() => 'suboptions', # rfc 2242
448             DHO_NISV3_DOMAIN() => 'string',
449             DHO_NISV3_SERVER() => 'string',
450             DHO_TFTP_SERVER() => 'string',
451             DHO_BOOTFILE() => 'string', # 67
452             DHO_MOBILE_IP_HOME_AGENT() => 'inets',
453             DHO_SMTP_SERVER() => 'inets',
454             DHO_POP3_SERVER() => 'inets',
455             DHO_NNTP_SERVER() => 'inets',
456             DHO_WWW_SERVER() => 'inets',
457             DHO_FINGER_SERVER() => 'inets',
458             DHO_IRC_SERVER() => 'inets',
459             DHO_STREETTALK_SERVER() => 'inets',
460             DHO_STDA_SERVER() => 'inets',
461              
462             DHO_SIP_SERVERS() => 'sipserv',
463             DHO_CLASSLESS_STATIC_ROUTE() => 'csr', # rfc 3442
464             DHO_CCC => 'suboptions', # 122
465              
466             # While not perfect, usage is primarily as a string. iPXE is
467             # a common use case for this option.
468             DHO_USER_CLASS() => 'string', # rfc 3004
469             # DHO_FQDN() => '', # draft-ietf-dhc-fqdn-option-10.txt
470             DHO_DHCP_AGENT_OPTIONS() => 'suboptions', # rfc 3046
471             # DHO_DHCP_AGENT_OPTIONS() => 'string', # rfc 3046
472             DHO_NDS_SERVERS() => 'inets', # rfc 2241
473             DHO_NDS_TREE_NAME() => 'string', # rfc 2241
474             DHO_USER_AUTHENTICATION_PROTOCOL() => 'string', # rfc 2485
475             DHO_AUTO_CONFIGURE() => 'byte', # rfc 2563
476             DHO_NAME_SERVICE_SEARCH() => 'shorts', # rfc 2937
477             DHO_SUBNET_SELECTION() => 'inet', # rfc 3011
478              
479             DHO_CLASSLESS_STATIC_ROUTE_MS() => 'csr',
480             );
481              
482             %RELAYAGENT_FORMATS = (
483             RAI_CIRCUIT_ID() => 'hexa',
484             RAI_REMOTE_ID() => 'hexa',
485             # RAI_AGENT_ID() => 'hexa',
486             # RAI_DOCSIS_CLASS() => 'hexa',
487             # RAI_LINK_SELECTION() => 'hexa',
488             # RAI_SUBSCRIBER_ID() => 'hexa',
489             # RAI_RADIUS_ATTRIBUTES() => 'hexa',
490             # RAI_AUTHENTICATION() => 'hexa',
491             RAI_VENDOR_INFO() => 'hexa',
492             # RAI_FLAGS() => 'hexa',
493             # RAI_SERVER_ID_OVERRIDE() => 'hexa',
494             # RAI_DHCPV4_VIRTUAL_SUBNET_SELECTION() => 'hexa',
495             # RAI_DHCPV4_VIRTUAL_SUBNET_SELECTION_CONTROL() => 'hexa',
496             ),
497              
498             our %SUBOPTION_FORMATS = (
499             $DHO_CODES{'DHO_DHCP_AGENT_OPTIONS'} => \%RELAYAGENT_FORMATS,
500             );
501              
502             our %REV_SUBOPTION_FORMATS = (
503             $DHO_CODES{'DHO_DHCP_AGENT_OPTIONS'} => \%REV_RELAYAGENT_FORMATS,
504             );
505              
506             # Links option codes with their suboption values
507             %SUBOPTION_CODES = (
508             $DHO_CODES{'DHO_NWIP_SUBOPTIONS'} => \%NWIP_CODES, # option 63
509             $DHO_CODES{'DHO_DHCP_AGENT_OPTIONS'} => \%RELAYAGENT_CODES, # option 82
510             $DHO_CODES{'DHO_CCC'} => \%CCC_CODES, # option 122
511             $DHO_CODES{'DHO_GEOCONF'} => \%GEOCONF_CODES, # option 123
512             );
513              
514             # Links option codes with their reverse suboption values
515             %REV_SUBOPTION_CODES = (
516             $DHO_CODES{'DHO_NWIP_SUBOPTIONS'} => \%REV_NWIP_CODES, # option 63
517             $DHO_CODES{'DHO_DHCP_AGENT_OPTIONS'} => \%REV_RELAYAGENT_CODES, # option 82
518             $DHO_CODES{'DHO_CCC'} => \%REV_CCC_CODES, # option 122
519             $DHO_CODES{'DHO_GEOCONF'} => \%REV_GEOCONF_CODES, # option 123
520             );
521              
522             1;
523              
524             __END__