PLCnext API Documentation 23.0.2.9
RscServerContext.hpp
1
2//
3// Copyright PHOENIX CONTACT Electronics GmbH
4//
6#pragma once
7#include "Arp/System/Rsc/Services/Rsc.h"
8#include "Arp/System/Rsc/Services/RscReader.hpp"
9#include "Arp/System/Rsc/Services/RscWriter.hpp"
10#include "Arp/System/Rsc/Services/RscChannelInfo.hpp"
11#include "Arp/System/Security/SecurityToken.hpp"
12#include "Arp/System/Security/SecurityContext.hpp"
13
14namespace CommonRemoting
15{
16
17class RemotingServerContext;
18
19}
20
21namespace Arp { namespace System { namespace Security { namespace Services
22{
23
24class PasswordConfigurationService2Impl;
25class PasswordAuthenticationServiceImpl;
26
27}}}} // end of namespace Arp::System::Security::Services
28
29
30namespace Arp { namespace System { namespace Rsc { namespace Services
31{
32
33using namespace CommonRemoting;
34
39class RscServerContext
40{
41 friend class Arp::System::Security::Services::PasswordConfigurationService2Impl;
42 friend class Arp::System::Security::Services::PasswordAuthenticationServiceImpl;
43
44public: // typedefs
46 typedef Arp::System::Security::SecurityContext SecurityContext;
47
48public: // construction/destruction
50 RscServerContext(RemotingServerContext& remotingServerContext);
52 RscServerContext(const RscServerContext& arg) = default;
54 RscServerContext& operator=(const RscServerContext& arg) = default;
56 ~RscServerContext(void);
57
58public: // static operations
59 static bool HasCurrent(void);
60 static RscServerContext& GetCurrent(void);
61
62public: // setter/getter operations
63 bool IsSecure(void)const;
64 const RscChannelInfo& GetChannelInfo(void)const;
65 SecurityToken GetSecurityToken(void)const;
66 RscReader& GetReader();
67 RscWriter& GetWriter();
68
69public: // operations
70 void AbortRequest(RscErrors errorCode, const char* errorMessage = NULL);
71 void AbortConnection(RscErrors errorCode, const char* errorMessage = NULL);
72 void AbortInvocation(RscErrors errorCode, const char* errorMessage = NULL);
73
74private: // security methods used by PasswordConfigurationService2Impl
75 bool HasSecurityContext(void);
76 bool HasSessionSecurityToken(const SecurityToken& token);
77 bool AddSessionSecurityToken(const SecurityToken& token, uint32 initialTimeoutMs);
78 bool RemoveSessionSecurityToken(const SecurityToken& token);
79
80private: // fields
81 RemotingServerContext& remotingServerContext;
82 RscChannelInfo channelInfo;
83 SecurityToken securityToken; // never remove this, it is passed and stored as ref to security context
84 SecurityContext securityContext;
85 RscReader rscReader;
86 RscWriter rscWriter;
87
88private: // static fields
89 static thread_local RscServerContext* pCurrentServerContext;
90};
91
93// inline methods of class RscServerContext
94inline const RscChannelInfo& RscServerContext::GetChannelInfo(void)const
95{
96 return this->channelInfo;
97}
98
99inline RscReader& RscServerContext::GetReader()
100{
101 return this->rscReader;
102}
103
104inline RscWriter& RscServerContext::GetWriter()
105{
106 return this->rscWriter;
107}
108}}}} // end of namespace Arp::System::Rsc::Services
Reads data from Rsc
Definition: RscReader.hpp:26
Writes data to Rsc.
Definition: RscWriter.hpp:31
Definition: SecurityContext.hpp:21
Definition: SecurityToken.hpp:12
std::uint32_t uint32
The Arp unsigned integer type of 4 byte size.
Definition: PrimitiveTypes.hpp:35
@ System
System components used by the System, Device, Plc or Io domains.
Root namespace for the PLCnext API