Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers dhcpv6_client_api.h Source File

dhcpv6_client_api.h

00001 /*
00002  * Copyright (c) 2018, 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 #ifndef DHCPV6_CLIENT_API_H_
00019 #define DHCPV6_CLIENT_API_H_
00020 #include <ns_types.h>
00021 
00022 /* DHCP client implementation.
00023  *
00024  * Responsibilities of this module are:
00025  * - handle Global address queries and refresh inside network.
00026  *
00027  */
00028 
00029 /* Initialize dhcp client.
00030  *
00031  * This instance needs to bee initialized once for each network interface.
00032  * if only one thread instance is supported this is needed to call only once.
00033  *
00034  * /param interface interface id of this instance.
00035  * /param link_type DHCPV6_DUID_HARDWARE_IEEE_802_NETWORKS_TYPE, DHCPV6_DUID_HARDWARE_EUI64_TYPE or DHCPV6_DUID_HARDWARE_EUI48_TYPE
00036  *
00037  */
00038 void dhcp_client_init(int8_t interface, uint16_t link_type);
00039 
00040 /* Set configurations for DHCP client
00041  *
00042  * /param interface Client Inteface ID
00043  * /param renew_uses_solicit Instead of renew message SOLICIT is used.
00044  * /param one_client_for_this_interface True Interface use oneinstance for allocate address
00045  * /param no_address_hint IAID use address at Solicit
00046  */
00047 void dhcp_client_configure(int8_t interface, bool renew_uses_solicit, bool one_client_for_this_interface, bool no_address_hint);
00048 
00049 /* Set Timeout parameters for SOLICIT transactions
00050  *
00051  * /param timeout SOLICIT timeout initial value. 0 means use defaults
00052  * /param max_rt SOLICIT timeout max value.
00053  * /param max_rc SOLICIT re-transmission count. 0 means infinite.
00054  */
00055 void dhcp_client_solicit_timeout_set(int8_t interface, uint16_t timeout, uint16_t max_rt, uint8_t max_rc);
00056 
00057 /* Delete dhcp client.
00058  *
00059  * When this is called all addressed assigned by this module are removed from stack.
00060  */
00061 void dhcp_client_delete(int8_t interface);
00062 
00063 /* Global address handler.
00064  *
00065  * This module updates the addresses from dhcp server and sets them in stack.
00066  * this module makes refresh of address when needed.
00067  *
00068  */
00069 
00070 
00071 /* give dhcp server and prefix for global address assignment
00072  *
00073  * /param interface interface where address is got
00074  * /param dhcp_addr dhcp server ML16 address where address is registered.
00075  * /param prefix dhcp server ML16 address where address is registered.
00076  * /param error_cb error callback that is called if address cannot be created or becomes invalid.
00077  * /param register_status true if address registered.
00078  *
00079  */
00080 typedef void (dhcp_client_global_adress_cb)(int8_t interface, uint8_t dhcp_addr[static 16], uint8_t prefix[static 16], bool register_status);
00081 
00082 int dhcp_client_get_global_address(int8_t interface, uint8_t dhcp_addr[static 16], uint8_t prefix[static 16], dhcp_client_global_adress_cb *error_cb);
00083 
00084 /* Renew all leased adddresses might be used when short address changes
00085  *
00086  * /param interface interface where address is got
00087  */
00088 void dhcp_client_global_address_renew(int8_t interface);
00089 
00090 /* Delete address from device
00091  *  if prefix is NULL all are deleted
00092  *
00093  * /param interface interface where address is got
00094  * /param prefix dhcp server ML16 address where address is registered.
00095  *
00096  */
00097 void dhcp_client_global_address_delete(int8_t interface, uint8_t *dhcp_addr, uint8_t prefix[static 16]);
00098 
00099 
00100 void dhcp_relay_agent_enable(int8_t interface, uint8_t border_router_address[static 16]);
00101 
00102 int dhcp_client_server_address_update(int8_t interface, uint8_t *prefix, uint8_t server_address[static 16]);
00103 
00104 
00105 
00106 #endif /* DHCPV6_CLIENT_API_H_ */