High Performance OPC UA Server SDK  1.7.1.383
UA File Extension Registry

File extension registry for maintaining a list of known namespace URIs. More...

Data Structures

struct  ua_file_extension_registry
 
struct  ua_file_extension_authorization
 Authorization information. More...
 
struct  ua_file_extension_generator
 This contains information about the tool which has generated the file. More...
 
struct  ua_file_extension
 A file extension allows to add vendor specific information to each node, namespace or global file header. More...
 

Macros

#define UA_FILE_EXT_AUTH_PERM_OTHERS_ATTR_READABLE   0x001
 
#define UA_FILE_EXT_AUTH_PERM_OTHERS_BROWSEABLE   0x001
 
#define UA_FILE_EXT_AUTH_PERM_OTHERS_READABLE   0x002
 
#define UA_FILE_EXT_AUTH_PERM_OTHERS_WRITABLE   0x004
 
#define UA_FILE_EXT_AUTH_PERM_OTHERS_EXECUTABLE   0x008
 
#define UA_FILE_EXT_AUTH_PERM_OTHERS_HIST_READABLE   0x010
 
#define UA_FILE_EXT_AUTH_PERM_OTHERS_HIST_INSERTABLE   0x020
 
#define UA_FILE_EXT_AUTH_PERM_OTHERS_HIST_MODIFIABLE   0x040
 
#define UA_FILE_EXT_AUTH_PERM_OTHERS_HIST_DELETABLE   0x080
 
#define UA_FILE_EXT_AUTH_PERM_OTHERS_EVENT_READABLE   0x100
 
#define UA_FILE_EXT_AUTH_PERM_OTHERS_ATTR_WRITABLE   0x200
 
#define UA_FILE_EXT_AUTH_PERM_OTHERS_ALL   0x2ff
 
#define UA_FILE_EXT_AUTH_PERM_OTHERS_OBSERVATION   (UA_FILE_EXT_AUTH_PERM_OTHERS_BROWSEABLE | UA_FILE_EXT_AUTH_PERM_OTHERS_READABLE | UA_FILE_EXT_AUTH_PERM_OTHERS_HIST_READABLE | UA_FILE_EXT_AUTH_PERM_OTHERS_EVENT_READABLE)
 
#define UA_FILE_EXT_AUTH_PERM_OTHERS_OPERATION   (UA_FILE_EXT_AUTH_PERM_OTHERS_OBSERVATION | UA_FILE_EXT_AUTH_PERM_OTHERS_WRITABLE | UA_FILE_EXT_AUTH_PERM_OTHERS_EXECUTABLE)
 
#define UA_FILE_EXT_AUTH_PERM_GROUP_ATTR_READABLE   (UA_FILE_EXT_AUTH_PERM_OTHERS_ATTR_READABLE << 10)
 
#define UA_FILE_EXT_AUTH_PERM_GROUP_BROWSEABLE   (UA_FILE_EXT_AUTH_PERM_OTHERS_BROWSEABLE << 10)
 
#define UA_FILE_EXT_AUTH_PERM_GROUP_READABLE   (UA_FILE_EXT_AUTH_PERM_OTHERS_READABLE << 10)
 
#define UA_FILE_EXT_AUTH_PERM_GROUP_WRITABLE   (UA_FILE_EXT_AUTH_PERM_OTHERS_WRITABLE << 10)
 
#define UA_FILE_EXT_AUTH_PERM_GROUP_EXECUTABLE   (UA_FILE_EXT_AUTH_PERM_OTHERS_EXECUTABLE << 10)
 
#define UA_FILE_EXT_AUTH_PERM_GROUP_HIST_READABLE   (UA_FILE_EXT_AUTH_PERM_OTHERS_HIST_READABLE << 10)
 
#define UA_FILE_EXT_AUTH_PERM_GROUP_HIST_INSERTABLE   (UA_FILE_EXT_AUTH_PERM_OTHERS_HIST_INSERTABLE << 10)
 
#define UA_FILE_EXT_AUTH_PERM_GROUP_HIST_MODIFIABLE   (UA_FILE_EXT_AUTH_PERM_OTHERS_HIST_MODIFIABLE << 10)
 
