Classes | Defines | Typedefs | Functions
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

Defines

#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
< InputChannel
BinaryIStream
typedef OpcUa::Binary::OStream
< OutputChannel
BinaryOStream

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.

Define Documentation

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"));

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

#define ASSERT_ENDPOINT_EQ (   e)
Value:
ASSERT_EQ(e.EndpointUrl, "eu"); \
  ASSERT_APPLICATION_DESCRIPTION_EQ(e.Server); \
  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);

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

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);

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

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);

Definition at line 229 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");

Definition at line 281 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;

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

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;

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

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;

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

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 292 of file tests/protocol/common.h.

Value:
2,0,0,0, 'e','u', \
  TEST_APPLICATION_DESCRIPTION_BINARY_DATA, \
  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

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

Value:
EV_TWO_BYTE, 1, \
  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 244 of file tests/protocol/common.h.

Value:
1,0,0,0,0,0,0,0, \
  2,0,0,0, \
  3,0,0,0, \
  static_cast<DiagnosticInfoMask>(DIM_LOCALIZED_TEXT | DIM_INNER_DIAGNOSTIC_INFO), 4,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', \
  EV_TWO_BYTE, 7, \
  8

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


Typedef Documentation

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

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


Function Documentation

std::string GetEndpoint ( ) [inline]

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

std::string GetHost ( ) [inline]

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

int GetPort ( ) [inline]

Definition at line 57 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 rykovanov.as@gmail.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 Sat Jun 8 2019 18:24:57