\doxysection{Message buffers}
\label{group__msgb}\index{Message buffers@{Message buffers}}


libosmocore message buffers, inspired by Linux kernel skbuff  


\doxysubsection*{Files}
\begin{DoxyCompactItemize}
\item 
file \textbf{ msgb.\+h}
\item 
file \textbf{ msgb.\+c}
\end{DoxyCompactItemize}
\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ msgb}
\begin{DoxyCompactList}\small\item\em Osmocom message buffer. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \textbf{ MSGB\+\_\+\+DEBUG}
\item 
\#define \textbf{ MSGB\+\_\+\+ABORT}(\textbf{ msg},  fmt,  args ...)
\item 
\#define \textbf{ msgb\+\_\+l1}(m)~((void $\ast$)((m)-\/$>$l1h))
\begin{DoxyCompactList}\small\item\em obtain L1 header of msgb \end{DoxyCompactList}\item 
\#define \textbf{ msgb\+\_\+l2}(m)~((void $\ast$)((m)-\/$>$l2h))
\begin{DoxyCompactList}\small\item\em obtain L2 header of msgb \end{DoxyCompactList}\item 
\#define \textbf{ msgb\+\_\+l3}(m)~((void $\ast$)((m)-\/$>$l3h))
\begin{DoxyCompactList}\small\item\em obtain L3 header of msgb \end{DoxyCompactList}\item 
\#define \textbf{ msgb\+\_\+l4}(m)~((void $\ast$)((m)-\/$>$l4h))
\begin{DoxyCompactList}\small\item\em obtain L4 header of msgb \end{DoxyCompactList}\item 
\#define \textbf{ msgb\+\_\+sms}(m)~\textbf{ msgb\+\_\+l4}(m)
\begin{DoxyCompactList}\small\item\em obtain SMS header of msgb \end{DoxyCompactList}\item 
\#define \textbf{ msgb\+\_\+eq\+\_\+data}(\textbf{ msg},  \textbf{ data},  \textbf{ len})~ \textbf{ \+\_\+msgb\+\_\+eq}(\+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+, \+\_\+\+\_\+func\+\_\+\+\_\+, 0, \textbf{ msg}, \textbf{ data}, \textbf{ len}, false)
\begin{DoxyCompactList}\small\item\em Compare\+: check data in msgb against given data. \end{DoxyCompactList}\item 
\#define \textbf{ msgb\+\_\+eq\+\_\+l1\+\_\+data}(\textbf{ msg},  \textbf{ data},  \textbf{ len})~ \textbf{ \+\_\+msgb\+\_\+eq}(\+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+, \+\_\+\+\_\+func\+\_\+\+\_\+, 1, \textbf{ msg}, \textbf{ data}, \textbf{ len}, false)
\begin{DoxyCompactList}\small\item\em Compare\+: check L1 data in msgb against given data. \end{DoxyCompactList}\item 
\#define \textbf{ msgb\+\_\+eq\+\_\+l2\+\_\+data}(\textbf{ msg},  \textbf{ data},  \textbf{ len})~ \textbf{ \+\_\+msgb\+\_\+eq}(\+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+, \+\_\+\+\_\+func\+\_\+\+\_\+, 2, \textbf{ msg}, \textbf{ data}, \textbf{ len}, false)
\begin{DoxyCompactList}\small\item\em Compare\+: check L2 data in msgb against given data. \end{DoxyCompactList}\item 
\#define \textbf{ msgb\+\_\+eq\+\_\+l3\+\_\+data}(\textbf{ msg},  \textbf{ data},  \textbf{ len})~ \textbf{ \+\_\+msgb\+\_\+eq}(\+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+, \+\_\+\+\_\+func\+\_\+\+\_\+, 3, \textbf{ msg}, \textbf{ data}, \textbf{ len}, false)
\begin{DoxyCompactList}\small\item\em Compare\+: check L3 data in msgb against given data. \end{DoxyCompactList}\item 
\#define \textbf{ msgb\+\_\+eq\+\_\+l4\+\_\+data}(\textbf{ msg},  \textbf{ data},  \textbf{ len})~ \textbf{ \+\_\+msgb\+\_\+eq}(\+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+, \+\_\+\+\_\+func\+\_\+\+\_\+, 4, \textbf{ msg}, \textbf{ data}, \textbf{ len}, false)
\begin{DoxyCompactList}\small\item\em Compare\+: check L4 data in msgb against given data. \end{DoxyCompactList}\item 
\#define \textbf{ msgb\+\_\+eq\+\_\+data\+\_\+print}(\textbf{ msg},  \textbf{ data},  \textbf{ len})~ \textbf{ \+\_\+msgb\+\_\+eq}(\+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+, \+\_\+\+\_\+func\+\_\+\+\_\+, 0, \textbf{ msg}, \textbf{ data}, \textbf{ len}, true)
\begin{DoxyCompactList}\small\item\em Compare and print\+: check data in msgb against given data and print errors if any. \end{DoxyCompactList}\item 
\#define \textbf{ msgb\+\_\+eq\+\_\+l1\+\_\+data\+\_\+print}(\textbf{ msg},  \textbf{ data},  \textbf{ len})~ \textbf{ \+\_\+msgb\+\_\+eq}(\+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+, \+\_\+\+\_\+func\+\_\+\+\_\+, 1, \textbf{ msg}, \textbf{ data}, \textbf{ len}, true)
\begin{DoxyCompactList}\small\item\em Compare and print\+: check L1 data in msgb against given data and print errors if any. \end{DoxyCompactList}\item 
\#define \textbf{ msgb\+\_\+eq\+\_\+l2\+\_\+data\+\_\+print}(\textbf{ msg},  \textbf{ data},  \textbf{ len})~ \textbf{ \+\_\+msgb\+\_\+eq}(\+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+, \+\_\+\+\_\+func\+\_\+\+\_\+, 2, \textbf{ msg}, \textbf{ data}, \textbf{ len}, true)
\begin{DoxyCompactList}\small\item\em Compare and print\+: check L2 data in msgb against given data and print errors if any. \end{DoxyCompactList}\item 
\#define \textbf{ msgb\+\_\+eq\+\_\+l3\+\_\+data\+\_\+print}(\textbf{ msg},  \textbf{ data},  \textbf{ len})~ \textbf{ \+\_\+msgb\+\_\+eq}(\+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+, \+\_\+\+\_\+func\+\_\+\+\_\+, 3, \textbf{ msg}, \textbf{ data}, \textbf{ len}, true)
\begin{DoxyCompactList}\small\item\em Compare and print\+: check L3 data in msgb against given data and print errors if any. \end{DoxyCompactList}\item 
\#define \textbf{ msgb\+\_\+eq\+\_\+l4\+\_\+data\+\_\+print}(\textbf{ msg},  \textbf{ data},  \textbf{ len})~ \textbf{ \+\_\+msgb\+\_\+eq}(\+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+, \+\_\+\+\_\+func\+\_\+\+\_\+, 4, \textbf{ msg}, \textbf{ data}, \textbf{ len}, true)
\begin{DoxyCompactList}\small\item\em Compare and print\+: check L4 data in msgb against given data and print errors if any. \end{DoxyCompactList}\item 
\#define \textbf{ msgb\+\_\+eq}(msg1,  msg2)~\textbf{ msgb\+\_\+eq\+\_\+data}(msg1, \textbf{ msgb\+\_\+data}(msg2), \textbf{ msgb\+\_\+length}(msg2))
\begin{DoxyCompactList}\small\item\em Compare msgbs. \end{DoxyCompactList}\item 
\#define \textbf{ msgb\+\_\+eq\+\_\+l1}(msg1,  msg2)~\textbf{ msgb\+\_\+eq\+\_\+l1\+\_\+data}(msg1, \textbf{ msgb\+\_\+l1}(msg2), \textbf{ msgb\+\_\+l1len}(msg2))
\begin{DoxyCompactList}\small\item\em Compare msgbs L1 content. \end{DoxyCompactList}\item 
\#define \textbf{ msgb\+\_\+eq\+\_\+l2}(msg1,  msg2)~\textbf{ msgb\+\_\+eq\+\_\+l2\+\_\+data}(msg1, \textbf{ msgb\+\_\+l2}(msg2), \textbf{ msgb\+\_\+l2len}(msg2))
\begin{DoxyCompactList}\small\item\em Compare msgbs L2 content. \end{DoxyCompactList}\item 
\#define \textbf{ msgb\+\_\+eq\+\_\+l3}(msg1,  msg2)~\textbf{ msgb\+\_\+eq\+\_\+l3\+\_\+data}(msg1, \textbf{ msgb\+\_\+l3}(msg2), \textbf{ msgb\+\_\+l3len}(msg2))
\begin{DoxyCompactList}\small\item\em Compare msgbs L3 content. \end{DoxyCompactList}\item 
\#define \textbf{ msgb\+\_\+eq\+\_\+l4}(msg1,  msg2)~\textbf{ msgb\+\_\+eq\+\_\+l4\+\_\+data}(msg1, \textbf{ msgb\+\_\+l4}(msg2), \textbf{ msgb\+\_\+l4len}(msg2))
\begin{DoxyCompactList}\small\item\em Compare msgbs L4 content. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ msgb} $\ast$ \textbf{ msgb\+\_\+alloc\+\_\+c} (const void $\ast$ctx, uint16\+\_\+t size, const char $\ast$\textbf{ name})
\begin{DoxyCompactList}\small\item\em Allocate a new message buffer from given talloc context. \end{DoxyCompactList}\item 
struct \textbf{ msgb} $\ast$ \textbf{ msgb\+\_\+alloc} (uint16\+\_\+t size, const char $\ast$\textbf{ name})
\begin{DoxyCompactList}\small\item\em Allocate a new message buffer from tall\+\_\+msgb\+\_\+ctx. \end{DoxyCompactList}\item 
void \textbf{ msgb\+\_\+free} (struct \textbf{ msgb} $\ast$m)
\begin{DoxyCompactList}\small\item\em Release given message buffer. \end{DoxyCompactList}\item 
void \textbf{ msgb\+\_\+enqueue} (struct \textbf{ llist\+\_\+head} $\ast$queue, struct \textbf{ msgb} $\ast$\textbf{ msg})
\begin{DoxyCompactList}\small\item\em Enqueue message buffer to tail of a queue. \end{DoxyCompactList}\item 
struct \textbf{ msgb} $\ast$ \textbf{ msgb\+\_\+dequeue} (struct \textbf{ llist\+\_\+head} $\ast$queue)
\begin{DoxyCompactList}\small\item\em Dequeue message buffer from head of queue. \end{DoxyCompactList}\item 
void \textbf{ msgb\+\_\+reset} (struct \textbf{ msgb} $\ast$\textbf{ msg})
\begin{DoxyCompactList}\small\item\em Re-\/set all message buffer pointers. \end{DoxyCompactList}\item 
uint16\+\_\+t \textbf{ msgb\+\_\+length} (const struct \textbf{ msgb} $\ast$\textbf{ msg})
\begin{DoxyCompactList}\small\item\em get length of message buffer \end{DoxyCompactList}\item 
const char $\ast$ \textbf{ msgb\+\_\+hexdump} (const struct \textbf{ msgb} $\ast$\textbf{ msg})
\begin{DoxyCompactList}\small\item\em Return a (static) buffer containing a hexdump of the msg. \end{DoxyCompactList}\item 
char $\ast$ \textbf{ msgb\+\_\+hexdump\+\_\+buf} (char $\ast$buf, size\+\_\+t buf\+\_\+len, const struct \textbf{ msgb} $\ast$\textbf{ msg})
\begin{DoxyCompactList}\small\item\em fill user-\/provided buffer with hexdump of the msg. \end{DoxyCompactList}\item 
char $\ast$ \textbf{ msgb\+\_\+hexdump\+\_\+c} (const void $\ast$ctx, const struct \textbf{ msgb} $\ast$\textbf{ msg})
\begin{DoxyCompactList}\small\item\em Return a dynamically allocated buffer containing a hexdump of the msg. \end{DoxyCompactList}\item 
int \textbf{ msgb\+\_\+resize\+\_\+area} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t $\ast$area, int old\+\_\+size, int new\+\_\+size)
\begin{DoxyCompactList}\small\item\em Resize an area within an msgb. \end{DoxyCompactList}\item 
struct \textbf{ msgb} $\ast$ \textbf{ msgb\+\_\+copy} (const struct \textbf{ msgb} $\ast$\textbf{ msg}, const char $\ast$\textbf{ name})
\begin{DoxyCompactList}\small\item\em Copy an msgb. \end{DoxyCompactList}\item 
struct \textbf{ msgb} $\ast$ \textbf{ msgb\+\_\+copy\+\_\+c} (const void $\ast$ctx, const struct \textbf{ msgb} $\ast$\textbf{ msg}, const char $\ast$\textbf{ name})
\begin{DoxyCompactList}\small\item\em Copy an msgb. \end{DoxyCompactList}\item 
struct \textbf{ msgb} $\ast$ \textbf{ msgb\+\_\+copy\+\_\+resize} (const struct \textbf{ msgb} $\ast$\textbf{ msg}, uint16\+\_\+t new\+\_\+len, const char $\ast$\textbf{ name})
\begin{DoxyCompactList}\small\item\em Copy an msgb with memory reallocation. \end{DoxyCompactList}\item 
struct \textbf{ msgb} $\ast$ \textbf{ msgb\+\_\+copy\+\_\+resize\+\_\+c} (const void $\ast$ctx, const struct \textbf{ msgb} $\ast$\textbf{ msg}, uint16\+\_\+t new\+\_\+len, const char $\ast$\textbf{ name})
\begin{DoxyCompactList}\small\item\em Copy an msgb with memory reallocation. \end{DoxyCompactList}\item 
static int \textbf{ msgb\+\_\+test\+\_\+invariant} (const struct \textbf{ msgb} $\ast$\textbf{ msg})
\begin{DoxyCompactList}\small\item\em Check a message buffer for consistency. \end{DoxyCompactList}\item 
static void \textbf{ msgb\+\_\+queue\+\_\+free} (struct \textbf{ llist\+\_\+head} $\ast$queue)
\begin{DoxyCompactList}\small\item\em Free all msgbs from a queue built with \doxyref{msgb\+\_\+enqueue()}{p.}{group__msgb_gacb8dd9493eb7fc266ce159e3325c6504}. \end{DoxyCompactList}\item 
static void \textbf{ msgb\+\_\+enqueue\+\_\+count} (struct \textbf{ llist\+\_\+head} $\ast$queue, struct \textbf{ msgb} $\ast$\textbf{ msg}, unsigned int $\ast$count)
\begin{DoxyCompactList}\small\item\em Enqueue message buffer to tail of a queue and increment queue size counter. \end{DoxyCompactList}\item 
static struct \textbf{ msgb} $\ast$ \textbf{ msgb\+\_\+dequeue\+\_\+count} (struct \textbf{ llist\+\_\+head} $\ast$queue, unsigned int $\ast$count)
\begin{DoxyCompactList}\small\item\em Dequeue message buffer from head of queue and decrement queue size counter. \end{DoxyCompactList}\item 
static unsigned int \textbf{ msgb\+\_\+l1len} (const struct \textbf{ msgb} $\ast$\textbf{ msgb})
\begin{DoxyCompactList}\small\item\em determine length of L1 message \end{DoxyCompactList}\item 
static unsigned int \textbf{ msgb\+\_\+l2len} (const struct \textbf{ msgb} $\ast$\textbf{ msgb})
\begin{DoxyCompactList}\small\item\em determine length of L2 message \end{DoxyCompactList}\item 
static unsigned int \textbf{ msgb\+\_\+l3len} (const struct \textbf{ msgb} $\ast$\textbf{ msgb})
\begin{DoxyCompactList}\small\item\em determine length of L3 message \end{DoxyCompactList}\item 
static unsigned int \textbf{ msgb\+\_\+l4len} (const struct \textbf{ msgb} $\ast$\textbf{ msgb})
\begin{DoxyCompactList}\small\item\em determine length of L4 message \end{DoxyCompactList}\item 
static unsigned int \textbf{ msgb\+\_\+headlen} (const struct \textbf{ msgb} $\ast$\textbf{ msgb})
\begin{DoxyCompactList}\small\item\em determine the length of the header \end{DoxyCompactList}\item 
static int \textbf{ msgb\+\_\+tailroom} (const struct \textbf{ msgb} $\ast$\textbf{ msgb})
\begin{DoxyCompactList}\small\item\em determine how much tail room is left in msgb \end{DoxyCompactList}\item 
static int \textbf{ msgb\+\_\+headroom} (const struct \textbf{ msgb} $\ast$\textbf{ msgb})
\begin{DoxyCompactList}\small\item\em determine the amount of headroom in msgb \end{DoxyCompactList}\item 
static unsigned char $\ast$ \textbf{ msgb\+\_\+put} (struct \textbf{ msgb} $\ast$\textbf{ msgb}, unsigned int \textbf{ len})
\begin{DoxyCompactList}\small\item\em append data to end of message buffer \end{DoxyCompactList}\item 
static void \textbf{ msgb\+\_\+put\+\_\+u8} (struct \textbf{ msgb} $\ast$\textbf{ msgb}, uint8\+\_\+t word)
\begin{DoxyCompactList}\small\item\em append a uint8 value to the end of the message \end{DoxyCompactList}\item 
static void \textbf{ msgb\+\_\+put\+\_\+u16} (struct \textbf{ msgb} $\ast$\textbf{ msgb}, uint16\+\_\+t word)
\begin{DoxyCompactList}\small\item\em append a uint16 value to the end of the message \end{DoxyCompactList}\item 
static void \textbf{ msgb\+\_\+put\+\_\+u32} (struct \textbf{ msgb} $\ast$\textbf{ msgb}, uint32\+\_\+t word)
\begin{DoxyCompactList}\small\item\em append a uint32 value to the end of the message \end{DoxyCompactList}\item 
static unsigned char $\ast$ \textbf{ msgb\+\_\+get} (struct \textbf{ msgb} $\ast$\textbf{ msgb}, unsigned int \textbf{ len})
\begin{DoxyCompactList}\small\item\em remove data from end of message \end{DoxyCompactList}\item 
static uint8\+\_\+t \textbf{ msgb\+\_\+get\+\_\+u8} (struct \textbf{ msgb} $\ast$\textbf{ msgb})
\begin{DoxyCompactList}\small\item\em remove uint8 from end of message \end{DoxyCompactList}\item 
static uint16\+\_\+t \textbf{ msgb\+\_\+get\+\_\+u16} (struct \textbf{ msgb} $\ast$\textbf{ msgb})
\begin{DoxyCompactList}\small\item\em remove uint16 from end of message \end{DoxyCompactList}\item 
static uint32\+\_\+t \textbf{ msgb\+\_\+get\+\_\+u32} (struct \textbf{ msgb} $\ast$\textbf{ msgb})
\begin{DoxyCompactList}\small\item\em remove uint32 from end of message \end{DoxyCompactList}\item 
static unsigned char $\ast$ \textbf{ msgb\+\_\+push} (struct \textbf{ msgb} $\ast$\textbf{ msgb}, unsigned int \textbf{ len})
\begin{DoxyCompactList}\small\item\em prepend (push) some data to start of message \end{DoxyCompactList}\item 
static void \textbf{ msgb\+\_\+push\+\_\+u8} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t word)
\begin{DoxyCompactList}\small\item\em prepend a uint8 value to the head of the message \end{DoxyCompactList}\item 
static void \textbf{ msgb\+\_\+push\+\_\+u16} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint16\+\_\+t word)
\begin{DoxyCompactList}\small\item\em prepend a uint16 value to the head of the message \end{DoxyCompactList}\item 
static void \textbf{ msgb\+\_\+push\+\_\+u32} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint32\+\_\+t word)
\begin{DoxyCompactList}\small\item\em prepend a uint32 value to the head of the message \end{DoxyCompactList}\item 
static unsigned char $\ast$ \textbf{ msgb\+\_\+push\+\_\+tl} (struct \textbf{ msgb} $\ast$\textbf{ msgb}, uint8\+\_\+t tag)
\item 
static unsigned char $\ast$ \textbf{ msgb\+\_\+pull} (struct \textbf{ msgb} $\ast$\textbf{ msgb}, unsigned int \textbf{ len})
\begin{DoxyCompactList}\small\item\em remove (pull) a header from the front of the message buffer \end{DoxyCompactList}\item 
static unsigned char $\ast$ \textbf{ msgb\+\_\+pull\+\_\+to\+\_\+l3} (struct \textbf{ msgb} $\ast$\textbf{ msg})
\begin{DoxyCompactList}\small\item\em remove (pull) all headers in front of l3h from the message buffer. \end{DoxyCompactList}\item 
static unsigned char $\ast$ \textbf{ msgb\+\_\+pull\+\_\+to\+\_\+l2} (struct \textbf{ msgb} $\ast$\textbf{ msg})
\begin{DoxyCompactList}\small\item\em remove (pull) all headers in front of l2h from the message buffer. \end{DoxyCompactList}\item 
static uint8\+\_\+t \textbf{ msgb\+\_\+pull\+\_\+u8} (struct \textbf{ msgb} $\ast$\textbf{ msgb})
\begin{DoxyCompactList}\small\item\em remove uint8 from front of message \end{DoxyCompactList}\item 
static uint16\+\_\+t \textbf{ msgb\+\_\+pull\+\_\+u16} (struct \textbf{ msgb} $\ast$\textbf{ msgb})
\begin{DoxyCompactList}\small\item\em remove uint16 from front of message \end{DoxyCompactList}\item 
static uint32\+\_\+t \textbf{ msgb\+\_\+pull\+\_\+u32} (struct \textbf{ msgb} $\ast$\textbf{ msgb})
\begin{DoxyCompactList}\small\item\em remove uint32 from front of message \end{DoxyCompactList}\item 
static void \textbf{ msgb\+\_\+reserve} (struct \textbf{ msgb} $\ast$\textbf{ msg}, int \textbf{ len})
\begin{DoxyCompactList}\small\item\em Increase headroom of empty msgb, reducing the tailroom. \end{DoxyCompactList}\item 
static int \textbf{ msgb\+\_\+trim} (struct \textbf{ msgb} $\ast$\textbf{ msg}, int \textbf{ len})
\begin{DoxyCompactList}\small\item\em Trim the msgb to a given absolute length. \end{DoxyCompactList}\item 
static int \textbf{ msgb\+\_\+l3trim} (struct \textbf{ msgb} $\ast$\textbf{ msg}, int l3len)
\begin{DoxyCompactList}\small\item\em Trim the msgb to a given layer3 length. \end{DoxyCompactList}\item 
static struct \textbf{ msgb} $\ast$ \textbf{ msgb\+\_\+alloc\+\_\+headroom\+\_\+c} (const void $\ast$ctx, uint16\+\_\+t size, uint16\+\_\+t headroom, const char $\ast$\textbf{ name})
\begin{DoxyCompactList}\small\item\em Allocate message buffer with specified headroom from specified talloc context. \end{DoxyCompactList}\item 
static struct \textbf{ msgb} $\ast$ \textbf{ msgb\+\_\+alloc\+\_\+headroom} (uint16\+\_\+t size, uint16\+\_\+t headroom, const char $\ast$\textbf{ name})
\begin{DoxyCompactList}\small\item\em Allocate message buffer with specified headroom. \end{DoxyCompactList}\item 
bool \textbf{ \+\_\+msgb\+\_\+eq} (const char $\ast$\textbf{ file}, size\+\_\+t line, const char $\ast$func, uint8\+\_\+t \textbf{ level}, const struct \textbf{ msgb} $\ast$\textbf{ msg}, const uint8\+\_\+t $\ast$\textbf{ data}, size\+\_\+t \textbf{ len}, bool print)
\begin{DoxyCompactList}\small\item\em Compare and print\+: check data in msgb against given data and print errors if any. \end{DoxyCompactList}\item 
uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+data} (const struct \textbf{ msgb} $\ast$\textbf{ msg})
\begin{DoxyCompactList}\small\item\em get pointer to data section of message buffer \end{DoxyCompactList}\item 
void $\ast$ \textbf{ msgb\+\_\+talloc\+\_\+ctx\+\_\+init} (void $\ast$root\+\_\+ctx, unsigned int pool\+\_\+size)
\begin{DoxyCompactList}\small\item\em Initialize a msgb talloc context for \doxyref{msgb\+\_\+alloc}{p.}{group__msgb_ga25906d049cbad1bf2d5a785319268ea8}. \end{DoxyCompactList}\item 
void \textbf{ msgb\+\_\+set\+\_\+talloc\+\_\+ctx} (void $\ast$ctx)
\begin{DoxyCompactList}\small\item\em Set the talloc context for \doxyref{msgb\+\_\+alloc}{p.}{group__msgb_ga25906d049cbad1bf2d5a785319268ea8} Deprecated, use \doxyref{msgb\+\_\+talloc\+\_\+ctx\+\_\+init()}{p.}{group__msgb_ga66fd1ee6b6667bf707fcef99ee2fb7db} instead. \end{DoxyCompactList}\item 
int \textbf{ msgb\+\_\+printf} (struct \textbf{ msgb} $\ast$\textbf{ msgb}, const char $\ast$format,...)
\begin{DoxyCompactList}\small\item\em Print a string to the end of message buffer. \end{DoxyCompactList}\item 
static const char $\ast$ \textbf{ msgb\+\_\+hexdump\+\_\+l1} (const struct \textbf{ msgb} $\ast$\textbf{ msg})
\item 
static const char $\ast$ \textbf{ msgb\+\_\+hexdump\+\_\+l2} (const struct \textbf{ msgb} $\ast$\textbf{ msg})
\item 
static const char $\ast$ \textbf{ msgb\+\_\+hexdump\+\_\+l3} (const struct \textbf{ msgb} $\ast$\textbf{ msg})
\item 
static const char $\ast$ \textbf{ msgb\+\_\+hexdump\+\_\+l4} (const struct \textbf{ msgb} $\ast$\textbf{ msg})
\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
void $\ast$ \textbf{ tall\+\_\+msgb\+\_\+ctx} = NULL
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
libosmocore message buffers, inspired by Linux kernel skbuff 

