OpenDDS  Snapshot(2023/04/07-19:43)
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
OpenDDS::Security::SecurityConfig Class Reference

#include <SecurityConfig.h>

Inheritance diagram for OpenDDS::Security::SecurityConfig:
Inheritance graph
[legend]
Collaboration diagram for OpenDDS::Security::SecurityConfig:
Collaboration graph
[legend]

Public Member Functions

OPENDDS_STRING name () const
 
Authentication_var get_authentication () const
 
AccessControl_var get_access_control () const
 
CryptoKeyExchange_var get_crypto_key_exchange () const
 
CryptoKeyFactory_var get_crypto_key_factory () const
 
CryptoTransform_var get_crypto_transform () const
 
DCPS::RcHandle< Utilityget_utility () const
 
HandleRegistry_rch get_handle_registry (const DCPS::GUID_t &participant_id)
 
void erase_handle_registry (const DCPS::GUID_t &participant_id)
 
void get_properties (DDS::PropertyQosPolicy &properties) const
 
bool qos_implies_security (const DDS::DomainParticipantQos &qos) const
 
 SecurityConfig (const OPENDDS_STRING &name, Authentication_var authentication_plugin, AccessControl_var access_ctrl_plugin, CryptoKeyExchange_var key_exchange_plugin, CryptoKeyFactory_var key_factory_plugin, CryptoTransform_var transform_plugin, DCPS::RcHandle< Utility > utility_plugin, const ConfigPropertyList &properties)
 
- Public Member Functions inherited from OpenDDS::DCPS::RcObject
virtual ~RcObject ()
 
virtual void _add_ref ()
 
virtual void _remove_ref ()
 
long ref_count () const
 
WeakObject_get_weak_object () const
 

Private Member Functions

 ~SecurityConfig ()
 
typedef OPENDDS_MAP_CMP (DCPS::GUID_t, HandleRegistry_rch, DCPS::GUID_tKeyLessThan) HandleRegistryMap
 

Private Attributes

const OPENDDS_STRING name_
 
Authentication_var authentication_plugin_
 
AccessControl_var access_control_plugin_
 
CryptoKeyExchange_var key_exchange_plugin_
 
CryptoKeyFactory_var key_factory_plugin_
 
CryptoTransform_var transform_plugin_
 
DCPS::RcHandle< Utilityutility_plugin_
 
HandleRegistryMap handle_registry_map_
 
ACE_Thread_Mutex mutex_
 
ConfigPropertyList properties_
 

Friends

class SecurityRegistry
 
template<typename T , typename U >
DCPS::RcHandle< T > DCPS::make_rch (U const &)
 

Additional Inherited Members

- Protected Member Functions inherited from OpenDDS::DCPS::RcObject
 RcObject ()
 

Detailed Description

Definition at line 50 of file SecurityConfig.h.

Constructor & Destructor Documentation

◆ SecurityConfig()

OpenDDS::Security::SecurityConfig::SecurityConfig ( const OPENDDS_STRING name,
Authentication_var  authentication_plugin,
AccessControl_var  access_ctrl_plugin,
CryptoKeyExchange_var  key_exchange_plugin,
CryptoKeyFactory_var  key_factory_plugin,
CryptoTransform_var  transform_plugin,
DCPS::RcHandle< Utility utility_plugin,
const ConfigPropertyList &  properties 
)

Definition at line 20 of file SecurityConfig.cpp.

30  : name_(name)
31 #ifdef OPENDDS_SECURITY
32  , authentication_plugin_(authentication_plugin)
33  , access_control_plugin_(access_ctrl_plugin)
34  , key_exchange_plugin_(key_exchange_plugin)
35  , key_factory_plugin_(key_factory_plugin)
36  , transform_plugin_(transform_plugin)
37  , utility_plugin_(utility_plugin)
38 #endif
39  , properties_(properties)
40 {}
Authentication_var authentication_plugin_
AccessControl_var access_control_plugin_
OPENDDS_STRING name() const
CryptoKeyExchange_var key_exchange_plugin_
CryptoKeyFactory_var key_factory_plugin_
DCPS::RcHandle< Utility > utility_plugin_
CryptoTransform_var transform_plugin_

◆ ~SecurityConfig()

OpenDDS::Security::SecurityConfig::~SecurityConfig ( )
private

Definition at line 42 of file SecurityConfig.cpp.

References ACE_DEBUG, ACE_TEXT(), handle_registry_map_, LM_DEBUG, and OpenDDS::DCPS::security_debug.

43 {
44 #ifdef OPENDDS_SECURITY
45  if (DCPS::security_debug.bookkeeping) {
46  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) {bookkeeping} ")
47  ACE_TEXT("SecurityConfig::~SecurityConfig handle_registry_map_ %B\n"),
48  handle_registry_map_.size()));
49  }
50 #endif
51 }
#define ACE_DEBUG(X)
ACE_TEXT("TCP_Factory")
OpenDDS_Dcps_Export SecurityDebug security_debug
Definition: debug.cpp:32
HandleRegistryMap handle_registry_map_

