|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
Thread spinel / HDLC-lite framing codec (PROTOCORE_ENABLE_THREAD) - OpenThread RCP. More...
#include "protocore_config.h"Go to the source code of this file.
Classes | |
| struct | SpinelReader |
| A read cursor over a spinel property value. More... | |
| struct | SpinelWriter |
| A write cursor building a spinel property value into a caller buffer. More... | |
| struct | SpinelPropInfo |
| A registry entry: a property id, its human name, and its primary spinel datatype char. More... | |
| struct | ThreadNs |
| Dispatch table. Addressed by offset, so the layout is asserted below. More... | |
Macros | |
| #define | HDLC_FLAG 0x7E |
| HDLC-lite markers. | |
| #define | HDLC_ESCAPE 0x7D |
| byte-stuffing escape | |
| #define | SPINEL_CMD_NOOP 0 |
| Common spinel commands (the property accessors a gateway uses). | |
| #define | SPINEL_CMD_RESET 1 |
| #define | SPINEL_CMD_PROP_VALUE_GET 2 |
| #define | SPINEL_CMD_PROP_VALUE_SET 3 |
| #define | SPINEL_CMD_PROP_VALUE_INSERT 4 |
| #define | SPINEL_CMD_PROP_VALUE_REMOVE 5 |
| #define | SPINEL_CMD_PROP_VALUE_IS 6 |
| an async property update from the NCP | |
| #define | SPINEL_CMD_PROP_VALUE_INSERTED 7 |
| a list property gained an entry | |
| #define | SPINEL_CMD_PROP_VALUE_REMOVED 8 |
| a list property lost an entry | |
| #define | SPINEL_PROP_LAST_STATUS 0 |
| The spinel property ids a Thread/802.15.4 gateway reads or writes (subset of the spinel property registry, grouped CORE / PHY / MAC / NET / IPv6 / STREAM). | |
| #define | SPINEL_PROP_PROTOCOL_VERSION 1 |
| 'ii' major, minor | |
| #define | SPINEL_PROP_NCP_VERSION 2 |
| 'U' NCP version string | |
| #define | SPINEL_PROP_INTERFACE_TYPE 3 |
| 'i' 3 = Thread | |
| #define | SPINEL_PROP_VENDOR_ID 4 |
| 'i' | |
| #define | SPINEL_PROP_CAPS 5 |
| 'A(i)' capability list | |
| #define | SPINEL_PROP_INTERFACE_COUNT 6 |
| 'C' | |
| #define | SPINEL_PROP_HWADDR 8 |
| 'E' factory EUI64 | |
| #define | SPINEL_PROP_LOCK 9 |
| 'b' | |
| #define | SPINEL_PROP_PHY_ENABLED 0x20 |
| 'b' | |
| #define | SPINEL_PROP_PHY_CHAN 0x21 |
| 'C' 802.15.4 channel | |
| #define | SPINEL_PROP_PHY_CHAN_SUPPORTED 0x22 |
| 'A(C)' | |
| #define | SPINEL_PROP_PHY_FREQ 0x23 |
| 'L' kHz | |
| #define | SPINEL_PROP_PHY_TX_POWER 0x25 |
| 'c' dBm | |
| #define | SPINEL_PROP_PHY_RSSI 0x26 |
| 'c' dBm | |
| #define | SPINEL_PROP_MAC_SCAN_STATE 0x30 |
| 'C' | |
| #define | SPINEL_PROP_MAC_SCAN_MASK 0x31 |
| 'A(C)' | |
| #define | SPINEL_PROP_MAC_SCAN_PERIOD 0x32 |
| 'S' ms/channel | |
| #define | SPINEL_PROP_MAC_15_4_LADDR 0x34 |
| 'E' extended (long) address | |
| #define | SPINEL_PROP_MAC_15_4_SADDR 0x35 |
| 'S' short address | |
| #define | SPINEL_PROP_MAC_15_4_PANID 0x36 |
| 'S' PAN id | |
| #define | SPINEL_PROP_NET_SAVED 0x40 |
| 'b' | |
| #define | SPINEL_PROP_NET_IF_UP 0x41 |
| 'b' | |
| #define | SPINEL_PROP_NET_STACK_UP 0x42 |
| 'b' | |
| #define | SPINEL_PROP_NET_ROLE 0x43 |
| 'C' 0 detached,1 child,2 router,3 leader | |
| #define | SPINEL_PROP_NET_NETWORK_NAME 0x44 |
| 'U' | |
| #define | SPINEL_PROP_NET_XPANID 0x45 |
| 'D' 8-byte extended PAN id | |
| #define | SPINEL_PROP_NET_NETWORK_KEY 0x46 |
| 'D' 16-byte network key | |
| #define | SPINEL_PROP_IPV6_LL_ADDR 0x60 |
| '6' link-local | |
| #define | SPINEL_PROP_IPV6_ML_ADDR 0x61 |
| '6' mesh-local | |
| #define | SPINEL_PROP_STREAM_DEBUG 0x70 |
| 'U' debug text | |
| #define | SPINEL_PROP_STREAM_RAW 0x71 |
| 'dD' raw 802.15.4 frame + metadata | |
| #define | SPINEL_PROP_STREAM_NET 0x72 |
| 'dD' IPv6 datagram + metadata | |
| #define | SPINEL_STATUS_OK 0 |
spinel LAST_STATUS codes (a subset - the ones a gateway acts on). | |
| #define | SPINEL_STATUS_FAILURE 1 |
| #define | SPINEL_STATUS_UNIMPLEMENTED 2 |
| #define | SPINEL_STATUS_INVALID_ARGUMENT 3 |
| #define | SPINEL_STATUS_INVALID_STATE 4 |
| #define | SPINEL_STATUS_INVALID_COMMAND 5 |
| #define | SPINEL_STATUS_INVALID_INTERFACE 6 |
| #define | SPINEL_STATUS_INTERNAL_ERROR 7 |
| #define | SPINEL_STATUS_SECURITY_ERROR 8 |
| #define | SPINEL_STATUS_PARSE_ERROR 9 |
| #define | SPINEL_STATUS_IN_PROGRESS 10 |
| #define | SPINEL_STATUS_NOMEM 11 |
| #define | SPINEL_STATUS_BUSY 12 |
| #define | SPINEL_STATUS_PROP_NOT_FOUND 13 |
| #define | SPINEL_STATUS_DROPPED 14 |
| #define | SPINEL_STATUS_EMPTY 15 |
| #define | SPINEL_STATUS_RESET_POWER_ON 112 |
| first of the reset-cause block | |
| #define | SPINEL_STATUS_RESET_END 128 |
| one past the block: 112..127 are all reset causes | |
Functions | |
| PROTOCORE_NS_LAYOUT (ThreadNs, spinel_fcs, spinel_pack_uint, spinel_unpack_uint, spinel_command_build, spinel_command_parse, spinel_reader_init, spinel_get_bool, spinel_get_u8, spinel_get_i8, spinel_get_u16, spinel_get_i16, spinel_get_u32, spinel_get_i32, spinel_get_uint, spinel_get_eui64, spinel_get_ipv6, spinel_get_utf8, spinel_get_data, spinel_get_data_wlen, spinel_reader_ok, spinel_writer_init, spinel_put_bool, spinel_put_u8, spinel_put_i8, spinel_put_u16, spinel_put_i16, spinel_put_u32, spinel_put_i32, spinel_put_uint, spinel_put_eui64, spinel_put_ipv6, spinel_put_utf8, spinel_put_data, spinel_put_data_wlen, spinel_writer_len, spinel_prop_lookup, spinel_prop_name, spinel_status_name, spinel_frame_encode, spinel_frame_decode) | |
| uint16_t | protocore_thread_spinel_fcs (uint8_t *work, const uint8_t *buf, uint16_t len) |
| HDLC frame check sequence: CRC-16/X-25 over buf. | |
| uint8_t | protocore_thread_spinel_pack_uint (uint8_t *work, uint32_t value, uint8_t *out, uint8_t cap) |
| Encode a spinel packed unsigned integer (7 bits/byte, . | |
| int | protocore_thread_spinel_unpack_uint (uint8_t *work, const uint8_t *raw, uint8_t len, uint32_t *value) |
| Decode a spinel packed unsigned integer from the front of raw. | |
| uint16_t | protocore_thread_spinel_command_build (uint8_t *work, uint8_t header, uint32_t cmd, uint32_t prop, const uint8_t *value, uint16_t value_len, uint8_t *out, uint16_t cap) |
| Build a spinel property-command payload (`header | CMD | PROP | . | |
| int | protocore_thread_spinel_command_parse (uint8_t *work, const uint8_t *payload, uint16_t len, uint8_t *header, uint32_t *cmd, uint32_t *prop, const uint8_t **value, uint16_t *value_len) |
| Parse a spinel property-command payload (from a decoded HDLC frame). | |
| void | protocore_thread_spinel_reader_init (uint8_t *work, SpinelReader *r, const uint8_t *value, uint16_t len) |
| Spinel_reader_init. | |
| proto_bool | protocore_thread_spinel_get_bool (uint8_t *work, SpinelReader *r, proto_bool *out) |
| Spinel_get_bool. | |
| proto_bool | protocore_thread_spinel_get_u8 (uint8_t *work, SpinelReader *r, uint8_t *out) |
| Spinel_get_u8. | |
| proto_bool | protocore_thread_spinel_get_i8 (uint8_t *work, SpinelReader *r, int8_t *out) |
| Spinel_get_i8. | |
| proto_bool | protocore_thread_spinel_get_u16 (uint8_t *work, SpinelReader *r, uint16_t *out) |
| Spinel_get_u16. | |
| proto_bool | protocore_thread_spinel_get_i16 (uint8_t *work, SpinelReader *r, int16_t *out) |
| Spinel_get_i16. | |
| proto_bool | protocore_thread_spinel_get_u32 (uint8_t *work, SpinelReader *r, uint32_t *out) |
| Spinel_get_u32. | |
| proto_bool | protocore_thread_spinel_get_i32 (uint8_t *work, SpinelReader *r, int32_t *out) |
| Spinel_get_i32. | |
| proto_bool | protocore_thread_spinel_get_uint (uint8_t *work, SpinelReader *r, uint32_t *out) |
| Spinel_get_uint. | |
| proto_bool | protocore_thread_spinel_get_eui64 (uint8_t *work, SpinelReader *r, const uint8_t **out8) |
| Spinel_get_eui64. | |
| proto_bool | protocore_thread_spinel_get_ipv6 (uint8_t *work, SpinelReader *r, const uint8_t **out16) |
| Spinel_get_ipv6. | |
| proto_bool | protocore_thread_spinel_get_utf8 (uint8_t *work, SpinelReader *r, const char **out, uint16_t *out_len) |
| UTF8 'U': out points into the value, out_len excludes the NUL; . | |
| proto_bool | protocore_thread_spinel_get_data (uint8_t *work, SpinelReader *r, const uint8_t **out, uint16_t *out_len) |
| Data 'D' (to end of value): out points into the value, out_len is . | |
| proto_bool | protocore_thread_spinel_get_data_wlen (uint8_t *work, SpinelReader *r, const uint8_t **out, uint16_t *out_len) |
| Data 'd' (uint16-LE length prefix): reads the count, then that many . | |
| proto_bool | protocore_thread_spinel_reader_ok (uint8_t *work, const SpinelReader *r) |
| True if every read so far stayed in bounds. | |
| void | protocore_thread_spinel_writer_init (uint8_t *work, SpinelWriter *w, uint8_t *out, uint16_t cap) |
| Spinel_writer_init. | |
| proto_bool | protocore_thread_spinel_put_bool (uint8_t *work, SpinelWriter *w, proto_bool v) |
| Spinel_put_bool. | |
| proto_bool | protocore_thread_spinel_put_u8 (uint8_t *work, SpinelWriter *w, uint8_t v) |
| Spinel_put_u8. | |
| void | protocore_thread_spinel_put_i8 (uint8_t *work, SpinelWriter *w, int8_t v) |
| Spinel_put_i8. | |
| proto_bool | protocore_thread_spinel_put_u16 (uint8_t *work, SpinelWriter *w, uint16_t v) |
| Spinel_put_u16. | |
| void | protocore_thread_spinel_put_i16 (uint8_t *work, SpinelWriter *w, int16_t v) |
| Spinel_put_i16. | |
| proto_bool | protocore_thread_spinel_put_u32 (uint8_t *work, SpinelWriter *w, uint32_t v) |
| Spinel_put_u32. | |
| void | protocore_thread_spinel_put_i32 (uint8_t *work, SpinelWriter *w, int32_t v) |
| Spinel_put_i32. | |
| proto_bool | protocore_thread_spinel_put_uint (uint8_t *work, SpinelWriter *w, uint32_t v) |
| Spinel_put_uint. | |
| proto_bool | protocore_thread_spinel_put_eui64 (uint8_t *work, SpinelWriter *w, const uint8_t *v8) |
| Spinel_put_eui64. | |
| proto_bool | protocore_thread_spinel_put_ipv6 (uint8_t *work, SpinelWriter *w, const uint8_t *v16) |
| Spinel_put_ipv6. | |
| proto_bool | protocore_thread_spinel_put_utf8 (uint8_t *work, SpinelWriter *w, const char *s) |
| Spinel_put_utf8. | |
| proto_bool | protocore_thread_spinel_put_data (uint8_t *work, SpinelWriter *w, const uint8_t *d, uint16_t n) |
| Spinel_put_data. | |
| proto_bool | protocore_thread_spinel_put_data_wlen (uint8_t *work, SpinelWriter *w, const uint8_t *d, uint16_t n) |
| Spinel_put_data_wlen. | |
| uint16_t | protocore_thread_spinel_writer_len (uint8_t *work, const SpinelWriter *w) |
| The finished value length, or 0 if any write overflowed. | |
| const SpinelPropInfo * | protocore_thread_spinel_prop_lookup (uint8_t *work, uint32_t id) |
| Look up a property's registry entry, or nullptr if it is not in the . | |
| const char * | protocore_thread_spinel_prop_name (uint8_t *work, uint32_t id) |
| A property's human name, or "UNKNOWN" if unregistered. | |
| const char * | protocore_thread_spinel_status_name (uint8_t *work, uint32_t status) |
A LAST_STATUS code's human name, or "UNKNOWN" if unregistered. | |
| uint16_t | protocore_thread_spinel_frame_encode (uint8_t *work, const uint8_t *payload, uint16_t len, uint8_t *out, uint16_t cap) |
| Encode an HDLC-lite frame: payload + FCS, byte-stuffed, . | |
| int | protocore_thread_spinel_frame_decode (uint8_t *work, const uint8_t *raw, uint16_t len, uint8_t *payload, uint16_t pay_cap, uint16_t *pay_len) |
| Decode one HDLC-lite frame from the front of raw: find the flag, . | |
Variables | |
| PROTOCORE_NS ThreadNs Thread | PROTOCORE_UNUSED |
| Module namespace. | |
Thread spinel / HDLC-lite framing codec (PROTOCORE_ENABLE_THREAD) - OpenThread RCP.
The HDLC-lite framing that carries spinel frames to an OpenThread radio co-processor (an nRF52840 / EFR32 RCP) over UART - an 802.15.4 / Thread mesh bridged to IP and the web. HDLC-lite wraps each spinel frame by appending an FCS, byte-stuffing the reserved bytes, and terminating with a Flag:
[spinel payload | FCS(lo,hi)] –byte-stuffed--> ... | 0x7E
The FCS is the HDLC frame check sequence, CRC-16/X-25 (poly 0x1021 reflected, init 0xFFFF, reflected in/out, final XOR 0xFFFF), transmitted low byte first. The reserved bytes stuffed (as 0x7D, byte XOR 0x20) are the Flag 0x7E, the Escape 0x7D, XON 0x11, and XOFF 0x13.
protocore_spinel_frame_encode() wraps a payload; protocore_spinel_frame_decode() finds the flag, removes the stuffing, and verifies the FCS. protocore_spinel_fcs() is the shared checksum. The spinel command inside (a property get/set/insert, an 802.15.4 stream) is the application's. Pure - you carry the bytes over your UART - so it is fully host-testable.
work is bytes the CALLER holds. This module reads none of them: it carries nothing between calls, so there is no state to keep and nothing to wipe. The parameter is there so a caller drives every namespace the same way.
Definition in file thread.h.
| #define SPINEL_CMD_NOOP 0 |
| #define SPINEL_CMD_PROP_VALUE_IS 6 |
| #define SPINEL_CMD_PROP_VALUE_INSERTED 7 |
| #define SPINEL_CMD_PROP_VALUE_REMOVED 8 |
| #define SPINEL_PROP_LAST_STATUS 0 |
| #define SPINEL_PROP_MAC_15_4_LADDR 0x34 |
| #define SPINEL_PROP_NET_ROLE 0x43 |
| #define SPINEL_PROP_NET_XPANID 0x45 |
| #define SPINEL_PROP_NET_NETWORK_KEY 0x46 |
| #define SPINEL_PROP_STREAM_RAW 0x71 |
| #define SPINEL_PROP_STREAM_NET 0x72 |
| #define SPINEL_STATUS_OK 0 |
| #define SPINEL_STATUS_RESET_POWER_ON 112 |
| #define SPINEL_STATUS_RESET_END 128 |
| PROTOCORE_NS_LAYOUT | ( | ThreadNs | , |
| spinel_fcs | , | ||
| spinel_pack_uint | , | ||
| spinel_unpack_uint | , | ||
| spinel_command_build | , | ||
| spinel_command_parse | , | ||
| spinel_reader_init | , | ||
| spinel_get_bool | , | ||
| spinel_get_u8 | , | ||
| spinel_get_i8 | , | ||
| spinel_get_u16 | , | ||
| spinel_get_i16 | , | ||
| spinel_get_u32 | , | ||
| spinel_get_i32 | , | ||
| spinel_get_uint | , | ||
| spinel_get_eui64 | , | ||
| spinel_get_ipv6 | , | ||
| spinel_get_utf8 | , | ||
| spinel_get_data | , | ||
| spinel_get_data_wlen | , | ||
| spinel_reader_ok | , | ||
| spinel_writer_init | , | ||
| spinel_put_bool | , | ||
| spinel_put_u8 | , | ||
| spinel_put_i8 | , | ||
| spinel_put_u16 | , | ||
| spinel_put_i16 | , | ||
| spinel_put_u32 | , | ||
| spinel_put_i32 | , | ||
| spinel_put_uint | , | ||
| spinel_put_eui64 | , | ||
| spinel_put_ipv6 | , | ||
| spinel_put_utf8 | , | ||
| spinel_put_data | , | ||
| spinel_put_data_wlen | , | ||
| spinel_writer_len | , | ||
| spinel_prop_lookup | , | ||
| spinel_prop_name | , | ||
| spinel_status_name | , | ||
| spinel_frame_encode | , | ||
| spinel_frame_decode | |||
| ) |
| uint16_t protocore_thread_spinel_fcs | ( | uint8_t * | work, |
| const uint8_t * | buf, | ||
| uint16_t | len | ||
| ) |
HDLC frame check sequence: CRC-16/X-25 over buf.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| buf | Buf |
| len | Len |
| uint8_t protocore_thread_spinel_pack_uint | ( | uint8_t * | work, |
| uint32_t | value, | ||
| uint8_t * | out, | ||
| uint8_t | cap | ||
| ) |
Encode a spinel packed unsigned integer (7 bits/byte, .
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| value | Value |
| out | Out |
| cap | Cap |
| int protocore_thread_spinel_unpack_uint | ( | uint8_t * | work, |
| const uint8_t * | raw, | ||
| uint8_t | len, | ||
| uint32_t * | value | ||
| ) |
Decode a spinel packed unsigned integer from the front of raw.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| raw | Raw |
| len | Len |
| value | Value |
| uint16_t protocore_thread_spinel_command_build | ( | uint8_t * | work, |
| uint8_t | header, | ||
| uint32_t | cmd, | ||
| uint32_t | prop, | ||
| const uint8_t * | value, | ||
| uint16_t | value_len, | ||
| uint8_t * | out, | ||
| uint16_t | cap | ||
| ) |
Build a spinel property-command payload (`header | CMD | PROP | .
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| header | Header |
| cmd | Cmd |
| prop | Prop |
| value | Value |
| value_len | Value len |
| out | Out |
| cap | Cap |
| int protocore_thread_spinel_command_parse | ( | uint8_t * | work, |
| const uint8_t * | payload, | ||
| uint16_t | len, | ||
| uint8_t * | header, | ||
| uint32_t * | cmd, | ||
| uint32_t * | prop, | ||
| const uint8_t ** | value, | ||
| uint16_t * | value_len | ||
| ) |
Parse a spinel property-command payload (from a decoded HDLC frame).
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| payload | Payload |
| len | Len |
| header | Header |
| cmd | Cmd |
| prop | Prop |
| value | Value |
| value_len | Value len |
| void protocore_thread_spinel_reader_init | ( | uint8_t * | work, |
| SpinelReader * | r, | ||
| const uint8_t * | value, | ||
| uint16_t | len | ||
| ) |
Spinel_reader_init.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| r | R |
| value | Value |
| len | Len |
| proto_bool protocore_thread_spinel_get_bool | ( | uint8_t * | work, |
| SpinelReader * | r, | ||
| proto_bool * | out | ||
| ) |
Spinel_get_bool.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| r | R |
| out | Out |
| proto_bool protocore_thread_spinel_get_u8 | ( | uint8_t * | work, |
| SpinelReader * | r, | ||
| uint8_t * | out | ||
| ) |
Spinel_get_u8.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| r | R |
| out | Out |
| proto_bool protocore_thread_spinel_get_i8 | ( | uint8_t * | work, |
| SpinelReader * | r, | ||
| int8_t * | out | ||
| ) |
Spinel_get_i8.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| r | R |
| out | Out |
| proto_bool protocore_thread_spinel_get_u16 | ( | uint8_t * | work, |
| SpinelReader * | r, | ||
| uint16_t * | out | ||
| ) |
Spinel_get_u16.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| r | R |
| out | Out |
| proto_bool protocore_thread_spinel_get_i16 | ( | uint8_t * | work, |
| SpinelReader * | r, | ||
| int16_t * | out | ||
| ) |
Spinel_get_i16.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| r | R |
| out | Out |
| proto_bool protocore_thread_spinel_get_u32 | ( | uint8_t * | work, |
| SpinelReader * | r, | ||
| uint32_t * | out | ||
| ) |
Spinel_get_u32.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| r | R |
| out | Out |
| proto_bool protocore_thread_spinel_get_i32 | ( | uint8_t * | work, |
| SpinelReader * | r, | ||
| int32_t * | out | ||
| ) |
Spinel_get_i32.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| r | R |
| out | Out |
| proto_bool protocore_thread_spinel_get_uint | ( | uint8_t * | work, |
| SpinelReader * | r, | ||
| uint32_t * | out | ||
| ) |
Spinel_get_uint.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| r | R |
| out | Out |
| proto_bool protocore_thread_spinel_get_eui64 | ( | uint8_t * | work, |
| SpinelReader * | r, | ||
| const uint8_t ** | out8 | ||
| ) |
Spinel_get_eui64.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| r | R |
| out8 | Out8 |
| proto_bool protocore_thread_spinel_get_ipv6 | ( | uint8_t * | work, |
| SpinelReader * | r, | ||
| const uint8_t ** | out16 | ||
| ) |
Spinel_get_ipv6.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| r | R |
| out16 | Out16 |
| proto_bool protocore_thread_spinel_get_utf8 | ( | uint8_t * | work, |
| SpinelReader * | r, | ||
| const char ** | out, | ||
| uint16_t * | out_len | ||
| ) |
UTF8 'U': out points into the value, out_len excludes the NUL; .
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| r | R |
| out | Out |
| out_len | Out len |
| proto_bool protocore_thread_spinel_get_data | ( | uint8_t * | work, |
| SpinelReader * | r, | ||
| const uint8_t ** | out, | ||
| uint16_t * | out_len | ||
| ) |
Data 'D' (to end of value): out points into the value, out_len is .
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| r | R |
| out | Out |
| out_len | Out len |
| proto_bool protocore_thread_spinel_get_data_wlen | ( | uint8_t * | work, |
| SpinelReader * | r, | ||
| const uint8_t ** | out, | ||
| uint16_t * | out_len | ||
| ) |
Data 'd' (uint16-LE length prefix): reads the count, then that many .
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| r | R |
| out | Out |
| out_len | Out len |
| proto_bool protocore_thread_spinel_reader_ok | ( | uint8_t * | work, |
| const SpinelReader * | r | ||
| ) |
True if every read so far stayed in bounds.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| r | R |
| void protocore_thread_spinel_writer_init | ( | uint8_t * | work, |
| SpinelWriter * | w, | ||
| uint8_t * | out, | ||
| uint16_t | cap | ||
| ) |
Spinel_writer_init.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| w | W |
| out | Out |
| cap | Cap |
| proto_bool protocore_thread_spinel_put_bool | ( | uint8_t * | work, |
| SpinelWriter * | w, | ||
| proto_bool | v | ||
| ) |
Spinel_put_bool.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| w | W |
| v | V |
| proto_bool protocore_thread_spinel_put_u8 | ( | uint8_t * | work, |
| SpinelWriter * | w, | ||
| uint8_t | v | ||
| ) |
Spinel_put_u8.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| w | W |
| v | V |
| void protocore_thread_spinel_put_i8 | ( | uint8_t * | work, |
| SpinelWriter * | w, | ||
| int8_t | v | ||
| ) |
Spinel_put_i8.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| w | W |
| v | V |
| proto_bool protocore_thread_spinel_put_u16 | ( | uint8_t * | work, |
| SpinelWriter * | w, | ||
| uint16_t | v | ||
| ) |
Spinel_put_u16.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| w | W |
| v | V |
| void protocore_thread_spinel_put_i16 | ( | uint8_t * | work, |
| SpinelWriter * | w, | ||
| int16_t | v | ||
| ) |
Spinel_put_i16.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| w | W |
| v | V |
| proto_bool protocore_thread_spinel_put_u32 | ( | uint8_t * | work, |
| SpinelWriter * | w, | ||
| uint32_t | v | ||
| ) |
Spinel_put_u32.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| w | W |
| v | V |
| void protocore_thread_spinel_put_i32 | ( | uint8_t * | work, |
| SpinelWriter * | w, | ||
| int32_t | v | ||
| ) |
Spinel_put_i32.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| w | W |
| v | V |
| proto_bool protocore_thread_spinel_put_uint | ( | uint8_t * | work, |
| SpinelWriter * | w, | ||
| uint32_t | v | ||
| ) |
Spinel_put_uint.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| w | W |
| v | V |
| proto_bool protocore_thread_spinel_put_eui64 | ( | uint8_t * | work, |
| SpinelWriter * | w, | ||
| const uint8_t * | v8 | ||
| ) |
Spinel_put_eui64.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| w | W |
| v8 | V8 |
| proto_bool protocore_thread_spinel_put_ipv6 | ( | uint8_t * | work, |
| SpinelWriter * | w, | ||
| const uint8_t * | v16 | ||
| ) |
Spinel_put_ipv6.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| w | W |
| v16 | V16 |
| proto_bool protocore_thread_spinel_put_utf8 | ( | uint8_t * | work, |
| SpinelWriter * | w, | ||
| const char * | s | ||
| ) |
Spinel_put_utf8.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| w | W |
| s | S |
| proto_bool protocore_thread_spinel_put_data | ( | uint8_t * | work, |
| SpinelWriter * | w, | ||
| const uint8_t * | d, | ||
| uint16_t | n | ||
| ) |
Spinel_put_data.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| w | W |
| d | D |
| n | N |
| proto_bool protocore_thread_spinel_put_data_wlen | ( | uint8_t * | work, |
| SpinelWriter * | w, | ||
| const uint8_t * | d, | ||
| uint16_t | n | ||
| ) |
Spinel_put_data_wlen.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| w | W |
| d | D |
| n | N |
| uint16_t protocore_thread_spinel_writer_len | ( | uint8_t * | work, |
| const SpinelWriter * | w | ||
| ) |
The finished value length, or 0 if any write overflowed.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| w | W |
| const SpinelPropInfo * protocore_thread_spinel_prop_lookup | ( | uint8_t * | work, |
| uint32_t | id | ||
| ) |
Look up a property's registry entry, or nullptr if it is not in the .
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| id | Id |
| const char * protocore_thread_spinel_prop_name | ( | uint8_t * | work, |
| uint32_t | id | ||
| ) |
A property's human name, or "UNKNOWN" if unregistered.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| id | Id |
| const char * protocore_thread_spinel_status_name | ( | uint8_t * | work, |
| uint32_t | status | ||
| ) |
A LAST_STATUS code's human name, or "UNKNOWN" if unregistered.
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| status | Status |
| uint16_t protocore_thread_spinel_frame_encode | ( | uint8_t * | work, |
| const uint8_t * | payload, | ||
| uint16_t | len, | ||
| uint8_t * | out, | ||
| uint16_t | cap | ||
| ) |
Encode an HDLC-lite frame: payload + FCS, byte-stuffed, .
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| payload | Payload |
| len | Len |
| out | Out |
| cap | Cap |
| int protocore_thread_spinel_frame_decode | ( | uint8_t * | work, |
| const uint8_t * | raw, | ||
| uint16_t | len, | ||
| uint8_t * | payload, | ||
| uint16_t | pay_cap, | ||
| uint16_t * | pay_len | ||
| ) |
Decode one HDLC-lite frame from the front of raw: find the flag, .
| work | PROTOCORE_THREAD_BORROW bytes the caller took. Not held past the call. |
| raw | Raw |
| len | Len |
| payload | Payload |
| pay_cap | Pay cap |
| pay_len | Pay len |
| PROTOCORE_NS ThreadNs Thread PROTOCORE_UNUSED |