-
Notifications
You must be signed in to change notification settings - Fork 36
/
dhcp.h
54 lines (38 loc) · 1.13 KB
/
dhcp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef DHCP_H
#define DHCP_H
#include <stdint.h>
enum ports {
BOOTPS = 67,
BOOTPC = 68
};
enum op_types {
BOOTREQUEST = 1,
BOOTREPLY = 2,
};
enum hardware_address_types {
ETHERNET = 0x01,
ETHERNET_LEN = 0x06,
};
/* DHCP message */
enum {
DHCP_HEADER_SIZE = 236 // without size of options
};
struct dhcp_message {
uint8_t op; // message op code, message type
uint8_t htype; // hardware address type
uint8_t hlen; // hardware address length
uint8_t hops; // incremented by relay agents
uint32_t xid; // transaction ID
uint16_t secs; // seconds since address acquisition or renewal
uint16_t flags; // flags
uint32_t ciaddr; // client IP address
uint32_t yiaddr; // 'your' client IP address
uint32_t siaddr; // IP address of the next server to use in bootstrap
uint32_t giaddr; // relay agent IP address
uint8_t chaddr[16]; // client hardware address
uint8_t sname[64]; // server host name
uint8_t file[128]; // boot file name
uint8_t options[312]; // optional parameters field
};
typedef struct dhcp_message dhcp_message;
#endif