Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers dhcp6.h Source File

dhcp6.h

Go to the documentation of this file.
00001 /**
00002  * @file
00003  * DHCPv6 protocol definitions
00004  */
00005 
00006 /*
00007  * Copyright (c) 2017 Simon Goldschmidt <goldsimon@gmx.de>
00008  * All rights reserved.
00009  *
00010  * Redistribution and use in source and binary forms, with or without modification,
00011  * are permitted provided that the following conditions are met:
00012  *
00013  * 1. Redistributions of source code must retain the above copyright notice,
00014  *    this list of conditions and the following disclaimer.
00015  * 2. Redistributions in binary form must reproduce the above copyright notice,
00016  *    this list of conditions and the following disclaimer in the documentation
00017  *    and/or other materials provided with the distribution.
00018  * 3. The name of the author may not be used to endorse or promote products
00019  *    derived from this software without specific prior written permission.
00020  *
00021  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00022  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00023  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
00024  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00025  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00026  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00027  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00028  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00029  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00030  * OF SUCH DAMAGE.
00031  *
00032  * This file is part of the lwIP TCP/IP stack.
00033  *
00034  * Author: Simon Goldschmidt <goldsimon@gmx.de>
00035  *
00036  */
00037 #ifndef LWIP_HDR_PROT_DHCP6_H
00038 #define LWIP_HDR_PROT_DHCP6_H
00039 
00040 #include "lwip/opt.h"
00041 
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045 
00046 #define DHCP6_CLIENT_PORT  546
00047 #define DHCP6_SERVER_PORT  547
00048 
00049 
00050  /* DHCPv6 message item offsets and length */
00051 #define DHCP6_TRANSACTION_ID_LEN   3
00052 
00053 #ifdef PACK_STRUCT_USE_INCLUDES
00054 #  include "arch/bpstruct.h"
00055 #endif
00056 PACK_STRUCT_BEGIN
00057 /** minimum set of fields of any DHCPv6 message */
00058 struct dhcp6_msg
00059 {
00060   PACK_STRUCT_FLD_8(u8_t msgtype);
00061   PACK_STRUCT_FLD_8(u8_t transaction_id[DHCP6_TRANSACTION_ID_LEN]);
00062   /* options follow */
00063 } PACK_STRUCT_STRUCT;
00064 PACK_STRUCT_END
00065 #ifdef PACK_STRUCT_USE_INCLUDES
00066 #  include "arch/epstruct.h"
00067 #endif
00068 
00069 
00070 /* DHCP6 client states */
00071 typedef enum {
00072   DHCP6_STATE_OFF               = 0,
00073   DHCP6_STATE_STATELESS_IDLE    = 1,
00074   DHCP6_STATE_REQUESTING_CONFIG = 2
00075 } dhcp6_state_enum_t;
00076 
00077 /* DHCPv6 message types */
00078 #define DHCP6_SOLICIT               1
00079 #define DHCP6_ADVERTISE             2
00080 #define DHCP6_REQUEST               3
00081 #define DHCP6_CONFIRM               4
00082 #define DHCP6_RENEW                 5
00083 #define DHCP6_REBIND                6
00084 #define DHCP6_REPLY                 7
00085 #define DHCP6_RELEASE               8
00086 #define DHCP6_DECLINE               9
00087 #define DHCP6_RECONFIGURE           10
00088 #define DHCP6_INFOREQUEST           11
00089 #define DHCP6_RELAYFORW             12
00090 #define DHCP6_RELAYREPL             13
00091 /* More message types see https://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml */
00092 
00093 /** DHCPv6 status codes */
00094 #define DHCP6_STATUS_SUCCESS        0 /* Success. */
00095 #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. */
00096 #define DHCP6_STATUS_NOADDRSAVAIL   2 /* Server has no addresses available to assign to the IA(s). */
00097 #define DHCP6_STATUS_NOBINDING      3 /* Client record (binding) unavailable. */
00098 #define DHCP6_STATUS_NOTONLINK      4 /* The prefix for the address is not appropriate for the link to which the client is attached. */
00099 #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. */
00100 /* More status codes see https://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml */
00101 
00102 /** DHCPv6 DUID types */
00103 #define DHCP6_DUID_LLT              1 /* LLT: Link-layer Address Plus Time */
00104 #define DHCP6_DUID_EN               2 /* EN: Enterprise number */
00105 #define DHCP6_DUID_LL               3 /* LL: Link-layer Address */
00106 #define DHCP6_DUID_UUID             4 /* UUID (RFC 6355) */
00107 
00108 /* DHCPv6 options */
00109 #define DHCP6_OPTION_CLIENTID       1
00110 #define DHCP6_OPTION_SERVERID       2
00111 #define DHCP6_OPTION_IA_NA          3
00112 #define DHCP6_OPTION_IA_TA          4
00113 #define DHCP6_OPTION_IAADDR         5
00114 #define DHCP6_OPTION_ORO            6
00115 #define DHCP6_OPTION_PREFERENCE     7
00116 #define DHCP6_OPTION_ELAPSED_TIME   8
00117 #define DHCP6_OPTION_RELAY_MSG      9
00118 #define DHCP6_OPTION_AUTH           11
00119 #define DHCP6_OPTION_UNICAST        12
00120 #define DHCP6_OPTION_STATUS_CODE    13
00121 #define DHCP6_OPTION_RAPID_COMMIT   14
00122 #define DHCP6_OPTION_USER_CLASS     15
00123 #define DHCP6_OPTION_VENDOR_CLASS   16
00124 #define DHCP6_OPTION_VENDOR_OPTS    17
00125 #define DHCP6_OPTION_INTERFACE_ID   18
00126 #define DHCP6_OPTION_RECONF_MSG     19
00127 #define DHCP6_OPTION_RECONF_ACCEPT  20
00128 /* More options see https://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml */
00129 #define DHCP6_OPTION_DNS_SERVERS    23 /* RFC 3646 */
00130 #define DHCP6_OPTION_DOMAIN_LIST    24 /* RFC 3646 */
00131 #define DHCP6_OPTION_SNTP_SERVERS   31 /* RFC 4075 */
00132 
00133 
00134 #ifdef __cplusplus
00135 }
00136 #endif
00137 
00138 #endif /* LWIP_HDR_PROT_DHCP6_H */