00001 /* ${copyright}$ */ 00002 /* $Id: DomainCreateCmd.H 888 2007-03-07 13:22:24Z eduardo $ */ 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 00020 using std::string; 00021 using std::set; 00022 using std::map; 00023 using std::list; 00024 using std::less; 00025 00026 LIBEPP_NICBR_NS_BEGIN 00027 00029 class DomainCreateCmd : public Command 00030 { 00031 public: 00032 00033 struct Period { 00034 int time; 00035 string unit; 00036 }; 00037 00039 DomainCreateCmd(bool reset = true) : Command(false) 00040 { 00041 if (reset) { 00042 this->reset(); 00043 } 00044 } 00045 00047 00050 void set_name(string name) { _name = name; } 00051 00053 00056 string get_name() { return _name; } 00057 00059 00063 void set_period(int time, string unit) 00064 { 00065 _period.time = time; 00066 _period.unit = unit; 00067 } 00068 00070 00073 Period get_period() { return _period; } 00074 00076 00079 void insert_nameserver(const struct NameServer &nameserver) 00080 { 00081 _nameservers.push_back(nameserver); 00082 } 00083 00085 00088 vector<struct NameServer> get_nameservers() { return _nameservers; } 00089 00091 00094 void set_registrant(string registrant) { _registrant = registrant; } 00095 00097 00100 string get_registrant() { return _registrant; } 00101 00103 00107 void insert_contact(string type, string identification) 00108 { 00109 _contacts[type] = identification; 00110 } 00111 00113 00116 map< string, string, less<string> > get_contacts() { return _contacts; } 00117 00119 00122 void set_authInfo(const AuthInfo &authInfo) 00123 { 00124 _authInfo = authInfo; 00125 } 00126 00128 00131 AuthInfo get_authInfo() { return _authInfo; } 00132 00133 //******************** RFC 4310 BEGIN ******************** 00135 00138 void add_dsInfo(const DSInfo &ds_info) 00139 { 00140 _ds_info.push_back(ds_info); 00141 } 00142 00144 00147 list<DSInfo> get_dsInfo() { return _ds_info; } 00148 00149 //******************** RFC 4310 END ******************** 00150 00152 bool has_extension() { 00153 return has_ds_extension(); 00154 } 00155 00157 bool has_ds_extension() { 00158 return !_ds_info.empty(); 00159 } 00160 00162 void reset() 00163 { 00164 Command::reset(); 00165 _name = ""; 00166 _period.time = 0; 00167 _period.unit = ""; 00168 _nameservers.clear(); 00169 _registrant = ""; 00170 _contacts.clear(); 00171 _authInfo.reset(); 00172 _ds_info.clear(); 00173 } 00174 00175 protected: 00177 string _name; 00178 00180 Period _period; 00181 00183 vector<struct NameServer> _nameservers; 00184 00186 string _registrant; 00187 00189 map< string, string, less<string> > _contacts; 00190 00192 AuthInfo _authInfo; 00193 00195 list<DSInfo> _ds_info; 00196 }; 00197 00198 LIBEPP_NICBR_NS_END 00199 #endif //__DOMAIN_CREATE_CMD_H__