diff options
author | Russ Dill <Russ.Dill@asu.edu> | 2002-10-14 21:41:28 +0000 |
---|---|---|
committer | Russ Dill <Russ.Dill@asu.edu> | 2002-10-14 21:41:28 +0000 |
commit | 61fb48930f45aa536584b2047f9e703186e8f69f (patch) | |
tree | e3b93e0a694be81939f8c4762553c43ffdb9b10b /networking/udhcp/dhcpd.h | |
parent | 9060a7315980bb05f42eab76b88746d43e138188 (diff) | |
download | busybox-w32-61fb48930f45aa536584b2047f9e703186e8f69f.tar.gz busybox-w32-61fb48930f45aa536584b2047f9e703186e8f69f.tar.bz2 busybox-w32-61fb48930f45aa536584b2047f9e703186e8f69f.zip |
added full udhcp integration
Diffstat (limited to 'networking/udhcp/dhcpd.h')
-rw-r--r-- | networking/udhcp/dhcpd.h | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/networking/udhcp/dhcpd.h b/networking/udhcp/dhcpd.h new file mode 100644 index 000000000..2971e19db --- /dev/null +++ b/networking/udhcp/dhcpd.h | |||
@@ -0,0 +1,131 @@ | |||
1 | /* dhcpd.h */ | ||
2 | #ifndef _DHCPD_H | ||
3 | #define _DHCPD_H | ||
4 | |||
5 | #include <netinet/ip.h> | ||
6 | #include <netinet/udp.h> | ||
7 | |||
8 | #include "libbb_udhcp.h" | ||
9 | #include "leases.h" | ||
10 | |||
11 | /************************************/ | ||
12 | /* Defaults _you_ may want to tweak */ | ||
13 | /************************************/ | ||
14 | |||
15 | /* the period of time the client is allowed to use that address */ | ||
16 | #define LEASE_TIME (60*60*24*10) /* 10 days of seconds */ | ||
17 | |||
18 | /* where to find the DHCP server configuration file */ | ||
19 | #define DHCPD_CONF_FILE "/etc/udhcpd.conf" | ||
20 | |||
21 | /*****************************************************************/ | ||
22 | /* Do not modify below here unless you know what you are doing!! */ | ||
23 | /*****************************************************************/ | ||
24 | |||
25 | /* DHCP protocol -- see RFC 2131 */ | ||
26 | #define SERVER_PORT 67 | ||
27 | #define CLIENT_PORT 68 | ||
28 | |||
29 | #define DHCP_MAGIC 0x63825363 | ||
30 | |||
31 | /* DHCP option codes (partial list) */ | ||
32 | #define DHCP_PADDING 0x00 | ||
33 | #define DHCP_SUBNET 0x01 | ||
34 | #define DHCP_TIME_OFFSET 0x02 | ||
35 | #define DHCP_ROUTER 0x03 | ||
36 | #define DHCP_TIME_SERVER 0x04 | ||
37 | #define DHCP_NAME_SERVER 0x05 | ||
38 | #define DHCP_DNS_SERVER 0x06 | ||
39 | #define DHCP_LOG_SERVER 0x07 | ||
40 | #define DHCP_COOKIE_SERVER 0x08 | ||
41 | #define DHCP_LPR_SERVER 0x09 | ||
42 | #define DHCP_HOST_NAME 0x0c | ||
43 | #define DHCP_BOOT_SIZE 0x0d | ||
44 | #define DHCP_DOMAIN_NAME 0x0f | ||
45 | #define DHCP_SWAP_SERVER 0x10 | ||
46 | #define DHCP_ROOT_PATH 0x11 | ||
47 | #define DHCP_IP_TTL 0x17 | ||
48 | #define DHCP_MTU 0x1a | ||
49 | #define DHCP_BROADCAST 0x1c | ||
50 | #define DHCP_NTP_SERVER 0x2a | ||
51 | #define DHCP_WINS_SERVER 0x2c | ||
52 | #define DHCP_REQUESTED_IP 0x32 | ||
53 | #define DHCP_LEASE_TIME 0x33 | ||
54 | #define DHCP_OPTION_OVER 0x34 | ||
55 | #define DHCP_MESSAGE_TYPE 0x35 | ||
56 | #define DHCP_SERVER_ID 0x36 | ||
57 | #define DHCP_PARAM_REQ 0x37 | ||
58 | #define DHCP_MESSAGE 0x38 | ||
59 | #define DHCP_MAX_SIZE 0x39 | ||
60 | #define DHCP_T1 0x3a | ||
61 | #define DHCP_T2 0x3b | ||
62 | #define DHCP_VENDOR 0x3c | ||
63 | #define DHCP_CLIENT_ID 0x3d | ||
64 | |||
65 | #define DHCP_END 0xFF | ||
66 | |||
67 | |||
68 | #define BOOTREQUEST 1 | ||
69 | #define BOOTREPLY 2 | ||
70 | |||
71 | #define ETH_10MB 1 | ||
72 | #define ETH_10MB_LEN 6 | ||
73 | |||
74 | #define DHCPDISCOVER 1 | ||
75 | #define DHCPOFFER 2 | ||
76 | #define DHCPREQUEST 3 | ||
77 | #define DHCPDECLINE 4 | ||
78 | #define DHCPACK 5 | ||
79 | #define DHCPNAK 6 | ||
80 | #define DHCPRELEASE 7 | ||
81 | #define DHCPINFORM 8 | ||
82 | |||
83 | #define BROADCAST_FLAG 0x8000 | ||
84 | |||
85 | #define OPTION_FIELD 0 | ||
86 | #define FILE_FIELD 1 | ||
87 | #define SNAME_FIELD 2 | ||
88 | |||
89 | /* miscellaneous defines */ | ||
90 | #define MAC_BCAST_ADDR (unsigned char *) "\xff\xff\xff\xff\xff\xff" | ||
91 | #define OPT_CODE 0 | ||
92 | #define OPT_LEN 1 | ||
93 | #define OPT_DATA 2 | ||
94 | |||
95 | struct option_set { | ||
96 | unsigned char *data; | ||
97 | struct option_set *next; | ||
98 | }; | ||
99 | |||
100 | struct server_config_t { | ||
101 | u_int32_t server; /* Our IP, in network order */ | ||
102 | u_int32_t start; /* Start address of leases, network order */ | ||
103 | u_int32_t end; /* End of leases, network order */ | ||
104 | struct option_set *options; /* List of DHCP options loaded from the config file */ | ||
105 | char *interface; /* The name of the interface to use */ | ||
106 | int ifindex; /* Index number of the interface to use */ | ||
107 | unsigned char arp[6]; /* Our arp address */ | ||
108 | unsigned long lease; /* lease time in seconds (host order) */ | ||
109 | unsigned long max_leases; /* maximum number of leases (including reserved address) */ | ||
110 | char remaining; /* should the lease file be interpreted as lease time remaining, or | ||
111 | * as the time the lease expires */ | ||
112 | unsigned long auto_time; /* how long should udhcpd wait before writing a config file. | ||
113 | * if this is zero, it will only write one on SIGUSR1 */ | ||
114 | unsigned long decline_time; /* how long an address is reserved if a client returns a | ||
115 | * decline message */ | ||
116 | unsigned long conflict_time; /* how long an arp conflict offender is leased for */ | ||
117 | unsigned long offer_time; /* how long an offered address is reserved */ | ||
118 | unsigned long min_lease; /* minimum lease a client can request*/ | ||
119 | char *lease_file; | ||
120 | char *pidfile; | ||
121 | char *notify_file; /* What to run whenever leases are written */ | ||
122 | u_int32_t siaddr; /* next server bootp option */ | ||
123 | char *sname; /* bootp server name */ | ||
124 | char *boot_file; /* bootp boot file option */ | ||
125 | }; | ||
126 | |||
127 | extern struct server_config_t server_config; | ||
128 | extern struct dhcpOfferedAddr *leases; | ||
129 | |||
130 | |||
131 | #endif | ||