]>
git.saurik.com Git - apple/xnu.git/blob - bsd/netinet/dhcp.h
2 #ifndef _NETINET_DHCP_H
3 #define _NETINET_DHCP_H
4 #include <sys/appleapiopts.h>
7 * Copyright (c) 1999-2007 Apple Inc. All rights reserved.
9 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
11 * This file contains Original Code and/or Modifications of Original Code
12 * as defined in and that are subject to the Apple Public Source License
13 * Version 2.0 (the 'License'). You may not use this file except in
14 * compliance with the License. The rights granted to you under the License
15 * may not be used to create, or enable the creation or redistribution of,
16 * unlawful or unlicensed copies of an Apple operating system, or to
17 * circumvent, violate, or enable the circumvention or violation of, any
18 * terms of an Apple operating system software license agreement.
20 * Please obtain a copy of the License at
21 * http://www.opensource.apple.com/apsl/ and read it before using this file.
23 * The Original Code and all software distributed under the License are
24 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
25 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
26 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
27 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
28 * Please see the License for the specific language governing rights and
29 * limitations under the License.
31 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
35 * - definitions for DHCP (as specified in RFC2132)
37 #include <sys/types.h>
38 #include <netinet/in.h>
39 #include <netinet/in_systm.h>
40 #include <netinet/ip.h>
41 #include <netinet/udp.h>
44 u_char dp_op
; /* packet opcode type */
45 u_char dp_htype
; /* hardware addr type */
46 u_char dp_hlen
; /* hardware addr length */
47 u_char dp_hops
; /* gateway hops */
48 u_int32_t dp_xid
; /* transaction ID */
49 u_int16_t dp_secs
; /* seconds since boot began */
50 u_int16_t dp_flags
; /* flags */
51 struct in_addr dp_ciaddr
; /* client IP address */
52 struct in_addr dp_yiaddr
; /* 'your' IP address */
53 struct in_addr dp_siaddr
; /* server IP address */
54 struct in_addr dp_giaddr
; /* gateway IP address */
55 u_char dp_chaddr
[16]; /* client hardware address */
56 u_char dp_sname
[64]; /* server host name */
57 u_char dp_file
[128]; /* boot file name */
58 u_char dp_options
[0]; /* variable-length options field */
67 #define DHCP_OPTIONS_MIN 312
68 #define DHCP_PACKET_MIN (sizeof(struct dhcp_packet) + DHCP_OPTIONS_MIN)
69 #define DHCP_PAYLOAD_MIN (sizeof(struct dhcp) + DHCP_OPTIONS_MIN)
71 /* dhcp message types */
72 #define DHCPDISCOVER 1
82 dhcp_msgtype_none_e
= 0,
83 dhcp_msgtype_discover_e
= DHCPDISCOVER
,
84 dhcp_msgtype_offer_e
= DHCPOFFER
,
85 dhcp_msgtype_request_e
= DHCPREQUEST
,
86 dhcp_msgtype_decline_e
= DHCPDECLINE
,
87 dhcp_msgtype_ack_e
= DHCPACK
,
88 dhcp_msgtype_nak_e
= DHCPNAK
,
89 dhcp_msgtype_release_e
= DHCPRELEASE
,
90 dhcp_msgtype_inform_e
= DHCPINFORM
,
93 typedef uint8_t dhcp_msgtype_t
;
95 typedef int32_t dhcp_time_secs_t
; /* absolute time */
96 typedef int32_t dhcp_lease_t
; /* relative time */
97 #define dhcp_time_hton htonl
98 #define dhcp_time_ntoh ntohl
99 #define dhcp_lease_hton htonl
100 #define dhcp_lease_ntoh ntohl
102 #define DHCP_INFINITE_LEASE ((dhcp_lease_t)-1)
103 #define DHCP_INFINITE_TIME ((dhcp_time_secs_t)-1)
105 #define DHCP_FLAGS_BROADCAST ((u_short)0x0001)
107 #endif /* _NETINET_DHCP_H */