COM32: add DHCP pack/unpack functions
[syslinux/sherbszt.git] / com32 / include / dhcp.h
blobafef924297ca7f694e571cbd4fc703d0143d6b1c
1 #ifndef DHCP_H
2 #define DHCP_H
4 #include <inttypes.h>
6 struct dhcp_option {
7 void *data;
8 int len;
9 };
11 struct dhcp_packet {
12 uint8_t op; /* 0 */
13 uint8_t htype; /* 1 */
14 uint8_t hlen; /* 2 */
15 uint8_t hops; /* 3 */
16 uint32_t xid; /* 4 */
17 uint16_t secs; /* 8 */
18 uint16_t flags; /* 10 */
19 uint32_t ciaddr; /* 12 */
20 uint32_t yiaddr; /* 16 */
21 uint32_t siaddr; /* 20 */
22 uint32_t giaddr; /* 24 */
23 uint8_t chaddr[16]; /* 28 */
24 uint8_t sname[64]; /* 44 */
25 uint8_t file[128]; /* 108 */
26 uint32_t magic; /* 236 */
27 uint8_t options[4]; /* 240 */
30 #define DHCP_VENDOR_MAGIC 0x63825363
32 int dhcp_pack_packet(void *packet, size_t *len,
33 const struct dhcp_option opt[256]);
35 int dhcp_unpack_packet(const void *packet, size_t len,
36 struct dhcp_option opt[256]);
38 #endif /* DHCP_H */