summaryrefslogtreecommitdiffstats
path: root/tinyNET/src/dhcp6/tnet_dhcp6_option.h
diff options
context:
space:
mode:
Diffstat (limited to 'tinyNET/src/dhcp6/tnet_dhcp6_option.h')
-rwxr-xr-xtinyNET/src/dhcp6/tnet_dhcp6_option.h209
1 files changed, 101 insertions, 108 deletions
diff --git a/tinyNET/src/dhcp6/tnet_dhcp6_option.h b/tinyNET/src/dhcp6/tnet_dhcp6_option.h
index 71241b9..56ec83e 100755
--- a/tinyNET/src/dhcp6/tnet_dhcp6_option.h
+++ b/tinyNET/src/dhcp6/tnet_dhcp6_option.h
@@ -2,19 +2,19 @@
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
-*
+*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
-*
+*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-*
+*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
@@ -42,47 +42,45 @@ TNET_BEGIN_DECLS
#define TNET_DHCP6_OPTION(self) ((tnet_dhcp6_option_t*)(self))
/** List of DHCPv6 option as registered by IANA (RFC 3315 subcaluse 24.3)*/
-typedef enum tnet_dhcp6_option_code_e
-{
- dhcp6_code_clientid = 1, /**< Client Identifier Option. */
- dhcp6_code_serverid = 2, /**< Server Identifier Option. */
- dhcp6_code_ia_na = 3, /**< Identity Association for Non-temporary Addresses Option. */
- dhcp6_code_ia_ta = 4, /**< Identity Association for Temporary Addresses Option. */
- dhcp6_code_iaaddr = 5, /**< IA Address Option. */
- dhcp6_code_oro = 6, /**< Option Request Option. */
- dhcp6_code_preference = 7, /**< Preference Option. */
- dhcp6_code_elapsed_time = 8, /**< Elapsed Time Option. */
- dhcp6_code_relay_msg = 9, /**< Relay Message Option. */
- dhcp6_code_auth = 11, /**< Authentication Option. */
- dhcp6_code_unicast = 12, /**< Server Unicast Option. */
- dhcp6_code_status_code = 13, /**< Status Code Option. */
- dhcp6_code_rapid_commit = 14, /**< Rapid Commit Option. */
- dhcp6_code_user_class = 15, /**< User Class Option. */
- dhcp6_code_vendor_class = 16, /**< Vendor Class Option. */
- dhcp6_code_vendor_opts = 17, /**< Vendor-specific Information Option. */
- dhcp6_code_interface_id = 18, /**< Interface-Id Option. */
- dhcp6_code_reconf_msg = 19, /**< Reconfigure Message Option. */
- dhcp6_code_reconf_accept = 20, /**< Reconfigure Accept Option. */
+typedef enum tnet_dhcp6_option_code_e {
+ dhcp6_code_clientid = 1, /**< Client Identifier Option. */
+ dhcp6_code_serverid = 2, /**< Server Identifier Option. */
+ dhcp6_code_ia_na = 3, /**< Identity Association for Non-temporary Addresses Option. */
+ dhcp6_code_ia_ta = 4, /**< Identity Association for Temporary Addresses Option. */
+ dhcp6_code_iaaddr = 5, /**< IA Address Option. */
+ dhcp6_code_oro = 6, /**< Option Request Option. */
+ dhcp6_code_preference = 7, /**< Preference Option. */
+ dhcp6_code_elapsed_time = 8, /**< Elapsed Time Option. */
+ dhcp6_code_relay_msg = 9, /**< Relay Message Option. */
+ dhcp6_code_auth = 11, /**< Authentication Option. */
+ dhcp6_code_unicast = 12, /**< Server Unicast Option. */
+ dhcp6_code_status_code = 13, /**< Status Code Option. */
+ dhcp6_code_rapid_commit = 14, /**< Rapid Commit Option. */
+ dhcp6_code_user_class = 15, /**< User Class Option. */
+ dhcp6_code_vendor_class = 16, /**< Vendor Class Option. */
+ dhcp6_code_vendor_opts = 17, /**< Vendor-specific Information Option. */
+ dhcp6_code_interface_id = 18, /**< Interface-Id Option. */
+ dhcp6_code_reconf_msg = 19, /**< Reconfigure Message Option. */
+ dhcp6_code_reconf_accept = 20, /**< Reconfigure Accept Option. */
}
tnet_dhcp6_option_code_t;
/** List of DHCPv6 status codes as registered by IANA (RFC 3315 subclause 24.4) */
-typedef enum tnet_dhcp6_statuscode_e
-{
- /* Success */
- dhcp6_statuscode_Success = 0,
- /* 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 (RFC 3315). */
- dhcp6_statuscode_UnspecFail = 1,
- /* Server has no addresses available to assign to the IA(s). */
- dhcp6_statuscode_NoAddrsAvail = 2,
- /* Client record (binding) unavailable. */
- dhcp6_statuscode_NoBinding = 3,
- /* The prefix for the address is not appropriate for the link to which the client is attached. */
- dhcp6_statuscode_NotOnLink = 4,
- /* 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.*/
- dhcp6_statuscode_UseMulticast = 5
+typedef enum tnet_dhcp6_statuscode_e {
+ /* Success */
+ dhcp6_statuscode_Success = 0,
+ /* 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 (RFC 3315). */
+ dhcp6_statuscode_UnspecFail = 1,
+ /* Server has no addresses available to assign to the IA(s). */
+ dhcp6_statuscode_NoAddrsAvail = 2,
+ /* Client record (binding) unavailable. */
+ dhcp6_statuscode_NoBinding = 3,
+ /* The prefix for the address is not appropriate for the link to which the client is attached. */
+ dhcp6_statuscode_NotOnLink = 4,
+ /* 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.*/
+ dhcp6_statuscode_UseMulticast = 5
}
tnet_dhcp6_statuscode_t;
@@ -93,34 +91,32 @@ tnet_dhcp6_statuscode_t;
/**@ingroup tnet_dhcpv_group
* DHCPv6 option-data.
*/
-typedef struct tnet_dhcp6_option_data_s
-{
- TSK_DECLARE_OBJECT;
+typedef struct tnet_dhcp6_option_data_s {
+ TSK_DECLARE_OBJECT;
}
tnet_dhcp6_option_data_t;
#define TNET_DECLARE_DHCP6_OPTION_DATA tnet_dhcp6_option_data_t dhcp6_option_data
-typedef struct tnet_dhcp6_option_s
-{
- TSK_DECLARE_OBJECT;
-
- /* RFC 3315 - 22.1. Format of DHCP Options
- 0 1 2 3
- 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | option-code(2) | option-len(2) |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | option-data |
- | (option-len octets) |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
- /* An unsigned integer identifying the specific option type carried in this option.*/
- tnet_dhcp6_option_code_t code;
- /* Option length. Same as tsk_strlen(data buffer)*/
- uint16_t len;
- /* opton-data */
- tnet_dhcp6_option_data_t *data;
+typedef struct tnet_dhcp6_option_s {
+ TSK_DECLARE_OBJECT;
+
+ /* RFC 3315 - 22.1. Format of DHCP Options
+ 0 1 2 3
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | option-code(2) | option-len(2) |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | option-data |
+ | (option-len octets) |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+
+ /* An unsigned integer identifying the specific option type carried in this option.*/
+ tnet_dhcp6_option_code_t code;
+ /* Option length. Same as tsk_strlen(data buffer)*/
+ uint16_t len;
+ /* opton-data */
+ tnet_dhcp6_option_data_t *data;
}
tnet_dhcp6_option_t;
@@ -136,29 +132,28 @@ int tnet_dhcp6_option_serializeex(tnet_dhcp6_option_code_t code, uint8_t length,
/*======================================================================================
-* RFC 3315 -
+* RFC 3315 -
22.2. Client Identifier Option
22.3. Server Identifier Option
*=======================================================================================*/
/** DHCPv6 Client /server Identifier Option (subclause 22.2 and 22.3).
*/
-typedef struct tnet_dhcp6_option_identifier_s
-{
- TNET_DECLARE_DHCP6_OPTION_DATA;
- /*
- 0 1 2 3
- 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | OPTION_XXXXXXID | option-len |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- . .
- . DUID .
- . (variable length) .
- . .
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- OPTION_XXXXXXID = OPTION_CLIENTID or OPTION_SERVERID
- */
- tnet_dhcp6_duid_t *duid;
+typedef struct tnet_dhcp6_option_identifier_s {
+ TNET_DECLARE_DHCP6_OPTION_DATA;
+ /*
+ 0 1 2 3
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | OPTION_XXXXXXID | option-len |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ . .
+ . DUID .
+ . (variable length) .
+ . .
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ OPTION_XXXXXXID = OPTION_CLIENTID or OPTION_SERVERID
+ */
+ tnet_dhcp6_duid_t *duid;
}
tnet_dhcp6_option_identifier_t;
typedef tnet_dhcp6_option_identifier_t tnet_dhcp6_option_clientid_t;
@@ -175,21 +170,20 @@ typedef tnet_dhcp6_option_identifier_t tnet_dhcp6_option_serverid_t;
/** DHCPv6 Option Request Option (subclause 22.7).
*/
-typedef struct tnet_dhcp6_option_orequest_s
-{
- TNET_DECLARE_DHCP6_OPTION_DATA;
- /*
- 0 1 2 3
- 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | OPTION_ORO | option-len |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | requested-option-code-1 | requested-option-code-2 |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | ... |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
- tsk_buffer_t* codes;
+typedef struct tnet_dhcp6_option_orequest_s {
+ TNET_DECLARE_DHCP6_OPTION_DATA;
+ /*
+ 0 1 2 3
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | OPTION_ORO | option-len |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | requested-option-code-1 | requested-option-code-2 |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | ... |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+ tsk_buffer_t* codes;
}
tnet_dhcp6_option_orequest_t;
@@ -201,11 +195,10 @@ TINYNET_API int tnet_dhcp6_option_orequest_add_code(tnet_dhcp6_option_orequest_t
/** DHCPv6 Vendor Class Option (subclause 22.16).
*/
-typedef struct tnet_dhcp6_option_vendorclass_s
-{
- TNET_DECLARE_DHCP6_OPTION_DATA;
- /*
- 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+typedef struct tnet_dhcp6_option_vendorclass_s {
+ TNET_DECLARE_DHCP6_OPTION_DATA;
+ /*
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| OPTION_VENDOR_CLASS | option-len |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -215,14 +208,14 @@ typedef struct tnet_dhcp6_option_vendorclass_s
. vendor-class-data .
. . . . .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
- uint32_t enterprise_number;
- /*
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...-+-+-+-+-+-+-+
+ */
+ uint32_t enterprise_number;
+ /*
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...-+-+-+-+-+-+-+
| vendor-class-len | opaque-data |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...-+-+-+-+-+-+-+
- */
- tsk_buffer_t* vendor_class_data;
+ */
+ tsk_buffer_t* vendor_class_data;
}
tnet_dhcp6_option_vendorclass_t;
OpenPOWER on IntegriCloud