OpenDDS  Snapshot(2023/04/28-20:55)
TokenWriter.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_TOKENWRITER_H
11 #define OPENDDS_DCPS_SECURITY_TOKENWRITER_H
12 
14 #include "TokenReader.h"
15 
18 
19 #include <dds/DdsSecurityCoreC.h>
20 
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 #pragma once
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 
25 class DDS_TEST;
26 
28 
29 namespace OpenDDS {
30 namespace Security {
31 
32 /**
33 * @class TokenWriter
34 *
35 * @brief Implements some simple wrapper functions to provide a non-const API
36 * around the Token data structure as specified in the DDS security specification
37 *
38 * See the DDS security specification, OMG formal/17-09-20, for a description of
39 * the interface this class is implementing.
40 *
41 */
42 
44 {
45 public:
46  explicit TokenWriter(DDS::Security::Token& token_ref);
47  TokenWriter(DDS::Security::Token& token_ref, const std::string& class_id);
48 
49  virtual ~TokenWriter();
50 
51  const TokenReader& get_reader();
52 
53  void set_class_id(const std::string& class_name);
54 
55  void add_property(const char* prop_name, const char* prop_value, bool propagate = true);
56  void add_property(const char* prop_name, const DDS::OctetSeq& prop_value, bool propagate = true);
57  void add_bin_property(const char* prop_name, const DDS::OctetSeq& prop_value, bool propagate = true);
58  void add_bin_property(const char* prop_name, const std::string& prop_value, bool propagate = true);
59 
60 private:
65 };
66 
68 {
69  return reader_;
70 }
71 
72 inline void TokenWriter::set_class_id(const std::string& class_id)
73 {
74  token_ref_.class_id = class_id.c_str();
75 }
76 
77 
78 } // namespace Security
79 } // namespace OpenDDS
80 
82 
83 #endif
DCPS::SequenceBackInsertIterator< DDS::BinaryPropertySeq > binary_property_inserter_
Definition: TokenWriter.h:61
Implements some simple wrapper functions to provide a const API around the Token data structure as sp...
Definition: TokenReader.h:40
DCPS::SequenceBackInsertIterator< DDS::PropertySeq > property_inserter_
Definition: TokenWriter.h:62
const TokenReader & get_reader()
Definition: TokenWriter.h:67
void set_class_id(const std::string &class_name)
Definition: TokenWriter.h:72
OpenDDS::Security::TokenReader reader_
Definition: TokenWriter.h:64
sequence< octet > OctetSeq
Definition: DdsDcpsCore.idl:64
#define OpenDDS_Security_Export
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
Implements some simple wrapper functions to provide a non-const API around the Token data structure a...
Definition: TokenWriter.h:43
DDS::Security::Token & token_ref_
Definition: TokenWriter.h:63