00001
00002
00007 #ifndef __DOMAIN_UPDATE_CMD_H__
00008 #define __DOMAIN_UPDATE_CMD_H__
00009
00010 #include <string>
00011 #include <vector>
00012 #include <set>
00013 #include <map>
00014
00015 #include "libepp_nicbr.H"
00016
00017 #include "Command.H"
00018 #include "CommonData.H"
00019
00020 using std::string;
00021 using std::set;
00022 using std::map;
00023 using std::less;
00024
00025 LIBEPP_NICBR_NS_BEGIN
00026
00028 class DomainUpdateCmd : public Command
00029 {
00030 public:
00031
00032 struct Status {
00033 string s;
00034 string lang;
00035 string msg;
00036 bool operator<(const Status &st) const {
00037 return s < st.s;
00038 }
00039 };
00040
00042 DomainUpdateCmd(bool reset = true) : Command(false)
00043 {
00044 if (reset) {
00045 this->reset();
00046 }
00047 }
00048
00050
00053 void set_name(string name) { _name = name; }
00054
00056
00059 string get_name() { return _name; }
00060
00062
00065 void insert_nameserver_add(const struct NameServer &nameserver_add)
00066 {
00067 _nameserver_add.push_back(nameserver_add);
00068 }
00069
00071
00074 vector<struct NameServer> get_nameserver_add() { return _nameserver_add; }
00075
00077
00080 void insert_nameserver_rem(const struct NameServer &nameserver_rem)
00081 {
00082 _nameserver_rem.push_back(nameserver_rem);
00083 }
00084
00086
00089 vector<struct NameServer> get_nameserver_rem() { return _nameserver_rem; }
00090
00092
00096 void insert_contact_add(string type, string identification)
00097 {
00098 _contact_add[type] = identification;
00099 }
00100
00102
00105 map< string, string, less<string> > get_contact_add()
00106 {
00107 return _contact_add;
00108 }
00109
00111
00115 void insert_contact_rem(string type, string identification)
00116 {
00117 _contact_rem[type] = identification;
00118 }
00119
00121
00124 map< string, string, less<string> > get_contact_rem()
00125 {
00126 return _contact_rem;
00127 }
00128
00130
00133 void insert_status_add(const struct Status &status_add)
00134 {
00135 _status_add.insert(status_add);
00136 }
00137
00139
00142 set<struct Status> get_status_add() { return _status_add; }
00143
00145
00148 void insert_status_rem(const struct Status &status_rem)
00149 {
00150 _status_rem.insert(status_rem);
00151 }
00152
00154
00157 set<struct Status> get_status_rem() { return _status_rem; }
00158
00160
00163 void set_registrant(const string ®istrant)
00164 {
00165 _registrant = registrant;
00166 _registrant_f = true;
00167 };
00168
00170
00173 string get_registrant() { return _registrant; };
00174
00176
00179 void set_registrant_f(bool registrant_f)
00180 {
00181 _registrant_f = registrant_f;
00182 };
00183
00185
00188 bool get_registrant_f()
00189 {
00190 return _registrant_f;
00191 };
00192
00194
00197 void set_authInfo(const AuthInfo &authInfo)
00198 {
00199 _authInfo = authInfo;
00200 }
00201
00203
00206 AuthInfo get_authInfo() { return _authInfo; }
00207
00208
00209
00211
00214 void insert_ds_add(const DSInfo &ds_info)
00215 {
00216 _ds_add.push_back(ds_info);
00217 }
00218
00220
00223 list<DSInfo> get_ds_add() { return _ds_add; }
00224
00226
00229 void insert_ds_rem(const unsigned int &key_tag)
00230 {
00231 _ds_rem.push_back(key_tag);
00232 }
00233
00235
00238 list<unsigned int> get_ds_rem() { return _ds_rem; }
00239
00241
00244 void insert_ds_chg(const DSInfo &ds_info)
00245 {
00246 _ds_chg.push_back(ds_info);
00247 }
00248
00250
00253 list<DSInfo> get_ds_chg() { return _ds_chg; }
00254
00256
00259 void setUrgentFlag(bool urgentFlag)
00260 {
00261 _urgentFlag = urgentFlag;
00262 }
00263
00265
00268 bool isUrgent()
00269 {
00270 return _urgentFlag;
00271 }
00272
00273
00274
00276 bool has_extension() {
00277 return has_ds_extension();
00278 };
00279
00281 bool has_ds_extension() {
00282 return (!_ds_add.empty() || !_ds_rem.empty() || !_ds_chg.empty());
00283 }
00284
00286 void reset()
00287 {
00288 Command::reset();
00289 _name = "";
00290 _nameserver_add.clear();
00291 _nameserver_rem.clear();
00292 _contact_add.clear();
00293 _contact_rem.clear();
00294 _status_add.clear();
00295 _status_rem.clear();
00296 _registrant = "";
00297 _registrant_f = false;
00298
00299
00300 _ds_add.clear();
00301 _ds_rem.clear();
00302 _ds_chg.clear();
00303 _urgentFlag = false;
00304
00305 _authInfo.reset();
00306 }
00307
00308 protected:
00310 string _name;
00311
00313 vector<struct NameServer> _nameserver_add;
00314
00316 vector<struct NameServer> _nameserver_rem;
00317
00319 map< string, string, less<string> > _contact_add;
00320
00322 map< string, string, less<string> > _contact_rem;
00323
00325 set<struct Status> _status_add;
00326
00328 set<struct Status> _status_rem;
00329
00331 string _registrant;
00332
00334 bool _registrant_f;
00335
00337 AuthInfo _authInfo;
00338
00340 list<DSInfo> _ds_add;
00341
00343 list<unsigned int> _ds_rem;
00344
00346 list<DSInfo> _ds_chg;
00347
00349 bool _urgentFlag;
00350 };
00351
00352 LIBEPP_NICBR_NS_END
00353 #endif //__DOMAIN_UPDATE_CMD_H__