Denislam Valeev / Mbed OS Nucleo_rtos_basic
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers libDHCPv6_server.h Source File

libDHCPv6_server.h

00001 /*
00002  * Copyright (c) 2014-2015, 2017, Arm Limited and affiliates.
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 /*
00019  * \file libDHCPv6_server.h
00020  * \brief Add short description about this file!!!
00021  *
00022  */
00023 
00024 #ifndef LIBDHCPV6_SERVER_H_
00025 #define LIBDHCPV6_SERVER_H_
00026 #ifdef HAVE_DHCPV6_SERVER
00027 #include "ns_list.h"
00028 
00029 typedef void (dhcp_address_prefer_timeout_cb)(int8_t interfaceId, uint8_t *targetAddress);
00030 
00031 typedef struct dhcpv6_alloacted_address_entry_s {
00032     uint8_t             nonTemporalAddress[16];
00033     uint8_t             linkId[8];  /*!< Services UL64 */
00034     uint16_t            linkType;
00035     uint32_t            iaID;
00036     uint32_t            T0;
00037     uint32_t            T1;
00038     uint32_t            preferredLifetime;
00039     uint32_t            lifetime;
00040     ns_list_link_t      link;               /*!< List link entry */
00041 } dhcpv6_alloacted_address_entry_t;
00042 
00043 typedef NS_LIST_HEAD (dhcpv6_alloacted_address_entry_t, link) dhcpv6_alloacted_address_list_t;
00044 
00045 typedef struct thread_dhcpv6_server_data_s {
00046     uint8_t           prefix[8];    /*!< Services Prefix */
00047     uint16_t          maxSuppertedClients;
00048     uint32_t          clientIdSequence;     /*!< Define  */
00049     dhcpv6_alloacted_address_list_t allocatedAddressList;
00050     ns_list_link_t      link;               /*!< List link entry */
00051 } dhcpv6_server_data_entry_t;
00052 
00053 typedef struct dhcpv6_gua_server_entry_s {
00054     int8_t      interfaceId;
00055     bool        enableAddressMapping;
00056     uint8_t     meshLocalPrefix[8];
00057     bool        enableAddressAutonous;
00058     uint16_t    socketInstance_id;
00059     uint8_t     guaPrefix[8];
00060     uint8_t     serverDUID[8];
00061     uint16_t    serverLinkType;
00062     uint32_t    maxSuppertedClients;
00063     uint32_t    clientIdDefaultSuffics;
00064     uint32_t    clientIdSequence;       /*!< Define  */
00065     uint32_t    validLifetime;
00066     dhcp_address_prefer_timeout_cb *timeoutCb;
00067     dhcpv6_alloacted_address_list_t allocatedAddressList;
00068     ns_list_link_t      link;                   /*!< List link entry */
00069 } dhcpv6_gua_server_entry_s;
00070 
00071 bool libdhcpv6_gua_server_list_empty(void);
00072 dhcpv6_gua_server_entry_s *libdhcpv6_gua_server_allocate(uint8_t *prefix, int8_t interfaceId, uint8_t *serverDUID, uint16_t serverDUIDType, dhcp_address_prefer_timeout_cb *prefered_timeout_cb);
00073 void libdhcpv6_gua_server_free_by_prefix_and_interfaceid(uint8_t *prefix, int8_t interfaceId);
00074 void libdhcpv6_gua_servers_time_update(uint32_t timeUpdateInSeconds);
00075 void libdhcpv6_address_rm_from_allocated_list(dhcpv6_gua_server_entry_s *serverInfo, const uint8_t *address);
00076 dhcpv6_alloacted_address_entry_t *libdhcpv6_address_get_from_allocated_list(dhcpv6_gua_server_entry_s *serverInfo, const uint8_t *address);
00077 dhcpv6_gua_server_entry_s *libdhcpv6_server_data_get_by_prefix_and_interfaceid(int8_t interfaceId, const uint8_t *prefixPtr);
00078 dhcpv6_gua_server_entry_s *libdhcpv6_server_data_get_by_prefix_and_socketinstance(uint16_t socketInstance, uint8_t *prefixPtr);
00079 dhcpv6_alloacted_address_entry_t *libdhcpv6_address_allocated_list_scan(dhcpv6_gua_server_entry_s *serverInfo, uint8_t *euid64, uint16_t linkType, uint32_t iaID, uint32_t T0, uint32_t T1, bool allocateNew);
00080 #else
00081 #define libdhcpv6_gua_server_list_empty() true
00082 #define libdhcpv6_server_data_get_by_prefix_and_interfaceid(interfaceId, prefixPtr) NULL
00083 #define libdhcpv6_server_data_get_by_prefix_and_socketinstance(socketInstance, prefixPtr) NULL
00084 #define libdhcpv6_gua_server_allocate(prefix, interfaceId, serverDUID, serverDUIDType, prefered_timeout_cb) NULL
00085 #define libdhcpv6_gua_server_free_by_prefix_and_interfaceid(prefix, interfaceId) ((void)0)
00086 #define libdhcpv6_gua_servers_time_update(timeUpdateInSeconds) ((void)0)
00087 #define libdhcpv6_gua_server_free_by_interfaceid(interfaceId) ((void)0)
00088 #define libdhcpv6_address_get_from_allocated_list(serverInfo, address) NULL
00089 #define libdhcpv6_address_rm_from_allocated_list(serverInfo, address) ((void)0)
00090 #define libdhcpv6_address_allocated_list_scan( serverInfo, linkId, linkType, iaID, T0, T1, allocateNew) NULL
00091 #endif
00092 
00093 #endif /* LIBDHCPV6_SERVER_H_ */