0.01.00
openthread-instance.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 OPENTHREADINSTANCE_H_
36 #define OPENTHREADINSTANCE_H_
37 
38 #include "openthread-core-config.h"
39 
40 #include "utils/wrap_stdint.h"
41 #include "utils/wrap_stdbool.h"
42 
43 #include <openthread/types.h>
45 
47 #if OPENTHREAD_ENABLE_RAW_LINK_API
48 #include "api/link_raw.hpp"
49 #endif
50 #include "coap/coap.hpp"
51 #include "crypto/heap.hpp"
52 #include "crypto/mbedtls.hpp"
53 #include "net/ip6.hpp"
54 #include "thread/thread_netif.hpp"
55 
59 typedef struct otInstance
60 {
61  //
62  // Callbacks
63  //
64 
66 
67  otIp6ReceiveCallback mReceiveIp6DatagramCallback;
68  void *mReceiveIp6DatagramCallbackContext;
69 
70  otHandleActiveScanResult mActiveScanCallback;
71  void *mActiveScanCallbackContext;
72 
73  otHandleEnergyScanResult mEnergyScanCallback;
74  void *mEnergyScanCallbackContext;
75 
76  //
77  // State
78  //
79 
80  ot::TaskletScheduler mTaskletScheduler;
81  ot::TimerMilliScheduler mTimerMilliScheduler;
82 #if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
83  ot::TimerMicroScheduler mTimerMicroScheduler;
84 #endif
85 
86 #if !OPENTHREAD_ENABLE_MULTIPLE_INSTANCES
87  ot::Crypto::MbedTls mMbedTls;
88  ot::Crypto::Heap mMbedTlsHeap;
89 #endif
90  ot::Ip6::Ip6 mIp6;
91  ot::ThreadNetif mThreadNetif;
92 
93 #if OPENTHREAD_ENABLE_RAW_LINK_API
94  ot::LinkRaw mLinkRaw;
95 #endif // OPENTHREAD_ENABLE_RAW_LINK_API
96 
97 #if OPENTHREAD_ENABLE_APPLICATION_COAP
98  ot::Coap::ApplicationCoap mApplicationCoap;
99 #endif // OPENTHREAD_ENABLE_APPLICATION_COAP
100 
101 #if OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL
102  otLogLevel mLogLevel;
103 #endif // OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL
104  ot::MessagePool mMessagePool;
105 
106  // Constructor
107  otInstance(void);
108 
109 } otInstance;
110 
111 #endif // OPENTHREADINSTANCE_H_
This type represents all the static / global variables used by OpenThread allocated in one place...
Definition: openthread-instance.h:59
This file defines the types and structures used in the OpenThread library API.
This class defines functionality to manipulate heap.
Definition: heap.hpp:186
uint8_t otLogLevel
Log levels.
Definition: types.h:1182
This file includes definitions for CoAP client and server functionality.
This file includes the platform abstraction for the debug log service.
This class implements the core IPv6 message processing.
Definition: ip6.hpp:101
Definition: link_raw.hpp:51
This class represents a message pool.
Definition: message.hpp:1055
This file defines the getter functions for single instance OpenThread objects.
#define OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS
The maximum number of state-changed callback handlers (set using otSetStateChangedCallback()).
Definition: openthread-core-default-config.h:371
This file includes definitions for using mbedTLS.
This file is a wrapper for the standard "string.h" file The purpose is add any missing function proto...
This file includes definitions for heap.
This class implements the tasklet scheduler.
Definition: tasklet.hpp:104
Definition: thread_netif.hpp:98
This file includes definitions for IPv6 packet processing.
void(* otIp6ReceiveCallback)(otMessage *aMessage, void *aContext)
This function pointer is called when an IPv6 datagram is received.
Definition: ip6.h:255
This file includes definitions for the Thread network interface.
This class implements network interface handlers.
Definition: netif.hpp:181
This class implements mbedTLS memory.
Definition: mbedtls.hpp:55
This file includes compile-time configuration constants for OpenThread.
This class implements the millisecond timer scheduler.
Definition: timer.hpp:307