Watt-32 tcp/ip  2.2 dev-rel.10
pcdhcp.h
Go to the documentation of this file.
1 
3 #ifndef _w32_PCDHCP_H
4 #define _w32_PCDHCP_H
5 
6 #define DHCP_MAGIC_COOKIE 0x63538263 /* magic cookie */
7 #define DHCP_MIN_LEASE 10 /* 10s min. lease */
8 
9 enum DHCP_MsgTypes {
10  DHCP_DISCOVER = 1,
11  DHCP_OFFER,
12  DHCP_REQUEST,
13  DHCP_DECLINE,
14  DHCP_ACK,
15  DHCP_NAK ,
16  DHCP_RELEASE,
17  DHCP_INFORM
18  };
19 
20 enum DHCP_Events {
21  EVENT_OFFER = 1,
22  EVENT_SEND_TIMEOUT,
23  EVENT_T1_TIMEOUT,
24  EVENT_T2_TIMEOUT,
25  EVENT_ACK,
26  EVENT_NAK,
27  };
28 
29 /*
30  * DHCP options and values (ref. RFC1533/RFC2132).
31  * Many are also BOOTP options.
32  */
33 enum DHCP_Options {
34  DHCP_OPT_PAD = 0,
35  DHCP_OPT_SUBNET_MASK = 1,
36  DHCP_OPT_TIME_OFFSET = 2,
37  DHCP_OPT_ROUTERS_ON_SNET = 3,
38  DHCP_OPT_TIME_SRV = 4,
39  DHCP_OPT_NAME_SRV = 5,
40  DHCP_OPT_DNS_SRV = 6,
41  DHCP_OPT_LOG_SRV = 7,
42  DHCP_OPT_COOKIE_SRV = 8,
43  DHCP_OPT_LPR_SRV = 9,
44  DHCP_OPT_IMPRESS_SRV = 10,
45  DHCP_OPT_RES_LOCATION_SRV = 11,
46  DHCP_OPT_HOST_NAME = 12,
47  DHCP_OPT_BOOT_FSIZE = 13,
48  DHCP_OPT_MERIT_DUMPFILE = 14,
49  DHCP_OPT_DOMAIN_NAME = 15,
50  DHCP_OPT_SWAP_SRV = 16,
51  DHCP_OPT_ROOT_PATH = 17,
52  DHCP_OPT_EXTENTIONS_PATH = 18,
53  DHCP_OPT_IP_FORWARDING = 19,
54  DHCP_OPT_NON_LOCAL_SRC_ROUTE = 20,
55  DHCP_OPT_POLICY_FILTER = 21,
56  DHCP_OPT_MAX_DGRAM_REASM_SIZE = 22,
57  DHCP_OPT_IP_DEFAULT_TTL = 23,
58  DHCP_OPT_PATH_MTU_AGING_TIMEOUT = 24,
59  DHCP_OPT_PATH_MTU_PLATEAU_TABLE = 25,
60  DHCP_OPT_IF_MTU = 26,
61  DHCP_OPT_ALL_SUBNETS_LOCAL = 27,
62  DHCP_OPT_BROADCAST_ADDR = 28,
63  DHCP_OPT_PERFORM_MASK_DISCOVERY = 29,
64  DHCP_OPT_MASK_SUPPLIER = 30,
65  DHCP_OPT_PERFORM_ROUTER_DISCOVERY = 31,
66  DHCP_OPT_ROUTER_SOLICITATION_ADDR = 32,
67  DHCP_OPT_STATIC_ROUTE = 33,
68  DHCP_OPT_TRAILER_ENCAPSULATION = 34,
69  DHCP_OPT_ARP_CACHE_TIMEOUT = 35,
70  DHCP_OPT_ETHERNET_ENCAPSULATION = 36,
71  DHCP_OPT_TCP_DEFAULT_TTL = 37,
72  DHCP_OPT_TCP_KEEPALIVE_INTERVAL = 38,
73  DHCP_OPT_TCP_KEEPALIVE_GARBAGE = 39,
74  DHCP_OPT_NIS_DOMAIN_NAME = 40,
75  DHCP_OPT_NIS_SRVS = 41,
76  DHCP_OPT_NTP_SRVS = 42,
77  DHCP_OPT_VENDOR_SPECIFIC_INFO = 43,
78  DHCP_OPT_NBIOS_NAME_SRV = 44,
79  DHCP_OPT_NBIOS_DGRAM_DIST_SRV = 45,
80  DHCP_OPT_NBIOS_NODE_TYPE = 46,
81  DHCP_OPT_NBIOS_SCOPE = 47,
82  DHCP_OPT_XFONT_SRV = 48,
83  DHCP_OPT_XDISPLAY_MANAGER = 49,
84  DHCP_OPT_REQUESTED_IP_ADDR = 50,
85  DHCP_OPT_IP_ADDR_LEASE_TIME = 51,
86  DHCP_OPT_OVERLOAD = 52,
87  DHCP_OPT_MSG_TYPE = 53,
88  DHCP_OPT_SRV_IDENTIFIER = 54,
89  DHCP_OPT_PARAM_REQUEST = 55,
90  DHCP_OPT_MSG = 56,
91  DHCP_OPT_MAX_MSG_SIZE = 57,
92  DHCP_OPT_T1_VALUE = 58,
93  DHCP_OPT_T2_VALUE = 59,
94  DHCP_OPT_CLASS_ID = 60,
95  DHCP_OPT_CLIENT_ID = 61,
96  DHCP_OPT_NIS_DOMAIN = 64,
97  DHCP_OPT_NIS_SRV_OPT = 65,
98  DHCP_OPT_TFTP_SERVER = 66,
99  DHCP_OPT_BOOT_FILENAME = 67,
100  DHCP_OPT_MOBIP_HOME_AGENTS = 68,
101  DHCP_OPT_SMTP_SRVS = 69,
102  DHCP_OPT_POP3_SRVS = 70,
103  DHCP_OPT_NNTP_SRVS = 71,
104  DHCP_OPT_WWW_SRVS = 72,
105  DHCP_OPT_FINGER_SRVS = 73,
106  DHCP_OPT_IRC_SRVS = 74,
107  DHCP_OPT_STREET_TALK_SRVS = 75,
108  DHCP_OPT_STDA_SRVS = 76,
109  DHCP_OPT_USER_CLASS = 77,
110  DHCP_OPT_GRUB_MENU = 150,
111  DHCP_OPT_END = 255
112  };
113 
116 struct DHCP_list {
117  BYTE *data;
118  unsigned size;
119  };
120 
121 #include <sys/pack_on.h>
122 
127 struct dhcp {
128  BYTE dh_op; /* packet op code / message type. */
129  BYTE dh_htype; /* hardware address type, 1 = 10 mb ethernet */
130  BYTE dh_hlen; /* hardware address len, eg '6' for ethernet */
131  BYTE dh_hops; /* client sets to zero, optionally used by */
132  /* gateways in cross-gateway booting. */
133  DWORD dh_xid; /* transaction ID, a random number */
134  WORD dh_secs; /* filled in by client, seconds elapsed */
135  /* since client started trying to boot. */
136  WORD dh_flags; /* Flag (0x8000 for broadcast, else 0) */
137  DWORD dh_ciaddr; /* client IP address filled in by client if known */
138  DWORD dh_yiaddr; /* 'your' (client) IP address */
139  /* filled by server if client doesn't know */
140  DWORD dh_siaddr; /* server IP address returned in bootreply */
141  DWORD dh_giaddr; /* gateway IP address, */
142  /* used in optional cross-gateway booting. */
143  BYTE dh_chaddr[16]; /* client hardware address, filled by client */
144  BYTE dh_sname[64]; /* optional server host name, null terminated */
145 
146  BYTE dh_file[128]; /* boot file name, null terminated string */
147  /* 'generic' name or null in bootrequest, */
148  /* fully qualified directory-path */
149  /* name in bootreply. */
150  BYTE dh_opt[312]; /* DHCP options area (minimum 308 bytes) */
151  };
152 
153 extern int DHCP_do_boot (void);
154 extern void DHCP_init (void);
155 
156 #endif
void DHCP_init(void)
Initialises the DHCP config-parser.
Definition: pcdhcp.c:1380
Definition: pcdhcp.h:127
int DHCP_do_boot(void)
Our first time DHCP handler.
Definition: pcdhcp.c:1056