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

Go to the source code of this file.

Data Structures

struct  VlcbNetPacket
 

Macros

#define VLCB_NET_PKT_MAX_PAYLOAD   7
 

Typedefs

typedef uint8_t VlcbNetPayload[7]
 

Enumerations

enum  VlcbNetProtocol { VLCB_NET_PROTO_DATAGRAM , VLCB_NET_PROTO_STREAM }
 
enum  VlcbNetPacketConstructErr { VLCB_NET_PKT_CONSTRUCT_ERR_OK = 0 , VLCB_NET_PKT_CONSTRUCT_ERR_PAYLOAD_TOO_LARGE , VLCB_NET_PKT_CONSTRUCT_ERR_INVALID_OPCODE , VLCB_NET_PKT_CONSTRUCT_ERR_COUNT }
 

Functions

VlcbNetProtocol vlcb_net_pkt_DetectProtocol (VlcbOpCode opc)
 
vlcb_error vlcb_net_pkt_ConstructErrToStr (VlcbNetPacketConstructErr err)
 
void vlcb_net_pkt_NewUnchecked (VlcbNetProtocol proto, VlcbOpCode opc, uint8_t payload_len, const VlcbNetPayload *const payload, VlcbNetPacket *const packet)
 
VlcbNetPacketConstructErr vlcb_net_pkt_New (VlcbOpCode opc, uint8_t payload_len, const VlcbNetPayload *const payload, VlcbNetPacket *const packet)
 

Macro Definition Documentation

◆ VLCB_NET_PKT_MAX_PAYLOAD

#define VLCB_NET_PKT_MAX_PAYLOAD   7

Definition at line 8 of file vlcb.h.

Typedef Documentation

◆ VlcbNetPayload

typedef uint8_t VlcbNetPayload[7]

VLCB 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 vlcb.h.

Enumeration Type Documentation

◆ VlcbNetPacketConstructErr

Enumerator
VLCB_NET_PKT_CONSTRUCT_ERR_OK 
VLCB_NET_PKT_CONSTRUCT_ERR_PAYLOAD_TOO_LARGE 

Given payload was too large

VLCB packets have max payload size of 7 bytes.

VLCB_NET_PKT_CONSTRUCT_ERR_INVALID_OPCODE 

Opcode has invalid value

VLCB_NET_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 40 of file vlcb.h.

◆ VlcbNetProtocol

VLCB sub-protocol

VLCB doesn't define any "sub-protocol", but this library uses this as a helper for separating traffic for easier handling.

Enumerator
VLCB_NET_PROTO_DATAGRAM 
VLCB_NET_PROTO_STREAM 

Definition at line 26 of file vlcb.h.

Function Documentation

◆ vlcb_net_pkt_ConstructErrToStr()

vlcb_error vlcb_net_pkt_ConstructErrToStr ( VlcbNetPacketConstructErr err)

Definition at line 15 of file vlcb.c.

Here is the caller graph for this function:

◆ vlcb_net_pkt_DetectProtocol()

VlcbNetProtocol vlcb_net_pkt_DetectProtocol ( VlcbOpCode opc)

Definition at line 6 of file vlcb.c.

Here is the caller graph for this function:

◆ vlcb_net_pkt_New()

VlcbNetPacketConstructErr vlcb_net_pkt_New ( VlcbOpCode opc,
uint8_t payload_len,
const VlcbNetPayload *const payload,
VlcbNetPacket *const packet )

Definition at line 35 of file vlcb.c.

Here is the caller graph for this function:

◆ vlcb_net_pkt_NewUnchecked()

void vlcb_net_pkt_NewUnchecked ( VlcbNetProtocol proto,
VlcbOpCode opc,
uint8_t payload_len,
const VlcbNetPayload *const payload,
VlcbNetPacket *const packet )

Definition at line 28 of file vlcb.c.

Here is the caller graph for this function: