libosmocore 1.13.1.1-afb4 Osmocom core library

Data Structures | Macros | Functions
msgb.h File Reference
Message buffers
`#include <stdint.h>`
`#include <osmocom/core/linuxlist.h>`
`#include <osmocom/core/utils.h>`
`#include <osmocom/core/bits.h>`
`#include <osmocom/core/defs.h>`
`#include <osmocom/core/panic.h>`

Go to the source code of this file.

## Data Structures
struct | msgb
| Osmocom message buffer. More...

## Macros
#define | MSGB_DEBUG
#define | MSGB_ABORT(msg, fmt, args ...)
#define | msgb_l1(m) ((void *)((m)->l1h))
| obtain L1 header of msgb More...
#define | msgb_l2(m) ((void *)((m)->l2h))
| obtain L2 header of msgb More...
#define | msgb_l3(m) ((void *)((m)->l3h))
| obtain L3 header of msgb More...
#define | msgb_l4(m) ((void *)((m)->l4h))
| obtain L4 header of msgb More...
#define | msgb_sms(m) msgb_l4(m)
| obtain SMS header of msgb More...
#define | msgb_eq_data(msg, data, len) _msgb_eq(__FILE__, __LINE__, __func__, 0, msg, data, len, false)
| Compare: check data in msgb against given data. More...
#define | msgb_eq_l1_data(msg, data, len) _msgb_eq(__FILE__, __LINE__, __func__, 1, msg, data, len, false)
| Compare: check L1 data in msgb against given data. More...
#define | msgb_eq_l2_data(msg, data, len) _msgb_eq(__FILE__, __LINE__, __func__, 2, msg, data, len, false)
| Compare: check L2 data in msgb against given data. More...
#define | msgb_eq_l3_data(msg, data, len) _msgb_eq(__FILE__, __LINE__, __func__, 3, msg, data, len, false)
| Compare: check L3 data in msgb against given data. More...
#define | msgb_eq_l4_data(msg, data, len) _msgb_eq(__FILE__, __LINE__, __func__, 4, msg, data, len, false)
| Compare: check L4 data in msgb against given data. More...
#define | msgb_eq_data_print(msg, data, len) _msgb_eq(__FILE__, __LINE__, __func__, 0, msg, data, len, true)
| Compare and print: check data in msgb against given data and print errors if any. More...
#define | msgb_eq_l1_data_print(msg, data, len) _msgb_eq(__FILE__, __LINE__, __func__, 1, msg, data, len, true)
| Compare and print: check L1 data in msgb against given data and print errors if any. More...
#define | msgb_eq_l2_data_print(msg, data, len) _msgb_eq(__FILE__, __LINE__, __func__, 2, msg, data, len, true)
| Compare and print: check L2 data in msgb against given data and print errors if any. More...
#define | msgb_eq_l3_data_print(msg, data, len) _msgb_eq(__FILE__, __LINE__, __func__, 3, msg, data, len, true)
| Compare and print: check L3 data in msgb against given data and print errors if any. More...
#define | msgb_eq_l4_data_print(msg, data, len) _msgb_eq(__FILE__, __LINE__, __func__, 4, msg, data, len, true)
| Compare and print: check L4 data in msgb against given data and print errors if any. More...
#define | msgb_eq(msg1, msg2) msgb_eq_data(msg1, msgb_data(msg2), msgb_length(msg2))
| Compare msgbs. More...
#define | msgb_eq_l1(msg1, msg2) msgb_eq_l1_data(msg1, msgb_l1(msg2), msgb_l1len(msg2))
| Compare msgbs L1 content. More...
#define | msgb_eq_l2(msg1, msg2) msgb_eq_l2_data(msg1, msgb_l2(msg2), msgb_l2len(msg2))
| Compare msgbs L2 content. More...
#define | msgb_eq_l3(msg1, msg2) msgb_eq_l3_data(msg1, msgb_l3(msg2), msgb_l3len(msg2))
| Compare msgbs L3 content. More...
#define | msgb_eq_l4(msg1, msg2) msgb_eq_l4_data(msg1, msgb_l4(msg2), msgb_l4len(msg2))
| Compare msgbs L4 content. More...

