5 * dhcp.h Structures and prototypes for DHCP.
6 * Why DHCP in a RADIUS server?
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 * Copyright 2008 The FreeRADIUS server project
26 * Copyright 2008 Alan DeKok <aland@deployingradius.com>
28 #include <freeradius-devel/ident.h>
29 RCSIDH(dhcp_h, "$Id$")
36 * Not for production use.
38 RADIUS_PACKET *fr_dhcp_recv(int sockfd);
39 int fr_dhcp_send(RADIUS_PACKET *packet);
41 int fr_dhcp_encode(RADIUS_PACKET *packet, RADIUS_PACKET *original);
42 int fr_dhcp_decode(RADIUS_PACKET *packet);
45 * This is a horrible hack.
47 #define PW_DHCP_OFFSET (1024)
48 #define PW_DHCP_DISCOVER (1024 + 1)
49 #define PW_DHCP_OFFER (1024 + 2)
50 #define PW_DHCP_REQUEST (1024 + 3)
51 #define PW_DHCP_DECLINE (1024 + 4)
52 #define PW_DHCP_ACK (1024 + 5)
53 #define PW_DHCP_NAK (1024 + 6)
54 #define PW_DHCP_RELEASE (1024 + 7)
55 #define PW_DHCP_INFORM (1024 + 8)
57 #define DHCP_MAGIC_VENDOR (54)
58 #define DHCP2ATTR(x) ((DHCP_MAGIC_VENDOR << 16) | (x))
59 #define ATTR2DHCP(x) ((x) & 0xff)
60 #define IS_DHCP_ATTR(x) (VENDOR((x)->attribute) == DHCP_MAGIC_VENDOR)
62 #define PW_DHCP_OPTION_82 (82)
63 #define DHCP_PACK_OPTION1(x,y) ((x) | ((y) << 8))
64 #define DHCP_BASE_ATTR(x) (x & 0xff)
65 #define DHCP_UNPACK_OPTION1(x) (((x) & 0xff00) >> 8)
71 #endif /* FR_DHCP_H */