OpenDDS  Snapshot(2023/04/28-20:55)
TokenReader.h
Go to the documentation of this file.
1 /*
2  *
3  *
4  * Distributed under the OpenDDS License.
5  * See: http://www.OpenDDS.org/license.html
6  */
7 
8 
9 
10 #ifndef OPENDDS_DCPS_SECURITY_TOKENREADER_H
11 #define OPENDDS_DCPS_SECURITY_TOKENREADER_H
12 
14 
15 #include <dds/DdsSecurityCoreC.h>
17 
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 #pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 
22 class DDS_TEST;
23 
25 
26 namespace OpenDDS {
27 namespace Security {
28 
29 /**
30 * @class TokenReader
31 *
32 * @brief Implements some simple wrapper functions to provide a const API
33 * around the Token data structure as specified in the DDS security specification
34 *
35 * See the DDS security specification, OMG formal/17-09-20, for a description of
36 * the interface this class is implementing.
37 *
38 */
39 
41 {
42 public:
43  explicit TokenReader(const DDS::Security::Token& token_ref);
44  virtual ~TokenReader();
45 
46  bool is_nil() const;
47  const char* get_property_value(const std::string& property_name) const;
48  const DDS::OctetSeq& get_bin_property_value(const std::string& property_name) const;
49 
50  CORBA::ULong get_num_properties() const;
51  CORBA::ULong get_num_bin_properties() const;
52 
53 private:
56 };
57 
58 inline bool TokenReader::is_nil() const
59 {
60  return ((token_ref_.binary_properties.length() == 0)
61  && (token_ref_.properties.length() == 0)
62  && (token_ref_.class_id[0] == '\0'));
63 }
64 
66 {
67  return token_ref_.properties.length();
68 }
69 
71 {
72  return token_ref_.binary_properties.length();
73 }
74 } // namespace Security
75 } // namespace OpenDDS
76 
78 
79 #endif
CORBA::ULong get_num_properties() const
Definition: TokenReader.h:65
Implements some simple wrapper functions to provide a const API around the Token data structure as sp...
Definition: TokenReader.h:40
const DDS::Security::Token & token_ref_
Definition: TokenReader.h:54
const DDS::OctetSeq _empty_seq_
Definition: TokenReader.h:55
ACE_CDR::ULong ULong
sequence< octet > OctetSeq
Definition: DdsDcpsCore.idl:64
CORBA::ULong get_num_bin_properties() const
Definition: TokenReader.h:70
#define OpenDDS_Security_Export
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
Boolean is_nil(T x)
TAO_PortableGroup_Export CORBA::Boolean get_property_value(const PortableGroup::Name &property_name, const PortableGroup::Properties &properties, PortableGroup::Value &property_value)