aboutsummaryrefslogtreecommitdiffstats
path: root/com32/include/dhcp.h
blob: afef924297ca7f694e571cbd4fc703d0143d6b1c (plain)
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
#ifndef DHCP_H
#define DHCP_H

#include <inttypes.h>

struct dhcp_option {
	void *data;
	int len;
};

struct dhcp_packet {
	uint8_t op;		/*   0 */
	uint8_t htype;		/*   1 */
	uint8_t hlen;		/*   2 */
	uint8_t hops;		/*   3 */
	uint32_t xid;		/*   4 */
	uint16_t secs;		/*   8 */
	uint16_t flags;		/*  10 */
	uint32_t ciaddr;	/*  12 */
	uint32_t yiaddr;	/*  16 */
	uint32_t siaddr;	/*  20 */
	uint32_t giaddr;	/*  24 */
	uint8_t chaddr[16];	/*  28 */
	uint8_t sname[64];	/*  44 */
	uint8_t file[128];	/* 108 */
	uint32_t magic;		/* 236 */
	uint8_t options[4];	/* 240 */
};

#define DHCP_VENDOR_MAGIC	0x63825363

int dhcp_pack_packet(void *packet, size_t *len,
		     const struct dhcp_option opt[256]);

int dhcp_unpack_packet(const void *packet, size_t len,
		       struct dhcp_option opt[256]);

#endif /* DHCP_H */