diff options
Diffstat (limited to 'tinyNET/src/dhcp6/tnet_dhcp6_duid.h')
-rwxr-xr-x | tinyNET/src/dhcp6/tnet_dhcp6_duid.h | 131 |
1 files changed, 63 insertions, 68 deletions
diff --git a/tinyNET/src/dhcp6/tnet_dhcp6_duid.h b/tinyNET/src/dhcp6/tnet_dhcp6_duid.h index 34383fa..94c2b32 100755 --- a/tinyNET/src/dhcp6/tnet_dhcp6_duid.h +++ b/tinyNET/src/dhcp6/tnet_dhcp6_duid.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. * @@ -44,23 +44,21 @@ TNET_BEGIN_DECLS /** List of DHCPv6 DUIDs types as per RFC 3315 subclause 9.1. */ -typedef enum tnet_dhcp6_duid_type_e -{ - dhcp6_duid_linklayer_plus_time = 1, /**< Link-layer address plus time. */ - dhcp6_duid_Vendor_assigned_id = 2, /**< Vendor-assigned unique ID based on Enterprise Number. */ - dhcp6_duid_linklayer = 3, /**< Link-layer address. */ +typedef enum tnet_dhcp6_duid_type_e { + dhcp6_duid_linklayer_plus_time = 1, /**< Link-layer address plus time. */ + dhcp6_duid_Vendor_assigned_id = 2, /**< Vendor-assigned unique ID based on Enterprise Number. */ + dhcp6_duid_linklayer = 3, /**< Link-layer address. */ } tnet_dhcp6_duid_type_t; /** DHCP Unique Identifier (DUID) base class (subclause 9). */ -typedef struct tnet_dhcp6_duid_s -{ - TSK_DECLARE_OBJECT; - - tsk_bool_t initialized; +typedef struct tnet_dhcp6_duid_s { + TSK_DECLARE_OBJECT; + + tsk_bool_t initialized; - tnet_dhcp6_duid_type_t type; /* DUID type. 2-bytes value. */ + tnet_dhcp6_duid_type_t type; /* DUID type. 2-bytes value. */ } tnet_dhcp6_duid_t; @@ -80,29 +78,28 @@ int tnet_dhcp6_duid_serialize(const tnet_dhcp6_duid_t* self, tsk_buffer_t *outpu /** DUID Based on Link-layer Address Plus Time [DUID-LLT] */ -typedef struct tnet_dhcp6_duid_llt_s -{ - TNET_DECLARE_DHCP6_DUID; - /* - 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 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | 1 | hardware type (16 bits) | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | time (32 bits) | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - . . - . link-layer address (variable length) . - . . - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - */ - /* The hardware type code as maintained by IANA. */ - tnet_hardware_type_t htype; - /* The time value is the time that the DUID is generated represented in seconds - since midnight (UTC), January 1, 2000, modulo 2^32. */ - uint32_t time; - /* The link-layer address. */ - tsk_buffer_t *address; +typedef struct tnet_dhcp6_duid_llt_s { + TNET_DECLARE_DHCP6_DUID; + /* + 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 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | 1 | hardware type (16 bits) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | time (32 bits) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + . . + . link-layer address (variable length) . + . . + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ + /* The hardware type code as maintained by IANA. */ + tnet_hardware_type_t htype; + /* The time value is the time that the DUID is generated represented in seconds + since midnight (UTC), January 1, 2000, modulo 2^32. */ + uint32_t time; + /* The link-layer address. */ + tsk_buffer_t *address; } tnet_dhcp6_duid_llt_t; @@ -113,27 +110,26 @@ tnet_dhcp6_duid_llt_t; /** DUID Assigned by Vendor Based on Enterprise Number [DUID-EN] */ -typedef struct tnet_dhcp6_duid_en_s -{ - TNET_DECLARE_DHCP6_DUID; - /* - 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 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | 2 | enterprise-number | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | enterprise-number (contd) | | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | - . identifier . - . (variable length) . - . . - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - */ - /* Tthe vendor's registered Private Enterprise Number as maintained by IANA. - For more information: http://www.iana.org/assignments/enterprise-numbers. */ - uint32_t en; - /* The link-layer address. */ - tsk_buffer_t *indentifier; +typedef struct tnet_dhcp6_duid_en_s { + TNET_DECLARE_DHCP6_DUID; + /* + 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 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | 2 | enterprise-number | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | enterprise-number (contd) | | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | + . identifier . + . (variable length) . + . . + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ + /* Tthe vendor's registered Private Enterprise Number as maintained by IANA. + For more information: http://www.iana.org/assignments/enterprise-numbers. */ + uint32_t en; + /* The link-layer address. */ + tsk_buffer_t *indentifier; } tnet_dhcp6_duid_en_t; @@ -143,11 +139,10 @@ tnet_dhcp6_duid_en_t; /** DUID Based on Link-layer Address [DUID-LL] */ -typedef struct tnet_dhcp6_duid_ll_s -{ - TNET_DECLARE_DHCP6_DUID; - /* - 0 1 2 3 +typedef struct tnet_dhcp6_duid_ll_s { + TNET_DECLARE_DHCP6_DUID; + /* + 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 3 | hardware type (16 bits) | @@ -156,11 +151,11 @@ typedef struct tnet_dhcp6_duid_ll_s . link-layer address (variable length) . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - */ - /* The hardware type code as maintained by IANA. */ - tnet_hardware_type_t htype; - /* The link-layer address. */ - tsk_buffer_t *address; + */ + /* The hardware type code as maintained by IANA. */ + tnet_hardware_type_t htype; + /* The link-layer address. */ + tsk_buffer_t *address; } tnet_dhcp6_duid_ll_t; |