YAPB
Loading...
Searching...
No Matches
Types

Data Structures

struct  YAPB_Packet
 Opaque packet handle, stack-allocatable. More...
struct  YAPB_Element
 Tagged union returned by YAPB_pop_next(). More...

Macros

#define YAPB_MODE_WRITE   0
 Packet is in write mode.
#define YAPB_MODE_READ   1
 Packet is in read mode.
#define YAPB_HEADER_SIZE   4
 Size of the packet header in bytes.
#define YAPB_PACKET_SIZE   48
 Size of the opaque YAPB_Packet_t storage in bytes.

Typedefs

typedef struct YAPB_Packet YAPB_Packet_t
 Opaque packet handle, stack-allocatable.
typedef struct YAPB_Element YAPB_Element_t
 Tagged union returned by YAPB_pop_next().

Enumerations

enum  YAPB_Type_t {
  YAPB_INT8 = 0x00 , YAPB_INT16 = 0x01 , YAPB_INT32 = 0x02 , YAPB_INT64 = 0x03 ,
  YAPB_FLOAT = 0x04 , YAPB_DOUBLE = 0x05 , YAPB_BLOB = 0x0E , YAPB_NESTED_PKT = 0x0F
}
 Element type tags stored in the wire format. More...
enum  YAPB_Result_t {
  YAPB_ERR_NO_MORE_ELEMENTS = -7 , YAPB_ERR_INVALID_PACKET = -6 , YAPB_ERR_TYPE_MISMATCH = -5 , YAPB_ERR_INVALID_MODE = -4 ,
  YAPB_ERR_BUFFER_TOO_SMALL = -3 , YAPB_ERR_NULL_PTR = -2 , YAPB_ERR_UNKNOWN = -1 , YAPB_OK = 0 ,
  YAPB_STS_COMPLETE = 1
}
 Result codes returned by all YAPB functions. More...

Detailed Description

Core types, enumerations, and constants.

Typedef Documentation

◆ YAPB_Element_t

typedef struct YAPB_Element YAPB_Element_t

Tagged union returned by YAPB_pop_next().

The type field indicates which union member in val is valid.

◆ YAPB_Packet_t

typedef struct YAPB_Packet YAPB_Packet_t

Opaque packet handle, stack-allocatable.

Internals are hidden; use YAPB_initialize() or YAPB_load() to set up.

Enumeration Type Documentation

◆ YAPB_Result_t

Result codes returned by all YAPB functions.

Negative values are errors. YAPB_OK indicates success with more data remaining. YAPB_STS_COMPLETE indicates success and the last element has been consumed.

Enumerator
YAPB_ERR_NO_MORE_ELEMENTS 

No more elements to pop.

YAPB_ERR_INVALID_PACKET 

Packet data is malformed.

YAPB_ERR_TYPE_MISMATCH 

Next element type doesn't match the pop call.

YAPB_ERR_INVALID_MODE 

Operation not valid in current mode (read/write).

YAPB_ERR_BUFFER_TOO_SMALL 

Buffer cannot hold the data.

YAPB_ERR_NULL_PTR 

A required pointer argument was NULL.

YAPB_ERR_UNKNOWN 

Unknown error.

YAPB_OK 

Success, more elements may follow.

YAPB_STS_COMPLETE 

Success, last element consumed.

◆ YAPB_Type_t

Element type tags stored in the wire format.

Each element in a packet is prefixed with a one-byte type tag. Tags 0x06-0x0D are reserved for future types.

Enumerator
YAPB_INT8 

Signed 8-bit integer (1 byte value).

YAPB_INT16 

Signed 16-bit integer (2 byte value, network order).

YAPB_INT32 

Signed 32-bit integer (4 byte value, network order).

YAPB_INT64 

Signed 64-bit integer (8 byte value, network order).

YAPB_FLOAT 

IEEE 754 single-precision float (4 bytes, network order).

YAPB_DOUBLE 

IEEE 754 double-precision float (8 bytes, network order).

YAPB_BLOB 

Raw byte blob (2 byte length + N bytes).

YAPB_NESTED_PKT 

Nested packet (complete packet with its own header).