You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dhcp.h 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. #ifndef _IPXE_DHCP_H
  2. #define _IPXE_DHCP_H
  3. /** @file
  4. *
  5. * Dynamic Host Configuration Protocol
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER );
  9. #include <stdint.h>
  10. #include <ipxe/in.h>
  11. #include <ipxe/list.h>
  12. #include <ipxe/refcnt.h>
  13. #include <ipxe/tables.h>
  14. #include <ipxe/uuid.h>
  15. #include <ipxe/netdevice.h>
  16. #include <ipxe/uaccess.h>
  17. struct job_interface;
  18. struct dhcp_options;
  19. struct dhcp_packet;
  20. /** BOOTP/DHCP server port */
  21. #define BOOTPS_PORT 67
  22. /** BOOTP/DHCP client port */
  23. #define BOOTPC_PORT 68
  24. /** PXE server port */
  25. #define PXE_PORT 4011
  26. /** Construct a tag value for an encapsulated option
  27. *
  28. * This tag value can be passed to Etherboot functions when searching
  29. * for DHCP options in order to search for a tag within an
  30. * encapsulated options block.
  31. */
  32. #define DHCP_ENCAP_OPT( encapsulator, encapsulated ) \
  33. ( ( (encapsulator) << 8 ) | (encapsulated) )
  34. /** Extract encapsulating option block tag from encapsulated tag value */
  35. #define DHCP_ENCAPSULATOR( encap_opt ) ( (encap_opt) >> 8 )
  36. /** Extract encapsulated option tag from encapsulated tag value */
  37. #define DHCP_ENCAPSULATED( encap_opt ) ( (encap_opt) & 0xff )
  38. /** Option is encapsulated */
  39. #define DHCP_IS_ENCAP_OPT( opt ) DHCP_ENCAPSULATOR( opt )
  40. /**
  41. * @defgroup dhcpopts DHCP option tags
  42. * @{
  43. */
  44. /** Padding
  45. *
  46. * This tag does not have a length field; it is always only a single
  47. * byte in length.
  48. */
  49. #define DHCP_PAD 0
  50. /** Minimum normal DHCP option */
  51. #define DHCP_MIN_OPTION 1
  52. /** Subnet mask */
  53. #define DHCP_SUBNET_MASK 1
  54. /** Routers */
  55. #define DHCP_ROUTERS 3
  56. /** DNS servers */
  57. #define DHCP_DNS_SERVERS 6
  58. /** Syslog servers */
  59. #define DHCP_LOG_SERVERS 7
  60. /** Host name */
  61. #define DHCP_HOST_NAME 12
  62. /** Domain name */
  63. #define DHCP_DOMAIN_NAME 15
  64. /** Root path */
  65. #define DHCP_ROOT_PATH 17
  66. /** Vendor encapsulated options */
  67. #define DHCP_VENDOR_ENCAP 43
  68. /** PXE boot server discovery control */
  69. #define DHCP_PXE_DISCOVERY_CONTROL DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 6 )
  70. /** PXE boot server discovery control bits */
  71. enum dhcp_pxe_discovery_control {
  72. /** Inhibit broadcast discovery */
  73. PXEBS_NO_BROADCAST = 1,
  74. /** Inhibit multicast discovery */
  75. PXEBS_NO_MULTICAST = 2,
  76. /** Accept only servers in DHCP_PXE_BOOT_SERVERS list */
  77. PXEBS_NO_UNKNOWN_SERVERS = 4,
  78. /** Skip discovery if filename present */
  79. PXEBS_SKIP = 8,
  80. };
  81. /** PXE boot server multicast address */
  82. #define DHCP_PXE_BOOT_SERVER_MCAST DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 7 )
  83. /** PXE boot servers */
  84. #define DHCP_PXE_BOOT_SERVERS DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 8 )
  85. /** PXE boot server */
  86. struct dhcp_pxe_boot_server {
  87. /** "Type" */
  88. uint16_t type;
  89. /** Number of IPv4 addresses */
  90. uint8_t num_ip;
  91. /** IPv4 addresses */
  92. struct in_addr ip[0];
  93. } __attribute__ (( packed ));
  94. /** PXE boot menu */
  95. #define DHCP_PXE_BOOT_MENU DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 9 )
  96. /** PXE boot menu */
  97. struct dhcp_pxe_boot_menu {
  98. /** "Type" */
  99. uint16_t type;
  100. /** Description length */
  101. uint8_t desc_len;
  102. /** Description */
  103. char desc[0];
  104. } __attribute__ (( packed ));
  105. /** PXE boot menu prompt */
  106. #define DHCP_PXE_BOOT_MENU_PROMPT DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 10 )
  107. /** PXE boot menu prompt */
  108. struct dhcp_pxe_boot_menu_prompt {
  109. /** Timeout
  110. *
  111. * A value of 0 means "time out immediately and select first
  112. * boot item, without displaying the prompt". A value of 255
  113. * means "display menu immediately with no timeout". Any
  114. * other value means "display prompt, wait this many seconds
  115. * for keypress, if key is F8, display menu, otherwise select
  116. * first boot item".
  117. */
  118. uint8_t timeout;
  119. /** Prompt to press F8 */
  120. char prompt[0];
  121. } __attribute__ (( packed ));
  122. /** PXE boot menu item */
  123. #define DHCP_PXE_BOOT_MENU_ITEM DHCP_ENCAP_OPT ( DHCP_VENDOR_ENCAP, 71 )
  124. /** PXE boot menu item */
  125. struct dhcp_pxe_boot_menu_item {
  126. /** "Type"
  127. *
  128. * This field actually identifies the specific boot server (or
  129. * cluster of boot servers offering identical boot files).
  130. */
  131. uint16_t type;
  132. /** "Layer"
  133. *
  134. * Just don't ask.
  135. */
  136. uint16_t layer;
  137. } __attribute__ (( packed ));
  138. /** Requested IP address */
  139. #define DHCP_REQUESTED_ADDRESS 50
  140. /** Lease time */
  141. #define DHCP_LEASE_TIME 51
  142. /** Option overloading
  143. *
  144. * The value of this option is the bitwise-OR of zero or more
  145. * DHCP_OPTION_OVERLOAD_XXX constants.
  146. */
  147. #define DHCP_OPTION_OVERLOAD 52
  148. /** The "file" field is overloaded to contain extra DHCP options */
  149. #define DHCP_OPTION_OVERLOAD_FILE 1
  150. /** The "sname" field is overloaded to contain extra DHCP options */
  151. #define DHCP_OPTION_OVERLOAD_SNAME 2
  152. /** DHCP message type */
  153. #define DHCP_MESSAGE_TYPE 53
  154. #define DHCPNONE 0
  155. #define DHCPDISCOVER 1
  156. #define DHCPOFFER 2
  157. #define DHCPREQUEST 3
  158. #define DHCPDECLINE 4
  159. #define DHCPACK 5
  160. #define DHCPNAK 6
  161. #define DHCPRELEASE 7
  162. #define DHCPINFORM 8
  163. /** DHCP server identifier */
  164. #define DHCP_SERVER_IDENTIFIER 54
  165. /** Parameter request list */
  166. #define DHCP_PARAMETER_REQUEST_LIST 55
  167. /** Maximum DHCP message size */
  168. #define DHCP_MAX_MESSAGE_SIZE 57
  169. /** Vendor class identifier */
  170. #define DHCP_VENDOR_CLASS_ID 60
  171. /** Client identifier */
  172. #define DHCP_CLIENT_ID 61
  173. /** Client identifier */
  174. struct dhcp_client_id {
  175. /** Link-layer protocol */
  176. uint8_t ll_proto;
  177. /** Link-layer address */
  178. uint8_t ll_addr[MAX_LL_ADDR_LEN];
  179. } __attribute__ (( packed ));
  180. /** TFTP server name
  181. *
  182. * This option replaces the fixed "sname" field, when that field is
  183. * used to contain overloaded options.
  184. */
  185. #define DHCP_TFTP_SERVER_NAME 66
  186. /** Bootfile name
  187. *
  188. * This option replaces the fixed "file" field, when that field is
  189. * used to contain overloaded options.
  190. */
  191. #define DHCP_BOOTFILE_NAME 67
  192. /** User class identifier */
  193. #define DHCP_USER_CLASS_ID 77
  194. /** Client system architecture */
  195. #define DHCP_CLIENT_ARCHITECTURE 93
  196. /** Client network device interface */
  197. #define DHCP_CLIENT_NDI 94
  198. /** UUID client identifier */
  199. #define DHCP_CLIENT_UUID 97
  200. /** UUID client identifier */
  201. struct dhcp_client_uuid {
  202. /** Identifier type */
  203. uint8_t type;
  204. /** UUID */
  205. union uuid uuid;
  206. } __attribute__ (( packed ));
  207. #define DHCP_CLIENT_UUID_TYPE 0
  208. /** Etherboot-specific encapsulated options
  209. *
  210. * This encapsulated options field is used to contain all options
  211. * specific to Etherboot (i.e. not assigned by IANA or other standards
  212. * bodies).
  213. */
  214. #define DHCP_EB_ENCAP 175
  215. /** Priority of this options block
  216. *
  217. * This is a signed 8-bit integer field indicating the priority of
  218. * this block of options. It can be used to specify the relative
  219. * priority of multiple option blocks (e.g. options from non-volatile
  220. * storage versus options from a DHCP server).
  221. */
  222. #define DHCP_EB_PRIORITY DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x01 )
  223. /** "Your" IP address
  224. *
  225. * This option is used internally to contain the value of the "yiaddr"
  226. * field, in order to provide a consistent approach to storing and
  227. * processing options. It should never be present in a DHCP packet.
  228. */
  229. #define DHCP_EB_YIADDR DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x02 )
  230. /** "Server" IP address
  231. *
  232. * This option is used internally to contain the value of the "siaddr"
  233. * field, in order to provide a consistent approach to storing and
  234. * processing options. It should never be present in a DHCP packet.
  235. */
  236. #define DHCP_EB_SIADDR DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x03 )
  237. /** Keep SAN drive registered
  238. *
  239. * If set to a non-zero value, iPXE will not detach any SAN drive
  240. * after failing to boot from it. (This option is required in order
  241. * to perform a Windows Server 2008 installation direct to an iSCSI
  242. * target.)
  243. */
  244. #define DHCP_EB_KEEP_SAN DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0x08 )
  245. /*
  246. * Tags in the range 0x10-0x7f are reserved for feature markers
  247. *
  248. */
  249. /** Skip PXE DHCP protocol extensions such as ProxyDHCP
  250. *
  251. * If set to a non-zero value, iPXE will not wait for ProxyDHCP offers
  252. * and will ignore any PXE-specific DHCP options that it receives.
  253. */
  254. #define DHCP_EB_NO_PXEDHCP DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xb0 )
  255. /** Network device descriptor
  256. *
  257. * Byte 0 is the bus type ID; remaining bytes depend on the bus type.
  258. *
  259. * PCI devices:
  260. * Byte 0 : 1 (PCI)
  261. * Byte 1 : PCI vendor ID MSB
  262. * Byte 2 : PCI vendor ID LSB
  263. * Byte 3 : PCI device ID MSB
  264. * Byte 4 : PCI device ID LSB
  265. */
  266. #define DHCP_EB_BUS_ID DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xb1 )
  267. /** Network device descriptor */
  268. struct dhcp_netdev_desc {
  269. /** Bus type ID */
  270. uint8_t type;
  271. /** Vendor ID */
  272. uint16_t vendor;
  273. /** Device ID */
  274. uint16_t device;
  275. } __attribute__ (( packed ));
  276. /** Use cached network settings
  277. *
  278. * Cached network settings may be available from a prior DHCP request
  279. * (if running as a PXE NBP), non-volatile storage on the NIC, or
  280. * settings set via the command line or an embedded image. If this
  281. * flag is not set, it will be assumed that those sources are
  282. * insufficient and that DHCP should still be run when autobooting.
  283. */
  284. #define DHCP_EB_USE_CACHED DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xb2 )
  285. /** BIOS drive number
  286. *
  287. * This is the drive number for a drive emulated via INT 13. 0x80 is
  288. * the first hard disk, 0x81 is the second hard disk, etc.
  289. */
  290. #define DHCP_EB_BIOS_DRIVE DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xbd )
  291. /** Username
  292. *
  293. * This will be used as the username for any required authentication.
  294. * It is expected that this option's value will be held in
  295. * non-volatile storage, rather than transmitted as part of a DHCP
  296. * packet.
  297. */
  298. #define DHCP_EB_USERNAME DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xbe )
  299. /** Password
  300. *
  301. * This will be used as the password for any required authentication.
  302. * It is expected that this option's value will be held in
  303. * non-volatile storage, rather than transmitted as part of a DHCP
  304. * packet.
  305. */
  306. #define DHCP_EB_PASSWORD DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xbf )
  307. /** Reverse username
  308. *
  309. * This will be used as the reverse username (i.e. the username
  310. * provided by the server) for any required authentication. It is
  311. * expected that this option's value will be held in non-volatile
  312. * storage, rather than transmitted as part of a DHCP packet.
  313. */
  314. #define DHCP_EB_REVERSE_USERNAME DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xc0 )
  315. /** Reverse password
  316. *
  317. * This will be used as the reverse password (i.e. the password
  318. * provided by the server) for any required authentication. It is
  319. * expected that this option's value will be held in non-volatile
  320. * storage, rather than transmitted as part of a DHCP packet.
  321. */
  322. #define DHCP_EB_REVERSE_PASSWORD DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xc1 )
  323. /** iPXE version number */
  324. #define DHCP_EB_VERSION DHCP_ENCAP_OPT ( DHCP_EB_ENCAP, 0xeb )
  325. /** iSCSI primary target IQN */
  326. #define DHCP_ISCSI_PRIMARY_TARGET_IQN 201
  327. /** iSCSI secondary target IQN */
  328. #define DHCP_ISCSI_SECONDARY_TARGET_IQN 202
  329. /** iSCSI initiator IQN */
  330. #define DHCP_ISCSI_INITIATOR_IQN 203
  331. /** Maximum normal DHCP option */
  332. #define DHCP_MAX_OPTION 254
  333. /** End of options
  334. *
  335. * This tag does not have a length field; it is always only a single
  336. * byte in length.
  337. */
  338. #define DHCP_END 255
  339. /** @} */
  340. /**
  341. * Count number of arguments to a variadic macro
  342. *
  343. * This rather neat, non-iterative solution is courtesy of Laurent
  344. * Deniau.
  345. *
  346. */
  347. #define _VA_ARG_COUNT( _1, _2, _3, _4, _5, _6, _7, _8, \
  348. _9, _10, _11, _12, _13, _14, _15, _16, \
  349. _17, _18, _19, _20, _21, _22, _23, _24, \
  350. _25, _26, _27, _28, _29, _30, _31, _32, \
  351. _33, _34, _35, _36, _37, _38, _39, _40, \
  352. _41, _42, _43, _44, _45, _46, _47, _48, \
  353. _49, _50, _51, _52, _53, _54, _55, _56, \
  354. _57, _58, _59, _60, _61, _62, _63, N, ... ) N
  355. #define VA_ARG_COUNT( ... ) \
  356. _VA_ARG_COUNT ( __VA_ARGS__, \
  357. 63, 62, 61, 60, 59, 58, 57, 56, \
  358. 55, 54, 53, 52, 51, 50, 49, 48, \
  359. 47, 46, 45, 44, 43, 42, 41, 40, \
  360. 39, 38, 37, 36, 35, 34, 33, 32, \
  361. 31, 30, 29, 28, 27, 26, 25, 24, \
  362. 23, 22, 21, 20, 19, 18, 17, 16, \
  363. 15, 14, 13, 12, 11, 10, 9, 8, \
  364. 7, 6, 5, 4, 3, 2, 1, 0 )
  365. /** Construct a DHCP option from a list of bytes */
  366. #define DHCP_OPTION( ... ) VA_ARG_COUNT ( __VA_ARGS__ ), __VA_ARGS__
  367. /** Construct a DHCP option from a list of characters */
  368. #define DHCP_STRING( ... ) DHCP_OPTION ( __VA_ARGS__ )
  369. /** Construct a byte-valued DHCP option */
  370. #define DHCP_BYTE( value ) DHCP_OPTION ( value )
  371. /** Construct a word-valued DHCP option */
  372. #define DHCP_WORD( value ) DHCP_OPTION ( ( ( (value) >> 8 ) & 0xff ), \
  373. ( ( (value) >> 0 ) & 0xff ) )
  374. /** Construct a dword-valued DHCP option */
  375. #define DHCP_DWORD( value ) DHCP_OPTION ( ( ( (value) >> 24 ) & 0xff ), \
  376. ( ( (value) >> 16 ) & 0xff ), \
  377. ( ( (value) >> 8 ) & 0xff ), \
  378. ( ( (value) >> 0 ) & 0xff ) )
  379. /** Construct a DHCP encapsulated options field */
  380. #define DHCP_ENCAP( ... ) DHCP_OPTION ( __VA_ARGS__, DHCP_END )
  381. /**
  382. * A DHCP option
  383. *
  384. * DHCP options consist of a mandatory tag, a length field that is
  385. * mandatory for all options except @c DHCP_PAD and @c DHCP_END, and a
  386. * payload.
  387. */
  388. struct dhcp_option {
  389. /** Tag
  390. *
  391. * Must be a @c DHCP_XXX value.
  392. */
  393. uint8_t tag;
  394. /** Length
  395. *
  396. * This is the length of the data field (i.e. excluding the
  397. * tag and length fields). For the two tags @c DHCP_PAD and
  398. * @c DHCP_END, the length field is implicitly zero and is
  399. * also missing, i.e. these DHCP options are only a single
  400. * byte in length.
  401. */
  402. uint8_t len;
  403. /** Option data */
  404. uint8_t data[0];
  405. } __attribute__ (( packed ));
  406. /**
  407. * Length of a DHCP option header
  408. *
  409. * The header is the portion excluding the data, i.e. the tag and the
  410. * length.
  411. */
  412. #define DHCP_OPTION_HEADER_LEN ( offsetof ( struct dhcp_option, data ) )
  413. /** Maximum length for a single DHCP option */
  414. #define DHCP_MAX_LEN 0xff
  415. /**
  416. * A DHCP header
  417. *
  418. */
  419. struct dhcphdr {
  420. /** Operation
  421. *
  422. * This must be either @c BOOTP_REQUEST or @c BOOTP_REPLY.
  423. */
  424. uint8_t op;
  425. /** Hardware address type
  426. *
  427. * This is an ARPHRD_XXX constant. Note that ARPHRD_XXX
  428. * constants are nominally 16 bits wide; this could be
  429. * considered to be a bug in the BOOTP/DHCP specification.
  430. */
  431. uint8_t htype;
  432. /** Hardware address length */
  433. uint8_t hlen;
  434. /** Number of hops from server */
  435. uint8_t hops;
  436. /** Transaction ID */
  437. uint32_t xid;
  438. /** Seconds since start of acquisition */
  439. uint16_t secs;
  440. /** Flags */
  441. uint16_t flags;
  442. /** "Client" IP address
  443. *
  444. * This is filled in if the client already has an IP address
  445. * assigned and can respond to ARP requests.
  446. */
  447. struct in_addr ciaddr;
  448. /** "Your" IP address
  449. *
  450. * This is the IP address assigned by the server to the client.
  451. */
  452. struct in_addr yiaddr;
  453. /** "Server" IP address
  454. *
  455. * This is the IP address of the next server to be used in the
  456. * boot process.
  457. */
  458. struct in_addr siaddr;
  459. /** "Gateway" IP address
  460. *
  461. * This is the IP address of the DHCP relay agent, if any.
  462. */
  463. struct in_addr giaddr;
  464. /** Client hardware address */
  465. uint8_t chaddr[16];
  466. /** Server host name (null terminated)
  467. *
  468. * This field may be overridden and contain DHCP options
  469. */
  470. char sname[64];
  471. /** Boot file name (null terminated)
  472. *
  473. * This field may be overridden and contain DHCP options
  474. */
  475. char file[128];
  476. /** DHCP magic cookie
  477. *
  478. * Must have the value @c DHCP_MAGIC_COOKIE.
  479. */
  480. uint32_t magic;
  481. /** DHCP options
  482. *
  483. * Variable length; extends to the end of the packet. Minimum
  484. * length (for the sake of sanity) is 1, to allow for a single
  485. * @c DHCP_END tag.
  486. */
  487. uint8_t options[0];
  488. };
  489. /** Opcode for a request from client to server */
  490. #define BOOTP_REQUEST 1
  491. /** Opcode for a reply from server to client */
  492. #define BOOTP_REPLY 2
  493. /** BOOTP reply must be broadcast
  494. *
  495. * Clients that cannot accept unicast BOOTP replies must set this
  496. * flag.
  497. */
  498. #define BOOTP_FL_BROADCAST 0x8000
  499. /** DHCP magic cookie */
  500. #define DHCP_MAGIC_COOKIE 0x63825363UL
  501. /** DHCP minimum packet length
  502. *
  503. * This is the mandated minimum packet length that a DHCP participant
  504. * must be prepared to receive.
  505. */
  506. #define DHCP_MIN_LEN 552
  507. /** Timeouts for sending DHCP packets */
  508. #define DHCP_MIN_TIMEOUT ( 1 * TICKS_PER_SEC )
  509. #define DHCP_MAX_TIMEOUT ( 10 * TICKS_PER_SEC )
  510. /** Maximum time that we will wait for ProxyDHCP responses */
  511. #define PROXYDHCP_MAX_TIMEOUT ( 2 * TICKS_PER_SEC )
  512. /** Maximum time that we will wait for Boot Server responses */
  513. #define PXEBS_MAX_TIMEOUT ( 3 * TICKS_PER_SEC )
  514. /** Settings block name used for DHCP responses */
  515. #define DHCP_SETTINGS_NAME "dhcp"
  516. /** Settings block name used for ProxyDHCP responses */
  517. #define PROXYDHCP_SETTINGS_NAME "proxydhcp"
  518. /** Setting block name used for BootServerDHCP responses */
  519. #define PXEBS_SETTINGS_NAME "pxebs"
  520. extern void * dhcp_chaddr ( struct net_device *netdev, uint8_t *hlen,
  521. uint16_t *flags );
  522. extern int dhcp_create_packet ( struct dhcp_packet *dhcppkt,
  523. struct net_device *netdev, uint8_t msgtype,
  524. const void *options, size_t options_len,
  525. void *data, size_t max_len );
  526. extern int dhcp_create_request ( struct dhcp_packet *dhcppkt,
  527. struct net_device *netdev,
  528. unsigned int msgtype, struct in_addr ciaddr,
  529. void *data, size_t max_len );
  530. extern int start_dhcp ( struct job_interface *job, struct net_device *netdev );
  531. extern int start_pxebs ( struct job_interface *job, struct net_device *netdev,
  532. unsigned int pxe_type );
  533. /* In environments that can provide cached DHCP packets, this function
  534. * should look for such a packet and call store_cached_dhcpack() with
  535. * it if it exists.
  536. */
  537. extern void get_cached_dhcpack ( void );
  538. extern void store_cached_dhcpack ( userptr_t data, size_t len );
  539. #endif /* _IPXE_DHCP_H */