3 * Copyright (C) 2009 Martin 'povik' Poviser (martin.povik@gmail.com)
4 * Copyright (C) 2010 Martin 'povik' Poviser (martin.povik@gmail.com)
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
28 #define DHCP_BAD_PARAMETERS -1
29 #define DHCP_OUT_OF_MEMORY -2
30 #define DHCP_SOCKET_FAILED -3
31 #define DHCP_CONNECT_FAILED -4
32 #define DHCP_CANT_SEND_REQUEST -5
33 #define DHCP_CANT_RECV_RESPONSE -6
34 #define DHCP_BAD_PACKET -7
35 #define DHCP_SRV_DIDNT_UNDERSTAND -8
38 #define DHCP_MAGIC_COOKIE 0x63538263
41 #define DHCP_MESSAGE_TYPE_BOOTREQUEST 0x01
42 #define DHCP_MESSAGE_TYPE_BOOTREPLY 0x02
44 /* options types + values*/
45 #define DHCP_OPTION_PAD 0x00
46 #define DHCP_OPTION_SUBNET_MASK 0x01
47 #define DHCP_OPTION_ROUTER 0x03
48 #define DHCP_OPTION_DNS_SERVER 0x06
49 #define DHCP_OPTION_HOSTNAME 12
50 #define DHCP_OPTION_REQUESTED_IP 50
51 #define DHCP_OPTION_LEASE_TIME 51
52 #define DHCP_OPTION_MESSAGE_TYPE 53
53 #define DHCP_OPTION_VALUE_DHCPDISCOVER 0x01
54 #define DHCP_OPTION_VALUE_DHCPOFFER 0x02
55 #define DHCP_OPTION_VALUE_DHCPREQUEST 0x03
56 #define DHCP_OPTION_VALUE_DHCPDECLINE 0x04
57 #define DHCP_OPTION_VALUE_DHCPACK 0x05
58 #define DHCP_OPTION_VALUE_DHCPNAK 0x06
59 #define DHCP_OPTION_VALUE_DHCPRELEASE 0x07
60 #define DHCP_OPTION_VALUE_DHCPINFORM 0x08
61 #define DHCP_OPTION_DHCP_SERVER 54
62 #define DHCP_OPTION_PARAMETER_REQUEST_LIST 55
63 #define DHCP_OPTION_VALUE_SUBNET_MASK 0x01
64 #define DHCP_OPTION_VALUE_ROUTER 0x03
65 #define DHCP_OPTION_VALUE_DNS_SERVER 0x06
66 #define DHCP_OPTION_VALUE_DOMAIN_NAME 0x0f
67 #define DHCP_OPTION_CLIENT_IDENTIFIER 61
68 #define DHCP_OPTION_END 0xff
70 typedef struct dhcp_bootp_header_t
{
85 unsigned int mag_cookie
;
86 } dhcp_bootp_header_t
;
88 typedef union dhcp_request_t
{
89 unsigned char *buffer
;
90 dhcp_bootp_header_t
*bootp_header
;
93 extern int dhcp_config_if (netif_t
*netif
);