Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
ePacket packet APIs

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.
 

Detailed Description

ePacket packet API

Macro Definition Documentation

◆ EPACKET_ADDR_ALL

#define EPACKET_ADDR_ALL   ((union epacket_interface_address){0})

◆ EPACKET_KEY_ID_REQ_MAGIC

#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.

◆ EPACKET_RATE_LIMIT_REQ_MAGIC

#define EPACKET_RATE_LIMIT_REQ_MAGIC   0x4E

#include <infuse/epacket/packet.h>

Magic value for epacket_rate_limit_req.

Typedef Documentation

◆ epacket_tx_done_cb

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.

Parameters
devInterface packet was sent on
pktPacket that was sent
resultResult of sending the packet
user_dataArbitrary context provided to epacket_set_tx_callback

Enumeration Type Documentation

◆ epacket_auth

#include <infuse/epacket/packet.h>

Enumerator
EPACKET_AUTH_FAILURE 
EPACKET_AUTH_REMOTE_ENCRYPTED 
EPACKET_AUTH_NETWORK 
EPACKET_AUTH_DEVICE 

◆ 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 

◆ epacket_forward_auto_conn_flags

#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 

Function Documentation

◆ epacket_alloc_rx()

struct net_buf * epacket_alloc_rx ( k_timeout_t timeout)

#include <infuse/epacket/packet.h>

Allocate ePacket RX buffer.

Parameters
timeoutMaximum duration to wait for buffer
Return values
NULLOn timeout
bufWhen successfully allocated

◆ epacket_alloc_tx()

struct net_buf * epacket_alloc_tx ( k_timeout_t timeout)

#include <infuse/epacket/packet.h>

Allocate ePacket TX buffer.

Warning
This function does not reserve space on the buffer for packet headers and footers.
Parameters
timeoutMaximum duration to wait for buffer
Return values
NULLOn timeout
bufWhen successfully allocated

◆ epacket_alloc_tx_for_interface()

static struct net_buf * epacket_alloc_tx_for_interface ( const struct device * dev,
k_timeout_t timeout )
inlinestatic

#include <infuse/epacket/packet.h>

Allocate ePacket TX buffer for a specific interface.

Parameters
devePacket interface to
timeoutMaximum duration to wait for buffer
Return values
NULLOn timeout
bufWhen successfully allocated

◆ epacket_global_flags_get()

uint16_t epacket_global_flags_get ( void )

#include <infuse/epacket/packet.h>

Get the current global flags value.

Returns
uint16_t Current global flags

◆ epacket_global_flags_set()

void epacket_global_flags_set ( uint16_t flags)

#include <infuse/epacket/packet.h>

Set global flags for all transmitted packets.

Note
Any flags other than EPACKET_FLAGS_CLOUD_* will be ignored
Parameters
flagsGlobal flags to set

◆ epacket_num_buffers_free_rx()

int epacket_num_buffers_free_rx ( void )

#include <infuse/epacket/packet.h>

Query the number of free RX buffers.

Returns
int Number of free RX buffers

◆ epacket_num_buffers_free_tx()

int epacket_num_buffers_free_tx ( void )

#include <infuse/epacket/packet.h>

Query the number of free TX buffers.

Returns
int Number of free TX buffers

◆ epacket_rate_limit_reset()

void epacket_rate_limit_reset ( void )

#include <infuse/epacket/packet.h>

Reset any active rate limits.

◆ epacket_rate_limit_tx()

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.

Parameters
last_callPointer to tick count at last call
bytes_transmittedBytes transmitted since last call

◆ epacket_received_packet_append()

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.

Parameters
storage_bufBuffer of type INFUSE_RECEIVED_EPACKET
received_bufReceive ePacket to append to storage_buf
Return values
0on success
-ENOMEMif insufficient space exists on storage_buf

◆ epacket_set_tx_callback()

static void epacket_set_tx_callback ( struct net_buf * buf,
epacket_tx_done_cb tx_done,
void * user_data )
inlinestatic

#include <infuse/epacket/packet.h>

Set callback to be run after packet sent.

Parameters
bufePacket TX buffer
tx_doneCallback to run on transmission
user_dataArbitrary context provided to tx_done

◆ epacket_set_tx_metadata()

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 )
inlinestatic

#include <infuse/epacket/packet.h>

Set metadata on a packet.

Parameters
bufePacket TX buffer
authAuthentication level to use for packet
flagsDesired packet flags
typePacket type
destDestination address