High Performance OPC UA Server SDK
1.2.0.193
|
The buffer structure is used for protocol encoding/decoding. More...
#include <buffer.h>
Public Member Functions | |
void | ua_buffer_init (struct ua_buffer *buf) |
Initialize an ua_buffer. | |
void | ua_buffer_attach (struct ua_buffer *buf, unsigned char *data, unsigned int len) |
Attaches buf to given data with length len . More... | |
struct ua_buffer * | ua_buffer_alloc (unsigned int conn) |
Allocate a new ua_buffer. More... | |
void | ua_buffer_free (struct ua_buffer *buf) |
Free an allocated ua_buffer. More... | |
static unsigned int | ua_buffer_remaining (struct ua_buffer *buf) |
Returns the remaining bytes that can be read or written of the given buffer buf . More... | |
static uint8_t | ua_buffer_getbyte (struct ua_buffer *buf) |
Returns the byte of at current position and increments the position counter. More... | |
static void | ua_buffer_addbyte (struct ua_buffer *buf, uint8_t val) |
Writes one byte to the current position and increments the position counter. More... | |
static void | ua_buffer_write (struct ua_buffer *buf, const void *data, unsigned int len) |
Writes an array of bytes to the buffer. More... | |
static void | ua_buffer_read (struct ua_buffer *buf, void *data, unsigned int len) |
Reads an array of bytes from the buffer. More... | |
Data Fields | |
unsigned int | conn |
connection handle for buffer-mgt | |
unsigned int | pos |
current position | |
unsigned int | len |
length of data | |
struct ua_buffer * | next |
pointer to next buffer | |
unsigned char * | data |
data pointer | |
The buffer structure is used for protocol encoding/decoding.
An OPC UA message can be chunked into multiple parts. Each part is stored in one buffer. These buffers can be chained in forward linked list, so one message consists of one list of buffers.
|
inline |
Writes one byte to the current position and increments the position counter.
struct ua_buffer * ua_buffer_alloc | ( | unsigned int | conn | ) |
Allocate a new ua_buffer.
conn | Buffer management handle form ua_buffer_mgt_register. |
void ua_buffer_attach | ( | struct ua_buffer * | buf, |
unsigned char * | data, | ||
unsigned int | len | ||
) |
Attaches buf
to given data
with length len
.
This does not take ownership of data
, so ua_buffer_clear will not free data
and doesn't know at all how data
was allocated. The caller is responsible of clearing data
after clearing buf
.
void ua_buffer_free | ( | struct ua_buffer * | buf | ) |
Free an allocated ua_buffer.
Inverse operation of ua_buffer_alloc, frees buf
and all ua_buffers linked to this buffer.
|
inline |
Returns the byte of at current position and increments the position counter.
|
inline |
Reads an array of bytes from the buffer.
buf | the source buffer |
data | pointer to destination data |
len | number of bytes to read |
|
inline |
Returns the remaining bytes that can be read or written of the given buffer buf
.
The number of remaining bytes is computed as len
- pos
.
|
inline |
Writes an array of bytes to the buffer.
buf | the destination buffer |
data | pointer to source data |
len | number of bytes to write |