00001 /* ${copyright}$ */ 00002 /* $Id: DomainCreateCmd.H 711 2006-05-03 16:55:52Z koji $ */ 00007 #ifndef __DOMAIN_CREATE_CMD_H__ 00008 #define __DOMAIN_CREATE_CMD_H__ 00009 00010 #include <string> 00011 #include <vector> 00012 #include <map> 00013 00014 #include "libepp_nicbr.H" 00015 00016 #include "Command.H" 00017 #include "CommonData.H" // struct NameServer 00018 00019 using std::string; 00020 using std::set; 00021 using std::map; 00022 using std::less; 00023 00024 LIBEPP_NICBR_NS_BEGIN 00025 00027 class DomainCreateCmd : public Command 00028 { 00029 public: 00030 00031 struct Period { 00032 int time; 00033 string unit; 00034 }; 00035 00037 DomainCreateCmd(bool reset = true) : Command(false) 00038 { 00039 if (reset) { 00040 this->reset(); 00041 } 00042 } 00043 00045 00048 void set_name(string name) { _name = name; } 00049 00051 00054 string get_name() { return _name; } 00055 00057 00061 void set_period(int time, string unit) 00062 { 00063 _period.time = time; 00064 _period.unit = unit; 00065 } 00066 00068 00071 Period get_period() { return _period; } 00072 00074 00077 void insert_nameserver(const struct NameServer &nameserver) 00078 { 00079 _nameservers.push_back(nameserver); 00080 } 00081 00083 00086 vector<struct NameServer> get_nameservers() { return _nameservers; } 00087 00089 00092 void set_registrant(string registrant) { _registrant = registrant; } 00093 00095 00098 string get_registrant() { return _registrant; } 00099 00101 00105 void insert_contact(string type, string identification) 00106 { 00107 _contacts[type] = identification; 00108 } 00109 00111 00114 map< string, string, less<string> > get_contacts() { return _contacts; } 00115 00117 00120 void set_authInfo(const AuthInfo &authInfo) 00121 { 00122 _authInfo = authInfo; 00123 } 00124 00126 00129 AuthInfo get_authInfo() { return _authInfo; } 00130 00132 void reset() 00133 { 00134 Command::reset(); 00135 _name = ""; 00136 _period.time = 0; 00137 _period.unit = ""; 00138 _nameservers.clear(); 00139 _registrant = ""; 00140 _contacts.clear(); 00141 _authInfo.reset(); 00142 } 00143 00144 protected: 00146 string _name; 00147 00149 Period _period; 00150 00152 vector<struct NameServer> _nameservers; 00153 00155 string _registrant; 00156 00158 map< string, string, less<string> > _contacts; 00159 00161 AuthInfo _authInfo; 00162 }; 00163 00164 LIBEPP_NICBR_NS_END 00165 #endif //__DOMAIN_CREATE_CMD_H__