Inspired by the \textquotesingle{}struct skbuff\textquotesingle{} of the Linux kernel, we implement a \textquotesingle{}struct msgb\textquotesingle{} which we use for handling network packets aka messages aka PDUs.

A msgb consists of
\begin{DoxyItemize}
\item a header with some metadata, such as
\begin{DoxyItemize}
\item a linked list header for message queues or the like
\item pointers to the headers of various protocol layers inside the packet
\end{DoxyItemize}
\item a data section consisting of
\begin{DoxyItemize}
\item headroom, i.\+e. space in front of the message, to allow for additional headers being pushed in front of the current data
\item the currently occupied data for the message
\item tailroom, i.\+e. space at the end of the message, to allow more data to be added after the end of the current data
\end{DoxyItemize}
\end{DoxyItemize}

We have plenty of utility functions around the msgb\+:
\begin{DoxyItemize}
\item allocation / release
\item enqueue / dequeue from/to message queues
\item prepending (pushing) and appending (putting) data
\item copying / resizing
\item hex-\/dumping to a string for debug purposes 
\end{DoxyItemize}

\doxysubsection{Macro Definition Documentation}
\mbox{\label{group__msgb_gaf2a76423d5e8b648c05a7696f9cf6ed3}} 
\index{Message buffers@{Message buffers}!MSGB\_ABORT@{MSGB\_ABORT}}
\index{MSGB\_ABORT@{MSGB\_ABORT}!Message buffers@{Message buffers}}
\doxysubsubsection{MSGB\_ABORT}
{\footnotesize\ttfamily \#define MSGB\+\_\+\+ABORT(\begin{DoxyParamCaption}\item[{}]{\textbf{ msg},  }\item[{}]{fmt,  }\item[{}]{args ... }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{        \textcolor{keywordflow}{do} \{            \(\backslash\)}
\DoxyCodeLine{        osmo\_panic(\textcolor{stringliteral}{"{}msgb(\%p): "{}} fmt, msg, \#\# args);     \(\backslash\)}
\DoxyCodeLine{        \} \textcolor{keywordflow}{while}(0)}

\end{DoxyCode}
\mbox{\label{group__msgb_ga8cf2c52f02bf6e832d7880282a435a5b}} 
\index{Message buffers@{Message buffers}!MSGB\_DEBUG@{MSGB\_DEBUG}}
\index{MSGB\_DEBUG@{MSGB\_DEBUG}!Message buffers@{Message buffers}}
\doxysubsubsection{MSGB\_DEBUG}
{\footnotesize\ttfamily \#define MSGB\+\_\+\+DEBUG}

\mbox{\label{group__msgb_gae9b5b86e28d3e7ec69b5bb80ad8be0e2}} 
\index{Message buffers@{Message buffers}!msgb\_eq@{msgb\_eq}}
\index{msgb\_eq@{msgb\_eq}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_eq}
{\footnotesize\ttfamily \#define msgb\+\_\+eq(\begin{DoxyParamCaption}\item[{}]{msg1,  }\item[{}]{msg2 }\end{DoxyParamCaption})~\textbf{ msgb\+\_\+eq\+\_\+data}(msg1, \textbf{ msgb\+\_\+data}(msg2), \textbf{ msgb\+\_\+length}(msg2))}



Compare msgbs. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg1} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em msg2} & reference message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
boolean indicating whether msgb content is equal 
\end{DoxyReturn}
\mbox{\label{group__msgb_gac9c7c6bee757b6fb1b37a7148c743a0b}} 
\index{Message buffers@{Message buffers}!msgb\_eq\_data@{msgb\_eq\_data}}
\index{msgb\_eq\_data@{msgb\_eq\_data}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_eq\_data}
{\footnotesize\ttfamily \#define msgb\+\_\+eq\+\_\+data(\begin{DoxyParamCaption}\item[{}]{\textbf{ msg},  }\item[{}]{\textbf{ data},  }\item[{}]{\textbf{ len} }\end{DoxyParamCaption})~ \textbf{ \+\_\+msgb\+\_\+eq}(\+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+, \+\_\+\+\_\+func\+\_\+\+\_\+, 0, \textbf{ msg}, \textbf{ data}, \textbf{ len}, false)}



Compare\+: check data in msgb against given data. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em data} & expected data \\
\hline
\mbox{\texttt{ in}}  & {\em len} & length of data \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
boolean indicating whether msgb content is equal to the given data 
\end{DoxyReturn}
\mbox{\label{group__msgb_gaaca88445376e3090c2e3762dc73ee458}} 
\index{Message buffers@{Message buffers}!msgb\_eq\_data\_print@{msgb\_eq\_data\_print}}
\index{msgb\_eq\_data\_print@{msgb\_eq\_data\_print}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_eq\_data\_print}
{\footnotesize\ttfamily \#define msgb\+\_\+eq\+\_\+data\+\_\+print(\begin{DoxyParamCaption}\item[{}]{\textbf{ msg},  }\item[{}]{\textbf{ data},  }\item[{}]{\textbf{ len} }\end{DoxyParamCaption})~ \textbf{ \+\_\+msgb\+\_\+eq}(\+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+, \+\_\+\+\_\+func\+\_\+\+\_\+, 0, \textbf{ msg}, \textbf{ data}, \textbf{ len}, true)}



Compare and print\+: check data in msgb against given data and print errors if any. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em data} & expected data \\
\hline
\mbox{\texttt{ in}}  & {\em len} & length of data \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
boolean indicating whether msgb content is equal to the given data 
\end{DoxyReturn}
\mbox{\label{group__msgb_ga55a2663d7da4d25b3939cf62798ff5b3}} 
\index{Message buffers@{Message buffers}!msgb\_eq\_l1@{msgb\_eq\_l1}}
\index{msgb\_eq\_l1@{msgb\_eq\_l1}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_eq\_l1}
{\footnotesize\ttfamily \#define msgb\+\_\+eq\+\_\+l1(\begin{DoxyParamCaption}\item[{}]{msg1,  }\item[{}]{msg2 }\end{DoxyParamCaption})~\textbf{ msgb\+\_\+eq\+\_\+l1\+\_\+data}(msg1, \textbf{ msgb\+\_\+l1}(msg2), \textbf{ msgb\+\_\+l1len}(msg2))}



Compare msgbs L1 content. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg1} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em msg2} & reference message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
boolean indicating whether msgb L1 content is equal 
\end{DoxyReturn}
\mbox{\label{group__msgb_gae4117d0a0ab548f99f2e2e63117df032}} 
\index{Message buffers@{Message buffers}!msgb\_eq\_l1\_data@{msgb\_eq\_l1\_data}}
\index{msgb\_eq\_l1\_data@{msgb\_eq\_l1\_data}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_eq\_l1\_data}
{\footnotesize\ttfamily \#define msgb\+\_\+eq\+\_\+l1\+\_\+data(\begin{DoxyParamCaption}\item[{}]{\textbf{ msg},  }\item[{}]{\textbf{ data},  }\item[{}]{\textbf{ len} }\end{DoxyParamCaption})~ \textbf{ \+\_\+msgb\+\_\+eq}(\+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+, \+\_\+\+\_\+func\+\_\+\+\_\+, 1, \textbf{ msg}, \textbf{ data}, \textbf{ len}, false)}



Compare\+: check L1 data in msgb against given data. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em data} & expected L1 data \\
\hline
\mbox{\texttt{ in}}  & {\em len} & length of data \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
boolean indicating whether msgb L1 content is equal to the given data 
\end{DoxyReturn}
\mbox{\label{group__msgb_ga386e61c1f2fbe123f1c52a94ec091e34}} 
\index{Message buffers@{Message buffers}!msgb\_eq\_l1\_data\_print@{msgb\_eq\_l1\_data\_print}}
\index{msgb\_eq\_l1\_data\_print@{msgb\_eq\_l1\_data\_print}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_eq\_l1\_data\_print}
{\footnotesize\ttfamily \#define msgb\+\_\+eq\+\_\+l1\+\_\+data\+\_\+print(\begin{DoxyParamCaption}\item[{}]{\textbf{ msg},  }\item[{}]{\textbf{ data},  }\item[{}]{\textbf{ len} }\end{DoxyParamCaption})~ \textbf{ \+\_\+msgb\+\_\+eq}(\+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+, \+\_\+\+\_\+func\+\_\+\+\_\+, 1, \textbf{ msg}, \textbf{ data}, \textbf{ len}, true)}



Compare and print\+: check L1 data in msgb against given data and print errors if any. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em data} & expected L1 data \\
\hline
\mbox{\texttt{ in}}  & {\em len} & length of data \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
boolean indicating whether msgb L1 content is equal to the given data 
\end{DoxyReturn}
\mbox{\label{group__msgb_ga4f5b7ecc9c2d0d12ff2c72f8c172b44c}} 
\index{Message buffers@{Message buffers}!msgb\_eq\_l2@{msgb\_eq\_l2}}
\index{msgb\_eq\_l2@{msgb\_eq\_l2}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_eq\_l2}
{\footnotesize\ttfamily \#define msgb\+\_\+eq\+\_\+l2(\begin{DoxyParamCaption}\item[{}]{msg1,  }\item[{}]{msg2 }\end{DoxyParamCaption})~\textbf{ msgb\+\_\+eq\+\_\+l2\+\_\+data}(msg1, \textbf{ msgb\+\_\+l2}(msg2), \textbf{ msgb\+\_\+l2len}(msg2))}



Compare msgbs L2 content. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg1} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em msg2} & reference message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
boolean indicating whether msgb L2 content is equal 
\end{DoxyReturn}
\mbox{\label{group__msgb_gac7c94c9cc0fabd46f4671aa629b0f714}} 
\index{Message buffers@{Message buffers}!msgb\_eq\_l2\_data@{msgb\_eq\_l2\_data}}
\index{msgb\_eq\_l2\_data@{msgb\_eq\_l2\_data}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_eq\_l2\_data}
{\footnotesize\ttfamily \#define msgb\+\_\+eq\+\_\+l2\+\_\+data(\begin{DoxyParamCaption}\item[{}]{\textbf{ msg},  }\item[{}]{\textbf{ data},  }\item[{}]{\textbf{ len} }\end{DoxyParamCaption})~ \textbf{ \+\_\+msgb\+\_\+eq}(\+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+, \+\_\+\+\_\+func\+\_\+\+\_\+, 2, \textbf{ msg}, \textbf{ data}, \textbf{ len}, false)}



Compare\+: check L2 data in msgb against given data. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em data} & expected L2 data \\
\hline
\mbox{\texttt{ in}}  & {\em len} & length of data \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
boolean indicating whether msgb L2 content is equal to the given data 
\end{DoxyReturn}
\mbox{\label{group__msgb_gae68671853cb54b9d698fb7d6d7f035e9}} 
\index{Message buffers@{Message buffers}!msgb\_eq\_l2\_data\_print@{msgb\_eq\_l2\_data\_print}}
\index{msgb\_eq\_l2\_data\_print@{msgb\_eq\_l2\_data\_print}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_eq\_l2\_data\_print}
{\footnotesize\ttfamily \#define msgb\+\_\+eq\+\_\+l2\+\_\+data\+\_\+print(\begin{DoxyParamCaption}\item[{}]{\textbf{ msg},  }\item[{}]{\textbf{ data},  }\item[{}]{\textbf{ len} }\end{DoxyParamCaption})~ \textbf{ \+\_\+msgb\+\_\+eq}(\+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+, \+\_\+\+\_\+func\+\_\+\+\_\+, 2, \textbf{ msg}, \textbf{ data}, \textbf{ len}, true)}



Compare and print\+: check L2 data in msgb against given data and print errors if any. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em data} & expected L2 data \\
\hline
\mbox{\texttt{ in}}  & {\em len} & length of data \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
boolean indicating whether msgb L2 content is equal to the given data 
\end{DoxyReturn}
\mbox{\label{group__msgb_ga1819185b9dd9a08c09508b31fd6cab35}} 
\index{Message buffers@{Message buffers}!msgb\_eq\_l3@{msgb\_eq\_l3}}
\index{msgb\_eq\_l3@{msgb\_eq\_l3}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_eq\_l3}
{\footnotesize\ttfamily \#define msgb\+\_\+eq\+\_\+l3(\begin{DoxyParamCaption}\item[{}]{msg1,  }\item[{}]{msg2 }\end{DoxyParamCaption})~\textbf{ msgb\+\_\+eq\+\_\+l3\+\_\+data}(msg1, \textbf{ msgb\+\_\+l3}(msg2), \textbf{ msgb\+\_\+l3len}(msg2))}



Compare msgbs L3 content. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg1} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em msg2} & reference message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
boolean indicating whether msgb L3 content is equal 
\end{DoxyReturn}
\mbox{\label{group__msgb_ga48b26c6bdc8a8eba642efd7f1e0f5d4f}} 
\index{Message buffers@{Message buffers}!msgb\_eq\_l3\_data@{msgb\_eq\_l3\_data}}
\index{msgb\_eq\_l3\_data@{msgb\_eq\_l3\_data}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_eq\_l3\_data}
{\footnotesize\ttfamily \#define msgb\+\_\+eq\+\_\+l3\+\_\+data(\begin{DoxyParamCaption}\item[{}]{\textbf{ msg},  }\item[{}]{\textbf{ data},  }\item[{}]{\textbf{ len} }\end{DoxyParamCaption})~ \textbf{ \+\_\+msgb\+\_\+eq}(\+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+, \+\_\+\+\_\+func\+\_\+\+\_\+, 3, \textbf{ msg}, \textbf{ data}, \textbf{ len}, false)}



Compare\+: check L3 data in msgb against given data. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em data} & expected L3 data \\
\hline
\mbox{\texttt{ in}}  & {\em len} & length of data \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
boolean indicating whether msgb L3 content is equal to the given data 
\end{DoxyReturn}
\mbox{\label{group__msgb_ga07dea4ee86de1f755a24f097f67eb1b2}} 
\index{Message buffers@{Message buffers}!msgb\_eq\_l3\_data\_print@{msgb\_eq\_l3\_data\_print}}
\index{msgb\_eq\_l3\_data\_print@{msgb\_eq\_l3\_data\_print}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_eq\_l3\_data\_print}
{\footnotesize\ttfamily \#define msgb\+\_\+eq\+\_\+l3\+\_\+data\+\_\+print(\begin{DoxyParamCaption}\item[{}]{\textbf{ msg},  }\item[{}]{\textbf{ data},  }\item[{}]{\textbf{ len} }\end{DoxyParamCaption})~ \textbf{ \+\_\+msgb\+\_\+eq}(\+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+, \+\_\+\+\_\+func\+\_\+\+\_\+, 3, \textbf{ msg}, \textbf{ data}, \textbf{ len}, true)}



Compare and print\+: check L3 data in msgb against given data and print errors if any. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em data} & expected L3 data \\
\hline
\mbox{\texttt{ in}}  & {\em len} & length of data \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
boolean indicating whether msgb L3 content is equal to the given data 
\end{DoxyReturn}
\mbox{\label{group__msgb_ga9de9fea11a097497aa33a401423a0cdf}} 
\index{Message buffers@{Message buffers}!msgb\_eq\_l4@{msgb\_eq\_l4}}
\index{msgb\_eq\_l4@{msgb\_eq\_l4}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_eq\_l4}
{\footnotesize\ttfamily \#define msgb\+\_\+eq\+\_\+l4(\begin{DoxyParamCaption}\item[{}]{msg1,  }\item[{}]{msg2 }\end{DoxyParamCaption})~\textbf{ msgb\+\_\+eq\+\_\+l4\+\_\+data}(msg1, \textbf{ msgb\+\_\+l4}(msg2), \textbf{ msgb\+\_\+l4len}(msg2))}



Compare msgbs L4 content. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg1} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em msg2} & reference message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
boolean indicating whether msgb L4 content is equal 
\end{DoxyReturn}
\mbox{\label{group__msgb_ga7cb914404304649bde1aa9cae7c3b494}} 
\index{Message buffers@{Message buffers}!msgb\_eq\_l4\_data@{msgb\_eq\_l4\_data}}
\index{msgb\_eq\_l4\_data@{msgb\_eq\_l4\_data}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_eq\_l4\_data}
{\footnotesize\ttfamily \#define msgb\+\_\+eq\+\_\+l4\+\_\+data(\begin{DoxyParamCaption}\item[{}]{\textbf{ msg},  }\item[{}]{\textbf{ data},  }\item[{}]{\textbf{ len} }\end{DoxyParamCaption})~ \textbf{ \+\_\+msgb\+\_\+eq}(\+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+, \+\_\+\+\_\+func\+\_\+\+\_\+, 4, \textbf{ msg}, \textbf{ data}, \textbf{ len}, false)}



Compare\+: check L4 data in msgb against given data. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em data} & expected L4 data \\
\hline
\mbox{\texttt{ in}}  & {\em len} & length of data \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
boolean indicating whether msgb L4 content is equal to the given data 
\end{DoxyReturn}
\mbox{\label{group__msgb_gacdbe0cdde2775b1ea052f5bee44115f3}} 
\index{Message buffers@{Message buffers}!msgb\_eq\_l4\_data\_print@{msgb\_eq\_l4\_data\_print}}
\index{msgb\_eq\_l4\_data\_print@{msgb\_eq\_l4\_data\_print}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_eq\_l4\_data\_print}
{\footnotesize\ttfamily \#define msgb\+\_\+eq\+\_\+l4\+\_\+data\+\_\+print(\begin{DoxyParamCaption}\item[{}]{\textbf{ msg},  }\item[{}]{\textbf{ data},  }\item[{}]{\textbf{ len} }\end{DoxyParamCaption})~ \textbf{ \+\_\+msgb\+\_\+eq}(\+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+, \+\_\+\+\_\+func\+\_\+\+\_\+, 4, \textbf{ msg}, \textbf{ data}, \textbf{ len}, true)}



Compare and print\+: check L4 data in msgb against given data and print errors if any. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em data} & expected L4 data \\
\hline
\mbox{\texttt{ in}}  & {\em len} & length of data \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
boolean indicating whether msgb L4 content is equal to the given data 
\end{DoxyReturn}
\mbox{\label{group__msgb_ga5b0a3beb8ad95637539655d0bd2212e9}} 
\index{Message buffers@{Message buffers}!msgb\_l1@{msgb\_l1}}
\index{msgb\_l1@{msgb\_l1}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_l1}
{\footnotesize\ttfamily \#define msgb\+\_\+l1(\begin{DoxyParamCaption}\item[{}]{m }\end{DoxyParamCaption})~((void $\ast$)((m)-\/$>$l1h))}



obtain L1 header of msgb 

\mbox{\label{group__msgb_gaf159332606c2999a33ed73d9e874013c}} 
\index{Message buffers@{Message buffers}!msgb\_l2@{msgb\_l2}}
\index{msgb\_l2@{msgb\_l2}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_l2}
{\footnotesize\ttfamily \#define msgb\+\_\+l2(\begin{DoxyParamCaption}\item[{}]{m }\end{DoxyParamCaption})~((void $\ast$)((m)-\/$>$l2h))}



obtain L2 header of msgb 

\mbox{\label{group__msgb_gad9d9ef8e08a61b8d03226b1ba4a8fc99}} 
\index{Message buffers@{Message buffers}!msgb\_l3@{msgb\_l3}}
\index{msgb\_l3@{msgb\_l3}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_l3}
{\footnotesize\ttfamily \#define msgb\+\_\+l3(\begin{DoxyParamCaption}\item[{}]{m }\end{DoxyParamCaption})~((void $\ast$)((m)-\/$>$l3h))}



obtain L3 header of msgb 

\mbox{\label{group__msgb_ga86664d6dc1e139cd649c0ab743336e93}} 
\index{Message buffers@{Message buffers}!msgb\_l4@{msgb\_l4}}
\index{msgb\_l4@{msgb\_l4}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_l4}
{\footnotesize\ttfamily \#define msgb\+\_\+l4(\begin{DoxyParamCaption}\item[{}]{m }\end{DoxyParamCaption})~((void $\ast$)((m)-\/$>$l4h))}



obtain L4 header of msgb 

\mbox{\label{group__msgb_ga1394ee8d1bda46a881b3acaada40784d}} 
\index{Message buffers@{Message buffers}!msgb\_sms@{msgb\_sms}}
\index{msgb\_sms@{msgb\_sms}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_sms}
{\footnotesize\ttfamily \#define msgb\+\_\+sms(\begin{DoxyParamCaption}\item[{}]{m }\end{DoxyParamCaption})~\textbf{ msgb\+\_\+l4}(m)}



obtain SMS header of msgb 



\doxysubsection{Function Documentation}
\mbox{\label{group__msgb_ga7c21cb1a25cffb5ad4f0e64af45db040}} 
\index{Message buffers@{Message buffers}!\_msgb\_eq@{\_msgb\_eq}}
\index{\_msgb\_eq@{\_msgb\_eq}!Message buffers@{Message buffers}}
\doxysubsubsection{\_msgb\_eq()}
{\footnotesize\ttfamily bool \+\_\+msgb\+\_\+eq (\begin{DoxyParamCaption}\item[{const char $\ast$}]{file,  }\item[{size\+\_\+t}]{line,  }\item[{const char $\ast$}]{func,  }\item[{uint8\+\_\+t}]{level,  }\item[{const struct \textbf{ msgb} $\ast$}]{msg,  }\item[{const uint8\+\_\+t $\ast$}]{data,  }\item[{size\+\_\+t}]{len,  }\item[{bool}]{print }\end{DoxyParamCaption})}



Compare and print\+: check data in msgb against given data and print errors if any. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em file} & text prefix, usually {\bfseries{FILE}}, ignored if print == false \\
\hline
\mbox{\texttt{ in}}  & {\em line} & numeric prefix, usually {\bfseries{LINE}}, ignored if print == false \\
\hline
\mbox{\texttt{ in}}  & {\em func} & text prefix, usually {\bfseries{func}}, ignored if print == false \\
\hline
\mbox{\texttt{ in}}  & {\em level} & while layer (L1, L2 etc) data should be compared against \\
\hline
\mbox{\texttt{ in}}  & {\em msg} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em data} & expected data \\
\hline
\mbox{\texttt{ in}}  & {\em len} & length of data \\
\hline
\mbox{\texttt{ in}}  & {\em print} & boolean indicating whether we should print anything to stdout \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
boolean indicating whether msgb content is equal to a given data
\end{DoxyReturn}
This function is not intended to be called directly but rather used through corresponding macro wrappers. 

References \textbf{ \+\_\+\+\_\+attribute\+\_\+\+\_\+}, \textbf{ data}, \textbf{ DLGLOBAL}, \textbf{ file()}, \textbf{ len()}, \textbf{ level}, \textbf{ LOGL\+\_\+\+FATAL}, \textbf{ LOGPC}, \textbf{ LOGPSRC}, \textbf{ msg}, \textbf{ msgb\+\_\+data()}, \textbf{ msgb\+\_\+hexdump()}, \textbf{ msgb\+\_\+hexdump\+\_\+l1()}, \textbf{ msgb\+\_\+hexdump\+\_\+l2()}, \textbf{ msgb\+\_\+hexdump\+\_\+l3()}, \textbf{ msgb\+\_\+hexdump\+\_\+l4()}, \textbf{ msgb\+\_\+l1}, \textbf{ msgb\+\_\+l1len()}, \textbf{ msgb\+\_\+l2}, \textbf{ msgb\+\_\+l2len()}, \textbf{ msgb\+\_\+l3}, \textbf{ msgb\+\_\+l3len()}, \textbf{ msgb\+\_\+l4}, \textbf{ msgb\+\_\+l4len()}, \textbf{ msgb\+\_\+length()}, and \textbf{ osmo\+\_\+hexdump()}.

\mbox{\label{group__msgb_ga25906d049cbad1bf2d5a785319268ea8}} 
\index{Message buffers@{Message buffers}!msgb\_alloc@{msgb\_alloc}}
\index{msgb\_alloc@{msgb\_alloc}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_alloc()}
{\footnotesize\ttfamily struct \textbf{ msgb} $\ast$ msgb\+\_\+alloc (\begin{DoxyParamCaption}\item[{uint16\+\_\+t}]{size,  }\item[{const char $\ast$}]{name }\end{DoxyParamCaption})}



Allocate a new message buffer from tall\+\_\+msgb\+\_\+ctx. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em size} & Length in octets, including headroom \\
\hline
\mbox{\texttt{ in}}  & {\em name} & Human-\/readable name to be associated with msgb \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
dynamically-\/allocated \doxyref{Message buffers}{p.}{group__msgb}
\end{DoxyReturn}
This function allocates a \textquotesingle{}struct msgb\textquotesingle{} as well as the underlying memory buffer for the actual message data (size specified by {\itshape size}) using the talloc memory context previously set by \doxyref{msgb\+\_\+set\+\_\+talloc\+\_\+ctx}{p.}{group__msgb_ga1d57bb92a849857deb6871446d3230da} 

References \textbf{ msgb\+\_\+alloc\+\_\+c()}, \textbf{ name}, and \textbf{ tall\+\_\+msgb\+\_\+ctx}.



Referenced by \textbf{ gsmtap\+\_\+makemsg\+\_\+ex()}, \textbf{ msgb\+\_\+alloc\+\_\+headroom()}, and \textbf{ tundev\+\_\+decaps()}.

\mbox{\label{group__msgb_gabfa7361c6d26ec2726525828813b8081}} 
\index{Message buffers@{Message buffers}!msgb\_alloc\_c@{msgb\_alloc\_c}}
\index{msgb\_alloc\_c@{msgb\_alloc\_c}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_alloc\_c()}
{\footnotesize\ttfamily struct \textbf{ msgb} $\ast$ msgb\+\_\+alloc\+\_\+c (\begin{DoxyParamCaption}\item[{const void $\ast$}]{ctx,  }\item[{uint16\+\_\+t}]{size,  }\item[{const char $\ast$}]{name }\end{DoxyParamCaption})}



Allocate a new message buffer from given talloc context. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctx} & talloc context from which to allocate \\
\hline
\mbox{\texttt{ in}}  & {\em size} & Length in octets, including headroom \\
\hline
\mbox{\texttt{ in}}  & {\em name} & Human-\/readable name to be associated with msgb \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
dynamically-\/allocated \doxyref{Message buffers}{p.}{group__msgb}
\end{DoxyReturn}
This function allocates a \textquotesingle{}struct msgb\textquotesingle{} as well as the underlying memory buffer for the actual message data (size specified by {\itshape size}) using the talloc memory context previously set by \doxyref{msgb\+\_\+set\+\_\+talloc\+\_\+ctx}{p.}{group__msgb_ga1d57bb92a849857deb6871446d3230da} 

References \textbf{ DLGLOBAL}, \textbf{ LOGL\+\_\+\+FATAL}, \textbf{ LOGP}, \textbf{ msg}, and \textbf{ name}.



Referenced by \textbf{ \+\_\+file\+\_\+raw\+\_\+output()}, \textbf{ \+\_\+gsmtap\+\_\+raw\+\_\+output()}, \textbf{ msgb\+\_\+alloc()}, \textbf{ msgb\+\_\+alloc\+\_\+headroom\+\_\+c()}, \textbf{ msgb\+\_\+copy\+\_\+resize\+\_\+c()}, \textbf{ osmo\+\_\+soft\+\_\+uart\+\_\+flush\+\_\+rx()}, \textbf{ osmo\+\_\+soft\+\_\+uart\+\_\+set\+\_\+rx()}, and \textbf{ osmo\+\_\+soft\+\_\+uart\+\_\+tx\+\_\+ubits()}.

\mbox{\label{group__msgb_ga456177a38643fcea2cdc2801fb7c7cb6}} 
\index{Message buffers@{Message buffers}!msgb\_alloc\_headroom@{msgb\_alloc\_headroom}}
\index{msgb\_alloc\_headroom@{msgb\_alloc\_headroom}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_alloc\_headroom()}
{\footnotesize\ttfamily static struct \textbf{ msgb} $\ast$ msgb\+\_\+alloc\+\_\+headroom (\begin{DoxyParamCaption}\item[{uint16\+\_\+t}]{size,  }\item[{uint16\+\_\+t}]{headroom,  }\item[{const char $\ast$}]{name }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Allocate message buffer with specified headroom. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em size} & size in bytes, including headroom \\
\hline
\mbox{\texttt{ in}}  & {\em headroom} & headroom in bytes \\
\hline
\mbox{\texttt{ in}}  & {\em name} & human-\/readable name \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
allocated message buffer with specified headroom
\end{DoxyReturn}
This function is a convenience wrapper around \doxyref{msgb\+\_\+alloc}{p.}{group__msgb_ga25906d049cbad1bf2d5a785319268ea8} followed by \doxyref{msgb\+\_\+reserve}{p.}{group__msgb_gad73da5b3dce61877ad745d5e25ea44d5} in order to create a new \doxyref{Message buffers}{p.}{group__msgb} with user-\/specified amount of headroom. 

References \textbf{ msg}, \textbf{ msgb\+\_\+alloc()}, \textbf{ msgb\+\_\+reserve()}, \textbf{ name}, \textbf{ OSMO\+\_\+\+ASSERT}, and \textbf{ OSMO\+\_\+\+LIKELY}.



Referenced by \textbf{ osmo\+\_\+sercomm\+\_\+alloc\+\_\+msgb()}.

\mbox{\label{group__msgb_ga9afe78b15621cf6ba80ff28ea02ad55a}} 
\index{Message buffers@{Message buffers}!msgb\_alloc\_headroom\_c@{msgb\_alloc\_headroom\_c}}
\index{msgb\_alloc\_headroom\_c@{msgb\_alloc\_headroom\_c}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_alloc\_headroom\_c()}
{\footnotesize\ttfamily static struct \textbf{ msgb} $\ast$ msgb\+\_\+alloc\+\_\+headroom\+\_\+c (\begin{DoxyParamCaption}\item[{const void $\ast$}]{ctx,  }\item[{uint16\+\_\+t}]{size,  }\item[{uint16\+\_\+t}]{headroom,  }\item[{const char $\ast$}]{name }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Allocate message buffer with specified headroom from specified talloc context. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctx} & talloc context from which to allocate \\
\hline
\mbox{\texttt{ in}}  & {\em size} & size in bytes, including headroom \\
\hline
\mbox{\texttt{ in}}  & {\em headroom} & headroom in bytes \\
\hline
\mbox{\texttt{ in}}  & {\em name} & human-\/readable name \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
allocated message buffer with specified headroom
\end{DoxyReturn}
This function is a convenience wrapper around \doxyref{msgb\+\_\+alloc}{p.}{group__msgb_ga25906d049cbad1bf2d5a785319268ea8} followed by \doxyref{msgb\+\_\+reserve}{p.}{group__msgb_gad73da5b3dce61877ad745d5e25ea44d5} in order to create a new \doxyref{Message buffers}{p.}{group__msgb} with user-\/specified amount of headroom. 

References \textbf{ msg}, \textbf{ msgb\+\_\+alloc\+\_\+c()}, \textbf{ msgb\+\_\+reserve()}, \textbf{ name}, \textbf{ OSMO\+\_\+\+ASSERT}, and \textbf{ OSMO\+\_\+\+LIKELY}.



Referenced by \textbf{ iofd\+\_\+msgb\+\_\+alloc2()}.

\mbox{\label{group__msgb_ga5f79dffec24b16b92bcdb4cd19a8ee90}} 
\index{Message buffers@{Message buffers}!msgb\_copy@{msgb\_copy}}
\index{msgb\_copy@{msgb\_copy}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_copy()}
{\footnotesize\ttfamily struct \textbf{ msgb} $\ast$ msgb\+\_\+copy (\begin{DoxyParamCaption}\item[{const struct \textbf{ msgb} $\ast$}]{msg,  }\item[{const char $\ast$}]{name }\end{DoxyParamCaption})}



Copy an msgb. 

This function allocates a new msgb, copies the data buffer of msg, and adjusts the pointers (incl l1h-\/l4h) accordingly. The cb part is not copied. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & The old msgb object \\
\hline
\mbox{\texttt{ in}}  & {\em name} & Human-\/readable name to be associated with msgb \\
\hline
\end{DoxyParams}


References \textbf{ msg}, \textbf{ msgb\+\_\+copy\+\_\+c()}, \textbf{ name}, and \textbf{ tall\+\_\+msgb\+\_\+ctx}.

\mbox{\label{group__msgb_ga3ff33cbd8eccd14d4c7766b8a2afeb51}} 
\index{Message buffers@{Message buffers}!msgb\_copy\_c@{msgb\_copy\_c}}
\index{msgb\_copy\_c@{msgb\_copy\_c}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_copy\_c()}
{\footnotesize\ttfamily struct \textbf{ msgb} $\ast$ msgb\+\_\+copy\+\_\+c (\begin{DoxyParamCaption}\item[{const void $\ast$}]{ctx,  }\item[{const struct \textbf{ msgb} $\ast$}]{msg,  }\item[{const char $\ast$}]{name }\end{DoxyParamCaption})}



Copy an msgb. 

This function allocates a new msgb, copies the data buffer of msg, and adjusts the pointers (incl l1h-\/l4h) accordingly. The cb part is not copied. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctx} & talloc context on which allocation happens \\
\hline
\mbox{\texttt{ in}}  & {\em msg} & The old msgb object \\
\hline
\mbox{\texttt{ in}}  & {\em name} & Human-\/readable name to be associated with msgb \\
\hline
\end{DoxyParams}


References \textbf{ msg}, \textbf{ msgb\+\_\+copy\+\_\+resize\+\_\+c()}, and \textbf{ name}.



Referenced by \textbf{ msgb\+\_\+copy()}.

\mbox{\label{group__msgb_gae522e97ead0bf5a6331399a4ec91d58b}} 
\index{Message buffers@{Message buffers}!msgb\_copy\_resize@{msgb\_copy\_resize}}
\index{msgb\_copy\_resize@{msgb\_copy\_resize}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_copy\_resize()}
{\footnotesize\ttfamily struct \textbf{ msgb} $\ast$ msgb\+\_\+copy\+\_\+resize (\begin{DoxyParamCaption}\item[{const struct \textbf{ msgb} $\ast$}]{msg,  }\item[{uint16\+\_\+t}]{new\+\_\+len,  }\item[{const char $\ast$}]{name }\end{DoxyParamCaption})}



Copy an msgb with memory reallocation. 

This function allocates a new msgb with new\+\_\+len size, copies the data buffer of msg, and adjusts the pointers (incl l1h-\/l4h) accordingly. The cb part is not copied. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & The old msgb object \\
\hline
\mbox{\texttt{ in}}  & {\em name} & Human-\/readable name to be associated with new msgb \\
\hline
\end{DoxyParams}


References \textbf{ msg}, \textbf{ msgb\+\_\+copy\+\_\+resize\+\_\+c()}, \textbf{ name}, and \textbf{ tall\+\_\+msgb\+\_\+ctx}.

\mbox{\label{group__msgb_gab30cebe53b874324e73e3cb56aaba015}} 
\index{Message buffers@{Message buffers}!msgb\_copy\_resize\_c@{msgb\_copy\_resize\_c}}
\index{msgb\_copy\_resize\_c@{msgb\_copy\_resize\_c}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_copy\_resize\_c()}
{\footnotesize\ttfamily struct \textbf{ msgb} $\ast$ msgb\+\_\+copy\+\_\+resize\+\_\+c (\begin{DoxyParamCaption}\item[{const void $\ast$}]{ctx,  }\item[{const struct \textbf{ msgb} $\ast$}]{msg,  }\item[{uint16\+\_\+t}]{new\+\_\+len,  }\item[{const char $\ast$}]{name }\end{DoxyParamCaption})}



Copy an msgb with memory reallocation. 

This function allocates a new msgb with new\+\_\+len size, copies the data buffer of msg, and adjusts the pointers (incl l1h-\/l4h) accordingly. The cb part is not copied. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctx} & talloc context on which allocation happens \\
\hline
\mbox{\texttt{ in}}  & {\em msg} & The old msgb object \\
\hline
\mbox{\texttt{ in}}  & {\em new\+\_\+len} & The length of new msgb object \\
\hline
\mbox{\texttt{ in}}  & {\em name} & Human-\/readable name to be associated with new msgb \\
\hline
\end{DoxyParams}


References \textbf{ \+\_\+data}, \textbf{ data}, \textbf{ DLGLOBAL}, \textbf{ head}, \textbf{ l1h}, \textbf{ l2h}, \textbf{ l3h}, \textbf{ l4h}, \textbf{ len}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGP}, \textbf{ msg}, \textbf{ msgb\+\_\+alloc\+\_\+c()}, \textbf{ msgb\+\_\+length()}, \textbf{ name}, and \textbf{ tail}.



