mirror of
https://github.com/espressif/openthread.git
synced 2026-09-16 06:00:13 +00:00
ncp: Source cleanup and refactor. (#55)
* ncp: Source cleanup and refactor. This change gets rid of the huge switch statements and now uses jump tables to look up the appropriate method to call for a given command-id or property. The result is much cleaner and, hopefully, easier to maintain and extend. Eventually we may want to numerically sort the lists so that we can use a binary search instead of a linear search, but for now this will do. * ncp: Added support for more properties. New supported properties include: * `PROP_PHY_ENABLED` (Set only) * `PROP_MAC_SCAN_PERIOD` * `PROP_MAC_SCAN_MASK` * `PROP_THREAD_LEADER_ADDR` * `PROP_THREAD_LEADER_RID` * `PROP_THREAD_LEADER_WEIGHT` * `PROP_THREAD_LOCAL_LEADER_WEIGHT` * `PROP_THREAD_NETWORK_DATA_VERSION` * `PROP_THREAD_STABLE_NETWORK_DATA_VERSION` * `PROP_IPV6_LL_ADDR` * `PROP_IPV6_ML_ADDR` * `PROP_IPV6_ML_PREFIX` Some of the above properties were previously only partially implemented, and are now fully implemented in the NCP.
This commit is contained in:
committed by
Jonathan Hui
parent
02cfdf26d7
commit
4f638353d6
+6
-6
@@ -331,7 +331,7 @@ several properties that are required in all implementations.
|
||||
|
||||
* 0: `PROP_LAST_STATUS`
|
||||
* 1: `PROP_PROTOCOL_VERSION`
|
||||
* 2: `PROP_CAPABILITIES`
|
||||
* 2: `PROP_CAPS`
|
||||
* 3: `PROP_NCP_VERSION`
|
||||
* 4: `PROP_INTERFACE_COUNT`
|
||||
* 5: `PROP_POWER_STATE`
|
||||
@@ -416,7 +416,7 @@ host.
|
||||
#### 5.2.3 Vendor Identifier ####
|
||||
|
||||
|
||||
### 5.3. PROP 2: `PROP_CAPABILITIES`
|
||||
### 5.3. PROP 2: `PROP_CAPS`
|
||||
|
||||
* Type: Read-Only
|
||||
* Packed-Encoding: `A(i)`
|
||||
@@ -855,7 +855,7 @@ present, allows the host to save and recall network credentials and
|
||||
state to and from nonvolatile storage.
|
||||
|
||||
The presence of this feature can be detected by checking for the
|
||||
presence of the `CAP_NET_SAVE` capability in `PROP_CAPABILITIES`.
|
||||
presence of the `CAP_NET_SAVE` capability in `PROP_CAPS`.
|
||||
|
||||
### B.1. Commands
|
||||
|
||||
@@ -934,7 +934,7 @@ that can be recalled at a later time.
|
||||
|
||||
The presence of this feature can be detected by the host by
|
||||
checking for the presence of the `CAP_HBO`
|
||||
capability in `PROP_CAPABILITIES`.
|
||||
capability in `PROP_CAPS`.
|
||||
|
||||
### C.1. Commands
|
||||
|
||||
@@ -994,7 +994,7 @@ host to a non-zero value before the NCP will begin offloading blocks.
|
||||
This value is encoded as an unsigned 32-bit integer.
|
||||
|
||||
This property is only available if the `CAP_HBO`
|
||||
capability is present in `PROP_CAPABILITIES`.
|
||||
capability is present in `PROP_CAPS`.
|
||||
|
||||
#### C.2.1. PROP 7: `PROP_HBO_BLOCK_MAX`
|
||||
|
||||
@@ -1012,7 +1012,7 @@ host block offload to be effectively disabled.
|
||||
This value is encoded as an unsigned 16-bit integer.
|
||||
|
||||
This property is only available if the `CAP_HBO`
|
||||
capability is present in `PROP_CAPABILITIES`.
|
||||
capability is present in `PROP_CAPS`.
|
||||
|
||||
|
||||
|
||||
|
||||
+1687
-1099
File diff suppressed because it is too large
Load Diff
+189
-36
@@ -44,72 +44,225 @@ namespace Thread {
|
||||
class NcpBase
|
||||
{
|
||||
public:
|
||||
|
||||
NcpBase();
|
||||
|
||||
virtual ThreadError Start();
|
||||
virtual ThreadError Stop();
|
||||
|
||||
virtual ThreadError OutboundFrameBegin(void) = 0;
|
||||
virtual uint16_t OutboundFrameGetRemaining(void) = 0;
|
||||
virtual ThreadError OutboundFrameFeedData(const uint8_t *frame, uint16_t frameLength) = 0;
|
||||
virtual ThreadError OutboundFrameFeedMessage(Message &message) = 0;
|
||||
virtual ThreadError OutboundFrameFeedPacked(const char *pack_format, ...);
|
||||
virtual ThreadError OutboundFrameFeedVPacked(const char *pack_format, va_list args);
|
||||
virtual ThreadError OutboundFrameSend(void) = 0;
|
||||
|
||||
static void HandleReceivedDatagram(void *context, Message &message);
|
||||
void HandleReceivedDatagram(Message &message);
|
||||
ThreadError Start();
|
||||
ThreadError Stop();
|
||||
|
||||
protected:
|
||||
static void HandleReceive(void *context, const uint8_t *buf, uint16_t bufLength);
|
||||
|
||||
virtual ThreadError OutboundFrameBegin(void) = 0;
|
||||
|
||||
virtual uint16_t OutboundFrameGetRemaining(void) = 0;
|
||||
|
||||
virtual ThreadError OutboundFrameFeedData(const uint8_t *frame, uint16_t frameLength) = 0;
|
||||
|
||||
virtual ThreadError OutboundFrameFeedMessage(Message &message) = 0;
|
||||
|
||||
virtual ThreadError OutboundFrameSend(void) = 0;
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* Called by the superclass to indicate when a frame has been received.
|
||||
*/
|
||||
void HandleReceive(const uint8_t *buf, uint16_t bufLength);
|
||||
|
||||
static void HandleSendDone(void *context);
|
||||
void HandleSendDone();
|
||||
|
||||
bool mSending;
|
||||
/**
|
||||
* Called by the superclass to indicate when a send has been completed.
|
||||
*/
|
||||
void HandleSendDone(void);
|
||||
|
||||
private:
|
||||
void HandleCommand(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len);
|
||||
void HandleCommandReset(uint8_t header);
|
||||
void HandleCommandNoop(uint8_t header);
|
||||
void HandleCommandPropertyGet(uint8_t header, spinel_prop_key_t key);
|
||||
void HandleCommandPropertySet(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
void HandleCommandPropertyInsert(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
void HandleCommandPropertyRemove(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
|
||||
void HandleCommandPropertyGetAddressList(uint8_t header);
|
||||
void HandleCommandPropertyGetRoutingTable(uint8_t header);
|
||||
/**
|
||||
* Trampoline for HandleDatagramFromStack().
|
||||
*/
|
||||
static void HandleDatagramFromStack(void *context, Message &message);
|
||||
|
||||
void HandleDatagramFromStack(Message &message);
|
||||
|
||||
/**
|
||||
* Trampoline for HandleActiveScanResult().
|
||||
*/
|
||||
static void HandleActiveScanResult_Jump(otActiveScanResult *result);
|
||||
|
||||
void HandleActiveScanResult(otActiveScanResult *result);
|
||||
|
||||
/**
|
||||
* Trampoline for RunUpdateAddressesTask().
|
||||
*/
|
||||
static void RunUpdateAddressesTask(void *context);
|
||||
|
||||
void RunUpdateAddressesTask(void);
|
||||
|
||||
|
||||
static void HandleUnicastAddressesChanged(void *context);
|
||||
|
||||
private:
|
||||
|
||||
ThreadError OutboundFrameFeedPacked(const char *pack_format, ...);
|
||||
|
||||
ThreadError OutboundFrameFeedVPacked(const char *pack_format, va_list args);
|
||||
|
||||
private:
|
||||
|
||||
void HandleCommand(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len);
|
||||
|
||||
void HandleCommandPropertyGet(uint8_t header, spinel_prop_key_t key);
|
||||
|
||||
void HandleCommandPropertySet(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
|
||||
void HandleCommandPropertyInsert(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
|
||||
void HandleCommandPropertyRemove(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
|
||||
void SendLastStatus(uint8_t header, spinel_status_t lastStatus);
|
||||
|
||||
void SendPropteryUpdate(uint8_t header, uint8_t command, spinel_prop_key_t key, const uint8_t *value_ptr,
|
||||
uint16_t value_len);
|
||||
void SendPropteryUpdate(uint8_t header, uint8_t command, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
|
||||
void SendPropteryUpdate(uint8_t header, uint8_t command, spinel_prop_key_t key, Message &message);
|
||||
|
||||
void SendPropteryUpdate(uint8_t header, uint8_t command, spinel_prop_key_t key, const char *format, ...);
|
||||
|
||||
private:
|
||||
|
||||
static void HandleActiveScanResult_Jump(otActiveScanResult *result);
|
||||
void HandleActiveScanResult(otActiveScanResult *result);
|
||||
static void HandleUnicastAddressesChanged(void *context);
|
||||
typedef void (NcpBase::*CommandHandlerType)(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len);
|
||||
|
||||
static void RunUpdateAddressesTask(void *context);
|
||||
typedef void (NcpBase::*GetPropertyHandlerType)(uint8_t header, spinel_prop_key_t key);
|
||||
|
||||
typedef void (NcpBase::*SetPropertyHandlerType)(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
|
||||
struct CommandHandlerEntry {
|
||||
spinel_cid_t mCommand;
|
||||
CommandHandlerType mHandler;
|
||||
};
|
||||
|
||||
struct GetPropertyHandlerEntry {
|
||||
spinel_prop_key_t mPropKey;
|
||||
GetPropertyHandlerType mHandler;
|
||||
};
|
||||
|
||||
struct SetPropertyHandlerEntry {
|
||||
spinel_prop_key_t mPropKey;
|
||||
SetPropertyHandlerType mHandler;
|
||||
};
|
||||
|
||||
struct InsertPropertyHandlerEntry {
|
||||
spinel_prop_key_t mPropKey;
|
||||
SetPropertyHandlerType mHandler;
|
||||
};
|
||||
|
||||
struct RemovePropertyHandlerEntry {
|
||||
spinel_prop_key_t mPropKey;
|
||||
SetPropertyHandlerType mHandler;
|
||||
};
|
||||
|
||||
static const CommandHandlerEntry mCommandHandlerTable[];
|
||||
static const GetPropertyHandlerEntry mGetPropertyHandlerTable[];
|
||||
static const SetPropertyHandlerEntry mSetPropertyHandlerTable[];
|
||||
static const InsertPropertyHandlerEntry mInsertPropertyHandlerTable[];
|
||||
static const RemovePropertyHandlerEntry mRemovePropertyHandlerTable[];
|
||||
|
||||
void CommandHandler_NOOP(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len);
|
||||
void CommandHandler_RESET(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len);
|
||||
void CommandHandler_PROP_VALUE_GET(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len);
|
||||
void CommandHandler_PROP_VALUE_SET(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len);
|
||||
void CommandHandler_PROP_VALUE_INSERT(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len);
|
||||
void CommandHandler_PROP_VALUE_REMOVE(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len);
|
||||
|
||||
void GetPropertyHandler_LAST_STATUS(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_PROTOCOL_VERSION(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_CAPS(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_NCP_VERSION(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_INTERFACE_COUNT(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_POWER_STATE(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_HWADDR(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_LOCK(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_PHY_ENABLED(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_PHY_FREQ(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_PHY_CHAN_SUPPORTED(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_PHY_CHAN(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_PHY_RSSI(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_MAC_SCAN_STATE(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_MAC_15_4_PANID(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_MAC_15_4_LADDR(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_MAC_15_4_SADDR(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_NET_ENABLED(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_NET_STATE(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_NET_ROLE(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_NET_NETWORK_NAME(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_NET_XPANID(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_NET_MASTER_KEY(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_NET_KEY_SEQUENCE(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_NET_PARTITION_ID(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_THREAD_LEADER(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_IPV6_ML_PREFIX(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_IPV6_ML_ADDR(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_IPV6_LL_ADDR(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_IPV6_ADDRESS_TABLE(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_IPV6_ROUTE_TABLE(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_STREAM_NET(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_MAC_SCAN_MASK(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_MAC_SCAN_PERIOD(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_THREAD_LEADER_ADDR(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_THREAD_LEADER_RID(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_THREAD_LEADER_WEIGHT(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_THREAD_NETWORK_DATA_VERSION(uint8_t header, spinel_prop_key_t key);
|
||||
void GetPropertyHandler_THREAD_STABLE_NETWORK_DATA_VERSION(uint8_t header, spinel_prop_key_t key);
|
||||
|
||||
void SetPropertyHandler_POWER_STATE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
void SetPropertyHandler_PHY_TX_POWER(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
void SetPropertyHandler_PHY_CHAN(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
void SetPropertyHandler_MAC_SCAN_MASK(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
void SetPropertyHandler_MAC_SCAN_STATE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
void SetPropertyHandler_MAC_15_4_PANID(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
void SetPropertyHandler_NET_ENABLED(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
void SetPropertyHandler_NET_STATE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
void SetPropertyHandler_NET_ROLE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
void SetPropertyHandler_NET_NETWORK_NAME(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
void SetPropertyHandler_NET_XPANID(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
void SetPropertyHandler_NET_MASTER_KEY(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
void SetPropertyHandler_NET_KEY_SEQUENCE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
void SetPropertyHandler_STREAM_NET_INSECURE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
void SetPropertyHandler_STREAM_NET(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
void SetPropertyHandler_IPV6_ML_PREFIX(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
void SetPropertyHandler_PHY_ENABLED(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
void SetPropertyHandler_PHY_PROMISCUOUS_MODE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
void SetPropertyHandler_MAC_SCAN_PERIOD(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
void SetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
|
||||
void InsertPropertyHandler_IPV6_ADDRESS_TABLE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
void RemovePropertyHandler_IPV6_ADDRESS_TABLE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, uint16_t value_len);
|
||||
|
||||
private:
|
||||
|
||||
Ip6::NetifHandler mNetifHandler;
|
||||
|
||||
spinel_status_t mLastStatus;
|
||||
|
||||
uint32_t mChannelMask;
|
||||
|
||||
uint8_t mQueuedGetHeader;
|
||||
|
||||
uint16_t mScanPeriod;
|
||||
|
||||
spinel_prop_key_t mQueuedGetKey;
|
||||
|
||||
void RunUpdateAddressesTask();
|
||||
Tasklet mUpdateAddressesTask;
|
||||
|
||||
void RunSendScanResultsTask();
|
||||
MessageQueue mSendQueue;
|
||||
|
||||
protected:
|
||||
MessageQueue mSendQueue;
|
||||
/**
|
||||
* Set to true when there is a send in progress. Set and cleared
|
||||
* by the superclass. Should be considered read-only by everyone
|
||||
* except the superclass!
|
||||
*/
|
||||
bool mSending;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Thread
|
||||
|
||||
+38
-6
@@ -798,8 +798,8 @@ spinel_prop_key_to_cstr(spinel_prop_key_t prop_key)
|
||||
ret = "PROP_PROTOCOL_VERSION";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_CAPABILITIES:
|
||||
ret = "PROP_CAPABILITIES";
|
||||
case SPINEL_PROP_CAPS:
|
||||
ret = "PROP_CAPS";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_NCP_VERSION:
|
||||
@@ -878,6 +878,10 @@ spinel_prop_key_to_cstr(spinel_prop_key_t prop_key)
|
||||
ret = "PROP_PHY_RAW_STREAM_ENABLED";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_PHY_PROMISCUOUS_MODE:
|
||||
ret = "PROP_PHY_PROMISCUOUS_MODE";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_MAC_SCAN_STATE:
|
||||
ret = "PROP_MAC_SCAN_STATE";
|
||||
break;
|
||||
@@ -890,6 +894,10 @@ spinel_prop_key_to_cstr(spinel_prop_key_t prop_key)
|
||||
ret = "PROP_MAC_SCAN_BEACON";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_MAC_SCAN_PERIOD:
|
||||
ret = "PROP_MAC_SCAN_PERIOD";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_MAC_15_4_LADDR:
|
||||
ret = "PROP_MAC_15_4_LADDR";
|
||||
break;
|
||||
@@ -938,12 +946,32 @@ spinel_prop_key_to_cstr(spinel_prop_key_t prop_key)
|
||||
ret = "PROP_NET_PARTITION_ID";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_THREAD_LEADER:
|
||||
ret = "PROP_THREAD_LEADER";
|
||||
case SPINEL_PROP_THREAD_LEADER_ADDR:
|
||||
ret = "PROP_THREAD_LEADER_ADDR";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_THREAD_PARENT:
|
||||
ret = "PROP_THREAD_PARENT";
|
||||
case SPINEL_PROP_THREAD_LEADER_RID:
|
||||
ret = "PROP_THREAD_LEADER_RID";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_THREAD_LEADER_WEIGHT:
|
||||
ret = "PROP_THREAD_LEADER_WEIGHT";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_THREAD_LOCAL_LEADER_WEIGHT:
|
||||
ret = "PROP_THREAD_LOCAL_LEADER_WEIGHT";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_THREAD_NETWORK_DATA_VERSION:
|
||||
ret = "PROP_THREAD_NETWORK_DATA_VERSION";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_THREAD_STABLE_NETWORK_DATA_VERSION:
|
||||
ret = "PROP_THREAD_STABLE_NETWORK_DATA_VERSION";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_THREAD_NETWORK_DATA:
|
||||
ret = "PROP_THREAD_NETWORK_DATA";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_THREAD_CHILD_TABLE:
|
||||
@@ -970,6 +998,10 @@ spinel_prop_key_to_cstr(spinel_prop_key_t prop_key)
|
||||
ret = "PROP_IPV6_ROUTE_TABLE";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_IPV6_EXT_ROUTE_TABLE:
|
||||
ret = "PROP_IPV6_EXT_ROUTE_TABLE";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
+27
-15
@@ -163,6 +163,7 @@ typedef struct in6_addr spinel_ipv6addr_t;
|
||||
typedef int spinel_ssize_t;
|
||||
typedef unsigned int spinel_size_t;
|
||||
typedef uint8_t spinel_tid_t;
|
||||
typedef unsigned int spinel_cid_t;
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -244,7 +245,7 @@ typedef enum
|
||||
{
|
||||
SPINEL_PROP_LAST_STATUS = 0, // status [i]
|
||||
SPINEL_PROP_PROTOCOL_VERSION = 1, // interface type, major, minor, vendor [i,i,i,i]
|
||||
SPINEL_PROP_CAPABILITIES = 2, // capability list [A(i)]
|
||||
SPINEL_PROP_CAPS = 2, // capability list [A(i)]
|
||||
SPINEL_PROP_NCP_VERSION = 3, // version string [U]
|
||||
SPINEL_PROP_INTERFACE_COUNT = 4, // Interface count [C]
|
||||
SPINEL_PROP_POWER_STATE = 5, // PowerState [C]
|
||||
@@ -262,6 +263,7 @@ typedef enum
|
||||
SPINEL_PROP_PHY_TX_POWER = SPINEL_PROP_PHY__BEGIN + 5, // [c]
|
||||
SPINEL_PROP_PHY_RSSI = SPINEL_PROP_PHY__BEGIN + 6, // dBm [c]
|
||||
SPINEL_PROP_PHY_RAW_STREAM_ENABLED = SPINEL_PROP_PHY__BEGIN + 7, // [C]
|
||||
SPINEL_PROP_PHY_PROMISCUOUS_MODE = SPINEL_PROP_PHY__BEGIN + 8, // [C]
|
||||
SPINEL_PROP_PHY__END = 0x30,
|
||||
|
||||
SPINEL_PROP_MAC__BEGIN = 0x30,
|
||||
@@ -286,26 +288,36 @@ typedef enum
|
||||
SPINEL_PROP_NET_PARTITION_ID = SPINEL_PROP_NET__BEGIN + 8, // [L]
|
||||
SPINEL_PROP_NET__END = 0x50,
|
||||
|
||||
SPINEL_PROP_THREAD__BEGIN = 0x50,
|
||||
SPINEL_PROP_THREAD_LEADER = SPINEL_PROP_THREAD__BEGIN + 0, // [6]
|
||||
SPINEL_PROP_THREAD_PARENT = SPINEL_PROP_THREAD__BEGIN + 1, // LADDR, SADDR [ES]
|
||||
SPINEL_PROP_THREAD_CHILD_TABLE = SPINEL_PROP_THREAD__BEGIN + 2, // [A(T(ES))]
|
||||
SPINEL_PROP_THREAD__END = 0x60,
|
||||
SPINEL_PROP_THREAD__BEGIN = 0x50,
|
||||
SPINEL_PROP_THREAD_LEADER_ADDR = SPINEL_PROP_THREAD__BEGIN + 0, // [6]
|
||||
SPINEL_PROP_THREAD_PARENT = SPINEL_PROP_THREAD__BEGIN + 1, // LADDR, SADDR [ES]
|
||||
SPINEL_PROP_THREAD_CHILD_TABLE = SPINEL_PROP_THREAD__BEGIN + 2, // [A(T(ES))]
|
||||
SPINEL_PROP_THREAD_LEADER_RID = SPINEL_PROP_THREAD__BEGIN + 3, // [C]
|
||||
SPINEL_PROP_THREAD_LEADER_WEIGHT = SPINEL_PROP_THREAD__BEGIN + 4, // [6]
|
||||
SPINEL_PROP_THREAD_LOCAL_LEADER_WEIGHT
|
||||
= SPINEL_PROP_THREAD__BEGIN + 5, // [6]
|
||||
SPINEL_PROP_THREAD_NETWORK_DATA = SPINEL_PROP_THREAD__BEGIN + 6, // [D]
|
||||
SPINEL_PROP_THREAD_NETWORK_DATA_VERSION
|
||||
= SPINEL_PROP_THREAD__BEGIN + 7, // [S]
|
||||
SPINEL_PROP_THREAD_STABLE_NETWORK_DATA_VERSION
|
||||
= SPINEL_PROP_THREAD__BEGIN + 8, // [S]
|
||||
SPINEL_PROP_THREAD__END = 0x60,
|
||||
|
||||
SPINEL_PROP_IPV6__BEGIN = 0x60,
|
||||
SPINEL_PROP_IPV6_LL_ADDR = SPINEL_PROP_IPV6__BEGIN + 0, // [6]
|
||||
SPINEL_PROP_IPV6_ML_ADDR = SPINEL_PROP_IPV6__BEGIN + 1, // [6C]
|
||||
SPINEL_PROP_IPV6_ML_PREFIX = SPINEL_PROP_IPV6__BEGIN + 2, // [6C]
|
||||
SPINEL_PROP_IPV6_ADDRESS_TABLE = SPINEL_PROP_IPV6__BEGIN + 3, // array(ipv6addr,prefixlen,flags) [A(6CL)]
|
||||
SPINEL_PROP_IPV6_ROUTE_TABLE = SPINEL_PROP_IPV6__BEGIN + 4, // array(ipv6prefix,prefixlen,nexthop,flags) [A(6C6L)]
|
||||
SPINEL_PROP_IPV6__END = 0x70,
|
||||
SPINEL_PROP_IPV6__BEGIN = 0x60,
|
||||
SPINEL_PROP_IPV6_LL_ADDR = SPINEL_PROP_IPV6__BEGIN + 0, // [6]
|
||||
SPINEL_PROP_IPV6_ML_ADDR = SPINEL_PROP_IPV6__BEGIN + 1, // [6C]
|
||||
SPINEL_PROP_IPV6_ML_PREFIX = SPINEL_PROP_IPV6__BEGIN + 2, // [6C]
|
||||
SPINEL_PROP_IPV6_ADDRESS_TABLE = SPINEL_PROP_IPV6__BEGIN + 3, // array(ipv6addr,prefixlen,flags) [A(6CL)]
|
||||
SPINEL_PROP_IPV6_ROUTE_TABLE = SPINEL_PROP_IPV6__BEGIN + 4, // array(ipv6prefix,prefixlen,iface,flags) [A(6CCL)]
|
||||
SPINEL_PROP_IPV6_EXT_ROUTE_TABLE = SPINEL_PROP_IPV6__BEGIN + 5, // array(ipv6prefix,prefixlen,flags) [A(6CL)]
|
||||
SPINEL_PROP_IPV6__END = 0x70,
|
||||
|
||||
SPINEL_PROP_STREAM__BEGIN = 112,
|
||||
SPINEL_PROP_STREAM__BEGIN = 0x70,
|
||||
SPINEL_PROP_STREAM_DEBUG = SPINEL_PROP_STREAM__BEGIN + 0, // [U]
|
||||
SPINEL_PROP_STREAM_RAW = SPINEL_PROP_STREAM__BEGIN + 1, // [D]
|
||||
SPINEL_PROP_STREAM_NET = SPINEL_PROP_STREAM__BEGIN + 2, // [D]
|
||||
SPINEL_PROP_STREAM_NET_INSECURE = SPINEL_PROP_STREAM__BEGIN + 3, // [D]
|
||||
SPINEL_PROP_STREAM__END = 128,
|
||||
SPINEL_PROP_STREAM__END = 0x80,
|
||||
|
||||
SPINEL_PROP_15_4_PIB__BEGIN = 1024,
|
||||
// For direct access to the 802.15.4 PID.
|
||||
|
||||
Reference in New Issue
Block a user