PLCnext API Documentation  22.6.0.43
SessionInfo.hpp
1 //
3 // Copyright PHOENIX CONTACT Electronics GmbH
4 //
6 #pragma once
7 #include "Arp/System/Core/Arp.h"
8 #include "Arp/System/Core/PimplPtr.hxx"
9 
10 #include <memory>
11 #include <list>
12 
13 namespace Arp { namespace System { namespace Um { namespace Commons
14 {
15 
19 {
20 public:
22  ARP_CXX_SYMBOL_EXPORT SessionInfo(void) = delete;
23  ARP_CXX_SYMBOL_EXPORT explicit SessionInfo(const std::list<String>& roles);
24  ARP_CXX_SYMBOL_EXPORT explicit SessionInfo(const String& username, uint32 gwID, const String& protolObjName, uint8 secMode, uint32 securityToken);
26  ARP_CXX_SYMBOL_EXPORT SessionInfo(const SessionInfo& arg);
28  ARP_CXX_SYMBOL_EXPORT SessionInfo(SessionInfo&& arg)noexcept;
30  ARP_CXX_SYMBOL_EXPORT SessionInfo& operator=(const SessionInfo& arg);
32  ARP_CXX_SYMBOL_EXPORT SessionInfo& operator=(SessionInfo&& arg)noexcept;
34  ARP_CXX_SYMBOL_EXPORT ~SessionInfo(void);
35 
37  ARP_CXX_SYMBOL_EXPORT const String& GetUserName() const;
39  ARP_CXX_SYMBOL_EXPORT const std::list<String>& GetRoles() const;
41  ARP_CXX_SYMBOL_EXPORT const String& GetProtocolObjName() const;
43  ARP_CXX_SYMBOL_EXPORT uint32 GetGatewayID() const;
44 
46  ARP_CXX_SYMBOL_EXPORT uint8 GetSecurityMode() const;
48  ARP_CXX_SYMBOL_EXPORT uint32 GetSecurityToken() const;
52  ARP_CXX_SYMBOL_EXPORT void SetRoles(const std::list<String>& roles);
53 
55  ARP_CXX_SYMBOL_EXPORT String GetExtensionProperty(const String& key) const;
60  ARP_CXX_SYMBOL_EXPORT bool TryGetExtensionProperty(const String& key, String& value) const;
64  ARP_CXX_SYMBOL_EXPORT bool DeleteExtensionProperty(const String& key);
66  ARP_CXX_SYMBOL_EXPORT void SetExtensionProperty(const String& key, const String& value);
67 
68 private:
69  class Impl;
71  Pimpl impl;
72 };
73 
75 // inline methods of class SessionInfo
76 
77 }}}} // end of namespace Arp::System::Um::Commons
This class a SessionInfo instance with given role list
Definition: SessionInfo.hpp:19
ARP_CXX_SYMBOL_EXPORT SessionInfo & operator=(const SessionInfo &arg)
Copy-assignment operator.
ARP_CXX_SYMBOL_EXPORT String GetExtensionProperty(const String &key) const
Returns custom security-related propertiy. If key does not exist, throws std::out_of_range.
ARP_CXX_SYMBOL_EXPORT void SetExtensionProperty(const String &key, const String &value)
This can be used by a module implementation to add custom security-related properties.
ARP_CXX_SYMBOL_EXPORT SessionInfo & operator=(SessionInfo &&arg) noexcept
Move-assignment operator.
ARP_CXX_SYMBOL_EXPORT bool TryGetExtensionProperty(const String &key, String &value) const
Tries to get custom security-related property. This never throws an exception.
ARP_CXX_SYMBOL_EXPORT const String & GetUserName() const
Returns current user of the session
ARP_CXX_SYMBOL_EXPORT uint32 GetGatewayID() const
Returns the gateway id of the channel
ARP_CXX_SYMBOL_EXPORT uint32 GetSecurityToken() const
Returns a unique identification of this session
ARP_CXX_SYMBOL_EXPORT SessionInfo(SessionInfo &&arg) noexcept
Move constructor.
ARP_CXX_SYMBOL_EXPORT void SetRoles(const std::list< String > &roles)
Sets the list of roles. Note, the role list of SessionInfo is not synchronized with the list of roles...
ARP_CXX_SYMBOL_EXPORT uint8 GetSecurityMode() const
Returns the security mode of the channel
ARP_CXX_SYMBOL_EXPORT const std::list< String > & GetRoles() const
Returns the set of roles associated with the session
ARP_CXX_SYMBOL_EXPORT ~SessionInfo(void)
Destructs this instance and frees all resources.
ARP_CXX_SYMBOL_EXPORT bool DeleteExtensionProperty(const String &key)
Deletes a custom security-related property. This never throws an exception.
ARP_CXX_SYMBOL_EXPORT const String & GetProtocolObjName() const
Returns the protocol object name of the channel
ARP_CXX_SYMBOL_EXPORT SessionInfo(void)=delete
Constructs an SessionInfo instance.
ARP_CXX_SYMBOL_EXPORT SessionInfo(const SessionInfo &arg)
Copy constructor.
std::uint8_t uint8
The Arp unsigned integer type of 1 byte size.
Definition: PrimitiveTypes.hpp:27
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