Referenced by \textbf{ msgb\+\_\+copy\+\_\+c()}, and \textbf{ msgb\+\_\+copy\+\_\+resize()}.

\mbox{\label{group__msgb_ga9bed2fe8aedfa7619eda155a4afbaf9a}} 
\index{Message buffers@{Message buffers}!msgb\_data@{msgb\_data}}
\index{msgb\_data@{msgb\_data}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_data()}
{\footnotesize\ttfamily uint8\+\_\+t $\ast$ msgb\+\_\+data (\begin{DoxyParamCaption}\item[{const struct \textbf{ msgb} $\ast$}]{msg }\end{DoxyParamCaption})}



get pointer to data section of message buffer 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pointer to data section of message buffer 
\end{DoxyReturn}


References \textbf{ msg}.



Referenced by \textbf{ \+\_\+file\+\_\+raw\+\_\+output()}, \textbf{ \+\_\+msgb\+\_\+eq()}, \textbf{ iofd\+\_\+handle\+\_\+segmentation()}, \textbf{ iofd\+\_\+prepare\+\_\+handle\+\_\+segmentation()}, \textbf{ osmo\+\_\+iofd\+\_\+sendmsg\+\_\+msgb()}, \textbf{ osmo\+\_\+iofd\+\_\+sendto\+\_\+msgb()}, \textbf{ osmo\+\_\+iofd\+\_\+write\+\_\+msgb()}, \textbf{ tundev\+\_\+decaps()}, and \textbf{ tundev\+\_\+write\+\_\+cb()}.

\mbox{\label{group__msgb_gadf56eab1dbbb193b132c3dc6ba4222bc}} 
\index{Message buffers@{Message buffers}!msgb\_dequeue@{msgb\_dequeue}}
\index{msgb\_dequeue@{msgb\_dequeue}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_dequeue()}
{\footnotesize\ttfamily struct \textbf{ msgb} $\ast$ msgb\+\_\+dequeue (\begin{DoxyParamCaption}\item[{struct \textbf{ llist\+\_\+head} $\ast$}]{queue }\end{DoxyParamCaption})}



Dequeue message buffer from head of queue. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em queue} & linked list header of queue \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
message buffer (if any) or NULL if queue empty
\end{DoxyReturn}
The function will remove the first message buffer from the queue implemented by \doxyref{llist\+\_\+head}{p.}{structllist__head} {\itshape queue}. 

References \textbf{ list}, \textbf{ llist\+\_\+del()}, \textbf{ llist\+\_\+empty()}, \textbf{ llist\+\_\+entry}, and \textbf{ llist\+\_\+head\+::next}.



Referenced by \textbf{ msgb\+\_\+dequeue\+\_\+count()}, \textbf{ msgb\+\_\+queue\+\_\+free()}, \textbf{ osmo\+\_\+sercomm\+\_\+drv\+\_\+pull()}, and \textbf{ osmo\+\_\+wqueue\+\_\+clear()}.

\mbox{\label{group__msgb_ga8de928af0e7f70b214e7dff128fc23fe}} 
\index{Message buffers@{Message buffers}!msgb\_dequeue\_count@{msgb\_dequeue\_count}}
\index{msgb\_dequeue\_count@{msgb\_dequeue\_count}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_dequeue\_count()}
{\footnotesize\ttfamily static struct \textbf{ msgb} $\ast$ msgb\+\_\+dequeue\+\_\+count (\begin{DoxyParamCaption}\item[{struct \textbf{ llist\+\_\+head} $\ast$}]{queue,  }\item[{unsigned int $\ast$}]{count }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Dequeue message buffer from head of queue and decrement queue size counter. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em queue} & linked list header of queue \\
\hline
\mbox{\texttt{ in}}  & {\em count} & pointer to variable holding size of the queue \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
message buffer (if any) or NULL if queue empty
\end{DoxyReturn}
The function will remove the first message buffer from the queue implemented by \doxyref{llist\+\_\+head}{p.}{structllist__head} {\itshape queue} using function \doxyref{msgb\+\_\+enqueue\+\_\+count}{p.}{group__msgb_gad1a243fb0f975bd5bc5942499f6fbb41}, and decrement {\itshape count}, all if queue is not empty. 

References \textbf{ msg}, and \textbf{ msgb\+\_\+dequeue()}.



Referenced by \textbf{ osmo\+\_\+wqueue\+\_\+bfd\+\_\+cb()}, and \textbf{ osmo\+\_\+wqueue\+\_\+set\+\_\+maxlen()}.

\mbox{\label{group__msgb_gacb8dd9493eb7fc266ce159e3325c6504}} 
\index{Message buffers@{Message buffers}!msgb\_enqueue@{msgb\_enqueue}}
\index{msgb\_enqueue@{msgb\_enqueue}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_enqueue()}
{\footnotesize\ttfamily void msgb\+\_\+enqueue (\begin{DoxyParamCaption}\item[{struct \textbf{ llist\+\_\+head} $\ast$}]{queue,  }\item[{struct \textbf{ msgb} $\ast$}]{msg }\end{DoxyParamCaption})}



Enqueue message buffer to tail of a queue. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em queue} & linked list header of queue \\
\hline
\mbox{\texttt{ in}}  & {\em msg} & message buffer to be added to the queue\\
\hline
\end{DoxyParams}
The function will append the specified message buffer {\itshape msg} to the queue implemented by \doxyref{llist\+\_\+head}{p.}{structllist__head} {\itshape queue} 

References \textbf{ llist\+\_\+add\+\_\+tail()}, and \textbf{ msg}.



Referenced by \textbf{ msgb\+\_\+enqueue\+\_\+count()}, and \textbf{ osmo\+\_\+sercomm\+\_\+sendmsg()}.

\mbox{\label{group__msgb_gad1a243fb0f975bd5bc5942499f6fbb41}} 
\index{Message buffers@{Message buffers}!msgb\_enqueue\_count@{msgb\_enqueue\_count}}
\index{msgb\_enqueue\_count@{msgb\_enqueue\_count}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_enqueue\_count()}
{\footnotesize\ttfamily static void msgb\+\_\+enqueue\+\_\+count (\begin{DoxyParamCaption}\item[{struct \textbf{ llist\+\_\+head} $\ast$}]{queue,  }\item[{struct \textbf{ msgb} $\ast$}]{msg,  }\item[{unsigned int $\ast$}]{count }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Enqueue message buffer to tail of a queue and increment queue size counter. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em queue} & linked list header of queue \\
\hline
\mbox{\texttt{ in}}  & {\em msg} & message buffer to be added to the queue \\
\hline
\mbox{\texttt{ in}}  & {\em count} & pointer to variable holding size of the queue\\
\hline
\end{DoxyParams}
The function will append the specified message buffer {\itshape msg} to the queue implemented by \doxyref{llist\+\_\+head}{p.}{structllist__head} {\itshape queue} using function \doxyref{msgb\+\_\+enqueue\+\_\+count}{p.}{group__msgb_gad1a243fb0f975bd5bc5942499f6fbb41}, then increment {\itshape count} 

References \textbf{ msg}, and \textbf{ msgb\+\_\+enqueue()}.



Referenced by \textbf{ osmo\+\_\+wqueue\+\_\+enqueue\+\_\+quiet()}.

\mbox{\label{group__msgb_gae48b55f6f4529aafb069eaa3fa1998f0}} 
\index{Message buffers@{Message buffers}!msgb\_free@{msgb\_free}}
\index{msgb\_free@{msgb\_free}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_free()}
{\footnotesize\ttfamily void msgb\+\_\+free (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{m }\end{DoxyParamCaption})}



Release given message buffer. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em m} & Message buffer to be freed \\
\hline
\end{DoxyParams}


Referenced by \textbf{ \+\_\+file\+\_\+raw\+\_\+output()}, \textbf{ \+\_\+gsmtap\+\_\+raw\+\_\+output()}, \textbf{ dispatch\+\_\+rx\+\_\+msg()}, \textbf{ iofd\+\_\+handle\+\_\+send\+\_\+completion()}, \textbf{ iofd\+\_\+poll\+\_\+handle\+\_\+recv()}, \textbf{ iofd\+\_\+prepare\+\_\+handle\+\_\+segmentation()}, \textbf{ msgb\+\_\+queue\+\_\+free()}, \textbf{ osmo\+\_\+iofd\+\_\+close()}, \textbf{ osmo\+\_\+iofd\+\_\+txqueue\+\_\+clear()}, \textbf{ osmo\+\_\+sercomm\+\_\+drv\+\_\+pull()}, \textbf{ osmo\+\_\+sercomm\+\_\+drv\+\_\+rx\+\_\+char()}, \textbf{ osmo\+\_\+soft\+\_\+uart\+\_\+free()}, \textbf{ osmo\+\_\+soft\+\_\+uart\+\_\+tx\+\_\+ubits()}, \textbf{ osmo\+\_\+tundev\+\_\+send()}, \textbf{ osmo\+\_\+wqueue\+\_\+bfd\+\_\+cb()}, \textbf{ osmo\+\_\+wqueue\+\_\+clear()}, \textbf{ osmo\+\_\+wqueue\+\_\+set\+\_\+maxlen()}, and \textbf{ tundev\+\_\+decaps()}.

