4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #ifndef _DHCP_IMPL_H
27 #define _DHCP_IMPL_H
28
29 #pragma ident "%Z%%M% %I% %E% SMI"
30
31 /*
32 * Common definitions used by Sun DHCP implementations
33 */
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 #include <sys/types.h>
40 #include <sys/socket.h>
41 #include <netinet/in.h>
42 #include <netinet/udp.h>
43 #include <netinet/dhcp.h>
77 #define DHCP_ERR_OFFSET 512
78 #define DHCP_GARBLED_MSG_TYPE (DHCP_ERR_OFFSET+0)
79 #define DHCP_WRONG_MSG_TYPE (DHCP_ERR_OFFSET+1)
80 #define DHCP_BAD_OPT_OVLD (DHCP_ERR_OFFSET+2)
81
82 /*
83 * Arbitrary "maximum" client ID length (in bytes), used by various bits
84 * of the standalone code. This needs to go away someday.
85 */
86 #define DHCP_MAX_CID_LEN 64
87
88 /*
89 * Generic DHCP option structure.
90 */
91 typedef struct {
92 uint8_t code;
93 uint8_t len;
94 uint8_t value[1];
95 } DHCP_OPT;
96
97 typedef union sockaddr46_s {
98 struct sockaddr_in v4;
99 struct sockaddr_in6 v6;
100 } sockaddr46_t;
101
102 /*
103 * Generic DHCP packet list. Ensure that _REENTRANT bracketed code stays at
104 * bottom of this definition - the client doesn't include it. Scan.c in
105 * libdhcp isn't aware of it either...
106 *
107 * The PKT * pointer here actually points to a dhcpv6_message_t if the packet
108 * is DHCPv6. We assume that PKT * the same or stricter alignment
109 * requirements, and that the unused elements are not a significant burden.
110 */
111 #define MAX_PKT_LIST 5 /* maximum list size */
112 typedef struct dhcp_list {
113 struct dhcp_list *next; /* keep first and in this */
114 struct dhcp_list *prev; /* order for insque/remque */
115
116 PKT *pkt; /* client packet */
|
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 * Copyright (c) 2016, Chris Fraire <cfraire@me.com>.
25 */
26
27 #ifndef _DHCP_IMPL_H
28 #define _DHCP_IMPL_H
29
30 #pragma ident "%Z%%M% %I% %E% SMI"
31
32 /*
33 * Common definitions used by Sun DHCP implementations
34 */
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 #include <sys/types.h>
41 #include <sys/socket.h>
42 #include <netinet/in.h>
43 #include <netinet/udp.h>
44 #include <netinet/dhcp.h>
78 #define DHCP_ERR_OFFSET 512
79 #define DHCP_GARBLED_MSG_TYPE (DHCP_ERR_OFFSET+0)
80 #define DHCP_WRONG_MSG_TYPE (DHCP_ERR_OFFSET+1)
81 #define DHCP_BAD_OPT_OVLD (DHCP_ERR_OFFSET+2)
82
83 /*
84 * Arbitrary "maximum" client ID length (in bytes), used by various bits
85 * of the standalone code. This needs to go away someday.
86 */
87 #define DHCP_MAX_CID_LEN 64
88
89 /*
90 * Generic DHCP option structure.
91 */
92 typedef struct {
93 uint8_t code;
94 uint8_t len;
95 uint8_t value[1];
96 } DHCP_OPT;
97
98 /*
99 * Defines the size of DHCP_OPT code + len
100 */
101 #define DHCP_OPT_META_LEN 2
102
103 typedef union sockaddr46_s {
104 struct sockaddr_in v4;
105 struct sockaddr_in6 v6;
106 } sockaddr46_t;
107
108 /*
109 * Generic DHCP packet list. Ensure that _REENTRANT bracketed code stays at
110 * bottom of this definition - the client doesn't include it. Scan.c in
111 * libdhcp isn't aware of it either...
112 *
113 * The PKT * pointer here actually points to a dhcpv6_message_t if the packet
114 * is DHCPv6. We assume that PKT * the same or stricter alignment
115 * requirements, and that the unused elements are not a significant burden.
116 */
117 #define MAX_PKT_LIST 5 /* maximum list size */
118 typedef struct dhcp_list {
119 struct dhcp_list *next; /* keep first and in this */
120 struct dhcp_list *prev; /* order for insque/remque */
121
122 PKT *pkt; /* client packet */
|