S2OPC OPCUA Toolkit
Loading...
Searching...
No Matches
sopc_network_layer.h
Go to the documentation of this file.
1/*
2 * Licensed to Systerel under one or more contributor license
3 * agreements. See the NOTICE file distributed with this work
4 * for additional information regarding copyright ownership.
5 * Systerel licenses this file to you under the Apache
6 * License, Version 2.0 (the "License"); you may not use this
7 * file except in compliance with the License. You may obtain
8 * a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
32#ifndef SOPC_NETWORK_LAYER_H_
33#define SOPC_NETWORK_LAYER_H_
34
35#include <inttypes.h>
36#include "sopc_buffer.h"
39#include "sopc_pubsub_conf.h"
41#include "sopc_sub_scheduler.h"
43
45typedef enum
46{
112
117
128 const uint16_t groupId,
129 const uint16_t writerId,
130 const uint16_t receivedSN);
131
141 const uint16_t groupId,
142 const uint16_t writerId);
143
151bool SOPC_Is_UInt16_Sequence_Number_Newer(uint16_t received, uint16_t processed);
152
164 SOPC_PubSub_SecurityType* security,
165 SOPC_Buffer** buffer);
166
178 SOPC_PubSub_SecurityType* security,
179 SOPC_Buffer** buffer_header,
180 SOPC_Buffer** buffer_payload);
181
191 SOPC_Buffer* buffer_header,
192 SOPC_Buffer** buffer_payload);
193
203 SOPC_PubSub_SecurityType* security);
204
219 const SOPC_UADP_Configuration* uadp_conf,
220 const SOPC_Dataset_LL_PublisherId* pubid,
221 const uint32_t groupVersion,
222 const uint32_t groupId);
223
237 const SOPC_UADP_Configuration* uadp_conf,
238 const uint16_t dataSetWriterId);
239
256 SOPC_SubTargetVariableConfig* targetConfig,
257 const SOPC_DataSetReader* reader,
258 SOPC_TargetVariableCtx* targetVariable);
259
272 const uint16_t groupId,
273 const uint16_t writerId);
274
281
291
308 SOPC_Buffer* buffer,
310 const SOPC_PubSubConnection* connection,
311 SOPC_UADP_NetworkMessage** uadp_nm);
312
314
315#endif /* SOPC_NETWORK_LAYER_H_ */
A buffer of bytes with a maximum size, length and position.
struct SOPC_Dataset_LL_DataSetMessage SOPC_Dataset_LL_DataSetMessage
Definition sopc_dataset_ll_layer.h:32
struct SOPC_Dataset_LL_NetworkMessage SOPC_Dataset_LL_NetworkMessage
Definition sopc_dataset_ll_layer.h:34
enum _SOPC_ReturnStatus SOPC_ReturnStatus
Common enumerations for S2OPC.
const SOPC_ReaderGroup * SOPC_UADP_NetworkMessage_GetReaderGroup(const SOPC_PubSubConnection *connection, const SOPC_UADP_Configuration *uadp_conf, const SOPC_Dataset_LL_PublisherId *pubid, const uint32_t groupVersion, const uint32_t groupId)
A callback for ReaderGroup identification. When a network message is received, this callback is expec...
Definition sopc_network_layer.h:218
SOPC_NetworkMessage_Error_Code SOPC_UADP_NetworkMessage_BuildFinalMessage(SOPC_PubSub_SecurityType *security, SOPC_Buffer *buffer_header, SOPC_Buffer **buffer_payload)
Sign and encrypt encoded buffer if necessary and merge header and payload buffer in one buffer.
SOPC_NetworkMessage_Error_Code SOPC_UADP_NetworkMessage_Decode(SOPC_Buffer *buffer, const SOPC_UADP_NetworkMessage_Reader_Configuration *reader_config, const SOPC_PubSubConnection *connection, SOPC_UADP_NetworkMessage **uadp_nm)
Decode a UADP packet into a NetworkMessage.
SOPC_TargetVariableCtx * SOPC_UADP_GetTargetVariable_Func(const SOPC_Conf_PublisherId *pubId, const uint16_t groupId, const uint16_t writerId)
A callback to retrieve a SOPC_TargetVariableCtx provided to user. The SOPC_TargetVariableCtx provided...
Definition sopc_network_layer.h:271
void SOPC_UADP_UpdateTimeout_Func(const SOPC_Conf_PublisherId *pubId, const uint16_t groupId, const uint16_t writerId)
Function used to update timeout state of an identified dataSetWriter. This function should be call if...
Definition sopc_network_layer.h:140
bool SOPC_UADP_IsWriterSequenceNumberNewer_Func(const SOPC_Conf_PublisherId *pubId, const uint16_t groupId, const uint16_t writerId, const uint16_t receivedSN)
Function used to check if a DataSetMessage sequence number is newer for the identified DataSetWriter.
Definition sopc_network_layer.h:127
SOPC_NetworkMessage_Error_Code
Definition sopc_network_layer.h:46
@ SOPC_UADP_NetworkMessage_Error_Read_DsmTimeStamp
Definition sopc_network_layer.h:85
@ SOPC_UADP_NetworkMessage_Error_Read_NoMatchingGroup
Definition sopc_network_layer.h:86
@ SOPC_UADP_NetworkMessage_Error_Read_SecurityNone_Failed
Definition sopc_network_layer.h:76
@ SOPC_UADP_NetworkMessage_Error_Read_DsmFields_Failed
Definition sopc_network_layer.h:83
@ SOPC_UADP_NetworkMessage_Error_Read_NoMatchingReader
Definition sopc_network_layer.h:87
@ SOPC_UADP_NetworkMessage_Error_Read_DsmSize_Failed
Definition sopc_network_layer.h:79
@ SOPC_JSON_NetworkMessage_Error_Generate_Unique_MessageId
Definition sopc_network_layer.h:104
@ SOPC_UADP_NetworkMessage_Error_Write_DsmSeqNum_Failed
Definition sopc_network_layer.h:61
@ SOPC_UADP_NetworkMessage_Error_Read_Security_Failed
Definition sopc_network_layer.h:70
@ SOPC_UADP_NetworkMessage_Error_Write_EncryptPaylod_Failed
Definition sopc_network_layer.h:63
@ SOPC_UADP_NetworkMessage_Error_Write_PayloadFlush_Failed
Definition sopc_network_layer.h:64
@ SOPC_UADP_NetworkMessage_Error_Write_DsmField_Failed
Definition sopc_network_layer.h:60
@ SOPC_UADP_NetworkMessage_Error_Read_SecurityNonce_Failed
Definition sopc_network_layer.h:74
@ SOPC_UADP_NetworkMessage_Error_Write_DsmSize_Failed
Definition sopc_network_layer.h:58
@ SOPC_UADP_NetworkMessage_Error_Read_SecuritySign_Failed
Definition sopc_network_layer.h:72
@ SOPC_UADP_NetworkMessage_Error_Write_Sign_Failed
Definition sopc_network_layer.h:65
@ SOPC_UADP_NetworkMessage_Error_Unsupported_PubIdType
Definition sopc_network_layer.h:92
@ SOPC_UADP_NetworkMessage_Error_Write_GroupVersion_Failed
Definition sopc_network_layer.h:52
@ SOPC_JSON_NetworkMessage_Error_Variant_Encode
Definition sopc_network_layer.h:108
@ SOPC_UADP_NetworkMessage_Error_Read_InvalidBit
Definition sopc_network_layer.h:82
@ SOPC_UADP_NetworkMessage_Error_Unsupported_Timestamp
Definition sopc_network_layer.h:96
@ SOPC_UADP_NetworkMessage_Error_Write_DsmTimestamp_Failed
Definition sopc_network_layer.h:62
@ SOPC_UADP_NetworkMessage_Error_Unsupported_PromotedFields
Definition sopc_network_layer.h:99
@ SOPC_UADP_NetworkMessage_Error_Read_Int_Failed
Definition sopc_network_layer.h:68
@ SOPC_UADP_NetworkMessage_Error_Unsupported_SeqNum
Definition sopc_network_layer.h:95
@ SOPC_UADP_NetworkMessage_Error_Write_GroupId_Failed
Definition sopc_network_layer.h:51
@ SOPC_UADP_NetworkMessage_Error_Unsupported_DsmPicoseconds
Definition sopc_network_layer.h:103
@ SOPC_JSON_NetworkMessage_Error_Security_Unsupported
Definition sopc_network_layer.h:110
@ SOPC_JSON_NetworkMessage_Error_Generate_Unique_VariantName
Definition sopc_network_layer.h:105
@ SOPC_UADP_NetworkMessage_Error_Read_DsmSeqNumCheck_Failed
Definition sopc_network_layer.h:81
@ SOPC_UADP_NetworkMessage_Error_Read_Short_Failed
Definition sopc_network_layer.h:67
@ SOPC_UADP_NetworkMessage_Error_Write_Buffer_Failed
Definition sopc_network_layer.h:49
@ SOPC_UADP_NetworkMessage_Error_Unsupported_EncodingType
Definition sopc_network_layer.h:100
@ SOPC_UADP_NetworkMessage_Error_Read_Alloc_Failed
Definition sopc_network_layer.h:69
@ SOPC_NetworkMessage_Error_Code_None
Definition sopc_network_layer.h:47
@ SOPC_UADP_NetworkMessage_Error_Unsupported_Picoseconds
Definition sopc_network_layer.h:97
@ SOPC_UADP_NetworkMessage_Error_Read_SecurityDecrypt_Failed
Definition sopc_network_layer.h:75
@ SOPC_JSON_NetworkMessage_Error_Encode
Definition sopc_network_layer.h:106
@ SOPC_UADP_NetworkMessage_Error_Write_SecuFooter_Failed
Definition sopc_network_layer.h:56
@ SOPC_NetworkMessage_Error_Write_Alloc_Failed
Definition sopc_network_layer.h:57
@ SOPC_UADP_NetworkMessage_Error_Write_DsmPreSize_Failed
Definition sopc_network_layer.h:59
@ SOPC_UADP_NetworkMessage_Error_Read_DsmSkip_Failed
Definition sopc_network_layer.h:78
@ SOPC_UADP_NetworkMessage_Error_Read_SecurityConf_Failed
Definition sopc_network_layer.h:71
@ SOPC_UADP_NetworkMessage_Error_Write_WriterId_Failed
Definition sopc_network_layer.h:53
@ SOPC_UADP_NetworkMessage_Error_Read_DsmSeqNum_Failed
Definition sopc_network_layer.h:80
@ SOPC_UADP_NetworkMessage_Error_Read_BadMetaData
Definition sopc_network_layer.h:88
@ SOPC_UADP_NetworkMessage_Error_Unsupported_SecurityFooterReset
Definition sopc_network_layer.h:98
@ SOPC_UADP_NetworkMessage_Error_Unsupported_Version
Definition sopc_network_layer.h:89
@ SOPC_UADP_NetworkMessage_Error_Unsupported_Flags2
Definition sopc_network_layer.h:91
@ SOPC_JSON_NetworkMessage_Error_Write_Closing_Structure
Definition sopc_network_layer.h:109
@ SOPC_UADP_NetworkMessage_Error_Write_SecuHdr_Failed
Definition sopc_network_layer.h:55
@ SOPC_UADP_NetworkMessage_Error_Read_Byte_Failed
Definition sopc_network_layer.h:66
@ SOPC_NetworkMessage_Error_Code_InvalidParameters
Definition sopc_network_layer.h:48
@ SOPC_JSON_NetworkMessage_Error_DataSetMessage_Encode
Definition sopc_network_layer.h:107
@ SOPC_UADP_NetworkMessage_Error_Unsupported_ClassId
Definition sopc_network_layer.h:93
@ SOPC_UADP_NetworkMessage_Error_Read_SecuritySignSize_Failed
Definition sopc_network_layer.h:73
@ SOPC_UADP_NetworkMessage_Error_Unsupported_DsmType
Definition sopc_network_layer.h:101
@ SOPC_UADP_NetworkMessage_Error_Write_PubId_Failed
Definition sopc_network_layer.h:50
@ SOPC_UADP_NetworkMessage_Error_Read_SeqNum_Failed
Definition sopc_network_layer.h:77
@ SOPC_UADP_NetworkMessage_Error_Unsupported_DsmSeqNum
Definition sopc_network_layer.h:102
@ SOPC_UADP_NetworkMessage_Error_Write_TokenId_Failed
Definition sopc_network_layer.h:54
@ SOPC_UADP_NetworkMessage_Error_Unsupported_Flags1
Definition sopc_network_layer.h:90
@ SOPC_UADP_NetworkMessage_Error_Unsupported_MessageNum
Definition sopc_network_layer.h:94
@ SOPC_UADP_NetworkMessage_Error_Read_DsmSizeCheck_Failed
Definition sopc_network_layer.h:84
SOPC_ReturnStatus SOPC_UADP_NetworkMessage_SetDsm(SOPC_Dataset_LL_DataSetMessage *dsm, SOPC_SubTargetVariableConfig *targetConfig, const SOPC_DataSetReader *reader, SOPC_TargetVariableCtx *targetVariable)
A callback for DataSet message application. When a compliant DataSet is received, this callback is ex...
Definition sopc_network_layer.h:255
SOPC_Buffer * SOPC_UADP_NetworkMessage_Get_PreencodedBuffer(SOPC_Dataset_LL_NetworkMessage *nm, SOPC_PubSub_SecurityType *security)
Get updated preencoded buffer.
void SOPC_UADP_NetworkMessage_Delete(SOPC_UADP_NetworkMessage *uadp_nm)
SOPC_NetworkMessage_Error_Code SOPC_UADP_NetworkMessage_Encode_Buffers(SOPC_Dataset_LL_NetworkMessage *nm, SOPC_PubSub_SecurityType *security, SOPC_Buffer **buffer_header, SOPC_Buffer **buffer_payload)
Encode a NetworkMessage with UADP Mapping. Buffer is split in a Header buffer and payload buffer.
struct SOPC_UADP_Network_Message SOPC_UADP_NetworkMessage
SOPC_NetworkMessage_Error_Code SOPC_JSON_NetworkMessage_Encode(SOPC_Dataset_LL_NetworkMessage *message, SOPC_PubSub_SecurityType *security, SOPC_Buffer **buffer)
Encode a NetworkMessage with JSON Mapping.
bool SOPC_Is_UInt16_Sequence_Number_Newer(uint16_t received, uint16_t processed)
check if received sequence number is newer than processsed sequence number following part 14 rules
const SOPC_DataSetReader * SOPC_UADP_NetworkMessage_GetReader(const SOPC_ReaderGroup *group, const SOPC_UADP_Configuration *uadp_conf, const uint16_t dataSetWriterId)
A callback for DataSetReader identification. When a DataSet content is received, this callback is exp...
Definition sopc_network_layer.h:236
struct SOPC_PubSubConnection SOPC_PubSubConnection
Definition sopc_pubsub_conf.h:29
struct SOPC_ReaderGroup SOPC_ReaderGroup
Definition sopc_pubsub_conf.h:34
struct SOPC_DataSetReader SOPC_DataSetReader
Definition sopc_pubsub_conf.h:35
Internal module used to implement PubSub security features.
struct SOPC_TargetVariableCtx SOPC_TargetVariableCtx
Definition sopc_sub_target_variable.h:34
struct _SOPC_SubTargetVariableConfig SOPC_SubTargetVariableConfig
Definition sopc_sub_target_variable.h:29
Bytes buffer structure.
Definition sopc_buffer.h:38
Definition sopc_pubsub_conf.h:118
Definition sopc_dataset_ll_layer.h:48
Definition sopc_pubsub_conf.h:48
Definition sopc_network_layer.h:276
SOPC_UADP_NetworkMessage_GetReader * pGetReader_Func
Definition sopc_network_layer.h:278
SOPC_UADP_NetworkMessage_GetReaderGroup * pGetGroup_Func
Definition sopc_network_layer.h:277
SOPC_UADP_NetworkMessage_SetDsm * pSetDsm_Func
Definition sopc_network_layer.h:279
Definition sopc_network_layer.h:283
SOPC_UADP_GetSecurity_Func * pGetSecurity_Func
Definition sopc_network_layer.h:285
SOPC_SubTargetVariableConfig * targetConfig
Definition sopc_network_layer.h:287
SOPC_UADP_IsWriterSequenceNumberNewer_Func * checkDataSetMessageSN_Func
Definition sopc_network_layer.h:286
SOPC_UADP_GetTargetVariable_Func * targetVariable_Func
Definition sopc_network_layer.h:289
SOPC_UADP_UpdateTimeout_Func * updateTimeout_Func
Definition sopc_network_layer.h:288
SOPC_UADP_NetworkMessage_Reader_Callbacks callbacks
Definition sopc_network_layer.h:284
Definition sopc_network_layer.h:114
SOPC_Dataset_LL_NetworkMessage * nm
Definition sopc_network_layer.h:115