\mbox{\label{group__msgb_gacbaa44ea8bece53cee7b4c6588c52fe8}} 
\index{Message buffers@{Message buffers}!msgb\_get@{msgb\_get}}
\index{msgb\_get@{msgb\_get}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_get()}
{\footnotesize\ttfamily static unsigned char $\ast$ msgb\+\_\+get (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msgb,  }\item[{unsigned int}]{len }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



remove data from end of message 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msgb} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em len} & number of bytes to remove from end \\
\hline
\end{DoxyParams}


References \textbf{ len()}, \textbf{ len}, \textbf{ MSGB\+\_\+\+ABORT}, \textbf{ msgb\+\_\+length()}, \textbf{ OSMO\+\_\+\+UNLIKELY}, and \textbf{ tail}.



Referenced by \textbf{ msgb\+\_\+get\+\_\+u16()}, \textbf{ msgb\+\_\+get\+\_\+u32()}, and \textbf{ msgb\+\_\+get\+\_\+u8()}.

\mbox{\label{group__msgb_gad07b39cd3d4d0865b4139582eb458e00}} 
\index{Message buffers@{Message buffers}!msgb\_get\_u16@{msgb\_get\_u16}}
\index{msgb\_get\_u16@{msgb\_get\_u16}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_get\_u16()}
{\footnotesize\ttfamily static uint16\+\_\+t msgb\+\_\+get\+\_\+u16 (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msgb }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



remove uint16 from end of message 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msgb} & message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
16bit value taken from end of msgb 
\end{DoxyReturn}


References \textbf{ msgb\+\_\+get()}, and \textbf{ osmo\+\_\+load16be()}.

\mbox{\label{group__msgb_ga3a53a5bb768bc46ad048794d0bd8e061}} 
\index{Message buffers@{Message buffers}!msgb\_get\_u32@{msgb\_get\_u32}}
\index{msgb\_get\_u32@{msgb\_get\_u32}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_get\_u32()}
{\footnotesize\ttfamily static uint32\+\_\+t msgb\+\_\+get\+\_\+u32 (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msgb }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



remove uint32 from end of message 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msgb} & message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
32bit value taken from end of msgb 
\end{DoxyReturn}


References \textbf{ msgb\+\_\+get()}, and \textbf{ osmo\+\_\+load32be()}.

\mbox{\label{group__msgb_gaa5b5674fbbe7b7206565f79dba2ca28f}} 
\index{Message buffers@{Message buffers}!msgb\_get\_u8@{msgb\_get\_u8}}
\index{msgb\_get\_u8@{msgb\_get\_u8}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_get\_u8()}
{\footnotesize\ttfamily static uint8\+\_\+t msgb\+\_\+get\+\_\+u8 (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msgb }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



remove uint8 from end of message 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msgb} & message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
8bit value taken from end of msgb 
\end{DoxyReturn}


References \textbf{ msgb\+\_\+get()}.

\mbox{\label{group__msgb_gae54ddbf27117a4cb1b750c6b113a0d0c}} 
\index{Message buffers@{Message buffers}!msgb\_headlen@{msgb\_headlen}}
\index{msgb\_headlen@{msgb\_headlen}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_headlen()}
{\footnotesize\ttfamily static unsigned int msgb\+\_\+headlen (\begin{DoxyParamCaption}\item[{const struct \textbf{ msgb} $\ast$}]{msgb }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



determine the length of the header 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msgb} & message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
number of bytes between start of buffer and start of msg
\end{DoxyReturn}
This function computes the length difference between the underlying data buffer and the used section of the {\itshape msgb}. 

References \textbf{ data\+\_\+len}, and \textbf{ len}.

\mbox{\label{group__msgb_gaff7eae95ec007dd419dc60c03c3db5bd}} 
\index{Message buffers@{Message buffers}!msgb\_headroom@{msgb\_headroom}}
\index{msgb\_headroom@{msgb\_headroom}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_headroom()}
{\footnotesize\ttfamily static int msgb\+\_\+headroom (\begin{DoxyParamCaption}\item[{const struct \textbf{ msgb} $\ast$}]{msgb }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



determine the amount of headroom in msgb 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msgb} & message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
number of bytes left ahead of message start in msgb
\end{DoxyReturn}
This function computes the amount of bytes left in the underlying data buffer before the start of the actual message. 

References \textbf{ data}, and \textbf{ head}.



Referenced by \textbf{ msgb\+\_\+push()}.

\mbox{\label{group__msgb_ga9a703fb35c8eafd88c6d0d20aef465ac}} 
\index{Message buffers@{Message buffers}!msgb\_hexdump@{msgb\_hexdump}}
\index{msgb\_hexdump@{msgb\_hexdump}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_hexdump()}
{\footnotesize\ttfamily const char $\ast$ msgb\+\_\+hexdump (\begin{DoxyParamCaption}\item[{const struct \textbf{ msgb} $\ast$}]{msg }\end{DoxyParamCaption})}



Return a (static) buffer containing a hexdump of the msg. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a pointer to a static char array 
\end{DoxyReturn}


References \textbf{ msg}, and \textbf{ msgb\+\_\+hexdump\+\_\+buf()}.



Referenced by \textbf{ \+\_\+msgb\+\_\+eq()}.

\mbox{\label{group__msgb_ga8f7a6483386bf042668201f9e18b5a05}} 
\index{Message buffers@{Message buffers}!msgb\_hexdump\_buf@{msgb\_hexdump\_buf}}
\index{msgb\_hexdump\_buf@{msgb\_hexdump\_buf}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_hexdump\_buf()}
{\footnotesize\ttfamily char $\ast$ msgb\+\_\+hexdump\+\_\+buf (\begin{DoxyParamCaption}\item[{char $\ast$}]{buf,  }\item[{size\+\_\+t}]{buf\+\_\+len,  }\item[{const struct \textbf{ msgb} $\ast$}]{msg }\end{DoxyParamCaption})}



fill user-\/provided buffer with hexdump of the msg. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ out}}  & {\em buf} & caller-\/allocated buffer for output string \\
\hline
\mbox{\texttt{ in}}  & {\em buf\+\_\+len} & length of buf \\
\hline
\mbox{\texttt{ in}}  & {\em msg} & message buffer to be dumped \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
buf 
\end{DoxyReturn}


References \textbf{ ARRAY\+\_\+\+SIZE}, \textbf{ msg}, \textbf{ osmo\+\_\+hexdump()}, and \textbf{ start}.



Referenced by \textbf{ msgb\+\_\+hexdump()}, and \textbf{ msgb\+\_\+hexdump\+\_\+c()}.

\mbox{\label{group__msgb_ga529723f7c2ae10e4ebcf05f2890e2999}} 
\index{Message buffers@{Message buffers}!msgb\_hexdump\_c@{msgb\_hexdump\_c}}
\index{msgb\_hexdump\_c@{msgb\_hexdump\_c}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_hexdump\_c()}
{\footnotesize\ttfamily char $\ast$ msgb\+\_\+hexdump\+\_\+c (\begin{DoxyParamCaption}\item[{const void $\ast$}]{ctx,  }\item[{const struct \textbf{ msgb} $\ast$}]{msg }\end{DoxyParamCaption})}



Return a dynamically allocated buffer containing a hexdump of the msg. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctx} & talloc context from where to allocate the output string \\
\hline
\mbox{\texttt{ in}}  & {\em msg} & message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a pointer to a static char array 
\end{DoxyReturn}


References \textbf{ msg}, \textbf{ msgb\+\_\+hexdump\+\_\+buf()}, and \textbf{ msgb\+\_\+length()}.

