Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
|
ePacket packet API More...
Data Structures | |
union | epacket_interface_address |
struct | epacket_tx_metadata |
struct | epacket_rx_metadata |
struct | epacket_key_ids_data |
Format of INFUSE_KEY_IDS packet. More... | |
struct | epacket_rate_limit_req |
Magic two byte packet that requests a pause in data transmission. More... | |
struct | epacket_rate_throughput_req |
Magic three byte packet that sets a target data throughput. More... | |
struct | epacket_interface_address_bt_le |
Format of BLE address in INFUSE_RECEIVED_EPACKET and INFUSE_EPACKET_FORWARD. More... | |
struct | epacket_received_common_header |
Common header for INFUSE_RECEIVED_EPACKET. More... | |
struct | epacket_received_decrypted_header |
Header for INFUSE_RECEIVED_EPACKET where packet was decrypted. More... | |
struct | epacket_forward_header |
Common header for INFUSE_EPACKET_FORWARD. More... | |
struct | epacket_forward_auto_conn_header |
Common header for INFUSE_EPACKET_FORWARD_AUTO_CONN. More... | |
struct | epacket_conn_terminated |
Packet for INFUSE_EPACKET_CONN_TERMINATED. More... | |
Macros | |
#define | EPACKET_ADDR_ALL ((union epacket_interface_address){0}) |
#define | EPACKET_KEY_ID_REQ_MAGIC 0x4D |
If a single byte payload with this value is received on an interface, respond with a INFUSE_KEY_IDS packet. | |
#define | EPACKET_RATE_LIMIT_REQ_MAGIC 0x4E |
Magic value for epacket_rate_limit_req. | |
Typedefs | |
typedef void(* | epacket_tx_done_cb) (const struct device *dev, struct net_buf *pkt, int result, void *user_data) |
Callback run when packet is transmitted. | |
Enumerations | |
enum | epacket_auth { EPACKET_AUTH_FAILURE = 0 , EPACKET_AUTH_REMOTE_ENCRYPTED = 0 , EPACKET_AUTH_NETWORK = 1 , EPACKET_AUTH_DEVICE = 2 } |
enum | epacket_flags { EPACKET_FLAGS_ENCRYPTION_DEVICE = BIT(15) , EPACKET_FLAGS_ENCRYPTION_NETWORK = 0 , EPACKET_FLAGS_ACK_REQUEST = BIT(14) , EPACKET_FLAGS_CLOUD_FORWARDING = BIT(13) , EPACKET_FLAGS_CLOUD_SELF = BIT(12) , EPACKET_FLAGS_INTERFACE_MASK = 0x00FF } |
enum | epacket_forward_auto_conn_flags { EPACKET_FORWARD_AUTO_CONN_SINGLE_RPC = BIT(0) , EPACKET_FORWARD_AUTO_CONN_SUB_DATA = BIT(1) , EPACKET_FORWARD_AUTO_CONN_DC_NOTIFICATION = BIT(2) , EPACKET_FORWARD_AUTO_CONN_PRIORITISE_UPLINK = BIT(3) } |
Functions | |
void | epacket_rate_limit_reset (void) |
Reset any active rate limits. | |
void | epacket_rate_limit_tx (k_ticks_t *last_call, uint16_t bytes_transmitted) |
Limit the transmission rate of bulk data paths. | |
void | epacket_global_flags_set (uint16_t flags) |
Set global flags for all transmitted packets. | |
uint16_t | epacket_global_flags_get (void) |
Get the current global flags value. | |
int | epacket_num_buffers_free_tx (void) |
Query the number of free TX buffers. | |
int | epacket_num_buffers_free_rx (void) |
Query the number of free RX buffers. | |
struct net_buf * | epacket_alloc_tx (k_timeout_t timeout) |
Allocate ePacket TX buffer. | |
struct net_buf * | epacket_alloc_rx (k_timeout_t timeout) |
Allocate ePacket RX buffer. | |
static struct net_buf * | epacket_alloc_tx_for_interface (const struct device *dev, k_timeout_t timeout) |
Allocate ePacket TX buffer for a specific interface. | |
static void | epacket_set_tx_metadata (struct net_buf *buf, enum epacket_auth auth, uint16_t flags, enum infuse_type type, union epacket_interface_address dest) |
Set metadata on a packet. | |
static void | epacket_set_tx_callback (struct net_buf *buf, epacket_tx_done_cb tx_done, void *user_data) |
Set callback to be run after packet sent. | |
int | epacket_received_packet_append (struct net_buf *storage_buf, struct net_buf *received_buf) |
Append received packet to storage buffer. | |
ePacket packet API
#define EPACKET_ADDR_ALL ((union epacket_interface_address){0}) |
#include <infuse/epacket/packet.h>
#define EPACKET_KEY_ID_REQ_MAGIC 0x4D |
#include <infuse/epacket/packet.h>
If a single byte payload with this value is received on an interface, respond with a INFUSE_KEY_IDS packet.
#define EPACKET_RATE_LIMIT_REQ_MAGIC 0x4E |
#include <infuse/epacket/packet.h>
Magic value for epacket_rate_limit_req.
typedef void(* epacket_tx_done_cb) (const struct device *dev, struct net_buf *pkt, int result, void *user_data) |
#include <infuse/epacket/packet.h>
Callback run when packet is transmitted.
dev | Interface packet was sent on |
pkt | Packet that was sent |
result | Result of sending the packet |
user_data | Arbitrary context provided to epacket_set_tx_callback |
enum epacket_auth |
#include <infuse/epacket/packet.h>
Enumerator | |
---|---|
EPACKET_AUTH_FAILURE | |
EPACKET_AUTH_REMOTE_ENCRYPTED | |
EPACKET_AUTH_NETWORK | |
EPACKET_AUTH_DEVICE |
enum epacket_flags |
#include <infuse/epacket/packet.h>
Enumerator | |
---|---|
EPACKET_FLAGS_ENCRYPTION_DEVICE | |
EPACKET_FLAGS_ENCRYPTION_NETWORK | |
EPACKET_FLAGS_ACK_REQUEST | |
EPACKET_FLAGS_CLOUD_FORWARDING | |
EPACKET_FLAGS_CLOUD_SELF | |
EPACKET_FLAGS_INTERFACE_MASK |
#include <infuse/epacket/packet.h>
Enumerator | |
---|---|
EPACKET_FORWARD_AUTO_CONN_SINGLE_RPC | |
EPACKET_FORWARD_AUTO_CONN_SUB_DATA | |
EPACKET_FORWARD_AUTO_CONN_DC_NOTIFICATION | |
EPACKET_FORWARD_AUTO_CONN_PRIORITISE_UPLINK |
struct net_buf * epacket_alloc_rx | ( | k_timeout_t | timeout | ) |
#include <infuse/epacket/packet.h>
Allocate ePacket RX buffer.
timeout | Maximum duration to wait for buffer |
NULL | On timeout |
buf | When successfully allocated |
struct net_buf * epacket_alloc_tx | ( | k_timeout_t | timeout | ) |
#include <infuse/epacket/packet.h>
Allocate ePacket TX buffer.
timeout | Maximum duration to wait for buffer |
NULL | On timeout |
buf | When successfully allocated |
|
inlinestatic |
#include <infuse/epacket/packet.h>
Allocate ePacket TX buffer for a specific interface.
dev | ePacket interface to |
timeout | Maximum duration to wait for buffer |
NULL | On timeout |
buf | When successfully allocated |
uint16_t epacket_global_flags_get | ( | void | ) |
#include <infuse/epacket/packet.h>
Get the current global flags value.
void epacket_global_flags_set | ( | uint16_t | flags | ) |
#include <infuse/epacket/packet.h>
Set global flags for all transmitted packets.
EPACKET_FLAGS_CLOUD_*
will be ignoredflags | Global flags to set |
int epacket_num_buffers_free_rx | ( | void | ) |
#include <infuse/epacket/packet.h>
Query the number of free RX buffers.
int epacket_num_buffers_free_tx | ( | void | ) |
#include <infuse/epacket/packet.h>
Query the number of free TX buffers.
void epacket_rate_limit_reset | ( | void | ) |
#include <infuse/epacket/packet.h>
Reset any active rate limits.
void epacket_rate_limit_tx | ( | k_ticks_t * | last_call, |
uint16_t | bytes_transmitted ) |
#include <infuse/epacket/packet.h>
Limit the transmission rate of bulk data paths.
last_call | Pointer to tick count at last call |
bytes_transmitted | Bytes transmitted since last call |
int epacket_received_packet_append | ( | struct net_buf * | storage_buf, |
struct net_buf * | received_buf ) |
#include <infuse/epacket/packet.h>
Append received packet to storage buffer.
storage_buf | Buffer of type INFUSE_RECEIVED_EPACKET |
received_buf | Receive ePacket to append to storage_buf |
0 | on success |
-ENOMEM | if insufficient space exists on storage_buf |
|
inlinestatic |
#include <infuse/epacket/packet.h>
Set callback to be run after packet sent.
buf | ePacket TX buffer |
tx_done | Callback to run on transmission |
user_data | Arbitrary context provided to tx_done |
|
inlinestatic |
#include <infuse/epacket/packet.h>
Set metadata on a packet.
buf | ePacket TX buffer |
auth | Authentication level to use for packet |
flags | Desired packet flags |
type | Packet type |
dest | Destination address |