High Performance OPC UA Server SDK  1.7.1.383

Register and lookup method handlers. More...

Data Structures

struct  uaserver_call_table_numeric
 This struct allows to create local tables with handler functions, that can be easily registered with uaserver_call_table_register_numeric, though it works only when ObjectId and MethodId are numeric nodeids. More...
 

Typedefs

typedef ua_statuscode(* uaserver_call_table_method_t) (struct uaprovider_call_ctx *ctx, const struct ua_callmethodrequest *req, struct ua_callmethodresult *res)
 Signature for the method handler function.
 

Functions

SERVER_NO_EXPORT void uaserver_call_table_clear (void)
 
SERVER_NO_EXPORT int uaserver_call_table_init (void)
 
SERVER_EXPORT int uaserver_call_table_register_numeric (const struct uaserver_call_table_numeric *table, size_t num_entries)
 Convenience function for registering bulks of numeric object/method combinations. More...
 
SERVER_EXPORT int uaserver_call_table_register (ua_node_t object, ua_node_t method, uaserver_call_table_method_t fct)
 Register a method function pointer for a certain object/method combination. More...
 
SERVER_EXPORT int uaserver_call_table_remove (ua_node_t object, ua_node_t method)
 Remove object/method combination registered with uaserver_call_table_register.
 
SERVER_EXPORT uaserver_call_table_method_t uaserver_call_table_lookup (ua_node_t object, ua_node_t method)
 Lookup a method fct pointer registered with uaserver_call_table_register.
 

Detailed Description

Register and lookup method handlers.

Function Documentation

◆ uaserver_call_table_register()

SERVER_EXPORT int uaserver_call_table_register ( ua_node_t  object,
ua_node_t  method,
uaserver_call_table_method_t  fct 
)

Register a method function pointer for a certain object/method combination.

Depending on the object the method fct can be registered for one of 3 different scopes:

  • object: When the object is an actual object node the fct will only be returned for this exact object.
  • type: When object is a type node the fct will be returned for all objects of this type and the type node itself. This also works for subtypes, the lookup will use the supertype of the type until fct is found or there are no more supertypes.
  • global: When object is UA_NODE_INVALID the fct will be returned for every object.

The more specific scope overrides the general scope, e.g. a method can be registered for a type but another method can be registered for an object of this type. Methods for the global scope will be used when no other method can be found, this is also the only way for objects that may not be in the address space but must callable (like Conditions).

The method to register is in most cases the method node from the type (instance declaration). As the lookup will follow the method declaration of the method used for the call registering the method node of the object will usually NOT work.

When registering a fct for the exact same object/method as before the existing fct will be replaced by the new one.

Returns
Zero on success or errorcode on failure.

◆ uaserver_call_table_register_numeric()

SERVER_EXPORT int uaserver_call_table_register_numeric ( const struct uaserver_call_table_numeric table,
size_t  num_entries 
)

Convenience function for registering bulks of numeric object/method combinations.

This functions allows to code const tables with numeric nodeids from the same namespace. To register for the global scope use UINT32_MAX as the identifier for the object. In case this operation fails, already registered entries will not be removed.

If this function does not satisfy your needs you will need to use uaserver_call_table_register directly.

Returns
Zero on success or errorcode on failure.