High Performance OPC UA Server SDK
1.4.0.256
|
This Built-in DataType defines a value that is a sequence of Byte values. More...
#include <bytestring.h>
Public Member Functions | |
void | ua_bytestring_init (struct ua_bytestring *bs) |
Initialize an ua_bytestring as empty bytestring. | |
void | ua_bytestring_clear (struct ua_bytestring *bs) |
Clear an ua_bytestring and set to empty bytestring. | |
size_t | ua_bytestring_length (const struct ua_bytestring *bs) |
Returns the length of the bytestring in bytes. More... | |
char * | ua_bytestring_data (struct ua_bytestring *bs) |
Returns the raw data of bs . More... | |
const char * | ua_bytestring_const_data (const struct ua_bytestring *bs) |
Returns the raw string data of bs . More... | |
const unsigned char * | ua_bytestring_unsigned_const_data (const struct ua_bytestring *bs) |
Returns the raw string data of bs as unsigned byte array. More... | |
bool | ua_bytestring_is_null (const struct ua_bytestring *bs) |
Returns true if the given bytestring is a NULL bytestring. | |
int | ua_bytestring_compare (const struct ua_bytestring *a, const struct ua_bytestring *b) |
Compare to ua_bytestrings. More... | |
int | ua_bytestring_copy (struct ua_bytestring *dst, const struct ua_bytestring *src) |
Copy ua_bytestring src to dst . More... | |
int | ua_bytestring_set (struct ua_bytestring *bs, const char *src, int32_t len) |
Initializes the bytestring bs with the given data. More... | |
void | ua_bytestring_set_null (struct ua_bytestring *bs) |
Initializes the bytestring bs as null bytestring. More... | |
void | ua_bytestring_attach (struct ua_bytestring *bs, char *src, int32_t len) |
Initializes the bytestring bs with the given data. More... | |
int | ua_bytestring_append (struct ua_bytestring *dst, const struct ua_bytestring *src) |
Appends the bytestring src to the bytestring dst . More... | |
int | ua_bytestring_to_string (const struct ua_bytestring *bs, struct ua_string *dst) |
Creates a ua_string dst with base64 encoded content from a ua_bytestring bs . More... | |
int | ua_bytestring_snprintf (char *dst, size_t size, const struct ua_bytestring *bs) |
Converts the given bytestring into a base64 string. More... | |
int | ua_bytestring_from_string (struct ua_bytestring *bs, const struct ua_string *src) |
Creates a ua_bytestring bs from a given base46 string src . More... | |
Data Fields | |
int32_t | len |
Number of bytes, or -1 for a ‘null’ bytestring. More... | |
char * | data |
Pointer to actual array with bytes. | |
Related Functions | |
#define | UA_BYTESTRING_INITIALIZER { 0, NULL } |
Initializer for empty ua_bytestrings. | |
This Built-in DataType defines a value that is a sequence of Byte values.
int ua_bytestring_append | ( | struct ua_bytestring * | dst, |
const struct ua_bytestring * | src | ||
) |
Appends the bytestring src
to the bytestring dst
.
void ua_bytestring_attach | ( | struct ua_bytestring * | bs, |
char * | src, | ||
int32_t | len | ||
) |
Initializes the bytestring bs
with the given data.
This function takes ownership of src
and will free it when calling ua_bytestring_clear().
int ua_bytestring_compare | ( | const struct ua_bytestring * | a, |
const struct ua_bytestring * | b | ||
) |
Compare to ua_bytestrings.
const char * ua_bytestring_const_data | ( | const struct ua_bytestring * | bs | ) |
Returns the raw string data of bs
.
This version of the function returns a const pointer.
int ua_bytestring_copy | ( | struct ua_bytestring * | dst, |
const struct ua_bytestring * | src | ||
) |
Copy ua_bytestring src
to dst
.
char * ua_bytestring_data | ( | struct ua_bytestring * | bs | ) |
Returns the raw data of bs
.
This pointer can be used to access and modify the data that compose the bytestring.
int ua_bytestring_from_string | ( | struct ua_bytestring * | bs, |
const struct ua_string * | src | ||
) |
Creates a ua_bytestring bs
from a given base46 string src
.
bs | Destination for the base64 decoded bytestring. It is save to pass an uninitialized ua_bytestring. |
src | ua_string with base64 encoded content to be decoded. |
size_t ua_bytestring_length | ( | const struct ua_bytestring * | bs | ) |
Returns the length of the bytestring in bytes.
A value of 0 indicates an invalid argument or empty or null bytestring. To check for the latter use ua_bytestring_is_null.
int ua_bytestring_set | ( | struct ua_bytestring * | bs, |
const char * | src, | ||
int32_t | len | ||
) |
Initializes the bytestring bs
with the given data.
This function creates a copy of src
.
void ua_bytestring_set_null | ( | struct ua_bytestring * | bs | ) |
Initializes the bytestring bs
as null bytestring.
Sometimes a distinction between empty and null bytestring is required, this function can set a null bytestring.
int ua_bytestring_snprintf | ( | char * | dst, |
size_t | size, | ||
const struct ua_bytestring * | bs | ||
) |
Converts the given bytestring into a base64 string.
dst | Destination string where the base64 string will be written to. |
size | Size in bytes of dst . |
bs | The bytestring to be converted. |
size
bytes (including the terminating null byte). If the output was truncated due to this limit then the return value is the number of characters (excluding the terminating null byte) which would have been written to the final string if enough space had been available. Thus, a return value of size or more means that the output was truncated. int ua_bytestring_to_string | ( | const struct ua_bytestring * | bs, |
struct ua_string * | dst | ||
) |
Creates a ua_string dst
with base64 encoded content from a ua_bytestring bs
.
bs | ua_bytestring to be converted to a base64 ua_string. |
dst | ua_string to write the encoded data to. It is save to pass an uninitialized ua_string. |
const unsigned char * ua_bytestring_unsigned_const_data | ( | const struct ua_bytestring * | bs | ) |
Returns the raw string data of bs
as unsigned byte array.
This is an alternative for ua_bytestring_const_data, because some APIs expect unsigned byte arrays and this way ugly casts can be avoided when passing the bytestring data to such APIs.
int32_t len |
Number of bytes, or -1 for a ‘null’ bytestring.