BA / Mbed OS BaBoRo1
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers thread_dhcpv6_client.h Source File

thread_dhcpv6_client.h

00001 /*
00002  * Copyright (c) 2014-2015, 2017, Arm Limited and affiliates.
00003  * SPDX-License-Identifier: BSD-3-Clause
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions are met:
00007  *
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  * 3. Neither the name of the copyright holder nor the
00014  *    names of its contributors may be used to endorse or promote products
00015  *    derived from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
00021  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00022  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00023  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00024  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00025  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00026  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00027  * POSSIBILITY OF SUCH DAMAGE.
00028  */
00029 
00030 
00031 #ifndef SOURCE_6LOWPAN_THREAD_THREAD_DHCPV6_CLIENT_H_
00032 #define SOURCE_6LOWPAN_THREAD_THREAD_DHCPV6_CLIENT_H_
00033 
00034 #include <ns_types.h>
00035 
00036 /* Thread DHCP client implementation.
00037  *
00038  * Responsibilities of this module are:
00039  * - send router id address request and receive new router address and inform it to thread bootstrap.
00040  * - handle Global address queries and refresh inside thread network.
00041  *
00042  */
00043 
00044 /* Initialize dhcp thread dhcp client.
00045  *
00046  * This instance needs to bee initialized once for each thread network interface.
00047  * if only one thread instance is supported this is needed to call only once.
00048  *
00049  * /param interface interface id of this thread instance.
00050  *
00051  */
00052 
00053 void thread_dhcp_client_init(int8_t interface);
00054 
00055 /* Delete dhcp thread dhcp client.
00056  *
00057  * When this is called all addressed assigned by this module are removed from stack.
00058  */
00059 void thread_dhcp_client_delete(int8_t interface);
00060 
00061 /* Global address handler.
00062  *
00063  * This module updates the addresses from dhcp server and sets them in stack.
00064  * this module makes refresh of address when needed.
00065  *
00066  */
00067 
00068 
00069 /* give dhcp server and prefix for global address assignment
00070  *
00071  * /param interface interface where address is got
00072  * /param dhcp_addr dhcp server ML16 address where address is registered.
00073  * /param prefix dhcp server ML16 address where address is registered.
00074  * /param mac64 64 bit mac address for identifieng client.
00075  * /param error_cb error callback that is called if address cannot be created or becomes invalid.
00076  * /param register_status true if address registered.
00077  *
00078  */
00079 typedef void (thread_dhcp_client_global_adress_cb)(int8_t interface, uint8_t dhcp_addr[static 16], uint8_t prefix[static 16], bool register_status);
00080 
00081 int thread_dhcp_client_get_global_address(int8_t interface, uint8_t dhcp_addr[static 16], uint8_t prefix[static 16], uint8_t mac64[static 8], thread_dhcp_client_global_adress_cb *error_cb);
00082 
00083 /* Renew all leased adddresses might be used when short address changes
00084  *
00085  * /param interface interface where address is got
00086  */
00087 void thread_dhcp_client_global_address_renew(int8_t interface);
00088 
00089 /* Delete address from device
00090  *  if prefix is NULL all are deleted
00091  *
00092  * /param interface interface where address is got
00093  * /param prefix dhcp server ML16 address where address is registered.
00094  *
00095  */
00096 void thread_dhcp_client_global_address_delete(int8_t interface, uint8_t dhcp_addr[static 16], uint8_t prefix[static 16]);
00097 
00098 #endif /* SOURCE_6LOWPAN_THREAD_THREAD_DHCPV6_CLIENT_H_ */