High Performance OPC UA Server SDK  1.2.0.193
ua_buffer Struct Reference

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_bufferua_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_buffernext
 pointer to next buffer
 
unsigned char * data
 data pointer
 

Detailed Description

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.

Member Function Documentation

static void ua_buffer_addbyte ( struct ua_buffer buf,
uint8_t  val 
)
inline

Writes one byte to the current position and increments the position counter.

Note
This function does not perform any security checks. The caller is responsible to provide correct parameters.
struct ua_buffer * ua_buffer_alloc ( unsigned int  conn)

Allocate a new ua_buffer.

Parameters
connBuffer 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.

static uint8_t ua_buffer_getbyte ( struct ua_buffer buf)
inline

Returns the byte of at current position and increments the position counter.

Note
This function does not perform any security checks. The caller is responsible to provide correct parameters.
static void ua_buffer_read ( struct ua_buffer buf,
void *  data,
unsigned int  len 
)
inline

Reads an array of bytes from the buffer.

Parameters
bufthe source buffer
datapointer to destination data
lennumber of bytes to read
Note
This function does not perform any security checks. The caller is responsible to provide correct parameters.
static unsigned int ua_buffer_remaining ( struct ua_buffer buf)
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.

Note
This function does not perform any security checks. The caller is responsible to provide correct parameters.
static void ua_buffer_write ( struct ua_buffer buf,
const void *  data,
unsigned int  len 
)
inline

Writes an array of bytes to the buffer.

Parameters
bufthe destination buffer
datapointer to source data
lennumber of bytes to write
Note
This function does not perform any security checks. The caller is responsible to provide correct parameters.

The documentation for this struct was generated from the following files: