13#ifndef INFUSE_SDK_INCLUDE_INFUSE_EPACKET_PACKET_H_
14#define INFUSE_SDK_INCLUDE_INFUSE_EPACKET_PACKET_H_
18#include <zephyr/kernel.h>
19#include <zephyr/device.h>
20#include <zephyr/toolchain.h>
21#include <zephyr/net_buf.h>
22#include <zephyr/bluetooth/bluetooth.h>
54#define EPACKET_ADDR_ALL ((union epacket_interface_address){0})
69#ifdef CONFIG_EPACKET_BUFFERS_TX_DELAYABLE_WORK
70 struct k_work_delayable dwork;
137#define EPACKET_KEY_ID_REQ_MAGIC 0x4D
145#define EPACKET_RATE_LIMIT_REQ_MAGIC 0x4E
355 uint32_t key_identifier, uint16_t flags,
384 uint32_t key_id = 0x00;
epacket_interface_id
Definition interface.h:55
static uint16_t epacket_interface_max_packet_size(const struct device *dev)
Get current maximum packet size.
Definition interface.h:218
epacket_auth
Definition packet.h:38
struct net_buf * epacket_alloc_tx(k_timeout_t timeout)
Allocate ePacket TX buffer.
int epacket_received_packet_append(struct net_buf *storage_buf, struct net_buf *received_buf)
Append received packet to storage buffer.
struct net_buf * epacket_alloc_rx(k_timeout_t timeout)
Allocate ePacket RX buffer.
void epacket_global_flags_set(uint16_t flags)
Set global flags for all transmitted packets.
void epacket_rate_limit_reset(void)
Reset any active rate limits.
epacket_flags
Definition packet.h:119
void(* epacket_tx_done_cb)(const struct device *dev, struct net_buf *pkt, int result, void *user_data)
Callback run when packet is transmitted.
Definition packet.h:64
int epacket_num_buffers_free_rx(void)
Query the number of free RX buffers.
int epacket_num_buffers_free_tx(void)
Query the number of free TX buffers.
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.
Definition packet.h:380
static void epacket_set_tx_metadata_core(struct net_buf *buf, enum epacket_auth auth, uint32_t key_identifier, uint16_t flags, enum infuse_type type, union epacket_interface_address dest)
Set all metadata on a packet.
Definition packet.h:354
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.
Definition packet.h:320
uint16_t epacket_global_flags_get(void)
Get the current global flags value.
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.
Definition packet.h:402
epacket_forward_auto_conn_flags
Definition packet.h:209
void epacket_rate_limit_tx(k_ticks_t *last_call, uint16_t bytes_transmitted)
Limit the transmission rate of bulk data paths.
@ EPACKET_AUTH_NETWORK
Definition packet.h:43
@ EPACKET_AUTH_DEVICE
Definition packet.h:44
@ EPACKET_AUTH_FAILURE
Definition packet.h:40
@ EPACKET_AUTH_REMOTE_ENCRYPTED
Definition packet.h:42
@ EPACKET_FLAGS_ENCRYPTION_NETWORK
Definition packet.h:122
@ EPACKET_FLAGS_CLOUD_SELF
Definition packet.h:128
@ EPACKET_FLAGS_ENCRYPTION_DEVICE
Definition packet.h:121
@ EPACKET_FLAGS_INTERFACE_MASK
Definition packet.h:131
@ EPACKET_FLAGS_ACK_REQUEST
Definition packet.h:124
@ EPACKET_FLAGS_CLOUD_FORWARDING
Definition packet.h:126
@ EPACKET_FORWARD_AUTO_CONN_DC_NOTIFICATION
Definition packet.h:215
@ EPACKET_FORWARD_AUTO_CONN_SUB_DATA
Definition packet.h:213
@ EPACKET_FORWARD_AUTO_CONN_PRIORITISE_UPLINK
Definition packet.h:217
@ EPACKET_FORWARD_AUTO_CONN_SINGLE_RPC
Definition packet.h:211
uint32_t infuse_security_network_key_identifier(void)
Get the current network key identifier.
uint32_t infuse_security_device_key_identifier(void)
Get the current device key identifier.
infuse_type
Core Infuse Data Types.
Definition types.h:26
Core Infuse-IoT platform types.
Infuse Platform Security Identifiers.
Packet for INFUSE_EPACKET_CONN_TERMINATED.
Definition packet.h:239
uint8_t interface
Definition packet.h:241
int16_t reason
Definition packet.h:243
uint8_t address[]
Definition packet.h:245
Format of BLE address in INFUSE_RECEIVED_EPACKET and INFUSE_EPACKET_FORWARD.
Definition packet.h:164
uint8_t type
Definition packet.h:165
uint8_t addr[6]
Definition packet.h:166
Common config struct for all interfaces.
Definition interface.h:166
uint8_t footer_size
Definition interface.h:169
uint8_t header_size
Definition interface.h:168
Format of INFUSE_KEY_IDS packet.
Definition packet.h:140
uint8_t device_key_id[3]
Definition packet.h:141
Magic two byte packet that requests a pause in data transmission.
Definition packet.h:148
uint8_t magic
EPACKET_RATE_LIMIT_REQ_MAGIC
Definition packet.h:150
uint8_t delay_ms
Duration to pause transmission for.
Definition packet.h:152
Magic three byte packet that sets a target data throughput.
Definition packet.h:156
uint16_t target_throughput_kbps
Target data throughput in kilobits/sec.
Definition packet.h:160
uint8_t magic
EPACKET_RATE_LIMIT_REQ_MAGIC
Definition packet.h:158
bt_addr_le_t bluetooth
Definition packet.h:50