Gleb Klochkov / Mbed OS Climatcontroll_Main

Dependencies:   esp8266-driver

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers thread_resolution_server.h Source File

thread_resolution_server.h

00001 /*
00002  * Copyright (c) 2014-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  * Thread CoAP address resolution server implementation.
00032  *
00033  * This server must be enabled for all routers and non-sleepy end devices.
00034  *
00035  * Routers respond on behalf of their sleepy children.
00036  */
00037 
00038 
00039 #ifndef THREAD_RESOLUTION_SERVER_H_
00040 #define THREAD_RESOLUTION_SERVER_H_
00041 
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045 
00046 #include <ns_types.h>
00047 
00048 /** Address resolution request.
00049  *
00050  * This callback is called when a device is requesting address resolution.
00051  *
00052  * \param interface_id interface id of this thread instance.
00053  * \param[in] target_addr target IP address being resolved
00054  * \param[out] addr_out pointer to write resulting RLOC16 address
00055  * \param[out] proxy write as true if responding for a child device
00056  * \param[out] last_transaction_time last transaction time for response (if proxy is true)
00057  * \param[out] ML-EID for target address
00058  *
00059  * /return return 0 for success, negative if unable to respond.
00060  */
00061 typedef int thread_resolution_server_addr_query_cb(int8_t interface_id, const uint8_t target_addr[static 16], uint16_t *addr_out, bool *proxy, uint32_t *last_transaction_time, uint8_t *mleid_ptr);
00062 
00063 #ifdef HAVE_THREAD_NEIGHBOR_DISCOVERY
00064 
00065 /** initialise CoAP thread resolution server
00066  * This instance needs to be initialised for all thread devices.
00067  *
00068  * When this is initialised this will enable the default management functionality for all the nodes in thread network,.
00069  *
00070  * \param interface interface id of this thread instance.
00071  *
00072  */
00073 int thread_resolution_server_init(int8_t interface_id, thread_resolution_server_addr_query_cb *query_cb);
00074 
00075 /** Delete thread resolution services.
00076  *
00077  * When this is called it close selected service and free all allocated memory.
00078  *
00079  *  \param interface interface id of this thread instance.
00080  */
00081 void thread_resolution_server_delete(int8_t interface_id);
00082 
00083 #else //HAVE_THREAD_NEIGHBOR_DISCOVERY
00084 
00085 #define thread_resolution_server_init(interface_id, query_cb)
00086 #define thread_resolution_server_delete(interface_id)
00087 
00088 #endif  //HAVE_THREAD_NEIGHBOR_DISCOVERY
00089 
00090 #ifdef __cplusplus
00091 }
00092 #endif
00093 
00094 #endif /* THREAD_RESOLUTION_SERVER_H_ */