#define UA_FILE_EXT_AUTH_PERM_GROUP_HIST_DELETABLE   (UA_FILE_EXT_AUTH_PERM_OTHERS_HIST_DELETABLE << 10)
 
#define UA_FILE_EXT_AUTH_PERM_GROUP_EVENT_READABLE   (UA_FILE_EXT_AUTH_PERM_OTHERS_EVENT_READABLE << 10)
 
#define UA_FILE_EXT_AUTH_PERM_GROUP_ATTR_WRITABLE   (UA_FILE_EXT_AUTH_PERM_OTHERS_ATTR_WRITABLE << 10)
 
#define UA_FILE_EXT_AUTH_PERM_GROUP_ALL   (UA_FILE_EXT_AUTH_PERM_OTHERS_ALL << 10)
 
#define UA_FILE_EXT_AUTH_PERM_GROUP_OBSERVATION   (UA_FILE_EXT_AUTH_PERM_GROUP_BROWSEABLE | UA_FILE_EXT_AUTH_PERM_GROUP_READABLE | UA_FILE_EXT_AUTH_PERM_GROUP_HIST_READABLE | UA_FILE_EXT_AUTH_PERM_GROUP_EVENT_READABLE)
 
#define UA_FILE_EXT_AUTH_PERM_GROUP_OPERATION   (UA_FILE_EXT_AUTH_PERM_GROUP_OBSERVATION | UA_FILE_EXT_AUTH_PERM_GROUP_WRITABLE | UA_FILE_EXT_AUTH_PERM_GROUP_EXECUTABLE)
 
#define UA_FILE_EXT_AUTH_PERM_OWNER_ATTR_READABLE   (UA_FILE_EXT_AUTH_PERM_OTHERS_ATTR_READABLE << 20)
 
#define UA_FILE_EXT_AUTH_PERM_OWNER_BROWSEABLE   (UA_FILE_EXT_AUTH_PERM_OTHERS_BROWSEABLE << 20)
 
#define UA_FILE_EXT_AUTH_PERM_OWNER_READABLE   (UA_FILE_EXT_AUTH_PERM_OTHERS_READABLE << 20)
 
#define UA_FILE_EXT_AUTH_PERM_OWNER_WRITABLE   (UA_FILE_EXT_AUTH_PERM_OTHERS_WRITABLE << 20)
 
#define UA_FILE_EXT_AUTH_PERM_OWNER_EXECUTABLE   (UA_FILE_EXT_AUTH_PERM_OTHERS_EXECUTABLE << 20)
 
#define UA_FILE_EXT_AUTH_PERM_OWNER_HIST_READABLE   (UA_FILE_EXT_AUTH_PERM_OTHERS_HIST_READABLE << 20)
 
#define UA_FILE_EXT_AUTH_PERM_OWNER_HIST_INSERTABLE   (UA_FILE_EXT_AUTH_PERM_OTHERS_HIST_INSERTABLE << 20)
 
#define UA_FILE_EXT_AUTH_PERM_OWNER_HIST_MODIFIABLE   (UA_FILE_EXT_AUTH_PERM_OTHERS_HIST_MODIFIABLE << 20)
 
#define UA_FILE_EXT_AUTH_PERM_OWNER_HIST_DELETABLE   (UA_FILE_EXT_AUTH_PERM_OTHERS_HIST_DELETABLE << 20)
 
#define UA_FILE_EXT_AUTH_PERM_OWNER_EVENT_READABLE   (UA_FILE_EXT_AUTH_PERM_OTHERS_EVENT_READABLE << 20)
 
#define UA_FILE_EXT_AUTH_PERM_OWNER_ATTR_WRITABLE   (UA_FILE_EXT_AUTH_PERM_OTHERS_ATTR_WRITABLE << 20)
 
#define UA_FILE_EXT_AUTH_PERM_OWNER_ALL   (UA_FILE_EXT_AUTH_PERM_OTHERS_ALL << 20)
 
#define UA_FILE_EXT_AUTH_PERM_OWNER_OBSERVATION   (UA_FILE_EXT_AUTH_PERM_OWNER_BROWSEABLE | UA_FILE_EXT_AUTH_PERM_OWNER_READABLE | UA_FILE_EXT_AUTH_PERM_OWNER_HIST_READABLE | UA_FILE_EXT_AUTH_PERM_OWNER_EVENT_READABLE)
 
