S2OPC OPCUA Toolkit
Data Structures | Typedefs | Functions
sopc_call_method_manager.h File Reference

Contains the types to be used by the method call manager to configure the Call service. More...

#include "sopc_builtintypes.h"
#include "sopc_service_call_context.h"

Go to the source code of this file.

Data Structures

struct  SOPC_MethodCallFunc
 Object to describe of function associated to a method and user parameter. More...
 
struct  SOPC_MethodCallManager
 The SOPC_MethodCallManager object defines the common interface for the method manager. More...
 

Typedefs

typedef struct SOPC_MethodCallManager SOPC_MethodCallManager
 
typedef struct SOPC_MethodCallFunc SOPC_MethodCallFunc
 
typedef SOPC_StatusCode SOPC_MethodCallFunc_Ptr(const SOPC_CallContext *callContextPtr, const SOPC_NodeId *objectId, uint32_t nbInputArgs, const SOPC_Variant *inputArgs, uint32_t *nbOutputArgs, SOPC_Variant **outputArgs, void *param)
 Type of the function to call associated to a method. More...
 
typedef void SOPC_MethodCallFunc_Free_Func(void *data)
 Type of the function to free param of SOPC_MethodCallFunc. More...
 
typedef void SOPC_MethodCallManager_Free_Func(void *data)
 
typedef SOPC_MethodCallFuncSOPC_MethodCallManager_Get_Func(SOPC_MethodCallManager *mcm, SOPC_NodeId *methodId)
 

Functions

SOPC_MethodCallManagerSOPC_MethodCallManager_Create (void)
 Provide a basic implementation of MethodCallManager. This implementation can be used with SOPC_MethodCallManager_AddMethod to add method. More...
 
void SOPC_MethodCallManager_Free (SOPC_MethodCallManager *mcm)
 Free MethodCallManager created with SOPC_MethodCallManager_Create. More...
 
SOPC_ReturnStatus SOPC_MethodCallManager_AddMethod (SOPC_MethodCallManager *mcm, SOPC_NodeId *methodId, SOPC_MethodCallFunc_Ptr *methodFunc, void *param, SOPC_MethodCallFunc_Free_Func *fnFree)
 Associate a C function to a NodeId of a Method. This function should be used only with the basic implementation of SOPC_MethodCallManager provided by the toolkit. More...
 

Detailed Description

Contains the types to be used by the method call manager to configure the Call service.

Warning
Methods call are blocking for server services treatment, methods implementation should be lightweight functions (see Part 3 §4.7).

Typedef Documentation

◆ SOPC_MethodCallManager

◆ SOPC_MethodCallFunc

◆ SOPC_MethodCallFunc_Ptr

typedef SOPC_StatusCode SOPC_MethodCallFunc_Ptr(const SOPC_CallContext *callContextPtr, const SOPC_NodeId *objectId, uint32_t nbInputArgs, const SOPC_Variant *inputArgs, uint32_t *nbOutputArgs, SOPC_Variant **outputArgs, void *param)

Type of the function to call associated to a method.

Warning
The method callback call is blocking for server services treatment and thus local services cannot be called synchronously. Method should be lightweight functions (see Part 3 §4.7) and only operations provided by callContextPtr shall be used to interact with server address space.
Note
Method call service verifies the input arguments before calling a SOPC_MethodCallFunc_Ptr function.
a ByteString could be provided instead of an expected array of Byte and conversely (See Spec 1.03 part 4 - table 66)
Parameters
callContextPtrcontext provided by server on connection/session associated to method call
objectIda valid pointer to the object on which the method is called or a type if the method is static
nbInputArgsnumber of input argument
inputArgsan array of input argument of the method. The size is nbInputArgs.
nbOutputArgsa valid pointer in which the number of output argument is written by the function
outputArgsa valid pointer to an SOPC_Variant[] in which the output arguments are allocated and written by the function
Returns
status code of the function. Should be SOPC_STATUS_OK if succeeded.

◆ SOPC_MethodCallFunc_Free_Func

typedef void SOPC_MethodCallFunc_Free_Func(void *data)

Type of the function to free param of SOPC_MethodCallFunc.

Parameters
dataa pointer to the object to free. Can be NULL

◆ SOPC_MethodCallManager_Free_Func

typedef void SOPC_MethodCallManager_Free_Func(void *data)

◆ SOPC_MethodCallManager_Get_Func

typedef SOPC_MethodCallFunc* SOPC_MethodCallManager_Get_Func(SOPC_MethodCallManager *mcm, SOPC_NodeId *methodId)

Function Documentation

◆ SOPC_MethodCallManager_Create()

SOPC_MethodCallManager* SOPC_MethodCallManager_Create ( void  )

Provide a basic implementation of MethodCallManager. This implementation can be used with SOPC_MethodCallManager_AddMethod to add method.

Returns
a valid SOPC_MethodCallManager pointer or NULL on memory allocation failure.

◆ SOPC_MethodCallManager_Free()

void SOPC_MethodCallManager_Free ( SOPC_MethodCallManager mcm)

Free MethodCallManager created with SOPC_MethodCallManager_Create.

◆ SOPC_MethodCallManager_AddMethod()

SOPC_ReturnStatus SOPC_MethodCallManager_AddMethod ( SOPC_MethodCallManager mcm,
SOPC_NodeId methodId,
SOPC_MethodCallFunc_Ptr methodFunc,
void *  param,
SOPC_MethodCallFunc_Free_Func fnFree 
)

Associate a C function to a NodeId of a Method. This function should be used only with the basic implementation of SOPC_MethodCallManager provided by the toolkit.

Parameters
mcma valid pointer on a SOPC_MethodCallManager returned by SOPC_MethodCallManager_Create().
methodIda valid pointer on a SOPC_NodeId of the method (mcm will manage its deallocation, do not reuse this nodeId after call)
methodFunca valid pointer on a C function to associate with the given methodId.
parama pointer on data to give as parameter when call methodFunc. Can be NULL.
fnFreea pointer on a C function to free param. Can be NULL.
Returns
SOPC_STATUS_OK when the function succeed, SOPC_STATUS_INVALID_PARAMETERS or SOPC_STATUS_OUT_OF_MEMORY.