File syn_opcua.h¶
FileList > proto > syn_opcua.h
Go to the source code of this file
Micro OPC UA (IEC 62541) Binary Protocol Engine & Embedded Server. More...
#include "../common/syn_defs.h"#include "../net/syn_transport.h"#include "../pt/syn_pt.h"#include "../sched/syn_sched.h"#include <stdbool.h>#include <stddef.h>#include <stdint.h>
Classes¶
| Type | Name |
|---|---|
| struct | SYN_OPCUA_Config Configuration parameters for Micro OPC UA Server. |
| struct | SYN_OPCUA_DataValue DataValue with value, status code, and source timestamp. |
| struct | SYN_OPCUA_Node In-memory OPC UA Node representation. |
| struct | SYN_OPCUA_NodeId OPC UA NodeId. |
| struct | SYN_OPCUA_Server Micro OPC UA Server Instance Context. |
| struct | SYN_OPCUA_Variant OPC UA Variant containing dynamic value. |
Public Types¶
| Type | Name |
|---|---|
| enum | SYN_OPCUA_DataType Built-in DataType enum (per Part 6). |
| enum | SYN_OPCUA_NodeClass NodeClass enum. |
| enum | SYN_OPCUA_NodeIdType NodeId identifier type. |
| typedef SYN_Status(* | SYN_OPCUA_ReadCb Dynamic callback invoked when a variable node is read. |
| enum | SYN_OPCUA_ServerState Server connection and session state. |
| typedef SYN_Status(* | SYN_OPCUA_WriteCb Dynamic callback invoked when a variable node is written. |
Public Functions¶
| Type | Name |
|---|---|
| SYN_OPCUA_Node * | syn_opcua_server_find_node_num (SYN_OPCUA_Server * srv, uint16_t ns, uint32_t num_id) Find a node in the address space by numeric NodeId. |
| SYN_Status | syn_opcua_server_init (SYN_OPCUA_Server * srv, const SYN_OPCUA_Config * cfg) Initialize Micro OPC UA Server. |
| SYN_Status | syn_opcua_server_process_message (SYN_OPCUA_Server * srv, const uint8_t * rx, size_t rx_len, uint8_t * tx, size_t max_tx, size_t * out_len) Process an incoming raw OPC UA frame and generate a response frame. |
| SYN_PT_Status | syn_opcua_server_pt (SYN_PT * pt, SYN_Task * task) Protothread continuation function for syn_sched . |
| SYN_Status | syn_opcua_server_read_variable (const SYN_OPCUA_Server * srv, uint16_t ns, uint32_t num_id, SYN_OPCUA_Variant * out_val) Read a variable node's value from the address space. |
| SYN_Status | syn_opcua_server_register_node (SYN_OPCUA_Server * srv, const SYN_OPCUA_Node * node) Register a Node in the server address space. |
| SYN_Status | syn_opcua_server_step (SYN_OPCUA_Server * srv, uint32_t now_ms) Advance OPC UA server state machine by one step / tick. |
| SYN_Status | syn_opcua_server_write_variable (SYN_OPCUA_Server * srv, uint16_t ns, uint32_t num_id, const SYN_OPCUA_Variant * val) Update a variable node's value in the address space. |
Macros¶
Detailed Description¶
Implements a zero-heap, deterministic OPC UA Binary protocol engine:
* UACP (OPC UA Connection Protocol) framing (HEL, ACK, ERR).
* UASC (OPC UA Secure Conversation) framing (OPN, CLO, MSG) with Security Policy None & Basic256Sha256.
* Static In-Memory Address Space: Object, Variable, and Method nodes with numeric & string NodeIds.
* Core Services: Read, Write, Browse, CreateSession, ActivateSession, CreateSubscription, Publish.
* Non-blocking poll step API and cooperative protothread continuation for syn_sched.
Public Types Documentation¶
enum SYN_OPCUA_DataType¶
Built-in DataType enum (per Part 6).
enum SYN_OPCUA_DataType {
SYN_OPCUA_TYPE_NULL = 0,
SYN_OPCUA_TYPE_BOOLEAN = 1,
SYN_OPCUA_TYPE_SBYTE = 2,
SYN_OPCUA_TYPE_BYTE = 3,
SYN_OPCUA_TYPE_INT16 = 4,
SYN_OPCUA_TYPE_UINT16 = 5,
SYN_OPCUA_TYPE_INT32 = 6,
SYN_OPCUA_TYPE_UINT32 = 7,
SYN_OPCUA_TYPE_INT64 = 8,
SYN_OPCUA_TYPE_UINT64 = 9,
SYN_OPCUA_TYPE_FLOAT = 10,
SYN_OPCUA_TYPE_DOUBLE = 11,
SYN_OPCUA_TYPE_STRING = 12,
SYN_OPCUA_TYPE_DATETIME = 13
};
enum SYN_OPCUA_NodeClass¶
NodeClass enum.
enum SYN_OPCUA_NodeClass {
SYN_OPCUA_NODECLASS_UNSPECIFIED = 0,
SYN_OPCUA_NODECLASS_OBJECT = 1,
SYN_OPCUA_NODECLASS_VARIABLE = 2,
SYN_OPCUA_NODECLASS_METHOD = 4
};
enum SYN_OPCUA_NodeIdType¶
NodeId identifier type.
typedef SYN_OPCUA_ReadCb¶
Dynamic callback invoked when a variable node is read.
typedef SYN_Status(* SYN_OPCUA_ReadCb) (struct SYN_OPCUA_Server *srv, const struct SYN_OPCUA_Node *node, SYN_OPCUA_DataValue *out_val, void *user_data);
enum SYN_OPCUA_ServerState¶
Server connection and session state.
enum SYN_OPCUA_ServerState {
SYN_OPCUA_STATE_CLOSED = 0,
SYN_OPCUA_STATE_HELLO_RECEIVED,
SYN_OPCUA_STATE_SECURE_CHANNEL,
SYN_OPCUA_STATE_SESSION_ACTIVE
};
typedef SYN_OPCUA_WriteCb¶
Dynamic callback invoked when a variable node is written.
typedef SYN_Status(* SYN_OPCUA_WriteCb) (struct SYN_OPCUA_Server *srv, const struct SYN_OPCUA_Node *node, const SYN_OPCUA_DataValue *in_val, void *user_data);
Public Functions Documentation¶
function syn_opcua_server_find_node_num¶
Find a node in the address space by numeric NodeId.
SYN_OPCUA_Node * syn_opcua_server_find_node_num (
SYN_OPCUA_Server * srv,
uint16_t ns,
uint32_t num_id
)
Parameters:
srvServer instance.nsNamespace index.num_idNumeric identifier.
Returns:
Pointer to node in address space or NULL if not found.
function syn_opcua_server_init¶
Initialize Micro OPC UA Server.
Parameters:
srvServer instance to initialize.cfgServer configuration.
Returns:
SYN_OK on success, SYN_INVALID_PARAM on invalid argument.
function syn_opcua_server_process_message¶
Process an incoming raw OPC UA frame and generate a response frame.
SYN_Status syn_opcua_server_process_message (
SYN_OPCUA_Server * srv,
const uint8_t * rx,
size_t rx_len,
uint8_t * tx,
size_t max_tx,
size_t * out_len
)
Parameters:
srvServer instance.rxInbound raw message frame.rx_lenInbound length in bytes.txOutbound response frame buffer.max_txOutbound buffer capacity.out_lenPointer receiving generated response length.
Returns:
SYN_OK on success.
function syn_opcua_server_pt¶
Protothread continuation function for syn_sched .
Parameters:
ptProtothread continuation structure.taskTask handle containing SYN_OPCUA_Server in user_data.
Returns:
SYN_PT_Status continuation status.
function syn_opcua_server_read_variable¶
Read a variable node's value from the address space.
SYN_Status syn_opcua_server_read_variable (
const SYN_OPCUA_Server * srv,
uint16_t ns,
uint32_t num_id,
SYN_OPCUA_Variant * out_val
)
Parameters:
srvServer instance.nsNamespace index.num_idNumeric identifier.out_valOutput variant value pointer.
Returns:
SYN_OK on success, SYN_ERROR if not found.
function syn_opcua_server_register_node¶
Register a Node in the server address space.
Parameters:
srvServer instance.nodeNode descriptor to copy into address space.
Returns:
SYN_OK on success, SYN_ERROR if address space is full.
function syn_opcua_server_step¶
Advance OPC UA server state machine by one step / tick.
Parameters:
srvServer instance.now_msCurrent system timestamp in milliseconds.
Returns:
SYN_OK on success.
function syn_opcua_server_write_variable¶
Update a variable node's value in the address space.
SYN_Status syn_opcua_server_write_variable (
SYN_OPCUA_Server * srv,
uint16_t ns,
uint32_t num_id,
const SYN_OPCUA_Variant * val
)
Parameters:
srvServer instance.nsNamespace index.num_idNumeric identifier.valNew variant value.
Returns:
SYN_OK on success, SYN_ERROR if not found.
Macro Definition Documentation¶
define SYN_OPCUA_ATTR_ACCESS_LEVEL¶
AccessLevel attribute
define SYN_OPCUA_ATTR_BROWSE_NAME¶
BrowseName attribute
define SYN_OPCUA_ATTR_DATA_TYPE¶
DataType attribute
define SYN_OPCUA_ATTR_DISPLAY_NAME¶
DisplayName attribute
define SYN_OPCUA_ATTR_NODE_CLASS¶
NodeClass attribute
define SYN_OPCUA_ATTR_NODE_ID¶
NodeId attribute
define SYN_OPCUA_ATTR_VALUE¶
Value attribute
define SYN_OPCUA_ATTR_VALUE_RANK¶
ValueRank attribute
define SYN_OPCUA_DEFAULT_BUFFER_SIZE¶
Default Chunk Buffer Size
define SYN_OPCUA_DEFAULT_PORT¶
Standard OPC UA TCP Port
define SYN_OPCUA_MAX_NODES¶
Static Node Table Capacity
define SYN_OPCUA_MAX_REFERENCES¶
Max References per Node
define SYN_OPCUA_MAX_STRING_LEN¶
Max Identifier & Name String Length
define SYN_OPCUA_NODEID_OBJECTS_FOLDER¶
ObjectsFolder NodeId
define SYN_OPCUA_NODEID_ROOT¶
RootFolder NodeId
define SYN_OPCUA_NODEID_SERVER¶
Server Object NodeId
define SYN_OPCUA_NODEID_SERVER_SERVERSTATUS¶
ServerStatus Variable NodeId
define SYN_OPCUA_NS_STANDARD¶
OPC UA standard namespace index
define SYN_OPCUA_NS_VENDOR¶
Vendor custom namespace index
define SYN_OPCUA_PROTOCOL_VERSION¶
OPC UA Binary Protocol Version
define SYN_OPCUA_STATUS_BAD_ATTRIBUTE_ID_INVALID¶
AttributeId is invalid
define SYN_OPCUA_STATUS_BAD_INTERNAL_ERROR¶
Internal error occurred
define SYN_OPCUA_STATUS_BAD_NODE_ID_UNKNOWN¶
NodeId is unknown in address space \
define SYN_OPCUA_STATUS_BAD_NOT_READABLE¶
Node attribute is not readable
define SYN_OPCUA_STATUS_BAD_NOT_WRITABLE¶
Node attribute is not writable
define SYN_OPCUA_STATUS_BAD_SECURITY_CHECKS_FAILED¶
Security verification failed \
define SYN_OPCUA_STATUS_BAD_SERVICE_UNSUPPORTED¶
Requested service is unsupported
define SYN_OPCUA_STATUS_BAD_UNEXPECTED¶
Unexpected error
define SYN_OPCUA_STATUS_GOOD¶
Operation succeeded
define SYN_OPCUA_STATUS_UNCERTAIN¶
Value is uncertain
The documentation for this class was generated from the following file src/syntropic/proto/syn_opcua.h