00001 /* ${copyright}$ */ 00002 /* $Id: DomainCreateCmd.H 1040 2009-10-01 17:49:12Z fneves $ */ 00007 #ifndef __DOMAIN_CREATE_CMD_H__ 00008 #define __DOMAIN_CREATE_CMD_H__ 00009 00010 #include <string> 00011 #include <vector> 00012 #include <map> 00013 #include <list> 00014 00015 #include "libepp_nicbr.H" 00016 00017 #include "Command.H" 00018 #include "CommonData.H" // struct NameServer 00019 #include "RegistrationPeriod.H" 00020 00021 using std::string; 00022 using std::set; 00023 using std::map; 00024 using std::list; 00025 using std::less; 00026 00027 LIBEPP_NICBR_NS_BEGIN 00028 00030 class DomainCreateCmd : public Command 00031 { 00032 public: 00034 DomainCreateCmd(bool reset = true) : Command(false) 00035 { 00036 if (reset) { 00037 this->reset(); 00038 } 00039 } 00040 00042 00045 void set_name(const string& name) { _name = name; } 00046 00048 00051 string get_name() const { return _name; } 00052 00054 00058 void set_period(const int time, const string& unit) 00059 { 00060 _period.time = time; 00061 _period.unit = unit; 00062 } 00063 00065 00068 RegistrationPeriod get_period() const { return _period; } 00069 00071 00074 void insert_nameserver(const struct NameServer &nameserver) 00075 { 00076 _nameservers.push_back(nameserver); 00077 } 00078 00080 00083 vector<struct NameServer> get_nameservers() const { return _nameservers; } 00084 00086 00089 void set_registrant(const string& registrant) { _registrant = registrant; } 00090 00092 00095 string get_registrant() const { return _registrant; } 00096 00098 00102 void insert_contact(const string& type, const string& identification) 00103 { 00104 _contacts[type] = identification; 00105 } 00106 00108 00111 map< string, string, less<string> > get_contacts() const { return _contacts; } 00112 00114 00117 void set_authInfo(const AuthInfo &authInfo) 00118 { 00119 _authInfo = authInfo; 00120 } 00121 00123 00126 AuthInfo get_authInfo() const { return _authInfo; } 00127 00128 //******************** RFC 4310 BEGIN ******************** 00130 00133 void add_dsInfo(const DSInfo &ds_info) 00134 { 00135 _ds_info.push_back(ds_info); 00136 } 00137 00139 00142 list<DSInfo> get_dsInfo() const { return _ds_info; } 00143 00144 //******************** RFC 4310 END ******************** 00145 00147 bool has_extension() const { 00148 return has_ds_extension(); 00149 } 00150 00152 bool has_ds_extension() const { 00153 return !_ds_info.empty(); 00154 } 00155 00157 void reset() 00158 { 00159 Command::reset(); 00160 _name = ""; 00161 _period.time = 0; 00162 _period.unit = ""; 00163 _nameservers.clear(); 00164 _registrant = ""; 00165 _contacts.clear(); 00166 _authInfo.reset(); 00167 _ds_info.clear(); 00168 } 00169 00170 protected: 00172 string _name; 00173 00175 RegistrationPeriod _period; 00176 00178 vector<struct NameServer> _nameservers; 00179 00181 string _registrant; 00182 00184 map< string, string, less<string> > _contacts; 00185 00187 AuthInfo _authInfo; 00188 00190 list<DSInfo> _ds_info; 00191 }; 00192 00193 LIBEPP_NICBR_NS_END 00194 #endif //__DOMAIN_CREATE_CMD_H__