Member Function Documentation

◆ erase_handle_registry()

void OpenDDS::Security::SecurityConfig::erase_handle_registry ( const DCPS::GUID_t participant_id)
inline

Definition at line 113 of file SecurityConfig.h.

References ACE_DEBUG, ACE_GUARD, ACE_TEXT(), LM_DEBUG, name, OPENDDS_STRING, and OpenDDS::DCPS::security_debug.

Referenced by OpenDDS::RTPS::Sedp::~Sedp().

114  {
116  handle_registry_map_.erase(participant_id);
117 
118  if (DCPS::security_debug.bookkeeping) {
119  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) {bookkeeping} ")
120  ACE_TEXT("SecurityConfig::erase_handle_registry handle_registry_map_ (total %B)\n"),
121  handle_registry_map_.size()));
122  }
123  }
#define ACE_DEBUG(X)
#define ACE_GUARD(MUTEX, OBJ, LOCK)
ACE_TEXT("TCP_Factory")
OpenDDS_Dcps_Export SecurityDebug security_debug
Definition: debug.cpp:32
HandleRegistryMap handle_registry_map_

◆ get_access_control()

AccessControl_var OpenDDS::Security::SecurityConfig::get_access_control ( ) const
inline

Definition at line 65 of file SecurityConfig.h.

Referenced by OpenDDS::RTPS::Sedp::init_security().

66  {
68  }
AccessControl_var access_control_plugin_

◆ get_authentication()

Authentication_var OpenDDS::Security::SecurityConfig::get_authentication ( ) const
inline

Definition at line 60 of file SecurityConfig.h.

Referenced by OpenDDS::RTPS::Sedp::init_security().

61  {
63  }
Authentication_var authentication_plugin_

◆ get_crypto_key_exchange()

CryptoKeyExchange_var OpenDDS::Security::SecurityConfig::get_crypto_key_exchange ( ) const
inline

◆ get_crypto_key_factory()

CryptoKeyFactory_var OpenDDS::Security::SecurityConfig::get_crypto_key_factory ( ) const
inline

◆ get_crypto_transform()

CryptoTransform_var OpenDDS::Security::SecurityConfig::get_crypto_transform ( ) const
inline

Definition at line 80 of file SecurityConfig.h.

81  {
82  return transform_plugin_;
83  }
CryptoTransform_var transform_plugin_

◆ get_handle_registry()

HandleRegistry_rch OpenDDS::Security::SecurityConfig::get_handle_registry ( const DCPS::GUID_t participant_id)
inline

Definition at line 90 of file SecurityConfig.h.

References ACE_DEBUG, ACE_GUARD_RETURN, ACE_TEXT(), LM_DEBUG, and OpenDDS::DCPS::security_debug.

Referenced by OpenDDS::RTPS::Sedp::init_security().

91  {
92  HandleRegistry_rch handle_registry;
93 
94  ACE_GUARD_RETURN(ACE_Thread_Mutex, g, mutex_, handle_registry);
95 
96  HandleRegistryMap::const_iterator pos = handle_registry_map_.find(participant_id);
97  if (pos != handle_registry_map_.end()) {
98  handle_registry = pos->second;
99  } else {
100  handle_registry = DCPS::make_rch<HandleRegistry>();
101  handle_registry_map_[participant_id] = handle_registry;
102 
103  if (DCPS::security_debug.bookkeeping) {
104  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) {bookkeeping} ")
105  ACE_TEXT("SecurityConfig::get_handle_registry handle_registry_map_ (total %B)\n"),
106  handle_registry_map_.size()));
107  }
108  }
109 
110  return handle_registry;
111  }
#define ACE_DEBUG(X)
DCPS::RcHandle< HandleRegistry > HandleRegistry_rch
#define ACE_GUARD_RETURN(MUTEX, OBJ, LOCK, RETURN)
ACE_TEXT("TCP_Factory")
OpenDDS_Dcps_Export SecurityDebug security_debug
Definition: debug.cpp:32
HandleRegistryMap handle_registry_map_

◆ get_properties()

void OpenDDS::Security::SecurityConfig::get_properties ( DDS::PropertyQosPolicy properties) const

Definition at line 53 of file SecurityConfig.cpp.

References DDS::Property_t::name, properties_, DDS::Property_t::value, and DDS::PropertyQosPolicy::value.

54 {
55  // The names on the internal attributes of the PropertyQosPolicy are
56  // strange, but value is a properties sequence
57 
58  // Allocate space and copy over the properties
59  // Presumably this will not be truncating the property count
60  out_properties.value.length(static_cast<CORBA::ULong>(properties_.size()));
61  CORBA::ULong index = 0;
62  for (ConfigPropertyList::const_iterator iProp = properties_.begin();
63  iProp != properties_.end();
64  ++iProp) {
65  DDS::Property_t& out_prop = out_properties.value[index++];
66  out_prop.name = iProp->first.c_str();
67  out_prop.value = iProp->second.c_str();
68  }
69 }
ACE_CDR::ULong ULong

