High Performance OPC UA Server SDK  1.7.1.383
ua_guid Struct Reference

A 16-byte globally unique identifier. More...

#include <guid.h>

Public Member Functions

void ua_guid_init (struct ua_guid *g)
 Initialize an ua_guid as null guid.
 
void ua_guid_clear (struct ua_guid *g)
 Clear an ua_guid and set it to a null guid.
 
int ua_guid_create (struct ua_guid *g)
 Write a random guid to g.
 
int ua_guid_compare (const struct ua_guid *a, const struct ua_guid *b)
 Compare two ua_guids. More...
 
int ua_guid_copy (struct ua_guid *dst, const struct ua_guid *src)
 Copy ua_guid src to dst. More...
 
int ua_guid_to_string (const struct ua_guid *src, struct ua_string *dst)
 Converts the given GUID into a UA string. More...
 
int ua_guid_snprintf (char *dst, size_t size, const struct ua_guid *src)
 Prints the given GUID src into dst. More...
 
int ua_guid_from_string (struct ua_guid *dst, const struct ua_string *src)
 This function parses a GUID string that was created using ua_guid_to_string. More...
 

Data Fields

uint32_t data1
 Data1 field. More...
 
uint16_t data2
 Data2 field. More...
 
uint16_t data3
 Data3 field. More...
 
uint8_t data4 [8]
 Data4 array. More...
 

Related Functions

#define UA_GUID_INITIALIZER   { 0, 0, 0, {0} }
 Initializer for null guids.
 

Detailed Description

A 16-byte globally unique identifier.

Its layout is shown in the following table:

Component Data Type
Data1 UInt32
Data2 UInt16
Data3 UInt16
Data4 Byte[8]

Guid values may be represented as a string in this form:
<Data1>-<Data2>-<Data3>-<Data4[0:1]>-<Data4[2:7]>

Where Data1 is 8 characters wide, Data2 and Data3 are 4 characters wide and each Byte in Data4 is 2 characters wide. Each value is formatted as a hexadecimal number padded zeros. A typical Guid value would look like this when formatted as a string:

C496578A-0DFE-4b8f-870A-745238C6AEAE

Member Function Documentation

◆ ua_guid_compare()

int ua_guid_compare ( const struct ua_guid a,
const struct ua_guid b 
)

Compare two ua_guids.

Returns
Zero if ua_guids are the same.

◆ ua_guid_copy()

int ua_guid_copy ( struct ua_guid dst,
const struct ua_guid src 
)

Copy ua_guid src to dst.

Returns
Zero on success or errorcode on failure.

◆ ua_guid_from_string()

int ua_guid_from_string ( struct ua_guid dst,
const struct ua_string src 
)

This function parses a GUID string that was created using ua_guid_to_string.

Parameters
dstGuid to fill with information from src.
srcString to parse.
Returns
Zero on success. A negative error code if the operation fails.

◆ ua_guid_snprintf()

int ua_guid_snprintf ( char *  dst,
size_t  size,
const struct ua_guid src 
)

Prints the given GUID src into dst.

dst should be at least 37 bytes long to avoid truncation. Format: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

◆ ua_guid_to_string()

int ua_guid_to_string ( const struct ua_guid src,
struct ua_string dst 
)

Converts the given GUID into a UA string.

This function uses ua_guid_snprintf internally.

Parameters
srcGuid to convert.
dstPointer to UA String to fill. This argument can be a null-string (not a NULL pointer) as this function automatically allocates the required memory internally. Existing strings inside dst will be freed before allocation.

Field Documentation

◆ data1

uint32_t data1

Data1 field.

◆ data2

uint16_t data2

Data2 field.

◆ data3

uint16_t data3

Data3 field.

◆ data4

uint8_t data4[8]

Data4 array.


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