Refactor OpenThread Global Variables into a Single Context Structure (#357)

* Refactor OpenThread to contain all global/static variables in a single context structure.
This commit is contained in:
Nick Banks
2016-10-04 15:23:25 -07:00
committed by Jonathan Hui
parent 671964c2d4
commit 79d99e7a91
27 changed files with 619 additions and 460 deletions
+20
View File
@@ -44,6 +44,26 @@
extern "C" {
#endif
#ifdef _WIN32
#ifdef WINDOWS_KERNEL
#include <ntdef.h>
#else
#include <windows.h>
#endif
#else
#ifndef CONTAINING_RECORD
/*#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
#define CONTAINING_RECORD(address, type, field) \
((type *)((uint8_t*)(address) - offsetof(type, field)))
#pragma GCC diagnostic pop*/
#define BASE 0x1
#define myoffsetof(s,m) (((size_t)&(((s*)BASE)->m))-BASE)
#define CONTAINING_RECORD(address, type, field) \
((type *)((uint8_t*)(address) - myoffsetof(type, field)))
#endif
#endif
/**
* This type represents the OpenThread instance structure.
*/
+3
View File
@@ -1621,6 +1621,8 @@ void otPlatformReset(otInstance *aInstance);
/**
* Get the ROUTER_DOWNGRADE_THRESHOLD parameter used in the Router role.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
* @returns The ROUTER_DOWNGRADE_THRESHOLD value.
*
* @sa otSetRouterDowngradeThreshold
@@ -1630,6 +1632,7 @@ uint8_t otGetRouterDowngradeThreshold(otInstance *aInstance);
/**
* Set the ROUTER_DOWNGRADE_THRESHOLD parameter used in the Leader role.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aThreshold The ROUTER_DOWNGRADE_THRESHOLD value.
*
* @sa otGetRouterDowngradeThreshold