-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdhcp.h
More file actions
36 lines (32 loc) · 689 Bytes
/
dhcp.h
File metadata and controls
36 lines (32 loc) · 689 Bytes
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
typedef unsigned char byte;
typedef struct {
byte type;
byte len;
byte *data;
} DHCPOption;
typedef enum {
DHCPDiscover = 1,
DHCPOffer = 2,
DHCPRequest = 3,
DHCPAck = 5,
} DHCPType;
typedef struct {
DHCPType type;
byte op;
byte htype;
byte hlen;
byte ops;
unsigned xid;
unsigned short secs;
unsigned short flags;
unsigned ciaddr;
unsigned yiaddr;
unsigned siaddr;
unsigned giaddr;
unsigned long long chaddr;
int option_num;
DHCPOption options[64 / 3 + 1]; // めんどいので
} DHCP;
DHCP *handle_discover(DHCP *dhcp);
DHCP *handle_request(DHCP *dhcp);
void init_dhcp(unsigned int x, unsigned int y);