joey shelton / LED_Demo

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by Maxim nexpaq

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers thread_border_router_api.h Source File

thread_border_router_api.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2014-2015 ARM Limited. All rights reserved.
00003  *
00004  * SPDX-License-Identifier: LicenseRef-PBL
00005  *
00006  * Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  * https://www.mbed.com/licenses/PBL-1.0
00010  *
00011  * See the License for the specific language governing permissions and limitations under the License.
00012  *
00013  */
00014 
00015 /**
00016  * \file thread_border_router_api.h
00017  * \brief Thread border router application interface.
00018  *
00019  * This file contains functions for managing Thread border router features.
00020  * Border routers can set up services in the Thread network including routes,
00021  * DHCPv6 servers, on-mesh prefixes and services.
00022  *
00023  */
00024 
00025 #ifndef THREAD_BORDER_ROUTER_API_H_
00026 #define THREAD_BORDER_ROUTER_API_H_
00027 
00028 #include "ns_types.h"
00029 
00030 
00031 /**
00032  * Structure specifying the prefix service.
00033  *
00034  */
00035 typedef struct thread_border_router_info_t {
00036     unsigned            Prf: 2;               /**!< Prefix preference, 01 = High, 00 = Default, 11 = Low, 10 = Reserved. */
00037     bool                P_preferred: 1;       /**!< Address is considered preferred address. */
00038     bool                P_slaac: 1;           /**!< Allowed to configure a new address */
00039     bool                P_dhcp: 1;            /**!< DHCPv6 server is available in the network. */
00040     bool                P_configure: 1;       /**!< DHCPv6 agent provides other configuration. */
00041     bool                P_default_route: 1;   /**!< This device provides the default route. */
00042     bool                P_on_mesh: 1;         /**!< This prefix is considered to be on-mesh */
00043     bool                P_nd_dns: 1;          /**!< this border router is able to provide DNS information */
00044     bool                stableData: 1;        /**!< This data is stable and expected to be available at least 48h. */
00045 } thread_border_router_info_t;
00046 
00047 /* Define flags for backwards compatibility. Remove once applications have been updated */
00048 #define P_slaac_preferred   P_preferred
00049 #define P_slaac_valid       P_slaac
00050 
00051 /**
00052  * \brief Create local service that is provided to the Thread network.
00053  * If a prefix exists it is updated. For example, when removing SLAAC (Stateless Address Autoconfiguration) you should modify the prefix
00054  * first to remove the creation of new addresses and after a while, remove the prefix.
00055  *
00056  * When you have configured the services locally, you need to call
00057  * thread_border_router_publish to make the services available in the network.
00058  *
00059  * \param interface_id Network interface ID.
00060  * \param prefix_ptr Pointer prefix.
00061  * \param prefix_len Length of prefix.
00062  * \param prefix_info_ptr Prefix service structure configuring the published service.
00063  *
00064  * \return 0, Set OK.
00065  * \return <0 Set not OK.
00066  */
00067 int thread_border_router_prefix_add(int8_t interface_id, uint8_t *prefix_ptr, uint8_t prefix_len, thread_border_router_info_t *prefix_info_ptr);
00068 
00069 /**
00070  * \brief Delete local service.
00071  *
00072  * \param interface_id Network interface ID.
00073  * \param prefix_ptr Pointer prefix.
00074  * \param prefix_len Length of prefix.
00075  *
00076  * \return 0, Set OK.
00077  * \return <0 Set not OK.
00078  */
00079 int thread_border_router_prefix_delete(int8_t interface_id, uint8_t *prefix_ptr, uint8_t prefix_len);
00080 
00081 /**
00082  * \brief Add a new route to the Thread network. Other devices can use the route.
00083  * For example, 0::0/0 means that this device provides the default route.
00084  * For example, 2001::0/64 means that this device provides a more specific route.
00085  *
00086  * If a prefix exists it is updated.
00087  *
00088  * \param interface_id Network interface ID.
00089  * \param prefix_ptr Pointer prefix. Can be NULL for the default route.
00090  * \param prefix_len Length of prefix.
00091  * \param stable This data is stable and expected to be available at least 48h.
00092  * \param prf Route preference, 01 = High, 00 = Default, 11 = Low, 10 = Reserved.
00093  *
00094  * \return 0, Set OK.
00095  * \return <0 Set not OK.
00096  */
00097 int thread_border_router_route_add(int8_t interface_id, uint8_t *prefix_ptr, uint8_t prefix_len, bool stable, int8_t prf);
00098 
00099 /**
00100  * \brief Delete locally served route.
00101  *
00102  * \param interface_id Network interface ID.
00103  * \param prefix_ptr Pointer prefix.
00104  * \param prefix_len Length of prefix.
00105  *
00106  * \return 0, Set OK.
00107  * \return <0 Set not OK.
00108  */
00109 int thread_border_router_route_delete(int8_t interface_id, uint8_t *prefix_ptr, uint8_t prefix_len);
00110 
00111 /**
00112  * \brief Add local service.
00113  *
00114  * \param interface_id Network interface ID.
00115  * \param service_ptr Pointer to service data.
00116  * \param service_len Length of service.
00117  * \param thread_enteprise True if Thread enterprise number is used.
00118  * \param sid Service identifier.
00119  * \param enterprise_number If thread_enteprise is false this must be given.
00120  *
00121  * \return 0, Set OK.
00122  * \return <0 Set not OK.
00123  */
00124 //TODO PUUTTUUU SERVER data
00125 int thread_border_router_service_add(int8_t interface_id, uint8_t *service_ptr, uint8_t service_len, bool thread_enteprise, uint8_t sid, uint32_t enterprise_number);
00126 
00127 /**
00128  * \brief Delete local service.
00129  *
00130  * \param interface_id Network interface ID.
00131  * \param service_ptr Pointer to service data.
00132  * \param service_len Length of service.
00133  *
00134  * \return 0, Set OK.
00135  * \return <0 Set not OK.
00136  */
00137 int thread_border_router_service_delete(int8_t interface_id, uint8_t *service_ptr, uint8_t service_len);
00138 
00139 /**
00140  * \brief Publish local services to Thread network.
00141  *
00142  * If local services are deleted before calling this, all services are deregistered from the network.
00143  *
00144  * \param interface_id Network interface ID.
00145  *
00146  * \return 0, Push OK.
00147  * \return <0 Push not OK.
00148  */
00149 int thread_border_router_publish(int8_t interface_id);
00150 
00151 /**
00152  * \brief Clear the local service list.
00153  *
00154  * \param interface_id Network interface ID.
00155  *
00156  * \return 0, Push OK.
00157  * \return <0 Push not OK.
00158  */
00159 int thread_border_router_delete_all(int8_t interface_id);
00160 
00161 #endif /* THREAD_DHCPV6_SERVER_H_ */