|
| 1 | +/* |
| 2 | + * Copyright (c) 2014-2018, Arm Limited and affiliates. |
| 3 | + * SPDX-License-Identifier: Apache-2.0 |
| 4 | + * |
| 5 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | + * you may not use this file except in compliance with the License. |
| 7 | + * You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | + |
| 18 | +/* |
| 19 | + * \file DHCPv6_Server_service.c |
| 20 | + * \brief Add short description about this file!!! |
| 21 | + * |
| 22 | + */ |
| 23 | +#include "nsconfig.h" |
| 24 | +#ifdef HAVE_DHCPV6_SERVER |
| 25 | +#include <string.h> |
| 26 | +#include <ns_types.h> |
| 27 | +#include <ns_trace.h> |
| 28 | +#include "eventOS_event.h" |
| 29 | +#include "eventOS_scheduler.h" |
| 30 | +#include "eventOS_event_timer.h" |
| 31 | +#include <nsdynmemLIB.h> |
| 32 | +#include "libDHCPv6/libDHCPv6.h" |
| 33 | +#include "libDHCPv6/libDHCPv6_server.h" |
| 34 | +#include "DHCPv6_Server/DHCPv6_server_service.h" |
| 35 | +#include "common_functions.h" |
| 36 | +#include "NWK_INTERFACE/Include/protocol.h" |
| 37 | +#include "Common_Protocols/icmpv6.h" |
| 38 | +#include "dhcp_service_api.h" |
| 39 | + |
| 40 | +#define TRACE_GROUP "dhcp" |
| 41 | + |
| 42 | +#define DHCPV6_GUA_IF "dhcp" |
| 43 | +#define DHCPV6_SERVER_SERVICE_TASKLET_INIT 1 |
| 44 | +#define DHCPV6_SERVER_SERVICE_TIMER 2 |
| 45 | + |
| 46 | +#define DHCPV6_SERVER_SERVICE_TIMER_ID 1 |
| 47 | + |
| 48 | +#define DHCPV6_TIMER_UPDATE_PERIOD_IN_SECONDS 10 |
| 49 | + |
| 50 | +typedef struct dhcpv6_gua_response { |
| 51 | + uint16_t responseLength; |
| 52 | + uint8_t *responsePtr; |
| 53 | +} dhcpv6_gua_response_t; |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | +/* Initialize dhcp Global address server. |
| 58 | + * |
| 59 | + * This instance needs to bee initialized once for each thread network interface. |
| 60 | + * if only one thread instance is supported this is needed to call only once. |
| 61 | + * |
| 62 | + * /param interface interface id of this thread instance. |
| 63 | + * /param guaPrefix Global prefix /64 |
| 64 | + * /param serverDUID Server Device ID (64-bit MAC) |
| 65 | + * /param serverDUIDType |
| 66 | + * |
| 67 | + */ |
| 68 | +int DHCPv6_server_service_init(int8_t interface, uint8_t guaPrefix[static 16], uint8_t serverDUID[static 8], uint16_t serverDUIDType) |
| 69 | +{ |
| 70 | + return 0; |
| 71 | +} |
| 72 | + |
| 73 | +void DHCPv6_server_service_timeout_cb(uint32_t timeUpdateInSeconds) |
| 74 | +{ |
| 75 | + |
| 76 | +} |
| 77 | + |
| 78 | +/* Delete dhcp thread dhcp router ID server. |
| 79 | + * |
| 80 | + * When this is called it close selected service and free all allocated memory. |
| 81 | + * |
| 82 | + * /param interface interface id of this thread instance. |
| 83 | + * /param guaPrefix Prefix which will be removed |
| 84 | + * /param delete_gua_addresses Whether or not assigned addresses with the prefix should be removed from the interface. |
| 85 | + */ |
| 86 | +void DHCPv6_server_service_delete(int8_t interface, uint8_t guaPrefix[static 16], bool delete_gua_addresses) |
| 87 | +{ |
| 88 | + |
| 89 | +} |
| 90 | + |
| 91 | +/* Control GUA address for client by DUI.Default value is true |
| 92 | + * |
| 93 | + * |
| 94 | + * /param interface interface id of this thread instance. |
| 95 | + * /param guaPrefix Prefix which will be removed |
| 96 | + * /param mode true trig autonous mode, false define address by default suffics + client id |
| 97 | + */ |
| 98 | +int DHCPv6_server_service_set_address_autonous_flag(int8_t interface, uint8_t guaPrefix[static 16], bool mode) |
| 99 | +{ |
| 100 | + return 0; |
| 101 | +} |
| 102 | + |
| 103 | +void DHCPv6_server_service_callback_set(int8_t interface, uint8_t guaPrefix[static 16], dhcp_address_prefer_remove_cb *remove_cb, dhcp_address_add_notify_cb *add_cb) |
| 104 | +{ |
| 105 | + |
| 106 | +} |
| 107 | + |
| 108 | +/* SET max accepted clients to server, Default is 200 |
| 109 | + * |
| 110 | + * |
| 111 | + * /param interface interface id of this thread instance. |
| 112 | + * /param guaPrefix Prefix which will be removed |
| 113 | + * /param maxClientCount |
| 114 | + */ |
| 115 | +int DHCPv6_server_service_set_max_clients_accepts_count(int8_t interface, uint8_t guaPrefix[static 16], uint32_t maxClientCount) |
| 116 | +{ |
| 117 | + return 0; |
| 118 | +} |
| 119 | + |
| 120 | +/** SET Address Valid Lifetime parameter for allocated address, Default is 7200 seconds |
| 121 | + * |
| 122 | + * |
| 123 | + * /param interface interface id of this thread instance. |
| 124 | + * /param guaPrefix Prefix which will be removed |
| 125 | + * /param validLifeTimne in seconds |
| 126 | + */ |
| 127 | +int DHCPv6_server_service_set_address_validlifetime(int8_t interface, uint8_t guaPrefix[static 16], uint32_t validLifeTimne) |
| 128 | +{ |
| 129 | + return 0; |
| 130 | +} |
| 131 | +#endif |
0 commit comments