VLCB SDK
An opinionated SDK for VLCB protocol
Loading...
Searching...
No Matches
datagram.h File Reference
#include <inttypes.h>
#include "vlcb/common/vlcb_defs.h"
#include "vlcb/platform/error.h"
Include dependency graph for packet/datagram.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  VlcbNetPacketDatagram
 

Macros

#define VLCB_DGRAM_PKT_MAX_PAYLOAD   7
 

Typedefs

typedef uint8_t VlcbNetDatagramPayload[7]
 

Enumerations

enum  VlcbNetPacketDatagramConstructErr { VLCB_DGRAM_PKT_CONSTRUCT_ERR_OK = 0 , VLCB_DGRAM_PKT_CONSTRUCT_ERR_PAYLOAD_TOO_LARGE , VLCB_DGRAM_PKT_CONSTRUCT_ERR_INVALID_OPCODE , VLCB_DGRAM_PKT_CONSTRUCT_ERR_COUNT }
 

Functions

vlcb_error vlcb_net_pkt_dgram_ConstructErrToStr (VlcbNetPacketDatagramConstructErr err)
 
VlcbNetPacketDatagramConstructErr vlcb_net_pkt_dgram_NewUnchecked (VlcbOpCode opc, uint8_t payload_len, const VlcbNetDatagramPayload *const payload, VlcbNetPacketDatagram *const packet)
 
VlcbNetPacketDatagramConstructErr vlcb_net_pkt_dgram_New (VlcbOpCode opc, uint8_t payload_len, const VlcbNetDatagramPayload *const payload, VlcbNetPacketDatagram *const packet)
 

Macro Definition Documentation

◆ VLCB_DGRAM_PKT_MAX_PAYLOAD

#define VLCB_DGRAM_PKT_MAX_PAYLOAD   7

Definition at line 8 of file packet/datagram.h.

Typedef Documentation

◆ VlcbNetDatagramPayload

typedef uint8_t VlcbNetDatagramPayload[7]

Datagram payload buffer

The type is supposed to function as a helper, so that clients don't have to write the whole expression and ensure it's correct.

Definition at line 17 of file packet/datagram.h.

Enumeration Type Documentation

◆ VlcbNetPacketDatagramConstructErr

Enumerator
VLCB_DGRAM_PKT_CONSTRUCT_ERR_OK 
VLCB_DGRAM_PKT_CONSTRUCT_ERR_PAYLOAD_TOO_LARGE 

Given payload was too large

VLCB packets have max payload size of 7 bytes.

VLCB_DGRAM_PKT_CONSTRUCT_ERR_INVALID_OPCODE 

Opcode has invalid value

VLCB_DGRAM_PKT_CONSTRUCT_ERR_COUNT 

Not an actual error. Can be used to check if the given error value is within the enum range.

Definition at line 25 of file packet/datagram.h.

Function Documentation

◆ vlcb_net_pkt_dgram_ConstructErrToStr()

vlcb_error vlcb_net_pkt_dgram_ConstructErrToStr ( VlcbNetPacketDatagramConstructErr err)

Definition at line 7 of file packet/datagram.c.

◆ vlcb_net_pkt_dgram_New()

VlcbNetPacketDatagramConstructErr vlcb_net_pkt_dgram_New ( VlcbOpCode opc,
uint8_t payload_len,
const VlcbNetDatagramPayload *const payload,
VlcbNetPacketDatagram *const packet )

Definition at line 26 of file packet/datagram.c.

Here is the caller graph for this function:

◆ vlcb_net_pkt_dgram_NewUnchecked()

VlcbNetPacketDatagramConstructErr vlcb_net_pkt_dgram_NewUnchecked ( VlcbOpCode opc,
uint8_t payload_len,
const VlcbNetDatagramPayload *const payload,
VlcbNetPacketDatagram *const packet )

Definition at line 21 of file packet/datagram.c.