Click
Loading...
Searching...
No Matches
dhcp.h
1#ifndef CLICKNET_DHCP_H
2#define CLICKNET_DHCP_H
3
4struct click_dhcp {
5 uint8_t op; /* message type */
6 uint8_t htype; /* hardware address type */
7 uint8_t hlen; /* hardware address length */
8 uint8_t hops; /* should be zero in client's message */
9 uint32_t xid; /* transaction id */
10 uint16_t secs; /* elapsed time in sec. from trying to boot */
11 uint16_t flags;
12 uint32_t ciaddr; /* (previously allocated) client IP address */
13 uint32_t yiaddr; /* 'your' client IP address */
14 uint32_t siaddr; /* should be zero in client's messages */
15 uint32_t giaddr; /* should be zero in client's messages */
16 uint8_t chaddr[16]; /* client's hardware address */
17 uint8_t sname[64]; /* server host name, null terminated string */
18 uint8_t file[128]; /* boot file name, null terminated string */
19 uint32_t magic; /* magic cookie */
20 uint8_t options[312]; /* message options */
21} CLICK_SIZE_PACKED_ATTRIBUTE;
22
23
24#define ETH_10MB 1 /* htype */
25#define ETH_10MB_LEN 6 /* hlen */
26
27/* DHCP message OP code */
28#define DHCP_BOOTREQUEST 1
29#define DHCP_BOOTREPLY 2
30
31/* DHCP Client State*/
32enum dhcp_client_state {
33 DHCP_CLIENT_INIT_STATE = 1,
34 DHCP_CLIENT_SELECTING_STATE,
35 DHCP_CLIENT_REQUESTING_STATE,
36 DHCP_CLIENT_INIT_REBOOT,
37 DHCP_CLIENT_REBOOTING,
38 DHCP_CLIENT_BOUND,
39 DHCP_CLIENT_RENEWING,
40 DHCP_CLIENT_REBINDING
41};
42
43
44/* DHCP message type */
45#define DHCP_DISCOVER 1
46#define DHCP_OFFER 2
47#define DHCP_REQUEST 3
48#define DHCP_DECLINE 4
49#define DHCP_ACK 5
50#define DHCP_NACK 6
51#define DHCP_RELEASE 7
52#define DHCP_INFORM 8
53
54#define DHCP_MAGIC 0x63538263
55
56
57
58/* DHCP Option codes: */
59#define DHO_PAD 0
60#define DHO_SUBNET_MASK 1
61#define DHO_TIME_OFFSET 2
62#define DHO_ROUTERS 3
63#define DHO_TIME_SERVERS 4
64#define DHO_NAME_SERVERS 5
65#define DHO_DOMAIN_NAME_SERVERS 6
66#define DHO_LOG_SERVERS 7
67#define DHO_COOKIE_SERVERS 8
68#define DHO_LPR_SERVERS 9
69#define DHO_IMPRESS_SERVERS 10
70#define DHO_RESOURCE_LOCATION_SERVERS 11
71#define DHO_HOST_NAME 12
72#define DHO_BOOT_SIZE 13
73#define DHO_MERIT_DUMP 14
74#define DHO_DOMAIN_NAME 15
75#define DHO_SWAP_SERVER 16
76#define DHO_ROOT_PATH 17
77#define DHO_EXTENSIONS_PATH 18
78#define DHO_IP_FORWARDING 19
79#define DHO_NON_LOCAL_SOURCE_ROUTING 20
80#define DHO_POLICY_FILTER 21
81#define DHO_MAX_DGRAM_REASSEMBLY 22
82#define DHO_DEFAULT_IP_TTL 23
83#define DHO_PATH_MTU_AGING_TIMEOUT 24
84#define DHO_PATH_MTU_PLATEAU_TABLE 25
85#define DHO_INTERFACE_MTU 26
86#define DHO_ALL_SUBNETS_LOCAL 27
87#define DHO_BROADCAST_ADDRESS 28
88#define DHO_PERFORM_MASK_DISCOVERY 29
89#define DHO_MASK_SUPPLIER 30
90#define DHO_ROUTER_DISCOVERY 31
91#define DHO_ROUTER_SOLICITATION_ADDRESS 32
92#define DHO_STATIC_ROUTES 33
93#define DHO_TRAILER_ENCAPSULATION 34
94#define DHO_ARP_CACHE_TIMEOUT 35
95#define DHO_IEEE802_3_ENCAPSULATION 36
96#define DHO_DEFAULT_TCP_TTL 37
97#define DHO_TCP_KEEPALIVE_INTERVAL 38
98#define DHO_TCP_KEEPALIVE_GARBAGE 39
99#define DHO_NIS_DOMAIN 40
100#define DHO_NIS_SERVERS 41
101#define DHO_NTP_SERVERS 42
102#define DHO_VENDOR_ENCAPSULATED_OPTIONS 43
103#define DHO_NETBIOS_NAME_SERVERS 44
104#define DHO_NETBIOS_DD_SERVER 45
105#define DHO_NETBIOS_NODE_TYPE 46
106#define DHO_NETBIOS_SCOPE 47
107#define DHO_FONT_SERVERS 48
108#define DHO_X_DISPLAY_MANAGER 49
109#define DHO_DHCP_REQUESTED_ADDRESS 50
110#define DHO_DHCP_LEASE_TIME 51
111#define DHO_DHCP_OPTION_OVERLOAD 52
112#define DHO_DHCP_MESSAGE_TYPE 53
113#define DHO_DHCP_SERVER_IDENTIFIER 54
114#define DHO_DHCP_PARAMETER_REQUEST_LIST 55
115#define DHO_DHCP_MESSAGE 56
116#define DHO_DHCP_MAX_MESSAGE_SIZE 57
117#define DHO_DHCP_RENEWAL_TIME 58
118#define DHO_DHCP_REBINDING_TIME 59
119#define DHO_VENDOR_CLASS_IDENTIFIER 60
120#define DHO_DHCP_CLIENT_IDENTIFIER 61
121#define DHO_NWIP_DOMAIN_NAME 62
122#define DHO_NWIP_SUBOPTIONS 63
123#define DHO_USER_CLASS 77
124#define DHO_FQDN 81
125#define DHO_DHCP_AGENT_OPTIONS 82
126#define DHO_SUBNET_SELECTION 118 /* RFC3011! */
127#define DHO_END 255
128
129#endif /* CLICKNET_DHCP_H */