◆ get_utility()

DCPS::RcHandle<Utility> OpenDDS::Security::SecurityConfig::get_utility ( ) const
inline

Definition at line 85 of file SecurityConfig.h.

86  {
87  return utility_plugin_;
88  }
DCPS::RcHandle< Utility > utility_plugin_

◆ name()

OPENDDS_STRING OpenDDS::Security::SecurityConfig::name ( void  ) const
inline

Definition at line 53 of file SecurityConfig.h.

Referenced by qos_implies_security().

54  {
55  return name_;
56  }

◆ OPENDDS_MAP_CMP()

typedef OpenDDS::Security::SecurityConfig::OPENDDS_MAP_CMP ( DCPS::GUID_t  ,
HandleRegistry_rch  ,
DCPS::GUID_tKeyLessThan   
)
private

◆ qos_implies_security()

bool OpenDDS::Security::SecurityConfig::qos_implies_security ( const DDS::DomainParticipantQos qos) const

Definition at line 71 of file SecurityConfig.cpp.

References DDS::Security::Properties::AccessGovernance, DDS::Security::Properties::AccessPermissions, DDS::Security::Properties::AccessPermissionsCA, DDS::Security::Properties::AuthIdentityCA, DDS::Security::Properties::AuthIdentityCertificate, DDS::Security::Properties::AuthPrivateKey, name(), OPENDDS_END_VERSIONED_NAMESPACE_DECL, DDS::DomainParticipantQos::property, and DDS::PropertyQosPolicy::value.

71  {
72  const DDS::PropertySeq& properties = qos.property.value;
73  for (unsigned int idx = 0; idx != properties.length(); ++idx) {
74  const char* name = properties[idx].name.in();
75  if (std::strcmp(DDS::Security::Properties::AuthIdentityCA, name) == 0 ||
77  std::strcmp(DDS::Security::Properties::AuthPrivateKey, name) == 0 ||
78  std::strcmp(DDS::Security::Properties::AccessPermissionsCA, name) == 0 ||
79  std::strcmp(DDS::Security::Properties::AccessGovernance, name) == 0 ||
80  std::strcmp(DDS::Security::Properties::AccessPermissions, name) == 0) {
81  return true;
82  }
83  }
84  return false;
85 }
const char AccessGovernance[]
Definition: Properties.h:17
sequence< Property_t > PropertySeq
Definition: DdsDcpsCore.idl:87
const char AuthPrivateKey[]
Definition: Properties.h:23
const char AuthIdentityCA[]
Definition: Properties.h:20
OPENDDS_STRING name() const
const char AccessPermissions[]
Definition: Properties.h:18
const char AuthIdentityCertificate[]
Definition: Properties.h:21
const char AccessPermissionsCA[]
Definition: Properties.h:19
PropertyQosPolicy property

Friends And Related Function Documentation

◆ DCPS::make_rch

template<typename T , typename U >
DCPS::RcHandle<T> DCPS::make_rch ( U const &  )
friend

◆ SecurityRegistry

friend class SecurityRegistry
friend

Definition at line 143 of file SecurityConfig.h.

Member Data Documentation

◆ access_control_plugin_

AccessControl_var OpenDDS::Security::SecurityConfig::access_control_plugin_
private

Definition at line 154 of file SecurityConfig.h.

◆ authentication_plugin_

Authentication_var OpenDDS::Security::SecurityConfig::authentication_plugin_
private

Definition at line 153 of file SecurityConfig.h.

◆ handle_registry_map_

HandleRegistryMap OpenDDS::Security::SecurityConfig::handle_registry_map_
private

Definition at line 160 of file SecurityConfig.h.

Referenced by ~SecurityConfig().

◆ key_exchange_plugin_

CryptoKeyExchange_var OpenDDS::Security::SecurityConfig::key_exchange_plugin_
private

Definition at line 155 of file SecurityConfig.h.

◆ key_factory_plugin_

CryptoKeyFactory_var OpenDDS::Security::SecurityConfig::key_factory_plugin_
private

Definition at line 156 of file SecurityConfig.h.

◆ mutex_

ACE_Thread_Mutex OpenDDS::Security::SecurityConfig::mutex_
mutableprivate

Definition at line 161 of file SecurityConfig.h.

◆ name_

const OPENDDS_STRING OpenDDS::Security::SecurityConfig::name_
private

Definition at line 150 of file SecurityConfig.h.

◆ properties_

ConfigPropertyList OpenDDS::Security::SecurityConfig::properties_
private

Definition at line 164 of file SecurityConfig.h.

Referenced by get_properties().

◆ transform_plugin_

CryptoTransform_var OpenDDS::Security::SecurityConfig::transform_plugin_
private

Definition at line 157 of file SecurityConfig.h.

◆ utility_plugin_

DCPS::RcHandle<Utility> OpenDDS::Security::SecurityConfig::utility_plugin_
private

Definition at line 158 of file SecurityConfig.h.


The documentation for this class was generated from the following files: