PLCnext API Documentation 25.0.2.69
SessionInfo.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/System/Core/PimplPtr.hxx"
9
10#include <memory>
11#include <list>
12
13namespace Arp { namespace System { namespace Um { namespace Commons
14{
15
19{
20public:
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);
25 ARP_CXX_SYMBOL_EXPORT SessionInfo(const SessionInfo& arg);
26 ARP_CXX_SYMBOL_EXPORT SessionInfo(SessionInfo&& arg)noexcept;
27 ARP_CXX_SYMBOL_EXPORT SessionInfo& operator=(const SessionInfo& arg);
28 ARP_CXX_SYMBOL_EXPORT SessionInfo& operator=(SessionInfo&& arg)noexcept;
29 ARP_CXX_SYMBOL_EXPORT ~SessionInfo(void);
30 ARP_CXX_SYMBOL_EXPORT const String& GetUserName() const;
31 ARP_CXX_SYMBOL_EXPORT const std::list<String>& GetRoles() const;
32 ARP_CXX_SYMBOL_EXPORT const String& GetProtocolObjName() const;
33 ARP_CXX_SYMBOL_EXPORT uint32 GetGatewayID() const;
34 ARP_CXX_SYMBOL_EXPORT uint8 GetSecurityMode() const;
35 ARP_CXX_SYMBOL_EXPORT uint32 GetSecurityToken() const;
36 ARP_CXX_SYMBOL_EXPORT void SetRoles(const std::list<String>& roles);
37 ARP_CXX_SYMBOL_EXPORT String GetExtensionProperty(const String& key) const;
38 ARP_CXX_SYMBOL_EXPORT bool TryGetExtensionProperty(const String& key, String& value) const;
39 ARP_CXX_SYMBOL_EXPORT bool DeleteExtensionProperty(const String& key);
40 ARP_CXX_SYMBOL_EXPORT void SetExtensionProperty(const String& key, const String& value);
41
42private:
43 class Impl;
45 Pimpl impl;
46};
47
48}}}} // end of namespace Arp::System::Um::Commons
Adapter class to implement PImpl idiom.
Definition: PimplPtr.hxx:15
This class represents the Arp String. The implementation is based on std::string.
Definition: String.hpp:39
This class a SessionInfo instance with given role list
Definition: SessionInfo.hpp:19
ARP_CXX_SYMBOL_EXPORT const std::list< String > & GetRoles() const
Returns the set of roles associated with the session
Definition: SessionInfo.cpp:38
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.
Definition: SessionInfo.cpp:76
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.
Definition: SessionInfo.cpp:99
ARP_CXX_SYMBOL_EXPORT bool TryGetExtensionProperty(const String &key, String &value) const
Tries to get custom security-related property. This never throws an exception.
Definition: SessionInfo.cpp:85
ARP_CXX_SYMBOL_EXPORT SessionInfo & operator=(const SessionInfo &arg)
Copy-assignment operator.
ARP_CXX_SYMBOL_EXPORT SessionInfo & operator=(SessionInfo &&arg) noexcept
Move-assignment operator.
ARP_CXX_SYMBOL_EXPORT uint32 GetGatewayID() const
Returns the gateway id of the channel
Definition: SessionInfo.cpp:50
ARP_CXX_SYMBOL_EXPORT uint32 GetSecurityToken() const
Returns a unique identification of this session
Definition: SessionInfo.cpp:62
ARP_CXX_SYMBOL_EXPORT SessionInfo(SessionInfo &&arg) noexcept
Move constructor.
ARP_CXX_SYMBOL_EXPORT const String & GetUserName() const
Returns current user of the session
Definition: SessionInfo.cpp:32
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...
Definition: SessionInfo.cpp:70
ARP_CXX_SYMBOL_EXPORT uint8 GetSecurityMode() const
Returns the security mode of the channel
Definition: SessionInfo.cpp:56
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.
Definition: SessionInfo.cpp:93
ARP_CXX_SYMBOL_EXPORT SessionInfo(void)=delete
Constructs an SessionInfo instance.
ARP_CXX_SYMBOL_EXPORT SessionInfo(const SessionInfo &arg)
Copy constructor.
ARP_CXX_SYMBOL_EXPORT const String & GetProtocolObjName() const
Returns the protocol object name of the channel
Definition: SessionInfo.cpp:44
std::uint32_t uint32
The Arp unsigned integer type of 4 byte size.
Definition: PrimitiveTypes.hpp:33
std::uint8_t uint8
The Arp unsigned integer type of 1 byte size.
Definition: PrimitiveTypes.hpp:25
Root namespace for the PLCnext API