Classes | Macros | Typedefs | Functions
tests/protocol/common.h File Reference
#include <gtest/gtest.h>
#include <opc/ua/protocol/extension_identifiers.h>
#include <opc/ua/protocol/message_identifiers.h>
#include <opc/ua/protocol/binary/stream.h>
#include <opc/ua/protocol/secure_channel.h>
#include <opc/ua/protocol/types.h>
#include <opc/ua/protocol/protocol.h>
#include <algorithm>
#include <stdexcept>
#include <stdlib.h>
#include <string>
Include dependency graph for tests/protocol/common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  InputChannel
 
class  OpcUaBinaryDeserialization
 
class  OpcUaBinarySerialization
 
class  OutputChannel
 

Macros

#define ASSERT_APPLICATION_DESCRIPTION_EQ(desc)
 
#define ASSERT_ENDPOINT_EQ(e)
 
#define ASSERT_REQUEST_HEADER_EQ(header)
 
#define ASSERT_RESPONSE_HEADER_EQ(header)
 
#define FILL_APPLICATION_DESCRIPTION(desc)
 
#define FILL_TEST_ENDPOINT(endpoint)
 
#define FILL_TEST_REQUEST_HEADER(header)
 
#define FILL_TEST_RESPONSE_HEADER(header)
 
#define TEST_APPLICATION_DESCRIPTION_BINARY_DATA
 
#define TEST_ENDPOINT_BINARY_DATA
 
#define TEST_REQUEST_HEADER_BINARY_DATA
 
#define TEST_RESPONSE_HEADER_BINARY_DATA
 

Typedefs

typedef OpcUa::Binary::IStream< InputChannelBinaryIStream
 
typedef OpcUa::Binary::OStream< OutputChannelBinaryOStream
 

Functions

std::string GetEndpoint ()
 
std::string GetHost ()
 
int GetPort ()
 
std::string PrintData (const std::vector< char > &vec)
 Test of opc ua binary handshake. GNU LGPL. More...
 

Macro Definition Documentation

#define ASSERT_APPLICATION_DESCRIPTION_EQ (   desc)
Value:
ASSERT_EQ(desc.ApplicationUri, "u"); \
ASSERT_EQ(desc.ProductUri, "pu"); \
ASSERT_EQ(desc.ApplicationName.Encoding, HAS_LOCALE | HAS_TEXT); \
ASSERT_EQ(desc.ApplicationName.Locale, "RU"); \
ASSERT_EQ(desc.ApplicationName.Text, "text"); \
ASSERT_EQ(desc.ApplicationType, ApplicationType::Client); \
ASSERT_EQ(desc.GatewayServerUri, "gw"); \
ASSERT_EQ(desc.DiscoveryProfileUri, "dpu"); \
ASSERT_EQ(desc.DiscoveryUrls, std::vector<std::string>(1,"du"));
const uint8_t HAS_LOCALE
Definition: types.h:129
const uint8_t HAS_TEXT
Definition: types.h:130
#define ASSERT_EQ(val1, val2)

Definition at line 310 of file tests/protocol/common.h.

#define ASSERT_ENDPOINT_EQ (   e)
Value:
ASSERT_EQ(e.EndpointUrl, "eu"); \
const ByteString certificate = ByteString(std::vector<uint8_t>{1,2,3,4}); \
ASSERT_EQ(e.ServerCertificate, certificate); \
ASSERT_EQ(e.SecurityMode, MessageSecurityMode::None); \
ASSERT_EQ(e.SecurityPolicyUri, "spu"); \
ASSERT_EQ(e.UserIdentityTokens.size(), 1); \
ASSERT_EQ(e.UserIdentityTokens[0].PolicyId, "pi"); \
ASSERT_EQ(e.UserIdentityTokens[0].TokenType, UserTokenType::UserName); \
ASSERT_EQ(e.UserIdentityTokens[0].IssuedTokenType, "itt"); \
ASSERT_EQ(e.UserIdentityTokens[0].IssuerEndpointUrl, "ieu"); \
ASSERT_EQ(e.UserIdentityTokens[0].SecurityPolicyUri, "spu"); \
ASSERT_EQ(e.TransportProfileUri, "tpu"); \
ASSERT_EQ(e.SecurityLevel, 3);
const char ByteString[]
Definition: strings.h:38
#define ASSERT_EQ(val1, val2)
#define ASSERT_APPLICATION_DESCRIPTION_EQ(desc)

Definition at line 352 of file tests/protocol/common.h.