\mbox{\label{group__msgb_ga721d5c287e8eb56eebb95c438939b81d}} 
\index{Message buffers@{Message buffers}!msgb\_hexdump\_l1@{msgb\_hexdump\_l1}}
\index{msgb\_hexdump\_l1@{msgb\_hexdump\_l1}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_hexdump\_l1()}
{\footnotesize\ttfamily static const char $\ast$ msgb\+\_\+hexdump\+\_\+l1 (\begin{DoxyParamCaption}\item[{const struct \textbf{ msgb} $\ast$}]{msg }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



References \textbf{ msg}, \textbf{ msgb\+\_\+l1}, \textbf{ msgb\+\_\+l1len()}, and \textbf{ osmo\+\_\+hexdump()}.



Referenced by \textbf{ \+\_\+msgb\+\_\+eq()}.

\mbox{\label{group__msgb_gae8022d59918936103cdd9521a0d054c8}} 
\index{Message buffers@{Message buffers}!msgb\_hexdump\_l2@{msgb\_hexdump\_l2}}
\index{msgb\_hexdump\_l2@{msgb\_hexdump\_l2}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_hexdump\_l2()}
{\footnotesize\ttfamily static const char $\ast$ msgb\+\_\+hexdump\+\_\+l2 (\begin{DoxyParamCaption}\item[{const struct \textbf{ msgb} $\ast$}]{msg }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



References \textbf{ msg}, \textbf{ msgb\+\_\+l2}, \textbf{ msgb\+\_\+l2len()}, and \textbf{ osmo\+\_\+hexdump()}.



Referenced by \textbf{ \+\_\+msgb\+\_\+eq()}.

\mbox{\label{group__msgb_ga4d8dfb6c63812f92502e902a93ab32b1}} 
\index{Message buffers@{Message buffers}!msgb\_hexdump\_l3@{msgb\_hexdump\_l3}}
\index{msgb\_hexdump\_l3@{msgb\_hexdump\_l3}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_hexdump\_l3()}
{\footnotesize\ttfamily static const char $\ast$ msgb\+\_\+hexdump\+\_\+l3 (\begin{DoxyParamCaption}\item[{const struct \textbf{ msgb} $\ast$}]{msg }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



References \textbf{ msg}, \textbf{ msgb\+\_\+l3}, \textbf{ msgb\+\_\+l3len()}, and \textbf{ osmo\+\_\+hexdump()}.



Referenced by \textbf{ \+\_\+msgb\+\_\+eq()}.

\mbox{\label{group__msgb_ga5965412cbc6326a2d77ba1d68d756b79}} 
\index{Message buffers@{Message buffers}!msgb\_hexdump\_l4@{msgb\_hexdump\_l4}}
\index{msgb\_hexdump\_l4@{msgb\_hexdump\_l4}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_hexdump\_l4()}
{\footnotesize\ttfamily static const char $\ast$ msgb\+\_\+hexdump\+\_\+l4 (\begin{DoxyParamCaption}\item[{const struct \textbf{ msgb} $\ast$}]{msg }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



References \textbf{ msg}, \textbf{ msgb\+\_\+l4}, \textbf{ msgb\+\_\+l4len()}, and \textbf{ osmo\+\_\+hexdump()}.



Referenced by \textbf{ \+\_\+msgb\+\_\+eq()}.

\mbox{\label{group__msgb_ga6c906f4c3afd52d2813a9c9a50acdf48}} 
\index{Message buffers@{Message buffers}!msgb\_l1len@{msgb\_l1len}}
\index{msgb\_l1len@{msgb\_l1len}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_l1len()}
{\footnotesize\ttfamily static unsigned int msgb\+\_\+l1len (\begin{DoxyParamCaption}\item[{const struct \textbf{ msgb} $\ast$}]{msgb }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



determine length of L1 message 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msgb} & message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
size of L1 message in bytes
\end{DoxyReturn}
This function computes the number of bytes between the tail of the message and the layer 1 header. 

References \textbf{ l1h}, \textbf{ msgb\+\_\+l1}, \textbf{ OSMO\+\_\+\+ASSERT}, and \textbf{ tail}.



Referenced by \textbf{ \+\_\+msgb\+\_\+eq()}, and \textbf{ msgb\+\_\+hexdump\+\_\+l1()}.

\mbox{\label{group__msgb_ga62f1183fcbb03ae09b922a79b95528ab}} 
\index{Message buffers@{Message buffers}!msgb\_l2len@{msgb\_l2len}}
\index{msgb\_l2len@{msgb\_l2len}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_l2len()}
{\footnotesize\ttfamily static unsigned int msgb\+\_\+l2len (\begin{DoxyParamCaption}\item[{const struct \textbf{ msgb} $\ast$}]{msgb }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



determine length of L2 message 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msgb} & message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
size of L2 message in bytes
\end{DoxyReturn}
This function computes the number of bytes between the tail of the message and the layer 2 header. 

References \textbf{ l2h}, \textbf{ msgb\+\_\+l2}, \textbf{ OSMO\+\_\+\+ASSERT}, and \textbf{ tail}.



Referenced by \textbf{ \+\_\+msgb\+\_\+eq()}, and \textbf{ msgb\+\_\+hexdump\+\_\+l2()}.

\mbox{\label{group__msgb_ga519e9198fe06b0ea67ada65e77c5d7b2}} 
\index{Message buffers@{Message buffers}!msgb\_l3len@{msgb\_l3len}}
\index{msgb\_l3len@{msgb\_l3len}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_l3len()}
{\footnotesize\ttfamily static unsigned int msgb\+\_\+l3len (\begin{DoxyParamCaption}\item[{const struct \textbf{ msgb} $\ast$}]{msgb }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



determine length of L3 message 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msgb} & message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
size of L3 message in bytes
\end{DoxyReturn}
This function computes the number of bytes between the tail of the message and the layer 3 header. 

References \textbf{ l3h}, \textbf{ msgb\+\_\+l3}, \textbf{ OSMO\+\_\+\+ASSERT}, and \textbf{ tail}.



Referenced by \textbf{ \+\_\+msgb\+\_\+eq()}, and \textbf{ msgb\+\_\+hexdump\+\_\+l3()}.

\mbox{\label{group__msgb_gadcf2bccabb0370141eebdc32aca77d30}} 
\index{Message buffers@{Message buffers}!msgb\_l3trim@{msgb\_l3trim}}
\index{msgb\_l3trim@{msgb\_l3trim}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_l3trim()}
{\footnotesize\ttfamily static int msgb\+\_\+l3trim (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msg,  }\item[{int}]{l3len }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Trim the msgb to a given layer3 length. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em l3len} & new layer3 length \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 in case of success, negative in case of error 
\end{DoxyReturn}


References \textbf{ msg}, and \textbf{ msgb\+\_\+trim()}.

\mbox{\label{group__msgb_ga23865301157c48a99407f62b3e178d06}} 
\index{Message buffers@{Message buffers}!msgb\_l4len@{msgb\_l4len}}
\index{msgb\_l4len@{msgb\_l4len}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_l4len()}
{\footnotesize\ttfamily static unsigned int msgb\+\_\+l4len (\begin{DoxyParamCaption}\item[{const struct \textbf{ msgb} $\ast$}]{msgb }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



determine length of L4 message 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msgb} & message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
size of L4 message in bytes
\end{DoxyReturn}
This function computes the number of bytes between the tail of the message and the layer 4 header. 

References \textbf{ l4h}, \textbf{ msgb\+\_\+l4}, \textbf{ OSMO\+\_\+\+ASSERT}, and \textbf{ tail}.



Referenced by \textbf{ \+\_\+msgb\+\_\+eq()}, and \textbf{ msgb\+\_\+hexdump\+\_\+l4()}.

\mbox{\label{group__msgb_ga036077cd924b90a798cb3b6c5541a492}} 
\index{Message buffers@{Message buffers}!msgb\_length@{msgb\_length}}
\index{msgb\_length@{msgb\_length}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_length()}
{\footnotesize\ttfamily uint16\+\_\+t msgb\+\_\+length (\begin{DoxyParamCaption}\item[{const struct \textbf{ msgb} $\ast$}]{msg }\end{DoxyParamCaption})}



get length of message buffer 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
length of data section in message buffer 
\end{DoxyReturn}


References \textbf{ msg}.



Referenced by \textbf{ \+\_\+msgb\+\_\+eq()}, \textbf{ iofd\+\_\+handle\+\_\+segmentation()}, \textbf{ iofd\+\_\+handle\+\_\+segmented\+\_\+read()}, \textbf{ iofd\+\_\+handle\+\_\+send\+\_\+completion()}, \textbf{ iofd\+\_\+prepare\+\_\+handle\+\_\+segmentation()}, \textbf{ msgb\+\_\+copy\+\_\+resize\+\_\+c()}, \textbf{ msgb\+\_\+get()}, \textbf{ msgb\+\_\+hexdump\+\_\+c()}, \textbf{ msgb\+\_\+pull()}, \textbf{ osmo\+\_\+iofd\+\_\+sendmsg\+\_\+msgb()}, \textbf{ osmo\+\_\+iofd\+\_\+sendto\+\_\+msgb()}, \textbf{ osmo\+\_\+iofd\+\_\+write\+\_\+msgb()}, \textbf{ osmo\+\_\+soft\+\_\+uart\+\_\+flush\+\_\+rx()}, \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+statsd\+\_\+send()}, \textbf{ suart\+\_\+rx\+\_\+ch()}, \textbf{ suart\+\_\+tx\+\_\+bit()}, and \textbf{ tundev\+\_\+write\+\_\+cb()}.

\mbox{\label{group__msgb_ga8b7ed585b26c2239b7f7e702a3daf29f}} 
\index{Message buffers@{Message buffers}!msgb\_printf@{msgb\_printf}}
\index{msgb\_printf@{msgb\_printf}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_printf()}
{\footnotesize\ttfamily int msgb\+\_\+printf (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msgb,  }\item[{const char $\ast$}]{format,  }\item[{}]{... }\end{DoxyParamCaption})}



Print a string to the end of message buffer. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msgb} & message buffer. \\
\hline
\mbox{\texttt{ in}}  & {\em format} & format string. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success, -\/EINVAL on error.
\end{DoxyReturn}
The resulting string is printed to the msgb without a trailing nul character. A nul following the data tail may be written as an implementation detail, but a trailing nul is never part of the msgb data in terms of \doxyref{msgb\+\_\+length()}{p.}{group__msgb_ga036077cd924b90a798cb3b6c5541a492}.

Note\+: the tailroom must always be one byte longer than the string to be written. The msgb is filled only up to tailroom=1. This is an implementation detail that allows leaving a nul character behind the valid data.

In case of error, the msgb remains unchanged, though data may have been written to the (unused) memory after the tail pointer. 

References \textbf{ msgb\+\_\+put()}, \textbf{ msgb\+\_\+tailroom()}, \textbf{ OSMO\+\_\+\+ASSERT}, and \textbf{ tail}.

\mbox{\label{group__msgb_ga031d4336b3ebd3a910f4fa178aa17b03}} 
\index{Message buffers@{Message buffers}!msgb\_pull@{msgb\_pull}}
\index{msgb\_pull@{msgb\_pull}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_pull()}
{\footnotesize\ttfamily static unsigned char $\ast$ msgb\+\_\+pull (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msgb,  }\item[{unsigned int}]{len }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



remove (pull) a header from the front of the message buffer 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msgb} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em len} & number of octets to be pulled \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pointer to new start of msgb
\end{DoxyReturn}
This function moves the {\itshape data} pointer of the \doxyref{Message buffers}{p.}{group__msgb} further back in the message, thereby shrinking the size of the message by {\itshape len} bytes. 

References \textbf{ data}, \textbf{ len()}, \textbf{ len}, \textbf{ MSGB\+\_\+\+ABORT}, \textbf{ msgb\+\_\+length()}, and \textbf{ OSMO\+\_\+\+UNLIKELY}.



Referenced by \textbf{ iofd\+\_\+handle\+\_\+send\+\_\+completion()}, \textbf{ iofd\+\_\+prepare\+\_\+handle\+\_\+segmentation()}, \textbf{ msgb\+\_\+pull\+\_\+to\+\_\+l2()}, \textbf{ msgb\+\_\+pull\+\_\+to\+\_\+l3()}, \textbf{ msgb\+\_\+pull\+\_\+u16()}, \textbf{ msgb\+\_\+pull\+\_\+u32()}, and \textbf{ msgb\+\_\+pull\+\_\+u8()}.

\mbox{\label{group__msgb_ga390bcb56ea0623b22c40f81d288812f0}} 
\index{Message buffers@{Message buffers}!msgb\_pull\_to\_l2@{msgb\_pull\_to\_l2}}
\index{msgb\_pull\_to\_l2@{msgb\_pull\_to\_l2}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_pull\_to\_l2()}
{\footnotesize\ttfamily static unsigned char $\ast$ msgb\+\_\+pull\+\_\+to\+\_\+l2 (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msg }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



remove (pull) all headers in front of l2h from the message buffer. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer with a valid l2h \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pointer to new start of msgb (l2h)
\end{DoxyReturn}
This function moves the {\itshape data} pointer of the \doxyref{Message buffers}{p.}{group__msgb} further back in the message, thereby shrinking the size of the message. l1h will be cleared. 

References \textbf{ msg}, and \textbf{ msgb\+\_\+pull()}.

\mbox{\label{group__msgb_gaaa6018286eef90118f6f44e531302028}} 
\index{Message buffers@{Message buffers}!msgb\_pull\_to\_l3@{msgb\_pull\_to\_l3}}
\index{msgb\_pull\_to\_l3@{msgb\_pull\_to\_l3}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_pull\_to\_l3()}
{\footnotesize\ttfamily static unsigned char $\ast$ msgb\+\_\+pull\+\_\+to\+\_\+l3 (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msg }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



remove (pull) all headers in front of l3h from the message buffer. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer with a valid l3h \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pointer to new start of msgb (l3h)
\end{DoxyReturn}
This function moves the {\itshape data} pointer of the \doxyref{Message buffers}{p.}{group__msgb} further back in the message, thereby shrinking the size of the message. l1h and l2h will be cleared. 

References \textbf{ msg}, and \textbf{ msgb\+\_\+pull()}.

\mbox{\label{group__msgb_ga2e2c2eb7ddf48d24cd78f95151537a73}} 
\index{Message buffers@{Message buffers}!msgb\_pull\_u16@{msgb\_pull\_u16}}
\index{msgb\_pull\_u16@{msgb\_pull\_u16}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_pull\_u16()}
{\footnotesize\ttfamily static uint16\+\_\+t msgb\+\_\+pull\+\_\+u16 (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msgb }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



remove uint16 from front of message 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msgb} & message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
16bit value taken from the front of msgb 
\end{DoxyReturn}


References \textbf{ msgb\+\_\+pull()}, and \textbf{ osmo\+\_\+load16be()}.

\mbox{\label{group__msgb_ga68f43d95ab0571e207ccc679c426bbbe}} 
\index{Message buffers@{Message buffers}!msgb\_pull\_u32@{msgb\_pull\_u32}}
\index{msgb\_pull\_u32@{msgb\_pull\_u32}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_pull\_u32()}
{\footnotesize\ttfamily static uint32\+\_\+t msgb\+\_\+pull\+\_\+u32 (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msgb }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



remove uint32 from front of message 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msgb} & message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
32bit value taken from the front of msgb 
\end{DoxyReturn}


References \textbf{ msgb\+\_\+pull()}, and \textbf{ osmo\+\_\+load32be()}.

\mbox{\label{group__msgb_ga0d66ac4622d966dfd30ce3ced46f7bff}} 
\index{Message buffers@{Message buffers}!msgb\_pull\_u8@{msgb\_pull\_u8}}
\index{msgb\_pull\_u8@{msgb\_pull\_u8}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_pull\_u8()}
{\footnotesize\ttfamily static uint8\+\_\+t msgb\+\_\+pull\+\_\+u8 (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msgb }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



remove uint8 from front of message 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msgb} & message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
8bit value taken from the front of msgb 
\end{DoxyReturn}


References \textbf{ msgb\+\_\+pull()}.



Referenced by \textbf{ suart\+\_\+tx\+\_\+bit()}.

\mbox{\label{group__msgb_gafe7118b63e3c23e5dd4f3a5bf8ce18ff}} 
\index{Message buffers@{Message buffers}!msgb\_push@{msgb\_push}}
\index{msgb\_push@{msgb\_push}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_push()}
{\footnotesize\ttfamily static unsigned char $\ast$ msgb\+\_\+push (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msgb,  }\item[{unsigned int}]{len }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



prepend (push) some data to start of message 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msgb} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em len} & number of bytes to pre-\/pend \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pointer to newly added portion at start of {\itshape msgb} 
\end{DoxyReturn}
This function moves the {\itshape data} pointer of the \doxyref{Message buffers}{p.}{group__msgb} further to the front (by {\itshape len} bytes), thereby enlarging the message by {\itshape len} bytes.

The return value is a pointer to the newly added section in the beginning of the message. It can be used to fill/copy data into it. 

References \textbf{ \+\_\+data}, \textbf{ data}, \textbf{ data\+\_\+len}, \textbf{ head}, \textbf{ len()}, \textbf{ len}, \textbf{ MSGB\+\_\+\+ABORT}, \textbf{ msgb\+\_\+headroom()}, \textbf{ msgb\+\_\+tailroom()}, and \textbf{ OSMO\+\_\+\+UNLIKELY}.



Referenced by \textbf{ msgb\+\_\+push\+\_\+tl()}, \textbf{ msgb\+\_\+push\+\_\+u16()}, \textbf{ msgb\+\_\+push\+\_\+u32()}, \textbf{ msgb\+\_\+push\+\_\+u8()}, and \textbf{ osmo\+\_\+sercomm\+\_\+sendmsg()}.

\mbox{\label{group__msgb_ga605f6a4d945369e1ccb38f168a8dc2c7}} 
\index{Message buffers@{Message buffers}!msgb\_push\_tl@{msgb\_push\_tl}}
\index{msgb\_push\_tl@{msgb\_push\_tl}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_push\_tl()}
{\footnotesize\ttfamily static unsigned char $\ast$ msgb\+\_\+push\+\_\+tl (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msgb,  }\item[{uint8\+\_\+t}]{tag }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



References \textbf{ data}, \textbf{ len}, and \textbf{ msgb\+\_\+push()}.

\mbox{\label{group__msgb_ga6884d6ab602f8d89256e67f4b6134671}} 
\index{Message buffers@{Message buffers}!msgb\_push\_u16@{msgb\_push\_u16}}
\index{msgb\_push\_u16@{msgb\_push\_u16}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_push\_u16()}
{\footnotesize\ttfamily static void msgb\+\_\+push\+\_\+u16 (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msg,  }\item[{uint16\+\_\+t}]{word }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



prepend a uint16 value to the head of the message 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em word} & unsigned 16bit byte to be prepended \\
\hline
\end{DoxyParams}


References \textbf{ msg}, \textbf{ msgb\+\_\+push()}, and \textbf{ osmo\+\_\+store16be()}.

\mbox{\label{group__msgb_gaae975f6c2478a9a588e4826207a45657}} 
\index{Message buffers@{Message buffers}!msgb\_push\_u32@{msgb\_push\_u32}}
\index{msgb\_push\_u32@{msgb\_push\_u32}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_push\_u32()}
{\footnotesize\ttfamily static void msgb\+\_\+push\+\_\+u32 (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msg,  }\item[{uint32\+\_\+t}]{word }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



prepend a uint32 value to the head of the message 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em word} & unsigned 32bit byte to be prepended \\
\hline
\end{DoxyParams}


References \textbf{ msg}, \textbf{ msgb\+\_\+push()}, and \textbf{ osmo\+\_\+store32be()}.

\mbox{\label{group__msgb_ga57b61b3a680a9b208f6e032421172d26}} 
\index{Message buffers@{Message buffers}!msgb\_push\_u8@{msgb\_push\_u8}}
\index{msgb\_push\_u8@{msgb\_push\_u8}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_push\_u8()}
{\footnotesize\ttfamily static void msgb\+\_\+push\+\_\+u8 (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msg,  }\item[{uint8\+\_\+t}]{word }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



prepend a uint8 value to the head of the message 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em word} & unsigned 8bit byte to be prepended \\
\hline
\end{DoxyParams}


References \textbf{ msg}, and \textbf{ msgb\+\_\+push()}.

\mbox{\label{group__msgb_ga776bdfbc2cc1de3e2005f8d765739852}} 
\index{Message buffers@{Message buffers}!msgb\_put@{msgb\_put}}
\index{msgb\_put@{msgb\_put}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_put()}
{\footnotesize\ttfamily static unsigned char $\ast$ msgb\+\_\+put (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msgb,  }\item[{unsigned int}]{len }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



append data to end of message buffer 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msgb} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em len} & number of bytes to append to message \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pointer to start of newly-\/appended data
\end{DoxyReturn}
This function will move the {\itshape tail} pointer of the message buffer {\itshape len} bytes further, thus enlarging the message by {\itshape len} bytes.

The return value is a pointer to start of the newly added section at the end of the message and can be used for actually filling/copying data into it. 

References \textbf{ \+\_\+data}, \textbf{ data\+\_\+len}, \textbf{ head}, \textbf{ len()}, \textbf{ len}, \textbf{ MSGB\+\_\+\+ABORT}, \textbf{ msgb\+\_\+tailroom()}, \textbf{ OSMO\+\_\+\+UNLIKELY}, and \textbf{ tail}.



Referenced by \textbf{ \+\_\+file\+\_\+raw\+\_\+output()}, \textbf{ \+\_\+gsmtap\+\_\+raw\+\_\+output()}, \textbf{ gsmtap\+\_\+makemsg\+\_\+ex()}, \textbf{ iofd\+\_\+handle\+\_\+segmentation()}, \textbf{ iofd\+\_\+poll\+\_\+handle\+\_\+recv()}, \textbf{ iofd\+\_\+prepare\+\_\+handle\+\_\+segmentation()}, \textbf{ msgb\+\_\+printf()}, \textbf{ msgb\+\_\+put\+\_\+u16()}, \textbf{ msgb\+\_\+put\+\_\+u32()}, \textbf{ msgb\+\_\+put\+\_\+u8()}, \textbf{ osmo\+\_\+sercomm\+\_\+drv\+\_\+rx\+\_\+char()}, \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+statsd\+\_\+send()}, and \textbf{ tundev\+\_\+decaps()}.

\mbox{\label{group__msgb_ga8c951f453a3d6dd6c800fc5d7480534c}} 
\index{Message buffers@{Message buffers}!msgb\_put\_u16@{msgb\_put\_u16}}
\index{msgb\_put\_u16@{msgb\_put\_u16}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_put\_u16()}
{\footnotesize\ttfamily static void msgb\+\_\+put\+\_\+u16 (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msgb,  }\item[{uint16\+\_\+t}]{word }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



append a uint16 value to the end of the message 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msgb} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em word} & unsigned 16bit byte to be appended \\
\hline
\end{DoxyParams}


References \textbf{ msgb\+\_\+put()}, and \textbf{ osmo\+\_\+store16be()}.

\mbox{\label{group__msgb_ga2650307d02f185d8f6ac11b8de7738c6}} 
\index{Message buffers@{Message buffers}!msgb\_put\_u32@{msgb\_put\_u32}}
\index{msgb\_put\_u32@{msgb\_put\_u32}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_put\_u32()}
{\footnotesize\ttfamily static void msgb\+\_\+put\+\_\+u32 (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msgb,  }\item[{uint32\+\_\+t}]{word }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



append a uint32 value to the end of the message 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msgb} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em word} & unsigned 32bit byte to be appended \\
\hline
\end{DoxyParams}


References \textbf{ msgb\+\_\+put()}, and \textbf{ osmo\+\_\+store32be()}.

\mbox{\label{group__msgb_gabf3d11e3739218fe013956285819f772}} 
\index{Message buffers@{Message buffers}!msgb\_put\_u8@{msgb\_put\_u8}}
\index{msgb\_put\_u8@{msgb\_put\_u8}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_put\_u8()}
{\footnotesize\ttfamily static void msgb\+\_\+put\+\_\+u8 (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msgb,  }\item[{uint8\+\_\+t}]{word }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



append a uint8 value to the end of the message 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msgb} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em word} & unsigned 8bit byte to be appended \\
\hline
\end{DoxyParams}


References \textbf{ msgb\+\_\+put()}.



Referenced by \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+statsd\+\_\+send()}, and \textbf{ suart\+\_\+rx\+\_\+ch()}.

\mbox{\label{group__msgb_ga9c04c785fc2ff39b85a47e915a39eab7}} 
\index{Message buffers@{Message buffers}!msgb\_queue\_free@{msgb\_queue\_free}}
\index{msgb\_queue\_free@{msgb\_queue\_free}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_queue\_free()}
{\footnotesize\ttfamily static void msgb\+\_\+queue\+\_\+free (\begin{DoxyParamCaption}\item[{struct \textbf{ llist\+\_\+head} $\ast$}]{queue }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Free all msgbs from a queue built with \doxyref{msgb\+\_\+enqueue()}{p.}{group__msgb_gacb8dd9493eb7fc266ce159e3325c6504}. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em queue} & list head of a msgb queue. \\
\hline
\end{DoxyParams}


References \textbf{ msg}, \textbf{ msgb\+\_\+dequeue()}, and \textbf{ msgb\+\_\+free()}.

\mbox{\label{group__msgb_gad73da5b3dce61877ad745d5e25ea44d5}} 
\index{Message buffers@{Message buffers}!msgb\_reserve@{msgb\_reserve}}
\index{msgb\_reserve@{msgb\_reserve}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_reserve()}
{\footnotesize\ttfamily static void msgb\+\_\+reserve (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msg,  }\item[{int}]{len }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Increase headroom of empty msgb, reducing the tailroom. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em len} & amount of extra octets to be reserved as headroom\\
\hline
\end{DoxyParams}
This function reserves some memory at the beginning of the underlying data buffer. The idea is to reserve space in case further headers have to be pushed to the \doxyref{Message buffers}{p.}{group__msgb} during further processing.

Calling this function leads to undefined reusults if it is called on a non-\/empty \doxyref{Message buffers}{p.}{group__msgb}. 

References \textbf{ len()}, and \textbf{ msg}.



Referenced by \textbf{ msgb\+\_\+alloc\+\_\+headroom()}, and \textbf{ msgb\+\_\+alloc\+\_\+headroom\+\_\+c()}.

\mbox{\label{group__msgb_ga5676421c50ed5d0049b53605fc5397ce}} 
\index{Message buffers@{Message buffers}!msgb\_reset@{msgb\_reset}}
\index{msgb\_reset@{msgb\_reset}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_reset()}
{\footnotesize\ttfamily void msgb\+\_\+reset (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msg }\end{DoxyParamCaption})}



Re-\/set all message buffer pointers. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer that is to be resetted\\
\hline
\end{DoxyParams}
This will re-\/set the various internal pointers into the underlying message buffer, i.\+e. remove all headroom and treat the msgb as completely empty. It also initializes the control buffer to zero. 

References \textbf{ msg}.



Referenced by \textbf{ osmo\+\_\+soft\+\_\+uart\+\_\+flush\+\_\+rx()}.

\mbox{\label{group__msgb_gab1ffdec5c9aa14709b9b10b0c3ad3612}} 
\index{Message buffers@{Message buffers}!msgb\_resize\_area@{msgb\_resize\_area}}
\index{msgb\_resize\_area@{msgb\_resize\_area}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_resize\_area()}
{\footnotesize\ttfamily int msgb\+\_\+resize\+\_\+area (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msg,  }\item[{uint8\+\_\+t $\ast$}]{area,  }\item[{int}]{old\+\_\+size,  }\item[{int}]{new\+\_\+size }\end{DoxyParamCaption})}



Resize an area within an msgb. 

This resizes a sub area of the msgb data and adjusts the pointers (incl l1h-\/l4h) accordingly. The cb part is not updated. If the area is extended, the contents of the extension is undefined. The complete sub area must be a part of [data,tail].


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em msg} & The msgb object \\
\hline
\mbox{\texttt{ in}}  & {\em area} & A pointer to the sub-\/area \\
\hline
\mbox{\texttt{ in}}  & {\em old\+\_\+size} & The old size of the sub-\/area \\
\hline
\mbox{\texttt{ in}}  & {\em new\+\_\+size} & The new size of the sub-\/area \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success, -\/1 if there is not enough space to extend the area 
\end{DoxyReturn}


References \textbf{ data}, \textbf{ msg}, \textbf{ MSGB\+\_\+\+ABORT}, and \textbf{ msgb\+\_\+trim()}.

\mbox{\label{group__msgb_ga1d57bb92a849857deb6871446d3230da}} 
\index{Message buffers@{Message buffers}!msgb\_set\_talloc\_ctx@{msgb\_set\_talloc\_ctx}}
\index{msgb\_set\_talloc\_ctx@{msgb\_set\_talloc\_ctx}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_set\_talloc\_ctx()}
{\footnotesize\ttfamily void msgb\+\_\+set\+\_\+talloc\+\_\+ctx (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx }\end{DoxyParamCaption})}



Set the talloc context for \doxyref{msgb\+\_\+alloc}{p.}{group__msgb_ga25906d049cbad1bf2d5a785319268ea8} Deprecated, use \doxyref{msgb\+\_\+talloc\+\_\+ctx\+\_\+init()}{p.}{group__msgb_ga66fd1ee6b6667bf707fcef99ee2fb7db} instead. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctx} & talloc context to be used as root for msgb allocations \\
\hline
\end{DoxyParams}


