summaryrefslogtreecommitdiff
path: root/networking/udhcp/dhcpd.h
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-04-07 01:05:47 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-04-07 01:05:47 +0000
commitfbd2918f5c91723063ed698026217a77a0fe565b (patch)
treecddfe351592f4a876232cf4c67c23df25bf0563c /networking/udhcp/dhcpd.h
parentbb5b01c7c711dd9ffc2abf23a05ccdfbf7fc0325 (diff)
downloadbusybox-w32-fbd2918f5c91723063ed698026217a77a0fe565b.tar.gz
busybox-w32-fbd2918f5c91723063ed698026217a77a0fe565b.tar.bz2
busybox-w32-fbd2918f5c91723063ed698026217a77a0fe565b.zip
udhcp: MAC_BCAST_ADDR and blank_chaddr are in fact constant, move to rodata.
a few global variables reduced to smallints function old new delta add_lease 75 227 +152 static.blank_chaddr - 16 +16 MAC_BCAST_ADDR - 6 +6 sockfd 4 8 +4 udhcp_run_script 1153 1155 +2 state 8 5 -3 listen_mode 4 1 -3 perform_release 152 148 -4 fd 8 4 -4 blank_chaddr 16 - -16 udhcpc_main 2518 2497 -21 .rodata 131864 131832 -32 oldest_expired_lease 61 - -61 clear_lease 127 - -127 ------------------------------------------------------------------------------ (add/remove: 2/3 grow/shrink: 3/6 up/down: 180/-271) Total: -91 bytes
Diffstat (limited to 'networking/udhcp/dhcpd.h')
-rw-r--r--networking/udhcp/dhcpd.h83
1 files changed, 2 insertions, 81 deletions
diff --git a/networking/udhcp/dhcpd.h b/networking/udhcp/dhcpd.h
index 40959e4ae..7c4fe695a 100644
--- a/networking/udhcp/dhcpd.h
+++ b/networking/udhcp/dhcpd.h
@@ -14,81 +14,6 @@
14/* where to find the DHCP server configuration file */ 14/* where to find the DHCP server configuration file */
15#define DHCPD_CONF_FILE "/etc/udhcpd.conf" 15#define DHCPD_CONF_FILE "/etc/udhcpd.conf"
16 16
17/*****************************************************************/
18/* Do not modify below here unless you know what you are doing!! */
19/*****************************************************************/
20
21/* DHCP protocol -- see RFC 2131 */
22#define SERVER_PORT 67
23#define CLIENT_PORT 68
24
25#define DHCP_MAGIC 0x63825363
26
27/* DHCP option codes (partial list) */
28#define DHCP_PADDING 0x00
29#define DHCP_SUBNET 0x01
30#define DHCP_TIME_OFFSET 0x02
31#define DHCP_ROUTER 0x03
32#define DHCP_TIME_SERVER 0x04
33#define DHCP_NAME_SERVER 0x05
34#define DHCP_DNS_SERVER 0x06
35#define DHCP_LOG_SERVER 0x07
36#define DHCP_COOKIE_SERVER 0x08
37#define DHCP_LPR_SERVER 0x09
38#define DHCP_HOST_NAME 0x0c
39#define DHCP_BOOT_SIZE 0x0d
40#define DHCP_DOMAIN_NAME 0x0f
41#define DHCP_SWAP_SERVER 0x10
42#define DHCP_ROOT_PATH 0x11
43#define DHCP_IP_TTL 0x17
44#define DHCP_MTU 0x1a
45#define DHCP_BROADCAST 0x1c
46#define DHCP_NTP_SERVER 0x2a
47#define DHCP_WINS_SERVER 0x2c
48#define DHCP_REQUESTED_IP 0x32
49#define DHCP_LEASE_TIME 0x33
50#define DHCP_OPTION_OVER 0x34
51#define DHCP_MESSAGE_TYPE 0x35
52#define DHCP_SERVER_ID 0x36
53#define DHCP_PARAM_REQ 0x37
54#define DHCP_MESSAGE 0x38
55#define DHCP_MAX_SIZE 0x39
56#define DHCP_T1 0x3a
57#define DHCP_T2 0x3b
58#define DHCP_VENDOR 0x3c
59#define DHCP_CLIENT_ID 0x3d
60#define DHCP_FQDN 0x51
61
62#define DHCP_END 0xFF
63
64
65#define BOOTREQUEST 1
66#define BOOTREPLY 2
67
68#define ETH_10MB 1
69#define ETH_10MB_LEN 6
70
71#define DHCPDISCOVER 1
72#define DHCPOFFER 2
73#define DHCPREQUEST 3
74#define DHCPDECLINE 4
75#define DHCPACK 5
76#define DHCPNAK 6
77#define DHCPRELEASE 7
78#define DHCPINFORM 8
79
80#define BROADCAST_FLAG 0x8000
81
82#define OPTION_FIELD 0
83#define FILE_FIELD 1
84#define SNAME_FIELD 2
85
86/* miscellaneous defines */
87#define MAC_BCAST_ADDR (uint8_t *) "\xff\xff\xff\xff\xff\xff"
88#define OPT_CODE 0
89#define OPT_LEN 1
90#define OPT_DATA 2
91
92struct option_set { 17struct option_set {
93 uint8_t *data; 18 uint8_t *data;
94 struct option_set *next; 19 struct option_set *next;
@@ -140,13 +65,9 @@ struct dhcpOfferedAddr {
140 uint32_t expires; /* host order */ 65 uint32_t expires; /* host order */
141}; 66};
142 67
143extern uint8_t blank_chaddr[]; 68struct dhcpOfferedAddr *add_lease(const uint8_t *chaddr, uint32_t yiaddr, unsigned long lease);
144
145void clear_lease(uint8_t *chaddr, uint32_t yiaddr);
146struct dhcpOfferedAddr *add_lease(uint8_t *chaddr, uint32_t yiaddr, unsigned long lease);
147int lease_expired(struct dhcpOfferedAddr *lease); 69int lease_expired(struct dhcpOfferedAddr *lease);
148struct dhcpOfferedAddr *oldest_expired_lease(void); 70struct dhcpOfferedAddr *find_lease_by_chaddr(const uint8_t *chaddr);
149struct dhcpOfferedAddr *find_lease_by_chaddr(uint8_t *chaddr);
150struct dhcpOfferedAddr *find_lease_by_yiaddr(uint32_t yiaddr); 71struct dhcpOfferedAddr *find_lease_by_yiaddr(uint32_t yiaddr);
151uint32_t find_address(int check_expired); 72uint32_t find_address(int check_expired);
152 73