#define UA_FILE_EXT_AUTH_PERM_OWNER_OPERATION   (UA_FILE_EXT_AUTH_PERM_OWNER_OBSERVATION | UA_FILE_EXT_AUTH_PERM_OWNER_WRITABLE | UA_FILE_EXT_AUTH_PERM_OWNER_EXECUTABLE)
 
#define UA_FILE_EXT_AUTH_PERM_REQUIRE_SIGNING   0x40000000
 
#define UA_FILE_EXT_AUTH_PERM_REQUIRE_ENCRYPTION   0x80000000
 

Functions

UAFILEFORMAT_EXPORT int ua_file_extension_registry_init (struct ua_file_extension_registry *reg, unsigned int size)
 Intializes a extension uri registry of given size. More...
 
UAFILEFORMAT_EXPORT void ua_file_extension_registry_clear (struct ua_file_extension_registry *reg)
 Frees all memory referenced by the given registry. More...
 
UAFILEFORMAT_EXPORT int ua_file_extension_registry_lookup (struct ua_file_extension_registry *reg, const char *uri)
 Searches for the given uri in the registry. More...
 
UAFILEFORMAT_EXPORT int ua_file_extension_registry_add_uri (struct ua_file_extension_registry *reg, const char *uri)
 Adds the given uri to the registry. More...
 
UAFILEFORMAT_EXPORT const char * ua_file_extension_registry_get_uri (struct ua_file_extension_registry *reg, unsigned int index)
 Returns the URI for the given URI index. More...
 
UAFILEFORMAT_EXPORT int ua_file_extension_set_authorization (struct ua_file_extension_registry *reg, struct ua_file_extension *ex, const struct ua_file_extension_authorization *auth)
 
UAFILEFORMAT_EXPORT int ua_file_extension_get_authorization (struct ua_file_extension_registry *reg, struct ua_file_extension *ex, struct ua_file_extension_authorization *auth)
 
UAFILEFORMAT_EXPORT int ua_file_extension_set_runtimeaddress (struct ua_file_extension_registry *reg, struct ua_file_extension *ex, const struct ua_string *address)
 
UAFILEFORMAT_EXPORT int ua_file_extension_get_runtimeaddress (struct ua_file_extension_registry *reg, struct ua_file_extension *ex, struct ua_string *address)
 
UAFILEFORMAT_EXPORT int ua_file_extension_set_documentation (struct ua_file_extension_registry *reg, struct ua_file_extension *ex, const struct ua_string *doc)
 
UAFILEFORMAT_EXPORT int ua_file_extension_get_documentation (struct ua_file_extension_registry *reg, struct ua_file_extension *ex, struct ua_string *doc)
 
UAFILEFORMAT_EXPORT int ua_file_extension_set_xml (struct ua_file_extension_registry *reg, struct ua_file_extension *ex, const struct ua_string *xml)
 
UAFILEFORMAT_EXPORT int ua_file_extension_get_xml (struct ua_file_extension_registry *reg, struct ua_file_extension *ex, struct ua_string *xml)
 
UAFILEFORMAT_EXPORT void ua_file_extension_generator_init (struct ua_file_extension_generator *generator)
 Initializes the generator info structure.
 
UAFILEFORMAT_EXPORT void ua_file_extension_generator_clear (struct ua_file_extension_generator *generator)
 Clears the generator info structure.
 
UAFILEFORMAT_EXPORT int ua_file_extension_set_generator (struct ua_file_extension_registry *reg, struct ua_file_extension *ex, const struct ua_file_extension_generator *generator)
 
UAFILEFORMAT_EXPORT int ua_file_extension_get_generator (struct ua_file_extension_registry *reg, struct ua_file_extension *ex, struct ua_file_extension_generator *generator)
 
#define UA_EXTENSION_UNIFIEDAUTOMATION_URI   "extension://unifiedautomation"
 Unified Automation Extension URI.
 
#define UA_EXTENSION_USERDB   0
 User database extension.
 
#define UA_EXTENSION_GROUPDB   1
 Group database extension.
 
#define UA_EXTENSION_PASSDB   2
 Password database extension.
 
#define UA_EXTENSION_GENERATOR   3
 Generator information extension.
 
#define UA_EXTENSION_ENGINFO   4
 Engineering Info extension.
 
#define UA_EXTENSION_AUTHORIZATION   5
 Authorization extension.
 
#define UA_EXTENSION_RUNTIMEADDRESS   6
 Runtime address extension. More...
 
#define UA_EXTENSION_DOCUMENTATION   7
 Documentation extension. More...
 
#define UA_EXTENSION_XML   8
 Raw XML extension. More...
 

Detailed Description

File extension registry for maintaining a list of known namespace URIs.

Macro Definition Documentation

◆ UA_EXTENSION_DOCUMENTATION

#define UA_EXTENSION_DOCUMENTATION   7

Documentation extension.

This contents of UA NodeSet File's <Documentation> element will be converted into this extension. Example fragment:

<Documentation>Example</Documentation>

The contents "Example" gets extracted by xml2bin and is stored in ua_file_extension bytestring.

◆ UA_EXTENSION_RUNTIMEADDRESS

#define UA_EXTENSION_RUNTIMEADDRESS   6

Runtime address extension.

This is a Unified Automation specific extension, wich can contain a textual runtime address. Example fragment:

<Extensions>
<Extension>
<ua:RTAddress>modbus://40001</ua:RTAddress>
</Extension>
</Extensions>

The contents "modbus://40001" gets extracted by xml2bin and is stored in ua_file_extension bytestring.

◆ UA_EXTENSION_XML

#define UA_EXTENSION_XML   8

Raw XML extension.

Any unknown XML extension that is not understood by xml2bin gets converted as-is into this extension. In this case the ua_file_extension contains the fill XML snippet, which then can be parsed on application level.

<Extensions>
<Extension>
<MyExtension>
<a>foo</a><b>bar</b>
</MyExtension>
</Extension>
</Extensions>

The contents <Extension> element gets extracted by xml2bin and is stored in ua_file_extension bytestring, keeping all the subelements of <Extension>. In this case the bytestring will contains this:

<MyExtension>
<a>foo</a><b>bar</b>
</MyExtension>

This includes all formatting like linebreaks and whitespaces. It makes sense to use unformatted XML fragments to reduce the XML overhead.

Function Documentation

◆ ua_file_extension_registry_add_uri()

UAFILEFORMAT_EXPORT int ua_file_extension_registry_add_uri ( struct ua_file_extension_registry reg,
const char *  uri 
)

Adds the given uri to the registry.

This function does create a copy of the URI string.

Parameters
regThe registry context.
uriURI to add.
Returns
Zero on success, UA_EBADOUTOFRESOURCE if the registry is full, UA_EBADNOMEM if creating a string copy fails.

◆ ua_file_extension_registry_clear()

UAFILEFORMAT_EXPORT void ua_file_extension_registry_clear ( struct ua_file_extension_registry reg)

Frees all memory referenced by the given registry.

This includes memory allocated by ua_file_extension_registry_init and ua_file_extension_registry_add_uri.

◆ ua_file_extension_registry_get_uri()

UAFILEFORMAT_EXPORT const char* ua_file_extension_registry_get_uri ( struct ua_file_extension_registry reg,
unsigned int  index 
)

Returns the URI for the given URI index.

Parameters
regThe registry context.
indexIndex of URI returned by ua_file_extension_registry_add_uri.
Returns
URI if the index is valid, or NULL.

◆ ua_file_extension_registry_init()

UAFILEFORMAT_EXPORT int ua_file_extension_registry_init ( struct ua_file_extension_registry reg,
unsigned int  size 
)

Intializes a extension uri registry of given size.

Use ua_file_extension_registry_clear the free all resources allocated by ua_file_extension_registry_init.

Parameters
regThe registry context.
sizeMaximum number of entries in registry.
Returns
Zero on success, UA_EBADNOMEM if memory allocation failed.

◆ ua_file_extension_registry_lookup()

UAFILEFORMAT_EXPORT int ua_file_extension_registry_lookup ( struct ua_file_extension_registry reg,
const char *  uri 
)

Searches for the given uri in the registry.

Parameters
regThe registry context.
uriURI to search for.
Returns
Returns the found registry index (zero based), or -1 if the URI was not found.