#define ASSERT_REQUEST_HEADER_EQ (   header)
Value:
ASSERT_EQ(header.SessionAuthenticationToken.Encoding, EV_TWO_BYTE); \
ASSERT_EQ(header.SessionAuthenticationToken.TwoByteData.Identifier, 1); \
ASSERT_EQ(header.UtcTime.Value, 2); \
ASSERT_EQ(header.RequestHandle, 3); \
ASSERT_EQ(header.ReturnDiagnostics, 4); \
ASSERT_EQ(header.AuditEntryId, "audit"); \
ASSERT_EQ(header.Timeout, 5); \
ASSERT_EQ(header.Additional.TypeId.Encoding, EV_TWO_BYTE); \
ASSERT_EQ(header.Additional.TypeId.TwoByteData.Identifier, 6); \
ASSERT_EQ(header.Additional.Encoding, 8);
std_msgs::Header * header(M &m)
#define ASSERT_EQ(val1, val2)

Definition at line 275 of file tests/protocol/common.h.

#define ASSERT_RESPONSE_HEADER_EQ (   header)
Value:
ASSERT_EQ(header.Timestamp.Value, 1); \
ASSERT_EQ(header.RequestHandle, 2); \
ASSERT_EQ(header.ServiceResult, static_cast<StatusCode>(3)); \
ASSERT_EQ(header.InnerDiagnostics.EncodingMask, static_cast<DiagnosticInfoMask>(DIM_LOCALIZED_TEXT | DIM_INNER_DIAGNOSTIC_INFO)); \
ASSERT_EQ(header.InnerDiagnostics.LocalizedText, 4); \
ASSERT_TRUE(static_cast<bool>(header.InnerDiagnostics.InnerDiagnostics)); \
ASSERT_EQ(header.InnerDiagnostics.InnerDiagnostics->EncodingMask, DIM_ADDITIONAL_INFO); \
ASSERT_EQ(header.InnerDiagnostics.InnerDiagnostics->AdditionalInfo, "add"); \
ASSERT_EQ(header.StringTable, std::vector<std::string>(2, std::string("str"))); \
ASSERT_EQ(header.Additional.TypeId.Encoding, EV_TWO_BYTE); \
ASSERT_EQ(header.Additional.TypeId.TwoByteData.Identifier, 7); \
ASSERT_EQ(header.Additional.Encoding, 8);
std_msgs::Header * header(M &m)
#define ASSERT_TRUE(condition)
#define ASSERT_EQ(val1, val2)

Definition at line 236 of file tests/protocol/common.h.

#define FILL_APPLICATION_DESCRIPTION (   desc)
Value:
desc.ApplicationUri = "u"; \
desc.ProductUri = "pu"; \
desc.ApplicationName.Encoding = HAS_LOCALE | HAS_TEXT; \
desc.ApplicationName.Locale = "RU"; \
desc.ApplicationName.Text = "text"; \
desc.ApplicationType = ApplicationType::Client; \
desc.GatewayServerUri = "gw"; \
desc.DiscoveryProfileUri = "dpu"; \
desc.DiscoveryUrls.push_back("du");
const uint8_t HAS_LOCALE
Definition: types.h:129
const uint8_t HAS_TEXT
Definition: types.h:130

Definition at line 288 of file tests/protocol/common.h.

#define FILL_TEST_ENDPOINT (   endpoint)
Value:
endpoint.EndpointUrl = "eu"; \
FILL_APPLICATION_DESCRIPTION(endpoint.Server); \
endpoint.ServerCertificate = ByteString(std::vector<uint8_t>{1,2,3,4}); \
endpoint.SecurityMode = MessageSecurityMode::None; \
endpoint.SecurityPolicyUri = "spu"; \
UserTokenPolicy token; \
token.PolicyId = "pi"; \
token.TokenType = UserTokenType::UserName; \
token.IssuedTokenType = "itt"; \
token.IssuerEndpointUrl = "ieu"; \
token.SecurityPolicyUri = "spu"; \
endpoint.UserIdentityTokens.push_back(token); \
endpoint.TransportProfileUri = "tpu"; \
endpoint.SecurityLevel = 3;
#define FILL_APPLICATION_DESCRIPTION(desc)
const char ByteString[]
Definition: strings.h:38

Definition at line 321 of file tests/protocol/common.h.

#define FILL_TEST_REQUEST_HEADER (   header)
Value:
header.SessionAuthenticationToken.Encoding = EV_TWO_BYTE; \
header.SessionAuthenticationToken.TwoByteData.Identifier = 1; \
header.UtcTime.Value = 2; \
header.RequestHandle = 3; \
header.ReturnDiagnostics = 4; \
header.AuditEntryId = "audit"; \
header.Timeout = 5; \
header.Additional.TypeId.Encoding = EV_TWO_BYTE; \
header.Additional.TypeId.TwoByteData.Identifier = 6; \
header.Additional.Encoding = 8;
std_msgs::Header * header(M &m)

Definition at line 263 of file tests/protocol/common.h.

#define FILL_TEST_RESPONSE_HEADER (   header)
Value:
header.Timestamp.Value = 1; \
header.RequestHandle = 2; \
header.ServiceResult = static_cast<StatusCode>(3); \
header.InnerDiagnostics.EncodingMask = static_cast<DiagnosticInfoMask>(DIM_LOCALIZED_TEXT | DIM_INNER_DIAGNOSTIC_INFO); \
header.InnerDiagnostics.LocalizedText = 4; \
header.InnerDiagnostics.InnerDiagnostics.reset(new DiagnosticInfo()); \
header.InnerDiagnostics.InnerDiagnostics->EncodingMask = DIM_ADDITIONAL_INFO; \
header.InnerDiagnostics.InnerDiagnostics->AdditionalInfo = "add"; \
header.StringTable = std::vector<std::string>(2, std::string("str")); \
header.Additional.TypeId.Encoding = EV_TWO_BYTE; \
header.Additional.TypeId.TwoByteData.Identifier = 7; \
header.Additional.Encoding = 8;
DiagnosticInfoMask
Definition: types.h:200
std_msgs::Header * header(M &m)
const char DiagnosticInfo[]
Definition: strings.h:50

Definition at line 222 of file tests/protocol/common.h.

#define TEST_APPLICATION_DESCRIPTION_BINARY_DATA
Value:
1,0,0,0, 'u', \
2,0,0,0, 'p','u', \
3, \
2,0,0,0, 'R','U', \
4,0,0,0, 't','e','x','t', \
1,0,0,0, \
2,0,0,0, 'g','w', \
3,0,0,0, 'd','p','u', \
1,0,0,0, 2,0,0,0, 'd','u'

Definition at line 299 of file tests/protocol/common.h.

#define TEST_ENDPOINT_BINARY_DATA
Value:
2,0,0,0, 'e','u', \
4,0,0,0, 1,2,3,4, \
1,0,0,0, \
3,0,0,0, 's','p','u', \
1,0,0,0, \
2,0,0,0, 'p','i', \
1,0,0,0, \
3,0,0,0, 'i','t','t', \
3,0,0,0, 'i','e','u', \
3,0,0,0, 's','p','u', \
3,0,0,0, 't','p','u', \
3
#define TEST_APPLICATION_DESCRIPTION_BINARY_DATA

Definition at line 337 of file tests/protocol/common.h.

#define TEST_REQUEST_HEADER_BINARY_DATA
Value:
2, 0, 0, 0, 0, 0, 0, 0, \
3, 0, 0, 0, \
4, 0, 0, 0, \
5, 0, 0, 0, \
'a', 'u', 'd', 'i', 't', \
5, 0, 0, 0, \
0, \
6, \
8

Definition at line 251 of file tests/protocol/common.h.

#define TEST_RESPONSE_HEADER_BINARY_DATA
Value:
1,0,0,0,0,0,0,0, \
2,0,0,0, \
3,0,0,0, \
DIM_ADDITIONAL_INFO, 3, 0, 0, 0, 'a', 'd', 'd', \
2,0,0,0, 3,0,0,0, 's','t','r', 3,0,0,0, 's','t','r', \
8
DiagnosticInfoMask
Definition: types.h:200

Definition at line 212 of file tests/protocol/common.h.

Typedef Documentation

Definition at line 174 of file tests/protocol/common.h.

Definition at line 96 of file tests/protocol/common.h.

Function Documentation

std::string GetEndpoint ( )
inline

Definition at line 71 of file tests/protocol/common.h.

std::string GetHost ( )
inline

Definition at line 51 of file tests/protocol/common.h.

int GetPort ( )
inline

Definition at line 61 of file tests/protocol/common.h.

std::string PrintData ( const std::vector< char > &  vec)
inline

Test of opc ua binary handshake. GNU LGPL.

Author
Alexander Rykovanov 2012 rykov.nosp@m.anov.nosp@m..as@g.nosp@m.mail.nosp@m..com Distributed under the GNU LGPL License (See accompanying file LICENSE or copy at http://www.gnu.org/licenses/lgpl.html)

Definition at line 29 of file tests/protocol/common.h.



ros_opcua_impl_freeopcua
Author(s): Denis Štogl
autogenerated on Tue Jan 19 2021 03:12:08