BadVPN – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 /**
2 * @file
3 * DHCPv6 protocol definitions
4 */
5  
6 /*
7 * Copyright (c) 2017 Simon Goldschmidt <goldsimon@gmx.de>
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without modification,
11 * are permitted provided that the following conditions are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright notice,
14 * this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 * 3. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
22 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
24 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
26 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
30 * OF SUCH DAMAGE.
31 *
32 * This file is part of the lwIP TCP/IP stack.
33 *
34 * Author: Simon Goldschmidt <goldsimon@gmx.de>
35 *
36 */
37 #ifndef LWIP_HDR_PROT_DHCP6_H
38 #define LWIP_HDR_PROT_DHCP6_H
39  
40 #include "lwip/opt.h"
41  
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45  
46 #define DHCP6_CLIENT_PORT 546
47 #define DHCP6_SERVER_PORT 547
48  
49  
50 /* DHCPv6 message item offsets and length */
51 #define DHCP6_TRANSACTION_ID_LEN 3
52 #define DHCP_SNAME_OFS 44U
53 #define DHCP_SNAME_LEN 64U
54 #define DHCP_FILE_OFS 108U
55 #define DHCP_FILE_LEN 128U
56 #define DHCP_MSG_LEN 236U
57 #define DHCP_OPTIONS_OFS (DHCP_MSG_LEN + 4U)*/ /* 4 byte: cookie */
58  
59 #ifdef PACK_STRUCT_USE_INCLUDES
60 # include "arch/bpstruct.h"
61 #endif
62 PACK_STRUCT_BEGIN
63 /** minimum set of fields of any DHCPv6 message */
64 struct dhcp6_msg
65 {
66 PACK_STRUCT_FLD_8(u8_t msgtype);
67 PACK_STRUCT_FLD_8(u8_t transaction_id[DHCP6_TRANSACTION_ID_LEN]);
68 /* options follow */
69 } PACK_STRUCT_STRUCT;
70 PACK_STRUCT_END
71 #ifdef PACK_STRUCT_USE_INCLUDES
72 # include "arch/epstruct.h"
73 #endif
74  
75  
76 /* DHCP6 client states */
77 typedef enum {
78 DHCP6_STATE_OFF = 0,
79 DHCP6_STATE_REQUESTING_CONFIG = 1
80 } dhcp_state_enum_t;
81  
82 /* DHCPv6 message types */
83 #define DHCP6_SOLICIT 1
84 #define DHCP6_ADVERTISE 2
85 #define DHCP6_REQUEST 3
86 #define DHCP6_CONFIRM 4
87 #define DHCP6_RENEW 5
88 #define DHCP6_REBIND 6
89 #define DHCP6_REPLY 7
90 #define DHCP6_RELEASE 8
91 #define DHCP6_DECLINE 9
92 #define DHCP6_RECONFIGURE 10
93 #define DHCP6_INFOREQUEST 11
94 #define DHCP6_RELAYFORW 12
95 #define DHCP6_RELAYREPL 13
96  
97 /** DHCPv6 status codes */
98 #define DHCP6_STATUS_SUCCESS 0 /* Success. */
99 #define DHCP6_STATUS_UNSPECFAIL 1 /* Failure, reason unspecified; this status code is sent by either a client or a server to indicate a failure not explicitly specified in this document. */
100 #define DHCP6_STATUS_NOADDRSAVAIL 2 /* Server has no addresses available to assign to the IA(s). */
101 #define DHCP6_STATUS_NOBINDING 3 /* Client record (binding) unavailable. */
102 #define DHCP6_STATUS_NOTONLINK 4 /* The prefix for the address is not appropriate for the link to which the client is attached. */
103 #define DHCP6_STATUS_USEMULTICAST 5 /* Sent by a server to a client to force the client to send messages to the server using the All_DHCP_Relay_Agents_and_Servers address. */
104  
105 /** DHCPv6 DUID types */
106 #define DHCP6_DUID_LLT 1 /* LLT: Link-layer Address Plus Time */
107 #define DHCP6_DUID_EN 2 /* EN: Enterprise number */
108 #define DHCP6_DUID_LL 3 /* LL: Link-layer Address */
109  
110 /* DHCPv6 options */
111 #define DHCP6_OPTION_CLIENTID 1
112 #define DHCP6_OPTION_SERVERID 2
113 #define DHCP6_OPTION_IA_NA 3
114 #define DHCP6_OPTION_IA_TA 4
115 #define DHCP6_OPTION_IAADDR 5
116 #define DHCP6_OPTION_ORO 6
117 #define DHCP6_OPTION_PREFERENCE 7
118 #define DHCP6_OPTION_ELAPSED_TIME 8
119 #define DHCP6_OPTION_RELAY_MSG 9
120 #define DHCP6_OPTION_AUTH 11
121 #define DHCP6_OPTION_UNICAST 12
122 #define DHCP6_OPTION_STATUS_CODE 13
123 #define DHCP6_OPTION_RAPID_COMMIT 14
124 #define DHCP6_OPTION_USER_CLASS 15
125 #define DHCP6_OPTION_VENDOR_CLASS 16
126 #define DHCP6_OPTION_VENDOR_OPTS 17
127 #define DHCP6_OPTION_INTERFACE_ID 18
128 #define DHCP6_OPTION_RECONF_MSG 19
129 #define DHCP6_OPTION_ACCEPT 20
130  
131  
132 #ifdef __cplusplus
133 }
134 #endif
135  
136 #endif /*LWIP_HDR_PROT_DHCP_H*/