0.01.00
ip6.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016, The OpenThread Authors.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. Neither the name of the copyright holder nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 
35 #ifndef OPENTHREAD_IP6_H_
36 #define OPENTHREAD_IP6_H_
37 
38 #include <openthread/message.h>
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
67 OTAPI otError OTCALL otIp6SetEnabled(otInstance *aInstance, bool aEnabled);
68 
78 OTAPI bool OTCALL otIp6IsEnabled(otInstance *aInstance);
79 
94 
106 
115 
132 
144 
153 
162 
171 void otIp6SetMulticastPromiscuousEnabled(otInstance *aInstance, bool aEnabled);
172 
184 typedef otError(*otIp6SlaacIidCreate)(otInstance *aInstance, otNetifAddress *aAddress, void *aContext);
185 
196 void otIp6SlaacUpdate(otInstance *aInstance, otNetifAddress *aAddresses, uint32_t aNumAddresses,
197  otIp6SlaacIidCreate aIidCreate, void *aContext);
198 
209 otError otIp6CreateRandomIid(otInstance *aInstance, otNetifAddress *aAddresses, void *aContext);
210 
221 otError otIp6CreateMacIid(otInstance *aInstance, otNetifAddress *aAddresses, void *aContext);
222 
234 otError otIp6CreateSemanticallyOpaqueIid(otInstance *aInstance, otNetifAddress *aAddresses, void *aContext);
235 
246 otMessage *otIp6NewMessage(otInstance *aInstance, bool aLinkSecurityEnabled);
247 
255 typedef void (*otIp6ReceiveCallback)(otMessage *aMessage, void *aContext);
256 
272 void otIp6SetReceiveCallback(otInstance *aInstance, otIp6ReceiveCallback aCallback, void *aCallbackContext);
273 
286 bool otIp6IsReceiveFilterEnabled(otInstance *aInstance);
287 
299 void otIp6SetReceiveFilterEnabled(otInstance *aInstance, bool aEnabled);
300 
308 otError otIp6Send(otInstance *aInstance, otMessage *aMessage);
309 
320 otError otIp6AddUnsecurePort(otInstance *aInstance, uint16_t aPort);
321 
332 otError otIp6RemoveUnsecurePort(otInstance *aInstance, uint16_t aPort);
333 
345 const uint16_t *otIp6GetUnsecurePorts(otInstance *aInstance, uint8_t *aNumEntries);
346 
356 OTAPI bool OTCALL otIp6IsAddressEqual(const otIp6Address *a, const otIp6Address *b);
357 
367 OTAPI otError OTCALL otIp6AddressFromString(const char *aString, otIp6Address *aAddress);
368 
378 OTAPI uint8_t OTCALL otIp6PrefixMatch(const otIp6Address *aFirst, const otIp6Address *aSecond);
379 
385 #ifdef __cplusplus
386 } // extern "C"
387 #endif
388 
389 #endif // OPENTHREAD_IP6_H_
This structure represents an IPv6 address.
Definition: types.h:417
OTAPI otError OTCALL otIp6AddUnicastAddress(otInstance *aInstance, const otNetifAddress *aAddress)
Add a Network Interface Address to the Thread interface.
Definition: ip6_api.cpp:84
bool otIp6IsReceiveFilterEnabled(otInstance *aInstance)
This function indicates whether or not Thread control traffic is filtered out when delivering IPv6 da...
Definition: ip6_api.cpp:149
This type represents all the static / global variables used by OpenThread allocated in one place...
Definition: openthread-instance.h:59
otError otIp6UnsubscribeMulticastAddress(otInstance *aInstance, const otIp6Address *aAddress)
Unsubscribe the Thread interface to a Network Interface Multicast Address.
Definition: ip6_api.cpp:104
void otIp6SetReceiveFilterEnabled(otInstance *aInstance, bool aEnabled)
This function sets whether or not Thread control traffic is filtered out when delivering IPv6 datagra...
Definition: ip6_api.cpp:154
bool otIp6IsMulticastPromiscuousEnabled(otInstance *aInstance)
Check if multicast promiscuous mode is enabled on the Thread interface.
Definition: ip6_api.cpp:109
otError otIp6Send(otInstance *aInstance, otMessage *aMessage)
This function sends an IPv6 datagram via the Thread interface.
Definition: ip6_api.cpp:159
This file defines the radio interface for OpenThread.
otError otIp6SubscribeMulticastAddress(otInstance *aInstance, const otIp6Address *aAddress)
Subscribe the Thread interface to a Network Interface Multicast Address.
Definition: ip6_api.cpp:99
OTAPI otError OTCALL otIp6SetEnabled(otInstance *aInstance, bool aEnabled)
This function brings up the IPv6 interface.
Definition: ip6_api.cpp:46
void otIp6SetMulticastPromiscuousEnabled(otInstance *aInstance, bool aEnabled)
Enable multicast promiscuous mode on the Thread interface.
Definition: ip6_api.cpp:114
otError(* otIp6SlaacIidCreate)(otInstance *aInstance, otNetifAddress *aAddress, void *aContext)
This function pointer is called to create IPv6 IID during SLAAC procedure.
Definition: ip6.h:184
const uint16_t * otIp6GetUnsecurePorts(otInstance *aInstance, uint8_t *aNumEntries)
This function returns a pointer to the unsecure port list.
Definition: ip6_api.cpp:195
This file defines the top-level OpenThread APIs related to message buffer and queues.
This type points to an OpenThread message buffer.
Definition: types.h:479
OTAPI const otNetifAddress *OTCALL otIp6GetUnicastAddresses(otInstance *aInstance)
Get the list of IPv6 addresses assigned to the Thread interface.
Definition: ip6_api.cpp:79
This structure represents an IPv6 network interface unicast address.
Definition: types.h:1089
void otIp6SetReceiveCallback(otInstance *aInstance, otIp6ReceiveCallback aCallback, void *aCallbackContext)
This function registers a callback to provide received IPv6 datagrams.
Definition: ip6_api.cpp:144
otError otIp6RemoveUnsecurePort(otInstance *aInstance, uint16_t aPort)
This function removes a port from the allowed unsecure port list.
Definition: ip6_api.cpp:190
OTAPI otError OTCALL otIp6RemoveUnicastAddress(otInstance *aInstance, const otIp6Address *aAddress)
Remove a Network Interface Address from the Thread interface.
Definition: ip6_api.cpp:89
otError otIp6CreateMacIid(otInstance *aInstance, otNetifAddress *aAddresses, void *aContext)
Create IID for given IPv6 address using extended MAC address.
Definition: ip6_api.cpp:130
OTAPI otError OTCALL otIp6AddressFromString(const char *aString, otIp6Address *aAddress)
Convert a human-readable IPv6 address string into a binary representation.
Definition: ip6_api.cpp:205
OTAPI uint8_t OTCALL otIp6PrefixMatch(const otIp6Address *aFirst, const otIp6Address *aSecond)
This function returns the prefix match length (bits) for two IPv6 addresses.
Definition: ip6_api.cpp:210
otError otIp6AddUnsecurePort(otInstance *aInstance, uint16_t aPort)
This function adds a port to the allowed unsecured port list.
Definition: ip6_api.cpp:185
void otIp6SlaacUpdate(otInstance *aInstance, otNetifAddress *aAddresses, uint32_t aNumAddresses, otIp6SlaacIidCreate aIidCreate, void *aContext)
Update all automatically created IPv6 addresses for prefixes from current Network Data with SLAAC pro...
Definition: ip6_api.cpp:119
#define OTCALL
Compiler-specific modifier to export functions in a DLL.
Definition: toolchain.h:217
#define OTAPI
Compiler-specific modifier for public API declarations.
Definition: toolchain.h:216
OTAPI bool OTCALL otIp6IsAddressEqual(const otIp6Address *a, const otIp6Address *b)
Test if two IPv6 addresses are the same.
Definition: ip6_api.cpp:200
otMessage * otIp6NewMessage(otInstance *aInstance, bool aLinkSecurityEnabled)
Allocate a new message buffer for sending an IPv6 message.
Definition: ip6_api.cpp:173
void(* otIp6ReceiveCallback)(otMessage *aMessage, void *aContext)
This function pointer is called when an IPv6 datagram is received.
Definition: ip6.h:255
const otNetifMulticastAddress * otIp6GetMulticastAddresses(otInstance *aInstance)
Get the list of IPv6 multicast addresses subscribed to the Thread interface.
Definition: ip6_api.cpp:94
This structure represents an IPv6 network interface multicast address.
Definition: types.h:1105
otError
This enumeration represents error codes used throughout OpenThread.
Definition: types.h:107
otError otIp6CreateRandomIid(otInstance *aInstance, otNetifAddress *aAddresses, void *aContext)
Create random IID for given IPv6 address.
Definition: ip6_api.cpp:125
OTAPI bool OTCALL otIp6IsEnabled(otInstance *aInstance)
This function indicates whether or not the IPv6 interface is up.
Definition: ip6_api.cpp:74
otError otIp6CreateSemanticallyOpaqueIid(otInstance *aInstance, otNetifAddress *aAddresses, void *aContext)
Create semantically opaque IID for given IPv6 address.
Definition: ip6_api.cpp:139