High Performance OPC UA Server SDK  1.2.1.203
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

int ua_file_extension_registry_init (struct ua_file_extension_registry *reg, unsigned int size)
 Intializes a extension uri registry of given size. More...
 
void ua_file_extension_registry_clear (struct ua_file_extension_registry *reg)
 Frees all memory referenced by the given registry. More...
 
int ua_file_extension_registry_lookup (struct ua_file_extension_registry *reg, const char *uri)
 Searches for the given uri in the registry. More...
 
int ua_file_extension_registry_add_uri (struct ua_file_extension_registry *reg, const char *uri)
 Adds the given uri to the registry. More...
 
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...
 
int ua_file_extension_set_authorization (struct ua_file_extension_registry *reg, struct ua_file_extension *ex, const struct ua_file_extension_authorization *auth)
 Creates a file extension of type UA_EXTENSION_AUTHORIZATION. More...
 
int ua_file_extension_get_authorization (struct ua_file_extension_registry *reg, struct ua_file_extension *ex, struct ua_file_extension_authorization *auth)
 Parse the given file extension and extracts the authorization info. More...
 
int ua_file_extension_set_runtimeaddress (struct ua_file_extension_registry *reg, struct ua_file_extension *ex, const struct ua_string *address)
 Creates a file extension of type UA_EXTENSION_RUNTIMEADDRESS. More...
 
int ua_file_extension_get_runtimeaddress (struct ua_file_extension_registry *reg, struct ua_file_extension *ex, struct ua_string *address)
 Parse the given file extension and extracts the runtime address. More...
 
int ua_file_extension_set_documentation (struct ua_file_extension_registry *reg, struct ua_file_extension *ex, const struct ua_string *doc)
 Creates a file extension of type UA_EXTENSION_DOCUMENTATION. More...
 
int ua_file_extension_get_documentation (struct ua_file_extension_registry *reg, struct ua_file_extension *ex, struct ua_string *doc)
 Parse the given file extension and extracts the documentation string. More...
 
void ua_file_extension_generator_init (struct ua_file_extension_generator *generator)
 Initializes the generator info structure.
 
void ua_file_extension_generator_clear (struct ua_file_extension_generator *generator)
 Clears the generator info structure.
 
int ua_file_extension_set_generator (struct ua_file_extension_registry *reg, struct ua_file_extension *ex, const struct ua_file_extension_generator *generator)
 Creates a file extension of type UA_EXTENSION_GENERATOR. More...
 
int ua_file_extension_get_generator (struct ua_file_extension_registry *reg, struct ua_file_extension *ex, struct ua_file_extension_generator *generator)
 Parse the given file extension and extracts the generator info. More...
 
#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.
 
#define UA_EXTENSION_DOCUMENTATION   7
 Documentation extension.
 

Detailed Description

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

Function Documentation

int ua_file_extension_get_authorization ( struct ua_file_extension_registry reg,
struct ua_file_extension ex,
struct ua_file_extension_authorization auth 
)

Parse the given file extension and extracts the authorization info.

Parameters
regFile extension registry for type lookup.
exFile extension to parse.
authAuthorization info to return. The function only sets the string pointers of this struct to point to the data inside ex. This way memory allocation and memcpy can be avoided. The struct is only valid as long as ex remains in memory. The caller must not free the strings inside auth.
Returns
Zero on success.
int ua_file_extension_get_documentation ( struct ua_file_extension_registry reg,
struct ua_file_extension ex,
struct ua_string doc 
)

Parse the given file extension and extracts the documentation string.

Parameters
regFile extension registry for type lookup.
exFile extension struct containing the documentation.
addressThis variable receives the documentation string. The string gets attached, so it is only valid as long as ex and you don't need to clear the string. It also doesn't hurt to clear, because the string maintains state information about being attached and will not free this memory.
Returns
Zero on success, UA_EBADINVALIDARGUMENT if the extension is of wrong type, UA_EBADNOTFOUND if the UA_EXTENSION_DOCUMENTATION is not registered.
int ua_file_extension_get_generator ( struct ua_file_extension_registry reg,
struct ua_file_extension ex,
struct ua_file_extension_generator generator 
)

Parse the given file extension and extracts the generator info.

Parameters
regFile extension registry for type lookup.
exFile extension struct containing the generator info.
generatorThis variable receives the generastor info. The returned memory must be cleared using ua_file_extension_generator_clear if the operation succeeds.
Returns
Zero on success, UA_EBADINVALIDARGUMENT if the extension is of wrong type, UA_EBADNOTFOUND if the UA_EXTENSION_GENERATOR is not registered.
int ua_file_extension_get_runtimeaddress ( struct ua_file_extension_registry reg,
struct ua_file_extension ex,
struct ua_string address 
)

Parse the given file extension and extracts the runtime address.

Parameters
regFile extension registry for type lookup.
exFile extension struct containing the runtime address.
addressThe string based runtime address. The string gets attached, so it is only valid as long as ex and you don't need to clear the string. It also doesn't hurt to clear, because the string maintains state information about being attached and will not free this memory.
Returns
Zero on success, UA_EBADINVALIDARGUMENT if the extension is of wrong type, UA_EBADNOTFOUND if the UA_EXTENSION_RUNTIMEADDRESS is not registered.
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.
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.

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.
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.
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.
int ua_file_extension_set_authorization ( struct ua_file_extension_registry reg,
struct ua_file_extension ex,
const struct ua_file_extension_authorization auth 
)

Creates a file extension of type UA_EXTENSION_AUTHORIZATION.

Parameters
regFile extension registry for type lookup.
exFile extension struct to fill with authorization data.
authAuthorization extension data.
Returns
Zero on success.
int ua_file_extension_set_documentation ( struct ua_file_extension_registry reg,
struct ua_file_extension ex,
const struct ua_string doc 
)

Creates a file extension of type UA_EXTENSION_DOCUMENTATION.

The function creates a copy of the given string address.

Parameters
regFile extension registry for type lookup.
exFile extension struct to fill with the documentation.
docThe documentation string to set.
Returns
Zero on success.
int ua_file_extension_set_generator ( struct ua_file_extension_registry reg,
struct ua_file_extension ex,
const struct ua_file_extension_generator generator 
)

Creates a file extension of type UA_EXTENSION_GENERATOR.

Parameters
regFile extension registry for type lookup.
exFile extension struct to fill with the generator info.
generatorThe generator info to set.
Returns
Zero on success.
int ua_file_extension_set_runtimeaddress ( struct ua_file_extension_registry reg,
struct ua_file_extension ex,
const struct ua_string address 
)

Creates a file extension of type UA_EXTENSION_RUNTIMEADDRESS.

The function creates a copy of the given string address.

Parameters
regFile extension registry for type lookup.
exFile extension struct to fill with the runtime address.
addressThe string based runtime address.
Returns
Zero on success.