## Functions
struct msgb * | msgb_alloc_c (const void *ctx, uint16_t size, const char *name)
| Allocate a new message buffer from given talloc context. More...
struct msgb * | msgb_alloc (uint16_t size, const char *name)
| Allocate a new message buffer from tall_msgb_ctx. More...
void | msgb_free (struct msgb *m)
| Release given message buffer. More...
void | msgb_enqueue (struct llist_head *queue, struct msgb *msg)
| Enqueue message buffer to tail of a queue. More...
struct msgb * | msgb_dequeue (struct llist_head *queue)
| Dequeue message buffer from head of queue. More...
void | msgb_reset (struct msgb *msg)
| Re-set all message buffer pointers. More...
uint16_t | msgb_length (const struct msgb *msg)
| get length of message buffer More...
const char * | msgb_hexdump (const struct msgb *msg)
| Return a (static) buffer containing a hexdump of the msg. More...
char * | msgb_hexdump_buf (char *buf, size_t buf_len, const struct msgb *msg)
| fill user-provided buffer with hexdump of the msg. More...
char * | msgb_hexdump_c (const void *ctx, const struct msgb *msg)
| Return a dynamically allocated buffer containing a hexdump of the msg. More...
int | msgb_resize_area (struct msgb *msg, uint8_t *area, int old_size, int new_size)
| Resize an area within an msgb. More...
struct msgb * | msgb_copy (const struct msgb *msg, const char *name)
| Copy an msgb. More...
struct msgb * | msgb_copy_c (const void *ctx, const struct msgb *msg, const char *name)
| Copy an msgb. More...
struct msgb * | msgb_copy_resize (const struct msgb *msg, uint16_t new_len, const char *name)
| Copy an msgb with memory reallocation. More...
struct msgb * | msgb_copy_resize_c (const void *ctx, const struct msgb *msg, uint16_t new_len, const char *name)
| Copy an msgb with memory reallocation. More...
static int | msgb_test_invariant (const struct msgb *msg)
| Check a message buffer for consistency. More...
static void | msgb_queue_free (struct llist_head *queue)
| Free all msgbs from a queue built with msgb_enqueue(). More...
static void | msgb_enqueue_count (struct llist_head *queue, struct msgb *msg, unsigned int *count)
| Enqueue message buffer to tail of a queue and increment queue size counter. More...
static struct msgb * | msgb_dequeue_count (struct llist_head *queue, unsigned int *count)
| Dequeue message buffer from head of queue and decrement queue size counter. More...
static unsigned int | msgb_l1len (const struct msgb *msgb)
| determine length of L1 message More...
static unsigned int | msgb_l2len (const struct msgb *msgb)
| determine length of L2 message More...
static unsigned int | msgb_l3len (const struct msgb *msgb)
| determine length of L3 message More...
static unsigned int | msgb_l4len (const struct msgb *msgb)
| determine length of L4 message More...
static unsigned int | msgb_headlen (const struct msgb *msgb)
| determine the length of the header More...
static int | msgb_tailroom (const struct msgb *msgb)
| determine how much tail room is left in msgb More...
static int | msgb_headroom (const struct msgb *msgb)
| determine the amount of headroom in msgb More...
static unsigned char * | msgb_put (struct msgb *msgb, unsigned int len)
| append data to end of message buffer More...
static void | msgb_put_u8 (struct msgb *msgb, uint8_t word)
| append a uint8 value to the end of the message More...
static void | msgb_put_u16 (struct msgb *msgb, uint16_t word)
| append a uint16 value to the end of the message More...
static void | msgb_put_u32 (struct msgb *msgb, uint32_t word)
| append a uint32 value to the end of the message More...
static unsigned char * | msgb_get (struct msgb *msgb, unsigned int len)
| remove data from end of message More...
static uint8_t | msgb_get_u8 (struct msgb *msgb)
| remove uint8 from end of message More...
static uint16_t | msgb_get_u16 (struct msgb *msgb)
| remove uint16 from end of message More...
static uint32_t | msgb_get_u32 (struct msgb *msgb)
| remove uint32 from end of message More...
static unsigned char * | msgb_push (struct msgb *msgb, unsigned int len)
| prepend (push) some data to start of message More...
static void | msgb_push_u8 (struct msgb *msg, uint8_t word)
| prepend a uint8 value to the head of the message More...
static void | msgb_push_u16 (struct msgb *msg, uint16_t word)
| prepend a uint16 value to the head of the message More...
static void | msgb_push_u32 (struct msgb *msg, uint32_t word)
| prepend a uint32 value to the head of the message More...
static unsigned char * | msgb_push_tl (struct msgb *msgb, uint8_t tag)
static unsigned char * | msgb_pull (struct msgb *msgb, unsigned int len)
| remove (pull) a header from the front of the message buffer More...
static unsigned char * | msgb_pull_to_l3 (struct msgb *msg)
| remove (pull) all headers in front of l3h from the message buffer. More...
static unsigned char * | msgb_pull_to_l2 (struct msgb *msg)
| remove (pull) all headers in front of l2h from the message buffer. More...
static uint8_t | msgb_pull_u8 (struct msgb *msgb)
| remove uint8 from front of message More...
static uint16_t | msgb_pull_u16 (struct msgb *msgb)
| remove uint16 from front of message More...
static uint32_t | msgb_pull_u32 (struct msgb *msgb)
| remove uint32 from front of message More...
static void | msgb_reserve (struct msgb *msg, int len)
| Increase headroom of empty msgb, reducing the tailroom. More...
static int | msgb_trim (struct msgb *msg, int len)
| Trim the msgb to a given absolute length. More...
static int | msgb_l3trim (struct msgb *msg, int l3len)
| Trim the msgb to a given layer3 length. More...
static struct msgb * | msgb_alloc_headroom_c (const void *ctx, uint16_t size, uint16_t headroom, const char *name)
| Allocate message buffer with specified headroom from specified talloc context. More...
static struct msgb * | msgb_alloc_headroom (uint16_t size, uint16_t headroom, const char *name)
| Allocate message buffer with specified headroom. More...
bool | _msgb_eq (const char *file, size_t line, const char *func, uint8_t level, const struct msgb *msg, const uint8_t *data, size_t len, bool print)
| Compare and print: check data in msgb against given data and print errors if any. More...
uint8_t * | msgb_data (const struct msgb *msg)
| get pointer to data section of message buffer More...
void * | msgb_talloc_ctx_init (void *root_ctx, unsigned int pool_size)
| Initialize a msgb talloc context for msgb_alloc. More...
void | msgb_set_talloc_ctx (void *ctx)
| Set the talloc context for msgb_alloc Deprecated, use msgb_talloc_ctx_init() instead. More...
int | msgb_printf (struct msgb *msgb, const char *format,...)
| Print a string to the end of message buffer. More...
static const char * | msgb_hexdump_l1 (const struct msgb *msg)
static const char * | msgb_hexdump_l2 (const struct msgb *msg)
static const char * | msgb_hexdump_l3 (const struct msgb *msg)
static const char * | msgb_hexdump_l4 (const struct msgb *msg)