High Performance OPC UA Server SDK
1.7.1.383
|
For creating instances of filetypes and managing those types. More...
Data Structures | |
struct | ua_file_context |
Stores the information about a file. More... | |
struct | ua_file_handle |
Stores the information of an opened file. More... | |
interface | ua_filetype_interface |
Interface table for implementing custom filetypes. More... | |
struct | ua_filetype_callbacks |
Filetype user callback table. More... | |
struct | ua_trustlist_create_args |
struct | ua_filetype_trust_list_interface |
class | ua_filesystem_implementation |
class | ua_memoryfile_implementation |
class | ua_trustlistfile_implementation |
Macros | |
#define | UA_FILETYPE_READ 1 |
READ bit as defined in OPC UA Spec, Part 5, Annex C. | |
#define | UA_FILETYPE_WRITE 2 |
WRITE bit as defined in OPC UA Spec, Part 5, Annex C. | |
#define | UA_FILETYPE_ERASEEXISTING 4 |
ERASEEXISTING bit as defined in OPC UA Spec, Part 5, Annex C. | |
#define | UA_FILETYPE_APPEND 8 |
APPEND bit as defined in OPC UA Spec, Part 5, Annex C. | |
#define | UA_FILETYPE_CALLBACKS_INITIALIZER |
This macro can be used to initialize variables of type ua_filetype_callbacks. More... | |
Functions | |
SERVER_EXPORT int | ua_file_context_init (struct ua_file_context *ctx, struct ua_filetype_interface *ftif, const void *args) |
SERVER_EXPORT int | ua_file_context_clear (struct ua_file_context *ctx) |
SERVER_EXPORT struct ua_file_context * | ua_file_context_create (struct ua_filetype_interface *ftif, const void *args) |
SERVER_EXPORT void | ua_file_context_delete (struct ua_file_context *ctx) |
SERVER_EXPORT void | ua_file_context_set_node (struct ua_file_context *ctx, ua_node_t node) |
SERVER_EXPORT ua_statuscode | ua_file_context_open (struct ua_file_context *ctx, bool exclusive) |
SERVER_EXPORT ua_statuscode | ua_file_context_close (struct ua_file_context *ctx) |
SERVER_EXPORT ua_statuscode | ua_file_context_set_mimetype (struct ua_file_context *ctx, const char *mimetype) |
Sets the optional Mime Type of the file context. More... | |
SERVER_EXPORT int | ua_file_handle_init (void) |
SERVER_EXPORT int | ua_file_handle_cleanup (void) |
SERVER_EXPORT struct ua_file_handle * | ua_file_handle_create (struct ua_file_context *file, uint8_t mode) |
Creates a new file handle context. More... | |
SERVER_EXPORT int | ua_file_handle_delete (struct ua_file_handle *fh) |
SERVER_EXPORT struct ua_file_handle * | ua_file_handle_lookup (uint32_t handle) |
Lookup file context by its handle. More... | |
SERVER_EXPORT void | ua_file_handle_update_use_timestamp (struct ua_file_handle *fh) |
SERVER_EXPORT ua_statuscode | ua_file_handle_open (struct ua_file_handle *fh) |
SERVER_EXPORT ua_statuscode | ua_file_handle_close (struct ua_file_handle *fh) |
SERVER_EXPORT ua_statuscode | ua_file_handle_read (struct ua_file_handle *fh, int32_t length, struct ua_bytestring *data) |
SERVER_EXPORT ua_statuscode | ua_file_handle_write (struct ua_file_handle *fh, const struct ua_bytestring *data) |
SERVER_EXPORT ua_statuscode | ua_file_handle_getposition (struct ua_file_handle *fh, uint64_t *position) |
SERVER_EXPORT ua_statuscode | ua_file_handle_setposition (struct ua_file_handle *fh, const uint64_t *position) |
SERVER_EXPORT ua_statuscode | ua_file_handle_getsize (struct ua_file_handle *fh, uint64_t *position) |
SERVER_NO_EXPORT ua_statuscode | ua_filesystemimpl_create (struct ua_file_context *ctx, const void *args) |
SERVER_NO_EXPORT ua_statuscode | ua_filesystemimpl_delete (struct ua_file_context *ctx) |
SERVER_NO_EXPORT ua_statuscode | ua_filesystemimpl_open (struct ua_file_handle *ctx, uint8_t mode) |
SERVER_NO_EXPORT ua_statuscode | ua_filesystemimpl_close (struct ua_file_handle *ctx) |
SERVER_NO_EXPORT ua_statuscode | ua_filesystemimpl_read (struct ua_file_handle *ctx, int32_t length, struct ua_bytestring *data) |
SERVER_NO_EXPORT ua_statuscode | ua_filesystemimpl_write (struct ua_file_handle *ctx, const struct ua_bytestring *data) |
SERVER_NO_EXPORT ua_statuscode | ua_filesystemimpl_get_position (struct ua_file_handle *ctx, uint64_t *position) |
SERVER_NO_EXPORT ua_statuscode | ua_filesystemimpl_set_position (struct ua_file_handle *ctx, const uint64_t *position) |
SERVER_NO_EXPORT ua_statuscode | ua_filesystemimpl_get_size (struct ua_file_context *ctx, uint64_t *size) |
SERVER_EXPORT struct ua_filetype_ctx * | ua_filetype_ctx_create (void) |
Creates new instance of a ua_filetype_ctx, which servers the same purpose as ua_instance_ctx, but for ua_filetype_create_ex(). More... | |
SERVER_EXPORT void | ua_filetype_ctx_delete (struct ua_filetype_ctx *ctx) |
Deletes the context created with ua_filetype_ctx_create(). | |
SERVER_EXPORT void | ua_filetype_ctx_set_mime_type (struct ua_filetype_ctx *ctx, const char *mimetype) |
Sets the optional MIME type of the file that should be created. More... | |
SERVER_EXPORT ua_node_t | ua_filetype_ctx_get_new_node (struct ua_filetype_ctx *ctx) |
Returns the newly create filetype node. More... | |
SERVER_EXPORT void | ua_filetype_ctx_set_cb_data (struct ua_filetype_ctx *ctx, void *data) |
Set some arbitrary callback data, can be retrieved with ua_instance_get_cb_data. More... | |
SERVER_EXPORT void | ua_filetype_ctx_set_pre_create_cb (struct ua_filetype_ctx *ctx, ua_instance_pre_create_cb cb) |
Set the pre create callback. More... | |
SERVER_EXPORT void | ua_filetype_ctx_set_post_create_cb (struct ua_filetype_ctx *ctx, ua_instance_post_create_cb cb) |
Set the post create callback. More... | |
SERVER_EXPORT void | ua_filetype_ctx_set_delete_cb (struct ua_filetype_ctx *ctx, ua_instance_delete_cb cb) |
Set the delete callback. More... | |
SERVER_EXPORT void | ua_filetype_ctx_set_parent (struct ua_filetype_ctx *ctx, ua_node_t parent_node, ua_node_t ref_type) |
Set a parent for new instances. More... | |
SERVER_EXPORT uint32_t | ua_filetype_ctx_get_last_numeric_id (struct ua_filetype_ctx *ctx) |
Get the number used for the last created node with numeric nodeid. More... | |
SERVER_EXPORT int | ua_filetype_init (void) |
SERVER_EXPORT int | ua_filetype_cleanup (void) |
SERVER_EXPORT ua_node_t | ua_filetype_create (const struct ua_nodeid *nodeid, ua_node_t type, const char *displayname, struct ua_filetype_interface *ftif, const void *args) |
Creates an instance of a file type. More... | |
SERVER_EXPORT int | ua_filetype_create_ex (struct ua_filetype_ctx *ctx, const struct ua_nodeid *nodeid, ua_node_t type, uint16_t browsename_idx, const char *browsename, const char *displayname, struct ua_filetype_interface *ftif, const void *args) |
Creates an instance of a file type. More... | |
SERVER_EXPORT ua_node_t | ua_filetype_create_with_existing_node (struct ua_nodeid *nodeid, struct ua_filetype_interface *ftif, const void *args) |
Creates an instance of a file type from an existing node. More... | |
SERVER_EXPORT int | ua_filetype_delete (ua_node_t file) |
Delete a file instance that was creates using ua_filetype_create. More... | |
SERVER_EXPORT int | ua_filetype_delete_ex (struct ua_filetype_ctx *ctx, ua_node_t file) |
Delete a file instance that was creates using ua_filetype_create_ex. More... | |
SERVER_EXPORT int | ua_filetype_set_callbacks (ua_node_t file, struct ua_filetype_callbacks *callbacks) |
Sets user callbacks for the given filetype instance. More... | |
SERVER_EXPORT int | ua_filetype_set_userdata (ua_node_t file, void *userdata) |
Stores a userdata pointer within the file context. More... | |
SERVER_EXPORT void * | ua_filetype_get_userdata (ua_node_t file) |
Returns the userdata pointer of the file context that was previously stored using ua_filetype_set_userdata(). More... | |
SERVER_EXPORT int | ua_verify_filetype_config (void) |
SERVER_EXPORT ua_statuscode | ua_filetype_check_args (const struct ua_nodeid *object_id, struct ua_file_context **f) |
Generic function for verifying method call object_id and retrieving the file context. More... | |
SERVER_EXPORT ua_statuscode | ua_filetype_check_filehandle (struct ua_file_context *f, uint32_t file_handle, struct uasession_session *session, struct ua_file_handle **pfh) |
Generic function for verifying the file handle and retrieving the file handle context. More... | |
SERVER_EXPORT ua_node_t | ua_file_type_get_write_method (ua_node_t file) |
SERVER_EXPORT ua_node_t | ua_file_type_get_read_method (ua_node_t file) |
SERVER_EXPORT ua_node_t | ua_file_type_get_open_method (ua_node_t file) |
SERVER_EXPORT ua_node_t | ua_file_type_get_close_method (ua_node_t file) |
SERVER_EXPORT ua_node_t | ua_file_type_get_setposition_method (ua_node_t file) |
SERVER_EXPORT ua_node_t | ua_file_type_get_getposition_method (ua_node_t file) |
SERVER_EXPORT struct ua_file_context * | ua_filetype_get_filecontext (ua_node_t file) |
SERVER_NO_EXPORT ua_statuscode | ua_memoryfileimpl_create (struct ua_file_context *ctx, const void *args) |
SERVER_NO_EXPORT ua_statuscode | ua_memoryfileimpl_delete (struct ua_file_context *ctx) |
SERVER_NO_EXPORT ua_statuscode | ua_memoryfileimpl_open (struct ua_file_handle *fh, uint8_t mode) |
SERVER_NO_EXPORT ua_statuscode | ua_memoryfileimpl_close (struct ua_file_handle *fh) |
SERVER_NO_EXPORT ua_statuscode | ua_memoryfileimpl_read (struct ua_file_handle *fh, int32_t length, struct ua_bytestring *data) |
SERVER_NO_EXPORT ua_statuscode | ua_memoryfileimpl_write (struct ua_file_handle *fh, const struct ua_bytestring *data) |
SERVER_NO_EXPORT ua_statuscode | ua_memoryfileimpl_get_position (struct ua_file_handle *fh, uint64_t *position) |
SERVER_NO_EXPORT ua_statuscode | ua_memoryfileimpl_set_position (struct ua_file_handle *fh, const uint64_t *position) |
SERVER_NO_EXPORT ua_statuscode | ua_memoryfileimpl_get_size (struct ua_file_context *ctx, uint64_t *position) |
Variables | |
SERVER_EXPORT struct ua_filetype_interface | ua_filesystem_implementation |
filetype interface table for real filesystem files. More... | |
SERVER_EXPORT struct ua_filetype_interface | ua_memoryfile_implementation |
filetype interface table for in-memory files. More... | |
SERVER_EXPORT struct ua_filetype_trust_list_interface | ua_trustlistfile_implementation |
For creating instances of filetypes and managing those types.
The SDK offers a ua_filetype_interface to register custom file IO implementations. Two ready to use implementations are also available:
#define UA_FILETYPE_CALLBACKS_INITIALIZER |
This macro can be used to initialize variables of type ua_filetype_callbacks.
SERVER_EXPORT ua_statuscode ua_file_context_set_mimetype | ( | struct ua_file_context * | ctx, |
const char * | mimetype | ||
) |
Sets the optional Mime Type of the file context.
ctx | the file context to work on. |
mimetype | the mime type to set. |
SERVER_EXPORT struct ua_file_handle* ua_file_handle_create | ( | struct ua_file_context * | file, |
uint8_t | mode | ||
) |
Creates a new file handle context.
SERVER_EXPORT struct ua_file_handle* ua_file_handle_lookup | ( | uint32_t | handle | ) |
Lookup file context by its handle.
handle | The file handle to search for. |
SERVER_EXPORT ua_statuscode ua_filetype_check_args | ( | const struct ua_nodeid * | object_id, |
struct ua_file_context ** | f | ||
) |
Generic function for verifying method call object_id and retrieving the file context.
This can be used in subtypes of filetype which need the same type of argument checks.
object_id | Nodeid to check. |
f | Returns the file context for the given nodeid (mandatory). |
SERVER_EXPORT ua_statuscode ua_filetype_check_filehandle | ( | struct ua_file_context * | f, |
uint32_t | file_handle, | ||
struct uasession_session * | session, | ||
struct ua_file_handle ** | pfh | ||
) |
Generic function for verifying the file handle and retrieving the file handle context.
SERVER_EXPORT ua_node_t ua_filetype_create | ( | const struct ua_nodeid * | nodeid, |
ua_node_t | type, | ||
const char * | displayname, | ||
struct ua_filetype_interface * | ftif, | ||
const void * | args | ||
) |
Creates an instance of a file type.
This function is a convenience wrapper function for ua_filetype_create_ex(), which can be used for the typical use cases. Use ua_filetype_create_ex() to get more control over instance creation.
nodeid | The nodeid of the new node to create. |
type | The type to create an instance from. This must be UA_NODE_FILETYPE or a subclass of it. |
displayname | The displayname to use for the new node. |
ftif | The calltable of the file implementation to use. If NULL the SDK will use its own implementation which creates a real file in the file system. |
args | Arguments for the file implementation. For the default implementation this must be the filename. |
SERVER_EXPORT int ua_filetype_create_ex | ( | struct ua_filetype_ctx * | ctx, |
const struct ua_nodeid * | nodeid, | ||
ua_node_t | type, | ||
uint16_t | browsename_idx, | ||
const char * | browsename, | ||
const char * | displayname, | ||
struct ua_filetype_interface * | ftif, | ||
const void * | args | ||
) |
Creates an instance of a file type.
ctx | Configuration object to control the node instance creation. |
nodeid | The nodeid of the new node to create. |
type | The type to create an instance from. This must be UA_NODE_FILETYPE or a subclass of it. |
displayname | The displayname to use for the new node. |
browsename | Browsename for the new node, no browsename is set if NULL. |
browsename_idx | Namespace index for the browsename of the new node. |
ftif | The calltable of the file implementation to use. If NULL the SDK will use its own implementation which creates a real file in the file system. |
args | Arguments for the file implementation. For the default implementation this must be the filename. |
SERVER_EXPORT ua_node_t ua_filetype_create_with_existing_node | ( | struct ua_nodeid * | nodeid, |
struct ua_filetype_interface * | ftif, | ||
const void * | args | ||
) |
Creates an instance of a file type from an existing node.
nodeid | The existing nodeid from which an instance shall be created. |
ftif | The calltable of the file implementation to use. If NULL the SDK will use its own implementation which creates a real file in the file system. |
args | Arguments for the file implementation. For the default implementation this must be the filename. |
SERVER_EXPORT struct ua_filetype_ctx* ua_filetype_ctx_create | ( | void | ) |
Creates new instance of a ua_filetype_ctx, which servers the same purpose as ua_instance_ctx, but for ua_filetype_create_ex().
This instance is used as argument for ua_filetype_create_ex().
Use ua_filetype_ctx_delete() to cleanup the resource after the ua_filetype_create_ex() call.
SERVER_EXPORT uint32_t ua_filetype_ctx_get_last_numeric_id | ( | struct ua_filetype_ctx * | ctx | ) |
Get the number used for the last created node with numeric nodeid.
May be used to calculate the nodeid for the next instance without gaps, however only the numeric part is returned, so the namespace index must still be set.
In case no node with numeric nodeid was ever created with this ctx
it returns zero.
SERVER_EXPORT ua_node_t ua_filetype_ctx_get_new_node | ( | struct ua_filetype_ctx * | ctx | ) |
Returns the newly create filetype node.
SERVER_EXPORT void ua_filetype_ctx_set_cb_data | ( | struct ua_filetype_ctx * | ctx, |
void * | data | ||
) |
Set some arbitrary callback data, can be retrieved with ua_instance_get_cb_data.
SERVER_EXPORT void ua_filetype_ctx_set_delete_cb | ( | struct ua_filetype_ctx * | ctx, |
ua_instance_delete_cb | cb | ||
) |
Set the delete callback.
For further information regarding the callback see ua_instance_delete_cb.
SERVER_EXPORT void ua_filetype_ctx_set_mime_type | ( | struct ua_filetype_ctx * | ctx, |
const char * | mimetype | ||
) |
Sets the optional MIME type of the file that should be created.
ctx | Configuration object to control the node instance deletion. |
mimetype | String constant for mime type e.g. "text/plain;charset=UTF-8". When this is set the optional property MimeType will be created. |
SERVER_EXPORT void ua_filetype_ctx_set_parent | ( | struct ua_filetype_ctx * | ctx, |
ua_node_t | parent_node, | ||
ua_node_t | ref_type | ||
) |
Set a parent for new instances.
When setting a parent, a new reference from the parent node to the top level node of the newly created instance will be created after instantiation.
To unset the parent pass UA_NODE_INVALID as parent node and reference type.
ctx | The ua_instance context to modify. |
parent_node | Node handle of the parent node. |
ref_type | Node handle of the reference type from the parent node to the new instance. |
SERVER_EXPORT void ua_filetype_ctx_set_post_create_cb | ( | struct ua_filetype_ctx * | ctx, |
ua_instance_post_create_cb | cb | ||
) |
Set the post create callback.
For further information regarding the callback see ua_instance_post_create_cb.
SERVER_EXPORT void ua_filetype_ctx_set_pre_create_cb | ( | struct ua_filetype_ctx * | ctx, |
ua_instance_pre_create_cb | cb | ||
) |
Set the pre create callback.
Note: This callback is not called if ua_instance_pre_create2_cb is set.
For further information regarding the callback see ua_instance_pre_create_cb.
SERVER_EXPORT int ua_filetype_delete | ( | ua_node_t | file | ) |
Delete a file instance that was creates using ua_filetype_create.
file | The node handle of the file. |
SERVER_EXPORT int ua_filetype_delete_ex | ( | struct ua_filetype_ctx * | ctx, |
ua_node_t | file | ||
) |
Delete a file instance that was creates using ua_filetype_create_ex.
ctx | Configuration object to control the node instance deletion. |
file | The node handle of the file. |
SERVER_EXPORT void* ua_filetype_get_userdata | ( | ua_node_t | file | ) |
Returns the userdata pointer of the file context that was previously stored using ua_filetype_set_userdata().
file | Node handle of the file. |
SERVER_EXPORT int ua_filetype_set_callbacks | ( | ua_node_t | file, |
struct ua_filetype_callbacks * | callbacks | ||
) |
Sets user callbacks for the given filetype instance.
file | Node handle of the file to monitor. |
callbacks | Pointer to callback table. The callbacks table gets copied into the internal file context, so the pointer is not needed anymore when the function returns. E.g. you can use a local variable (stack variable) for register the callbacks. |
SERVER_EXPORT int ua_filetype_set_userdata | ( | ua_node_t | file, |
void * | userdata | ||
) |
Stores a userdata pointer within the file context.
file | Node handle of the file. |
userdata | Data to store. |
SERVER_EXPORT struct ua_filetype_interface ua_filesystem_implementation |
filetype interface table for real filesystem files.
SERVER_EXPORT struct ua_filetype_interface ua_memoryfile_implementation |
filetype interface table for in-memory files.