Line data Source code
1 : /* 2 : * Distributed under the OpenDDS License. 3 : * See: http://www.OpenDDS.org/license.html 4 : */ 5 : 6 : #ifndef OPENDDS_DCPS_SECURITY_SSL_SUBJECTNAME_H 7 : #define OPENDDS_DCPS_SECURITY_SSL_SUBJECTNAME_H 8 : 9 : #include <dds/Versioned_Namespace.h> 10 : #include <dds/DCPS/security/OpenDDS_Security_Export.h> 11 : 12 : #include <string> 13 : #include <map> 14 : 15 : OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 16 : 17 : namespace OpenDDS { 18 : namespace Security { 19 : namespace SSL { 20 : 21 : class OpenDDS_Security_Export SubjectName { 22 : private: 23 : typedef std::map<std::string, std::string> AttrMap; 24 : 25 : public: 26 : SubjectName(); 27 : explicit SubjectName(const char*, bool permissive = false); 28 : explicit SubjectName(const std::string&, bool permissive = false); 29 : 30 : /** 31 : * @return int 0 on success; 1 on failure. 32 : */ 33 : int parse(const char*, bool permissive = false); 34 : 35 : /** 36 : * @return int 0 on success; 1 on failure. 37 : */ 38 : int parse(const std::string&, bool permissive = false); 39 : 40 : bool operator==(const SubjectName&) const; 41 : bool operator!=(const SubjectName&) const; 42 : 43 : typedef AttrMap::const_iterator const_iterator; 44 0 : const_iterator begin() const { return map_.begin(); } 45 0 : const_iterator end() const { return map_.end(); } 46 : const_iterator find(const std::string& key) const { return map_.find(key); } 47 : 48 : private: 49 : /** 50 : * @return int 0 on success; 1 on failure. 51 : */ 52 : int parse_permissive(const char*); 53 : 54 : /** 55 : * @return int 0 on success; 1 on failure. 56 : */ 57 : int parse_dce(const char*); 58 : 59 : /** 60 : * @return int 0 on success; 1 on failure. 61 : */ 62 : int parse_ldap_v3(const char*); 63 : 64 : int simple_avp_seq_parse(const char* in, const char* s_del, 65 : const char* a_del, const char* s_trim, 66 : const char* a_trim, bool push_back); 67 : 68 : AttrMap map_; 69 : }; 70 : 71 : } // namespace SSL 72 : } // namespace Security 73 : } // namespace OpenDDS 74 : 75 : OPENDDS_END_VERSIONED_NAMESPACE_DECL 76 : 77 : #endif