S2OPC OPCUA Toolkit
Loading...
Searching...
No Matches
sopc_secure_channels_api.h File Reference

Event oriented API of the Secure Channel layer. More...

#include <stdint.h>
#include "sopc_event_handler.h"

Go to the source code of this file.

Enumerations

enum  SOPC_SecureChannels_InputEvent {
  EP_OPEN = 0x200 , EP_CLOSE , REVERSE_EP_OPEN , REVERSE_EP_CLOSE ,
  SC_CONNECT , SC_REVERSE_CONNECT , SC_DISCONNECT , SC_SERVICE_SND_MSG ,
  SC_SERVICE_SND_ERR , SC_DISCONNECTED_ACK , SCS_REEVALUATE_SCS
}
 Secure channel input events from services layer. More...
 
enum  SOPC_SecureChannels_OutputEvent {
  EP_CONNECTED = 0x300 , EP_CLOSED , EP_REVERSE_CLOSED , SC_CONNECTED ,
  SC_REVERSE_CONNECTED , SC_CONNECTION_TIMEOUT , SC_DISCONNECTED , SC_SERVICE_RCV_MSG ,
  SC_SND_FAILURE , SC_REQUEST_TIMEOUT
}
 Secure channel output events to services layer. More...
 

Functions

SOPC_ReturnStatus SOPC_SecureChannels_EnqueueEvent (SOPC_SecureChannels_InputEvent scEvent, uint32_t id, uintptr_t params, uintptr_t auxParam)
 
void SOPC_SecureChannels_Initialize (SOPC_SetListenerFunc *setSocketsListener)
 
void SOPC_SecureChannels_SetEventHandler (SOPC_EventHandler *handler)
 
void SOPC_SecureChannels_Clear (void)
 

Detailed Description

Event oriented API of the Secure Channel layer.

This module is in charge of the event dispatcher thread management.

Enumeration Type Documentation

◆ SOPC_SecureChannels_InputEvent

Secure channel input events from services layer.

Enumerator
EP_OPEN 

Server side only:
Opens a new endpoint connection listener.
id = endpoint description configuration index

EP_CLOSE 

Server side only:
Closes an opened endpoint connection listener.
id = endpoint description configuration index

REVERSE_EP_OPEN 

Client side only:
Open a reverse endpoint
id = reverse endpoint configuration index

REVERSE_EP_CLOSE 

Client side only:
close a reverse endpoint
id = reverse endpoint configuration index

SC_CONNECT 

Client side only:
Establishes connection of a new secure channel.
id = secure channel configuration index

SC_REVERSE_CONNECT 

Client side only:
Activate the connection on next available server reverse connection
id = reverse endpoint configuration index
params = (uint32_t) secure channel configuration index

SC_DISCONNECT 

Disconnects and clears the secure channel identified by the given secure channel index (provided on connected event).
id = secure channel connection index params = (SOPC_StatusCode) reasonCode

SC_SERVICE_SND_MSG 

Sends a message on a secure channel.
id = secure channel connection index
params = (SOPC_Buffer*) buffer to send containing empty space for TCP UA header (24 bytes) followed by encoded OpcUa message
auxParam = (uint32_t) request Id context if response (server) / request Handle context if request (client)

SC_SERVICE_SND_ERR 

Sends an error message related to the secure channel so as to close it (if in state Connected or Connected_Renew).
id = secure channel connection index
params = (SOPC_StatusCode) encoding failure status code or security check failed (user auth)
auxParam = (uint32_t) request Id context of response (Debug info only)

SC_DISCONNECTED_ACK 

Notify secure channel disconnected state was received
id = secure channel connection index
params = (uint32_t) secure channel config index (SERVER SIDE ONLY) or 0 (CLIENT SIDE)

SCS_REEVALUATE_SCS 

Re-evaluate the secure channels due to application certificate/key update (force SC re-establishment) or PKI application trust list update (peer certificate re-validation necessary).
params = (bool) flag indicating if it concerns server (true) or client (false) application secure channels.
auxParam = (bool) flag indicating if it concerns application certificate/key update (true), otherwise the PKI trust list update (false).

◆ SOPC_SecureChannels_OutputEvent

Secure channel output events to services layer.

Enumerator
EP_CONNECTED 

(Server only) Notification of new SC connected on SC connection listener.
id = endpoint description config index
params = (uint32_t) secure channel config index
auxParams = (uint32_t) secure channel connection index

EP_CLOSED 

Notification of closed endpoint connection listener.
id = endpoint description config index
auxParams = SOPC_ReturnStatus

EP_REVERSE_CLOSED 

Notifies the SC reverse listener is closed for the given endpoint configuration index
id = reverse endpoint config index
auxParams = SOPC_ReturnStatus

SC_CONNECTED 

(Client only) Notify secure channel in connected state. Treats actions waiting for connection to be established.
id = secure channel connection index
auxParams = (uint32_t) secure channel configuration index

SC_REVERSE_CONNECTED 

(Client only) Notify secure channel in connected state for a reverse connection. Treats actions waiting for connection to be established.
id = secure channel connection index
params = (uint32_t) secure channel configuration index
auxParams = (uint32_t) reverse endpoint configuration index

SC_CONNECTION_TIMEOUT 

Notification that secure channel connection attempt failed for the given SC connection configuration index. Notifies failure for actions waiting for connection to be established.
id = secure channel config index

SC_DISCONNECTED 

Notify secure channel previously in connected state is now disconnected. It shall be acknowledged by raising back a SC_DISCONNECTED_ACK event.
id = secure channel connection index
params = (uint32_t) secure channel config index (SERVER SIDE ONLY) or 0 (CLIENT SIDE)
auxParam = SOPC_StatusCode

SC_SERVICE_RCV_MSG 

Received message on the secure channel for the given SC connection index and with the provided OPC UA message encoded as bytes buffer. When triggered on Server side, the request Id context is provided in addition to other parameters so it can be returned in the response.
id = secure channel connection index
params = (SOPC_Buffer*) OPC UA message payload buffer
auxParam = (uint32_t) request Id context (server side only, 0 if client)

SC_SND_FAILURE 

Notifies a message which was provided through the output event SC_SERVICE_SND_MSG failed to be sent.
id = secure channel connection index
params = (uint32_t) requestHandle for client / requestId for server (unused)
auxParam = SOPC_StatusCode

SC_REQUEST_TIMEOUT 

When an OPN or MSG sent message did not receive any answer.
id = secure channel connection index
auxParam = (uint32_t) request handle

Function Documentation

◆ SOPC_SecureChannels_EnqueueEvent()

SOPC_ReturnStatus SOPC_SecureChannels_EnqueueEvent ( SOPC_SecureChannels_InputEvent scEvent,
uint32_t id,
uintptr_t params,
uintptr_t auxParam )

◆ SOPC_SecureChannels_Initialize()

void SOPC_SecureChannels_Initialize ( SOPC_SetListenerFunc * setSocketsListener)

◆ SOPC_SecureChannels_SetEventHandler()

void SOPC_SecureChannels_SetEventHandler ( SOPC_EventHandler * handler)

◆ SOPC_SecureChannels_Clear()

void SOPC_SecureChannels_Clear ( void )