Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of OmniWheels by
nd_proxy.h
00001 /* 00002 * Copyright (c) 2015-2017, 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 ND_PROXY_H_ 00019 #define ND_PROXY_H_ 00020 00021 #ifdef HAVE_ND_PROXY 00022 /** 00023 * Validation callback for destination address validation or Upstream route onlink check 00024 * 00025 *\param interface_id Mesh interface Id 00026 *\param address IPv6 address which need to validate 00027 * 00028 *\return 0 This address is behind this interface or Route is not onLink at Upstream 00029 *\return <0 This address is not registered to this interface or this address is OnLink at this interface 00030 */ 00031 typedef int (nd_proxy_req_cb)(int8_t interface_id , uint8_t *address); 00032 00033 /** 00034 * Inform Downstram Interface when proxy is enabled and disabled 00035 * 00036 *\param upstream_id Upstream interface id 00037 *\param downstream_id Downstram Interface ID 00038 *\param status True when proxy is is enabled and false when proxy is disabled 00039 * 00040 *\return 0 Process OK 00041 *\return <0 Process not valid 00042 */ 00043 typedef int (bridge_state_update_cb)(int8_t upstream_id , int8_t downstream_id, bool status); 00044 00045 /** 00046 * Register connected Downstram interface to nd proxy 00047 * 00048 * When Downstram Interface bootstrap interface is ready it can call this. 00049 * After call proxy will connect this interfaces to all registered Upstream interface's. 00050 * 00051 *\param interface_id interface id 00052 *\param nd_proxy_req function pointer for address validation (Must parameter) 00053 *\param bridge_state_update function pointer for proxy notify Downstram interface when proxy is enabled and disabled 00054 * 00055 *\return 0 Register OK 00056 *\return <0 Registeration fail 00057 */ 00058 int nd_proxy_downstream_interface_register(int8_t interface_id, nd_proxy_req_cb *nd_proxy_req, bridge_state_update_cb * bridge_state_update); 00059 00060 /** 00061 * Remove connected Downstram interface from nd proxy 00062 * 00063 * This should call when interface close interface or loose connection. 00064 * After call proxy remove connection from all connected proxy where interface is linked. 00065 * 00066 *\param interface_id interface id 00067 * 00068 *\return 0 Remove OK 00069 *\return <0 Remove fail 00070 */ 00071 int nd_proxy_downstream_interface_unregister(int8_t interface_id); 00072 00073 /** 00074 * Register Upstream interface to proxy 00075 * 00076 * When Mesh Interface bootstrap interface is ready it can call this 00077 * After call proxy will connect all registered mesh interfaces to this interface. 00078 * 00079 *\param interface_id interface id 00080 * 00081 *\return 0 Remove OK 00082 *\return <0 Remove fail 00083 */ 00084 int nd_proxy_upstream_interface_register(int8_t interface_id, nd_proxy_req_cb *route_validation_req); 00085 /** 00086 * Remove connected Upstream interface from nd proxy 00087 * 00088 * This should call when interface close interface or loose connection. 00089 * After call proxy remove connection from all connected proxy where interface is linked. 00090 * 00091 *\param interface_id interface id 00092 * 00093 *\return 0 Remove OK 00094 *\return <0 Remove fail 00095 */ 00096 int nd_proxy_upstream_interface_unregister(int8_t interface_id); 00097 00098 /** 00099 * Upstream interface verify is proxy enabled for this interface 00100 * 00101 *\param interface_id interface id 00102 * 00103 *\return true Proxy is enabled 00104 *\return false proxy is disabled 00105 */ 00106 bool nd_proxy_enabled_for_downstream(int8_t interface_id); 00107 00108 /** 00109 * Downstream interface verify is proxy enabled for this interface 00110 * 00111 *\param interface_id interface id 00112 * 00113 *\return true Proxy is enabled 00114 *\return false proxy is disabled 00115 */ 00116 bool nd_proxy_enabled_for_upstream(int8_t interface_id); 00117 00118 /** 00119 * Upstream interface validate target address from proxy 00120 * 00121 *\param upstream_id interface id 00122 *\param address target address for verify 00123 *\param downstream_id_ptr pointer where proxy save mesh interface id where target is registered 00124 * 00125 *\return true Address validated behind downstream_id_ptr interface 00126 *\return false Unknown address for this proxy 00127 */ 00128 bool nd_proxy_target_address_validation(int8_t upstream_id, uint8_t *address, int8_t *downstream_id_ptr); 00129 /** 00130 * Downstream interface validate prefix route on Link status from connected Upstream interface 00131 * 00132 *\param downstream_id interface id 00133 *\param address Validated route prefix 00134 * 00135 *\return true Route is On-link at Downstream mesh should remove current route 00136 *\return false Route is not On-Link Downstream can add On-Link route 00137 */ 00138 bool nd_proxy_upstream_route_onlink(int8_t downstream_id, uint8_t *address); 00139 00140 #else 00141 00142 NS_DUMMY_DEFINITIONS_OK 00143 00144 #define nd_proxy_downstream_interface_register(interface_id, nd_proxy_req, bridge_state_update) -1 00145 #define nd_proxy_downstream_interface_unregister(interface_id) -1 00146 #define nd_proxy_upstream_interface_register(interface_id, route_validation_req) -1 00147 #define nd_proxy_upstream_interface_unregister(interface_id) -1 00148 #define nd_proxy_enabled_for_downstream(interface_id) false 00149 #define nd_proxy_enabled_for_upstream(interface_id) false 00150 #define nd_proxy_target_address_validation(upstream_id, address, downstream_id_ptr) false 00151 #define nd_proxy_upstream_route_onlink(downstream_id, address) false 00152 #define nd_proxy_target_address_validation(upstream_id, address, downstream_id_ptr) false 00153 #endif /* HAVE_ND_PROXY */ 00154 00155 #endif /* ND_PROXY_H_ */
Generated on Fri Jul 22 2022 04:53:57 by
1.7.2