References \textbf{ tall\+\_\+msgb\+\_\+ctx}.

\mbox{\label{group__msgb_ga14ba72cbede82dddeece5838969d064c}} 
\index{Message buffers@{Message buffers}!msgb\_tailroom@{msgb\_tailroom}}
\index{msgb\_tailroom@{msgb\_tailroom}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_tailroom()}
{\footnotesize\ttfamily static int msgb\+\_\+tailroom (\begin{DoxyParamCaption}\item[{const struct \textbf{ msgb} $\ast$}]{msgb }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



determine how much tail room is left in msgb 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msgb} & message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
number of bytes remaining at end of msgb
\end{DoxyReturn}
This function computes the amount of octets left in the underlying data buffer after the end of the message. 

References \textbf{ data\+\_\+len}, \textbf{ head}, and \textbf{ tail}.



Referenced by \textbf{ \+\_\+file\+\_\+raw\+\_\+output()}, \textbf{ \+\_\+gsmtap\+\_\+raw\+\_\+output()}, \textbf{ iofd\+\_\+poll\+\_\+ofd\+\_\+cb\+\_\+recvmsg\+\_\+sendmsg()}, \textbf{ iofd\+\_\+prepare\+\_\+handle\+\_\+segmentation()}, \textbf{ msgb\+\_\+printf()}, \textbf{ msgb\+\_\+push()}, \textbf{ msgb\+\_\+put()}, \textbf{ osmo\+\_\+sercomm\+\_\+drv\+\_\+rx\+\_\+char()}, and \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+statsd\+\_\+send()}.

\mbox{\label{group__msgb_ga66fd1ee6b6667bf707fcef99ee2fb7db}} 
\index{Message buffers@{Message buffers}!msgb\_talloc\_ctx\_init@{msgb\_talloc\_ctx\_init}}
\index{msgb\_talloc\_ctx\_init@{msgb\_talloc\_ctx\_init}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_talloc\_ctx\_init()}
{\footnotesize\ttfamily void $\ast$ msgb\+\_\+talloc\+\_\+ctx\+\_\+init (\begin{DoxyParamCaption}\item[{void $\ast$}]{root\+\_\+ctx,  }\item[{unsigned int}]{pool\+\_\+size }\end{DoxyParamCaption})}



Initialize a msgb talloc context for \doxyref{msgb\+\_\+alloc}{p.}{group__msgb_ga25906d049cbad1bf2d5a785319268ea8}. 

Create a talloc context called \char`\"{}msgb\char`\"{}. If {\itshape pool\+\_\+size} is 0, create a named const as msgb talloc context. If {\itshape pool\+\_\+size} is nonzero, create a talloc pool, possibly for faster msgb allocations (see talloc\+\_\+pool()). 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em root\+\_\+ctx} & talloc context used as parent for the new \char`\"{}msgb\char`\"{} ctx. \\
\hline
\mbox{\texttt{ in}}  & {\em pool\+\_\+size} & if nonzero, create a talloc pool of this size. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the new msgb talloc context, e.\+g. for reporting 
\end{DoxyReturn}


References \textbf{ tall\+\_\+msgb\+\_\+ctx}.

\mbox{\label{group__msgb_ga4b2dd2f9f18244da4014d89693e39927}} 
\index{Message buffers@{Message buffers}!msgb\_test\_invariant@{msgb\_test\_invariant}}
\index{msgb\_test\_invariant@{msgb\_test\_invariant}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_test\_invariant()}
{\footnotesize\ttfamily static int msgb\+\_\+test\+\_\+invariant (\begin{DoxyParamCaption}\item[{const struct \textbf{ msgb} $\ast$}]{msg }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Check a message buffer for consistency. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 (false) if inconsistent, != 0 (true) otherwise 
\end{DoxyReturn}


References \textbf{ msg}.

\mbox{\label{group__msgb_ga9c64d044b82dc23de865fadc8533249e}} 
\index{Message buffers@{Message buffers}!msgb\_trim@{msgb\_trim}}
\index{msgb\_trim@{msgb\_trim}!Message buffers@{Message buffers}}
\doxysubsubsection{msgb\_trim()}
{\footnotesize\ttfamily static int msgb\+\_\+trim (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msg,  }\item[{int}]{len }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Trim the msgb to a given absolute length. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msg} & message buffer \\
\hline
\mbox{\texttt{ in}}  & {\em len} & new total length of buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 in case of success, negative in case of error 
\end{DoxyReturn}


References \textbf{ len()}, \textbf{ msg}, \textbf{ MSGB\+\_\+\+ABORT}, and \textbf{ OSMO\+\_\+\+UNLIKELY}.



Referenced by \textbf{ msgb\+\_\+l3trim()}, \textbf{ msgb\+\_\+resize\+\_\+area()}, and \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+statsd\+\_\+send()}.



\doxysubsection{Variable Documentation}
\mbox{\label{group__msgb_ga72b7917a2ec7fb2120f31cab8d749218}} 
\index{Message buffers@{Message buffers}!tall\_msgb\_ctx@{tall\_msgb\_ctx}}
\index{tall\_msgb\_ctx@{tall\_msgb\_ctx}!Message buffers@{Message buffers}}
\doxysubsubsection{tall\_msgb\_ctx}
{\footnotesize\ttfamily void$\ast$ tall\+\_\+msgb\+\_\+ctx = NULL}



Referenced by \textbf{ \+\_\+log\+\_\+target\+\_\+file\+\_\+setup\+\_\+talloc\+\_\+pool()}, \textbf{ log\+\_\+target\+\_\+create\+\_\+gsmtap()}, \textbf{ msgb\+\_\+alloc()}, \textbf{ msgb\+\_\+copy()}, \textbf{ msgb\+\_\+copy\+\_\+resize()}, \textbf{ msgb\+\_\+set\+\_\+talloc\+\_\+ctx()}, and \textbf{ msgb\+\_\+talloc\+\_\+ctx\+\_\+init()}.

