librfn
An ad-hoc utility library
Macros | Functions
pack.c File Reference
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "librfn.h"

Go to the source code of this file.

Macros

#define PACK(pack, decl, sz)
 
#define UNPACK(pack, decl, sz)
 

Functions

void rf_pack_init (rf_pack_t *pack, void *p, unsigned int sz)
 
int rf_pack_remaining (rf_pack_t *pack)
 
void rf_pack_bytes (rf_pack_t *pack, void *p, unsigned int sz)
 
void rf_pack_char (rf_pack_t *pack, char c)
 
void rf_pack_s8 (rf_pack_t *pack, int8_t s8)
 
void rf_pack_u8 (rf_pack_t *pack, int16_t u8)
 
void rf_pack_s16be (rf_pack_t *pack, int16_t s16)
 
void rf_pack_s16le (rf_pack_t *pack, int16_t s16)
 
void rf_pack_u16be (rf_pack_t *pack, uint16_t u16)
 
void rf_pack_u16le (rf_pack_t *pack, uint16_t u16)
 
void rf_pack_s32be (rf_pack_t *pack, int32_t s32)
 
void rf_pack_s32le (rf_pack_t *pack, int32_t s32)
 
void rf_pack_u32be (rf_pack_t *pack, uint32_t u32)
 
void rf_pack_u32le (rf_pack_t *pack, uint32_t u32)
 
void rf_unpack_bytes (rf_pack_t *pack, void *p, unsigned int sz)
 
char rf_unpack_char (rf_pack_t *pack)
 
int8_t rf_unpack_s8 (rf_pack_t *pack)
 
uint8_t rf_unpack_u8 (rf_pack_t *pack)
 
int16_t rf_unpack_s16be (rf_pack_t *pack)
 
int16_t rf_unpack_s16le (rf_pack_t *pack)
 
uint16_t rf_unpack_u16be (rf_pack_t *pack)
 
uint16_t rf_unpack_u16le (rf_pack_t *pack)
 
int32_t rf_unpack_s32be (rf_pack_t *pack)
 
int32_t rf_unpack_s32le (rf_pack_t *pack)
 
uint32_t rf_unpack_u32be (rf_pack_t *pack)
 
uint32_t rf_unpack_u32le (rf_pack_t *pack)
 

Macro Definition Documentation

#define PACK (   pack,
  decl,
  sz 
)
Value:
uint8_t *decl = pack->p; \
pack->p += sz; \
if (pack->p <= pack->endp)

Definition at line 33 of file pack.c.

#define UNPACK (   pack,
  decl,
  sz 
)
Value:
uint8_t *decl = pack->p; \
pack->p += sz; \
if (pack->p > pack->endp) \
return 0; \
else

Definition at line 99 of file pack.c.

Function Documentation

void rf_pack_char ( rf_pack_t pack,
char  c 
)
void rf_pack_s16be ( rf_pack_t pack,
int16_t  s16 
)
void rf_pack_s32be ( rf_pack_t pack,
int32_t  s32 
)
void rf_pack_s8 ( rf_pack_t pack,
int8_t  s8 
)
void rf_pack_u32be ( rf_pack_t pack,
uint32_t  u32 
)
void rf_pack_u8 ( rf_pack_t pack,
int16_t  u8 
)
int16_t rf_unpack_s16be ( rf_pack_t pack)
int16_t rf_unpack_s16le ( rf_pack_t pack)
int32_t rf_unpack_s32be ( rf_pack_t pack)
int32_t rf_unpack_s32le ( rf_pack_t pack)
uint16_t rf_unpack_u16be ( rf_pack_t pack)
uint32_t rf_unpack_u32be ( rf_pack_t pack)