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 #include "DSInfo.H"
00020 #include "KeyData.H"
00021
00022 using std::string;
00023 using std::set;
00024 using std::map;
00025 using std::less;
00026
00027 LIBEPP_NICBR_NS_BEGIN
00028
00030 class DomainUpdateCmd : public Command
00031 {
00032 public:
00033
00034 struct Status {
00035 string s;
00036 string lang;
00037 string msg;
00038 bool operator<(const Status &st) const {
00039 return s < st.s;
00040 }
00041 };
00042
00044 DomainUpdateCmd(bool reset = true) : Command(false)
00045 {
00046 if (reset) {
00047 this->reset();
00048 }
00049 }
00050
00052
00055 void set_name(const string& name) { _name = name; }
00056
00058
00061 string get_name() const { return _name; }
00062
00064
00067 void insert_nameserver_add(const struct NameServer &nameserver_add)
00068 {
00069 _nameserver_add.push_back(nameserver_add);
00070 }
00071
00073
00076 vector<struct NameServer> get_nameserver_add() const
00077 {
00078 return _nameserver_add;
00079 }
00080
00082
00085 void insert_nameserver_rem(const struct NameServer &nameserver_rem)
00086 {
00087 _nameserver_rem.push_back(nameserver_rem);
00088 }
00089
00091
00094 vector<struct NameServer> get_nameserver_rem() const
00095 {
00096 return _nameserver_rem;
00097 }
00098
00100
00104 void insert_contact_add(const string& type, const string& identification)
00105 {
00106 _contact_add[type] = identification;
00107 }
00108
00110
00113 map< string, string, less<string> > get_contact_add() const
00114 {
00115 return _contact_add;
00116 }
00117
00119
00123 void insert_contact_rem(const string& type, const string& identification)
00124 {
00125 _contact_rem[type] = identification;
00126 }
00127
00129
00132 map< string, string, less<string> > get_contact_rem() const
00133 {
00134 return _contact_rem;
00135 }
00136
00138
00141 void insert_status_add(const struct Status &status_add)
00142 {
00143 _status_add.insert(status_add);
00144 }
00145
00147
00150 set<struct Status> get_status_add() const { return _status_add; }
00151
00153
00156 void insert_status_rem(const struct Status &status_rem)
00157 {
00158 _status_rem.insert(status_rem);
00159 }
00160
00162
00165 set<struct Status> get_status_rem() const { return _status_rem; }
00166
00168
00171 void set_registrant(const string ®istrant)
00172 {
00173 _registrant = registrant;
00174 _registrant_f = true;
00175 };
00176
00178
00181 string get_registrant() const { return _registrant; };
00182
00184
00187 void set_registrant_f(const bool registrant_f)
00188 {
00189 _registrant_f = registrant_f;
00190 };
00191
00193
00196 bool get_registrant_f() const
00197 {
00198 return _registrant_f;
00199 };
00200
00202
00205 void set_authInfo(const AuthInfo &authInfo)
00206 {
00207 _authInfo = authInfo;
00208 }
00209
00211
00214 AuthInfo get_authInfo() const { return _authInfo; }
00215
00216
00218
00221 void set_secDnsVersion(string secDnsVersion)
00222 {
00223 _secDnsVersion = secDnsVersion;
00224 }
00225
00227
00230 string get_secDnsVersion() const
00231 {
00232 return _secDnsVersion;
00233 }
00234
00236
00239 void set_max_sig_life(const unsigned int max_sig_life)
00240 {
00241 _max_sig_life = max_sig_life;
00242 }
00243
00245
00248 unsigned int get_max_sig_life() const
00249 {
00250 return _max_sig_life;
00251 }
00252
00254
00257 void insert_dnskey_add(const KeyData &keydata)
00258 {
00259 _dnskey_list_add.push_back(keydata);
00260 }
00261
00263
00266 list<KeyData> get_dnskey_add() const
00267 {
00268 return _dnskey_list_add;
00269 }
00270
00272
00275 void insert_dnskey_rem(const KeyData &keydata)
00276 {
00277 _dnskey_list_rem.push_back(keydata);
00278 }
00279
00281
00284 list<KeyData> get_dnskey_rem() const
00285 {
00286 return _dnskey_list_rem;
00287 }
00288
00290
00293 void insert_ds_add(const DSInfo &ds_info)
00294 {
00295 _ds_list_add.push_back(ds_info);
00296 }
00297
00299
00302 list<DSInfo> get_ds_add() const
00303 {
00304 return _ds_list_add;
00305 }
00306
00308
00311 void insert_ds_rem_1_1(const DSInfo &ds_info)
00312 {
00313 _ds_list_rem.push_back(ds_info);
00314 }
00315
00317
00320 void insert_ds_rem(const unsigned int &keyTag)
00321 {
00322 _ds_list_rem_1_0.push_back(keyTag);
00323 }
00324
00326
00329 list<DSInfo> get_ds_rem_1_1() const
00330 {
00331 return _ds_list_rem;
00332 }
00333
00335
00338 list<unsigned int> get_ds_rem() const
00339 {
00340 return _ds_list_rem_1_0;
00341 }
00342
00344
00347 void insert_ds_chg(const DSInfo &ds_info)
00348 {
00349 _ds_list_chg.push_back(ds_info);
00350 }
00351
00353
00356 list<DSInfo> get_ds_chg() const
00357 {
00358 return _ds_list_chg;
00359 }
00360
00362
00365 void setUrgentFlag(const bool urgentFlag)
00366 {
00367 _urgentFlag = urgentFlag;
00368 }
00369
00371
00374 bool isUrgent() const
00375 {
00376 return _urgentFlag;
00377 }
00378
00380
00383 void setRemoveAll(const bool removeAll)
00384 {
00385 _removeAll = removeAll;
00386 }
00387
00389
00392 bool getRemoveAll() const
00393 {
00394 return _removeAll;
00395 }
00396
00397
00398
00400 bool has_extension() const {
00401 return has_secdns_extension();
00402 };
00403
00405 bool has_secdns_extension() const {
00406 bool hasSecDns10 = _secDnsVersion == "1.0" &&
00407 !(_ds_list_add.empty() && _ds_list_rem_1_0.empty() && _ds_list_chg.empty());
00408
00409 bool hasSecDns11 = _secDnsVersion == "1.1" &&
00410 (!(_ds_list_add.empty() && _ds_list_rem.empty()) ||
00411 !(_dnskey_list_add.empty() && _dnskey_list_rem.empty()) ||
00412 _max_sig_life > 0 || _removeAll == true);
00413
00414 return (hasSecDns10 || hasSecDns11);
00415 }
00416
00418 void reset()
00419 {
00420 Command::reset();
00421 _name = "";
00422 _nameserver_add.clear();
00423 _nameserver_rem.clear();
00424 _contact_add.clear();
00425 _contact_rem.clear();
00426 _status_add.clear();
00427 _status_rem.clear();
00428 _registrant = "";
00429 _registrant_f = false;
00430
00431
00432 _secDnsVersion = "1.1";
00433 _max_sig_life = 0;
00434 _ds_list_add.clear();
00435 _ds_list_rem.clear();
00436 _ds_list_rem_1_0.clear();
00437 _ds_list_chg.clear();
00438 _dnskey_list_rem.clear();
00439 _dnskey_list_add.clear();
00440 _urgentFlag = false;
00441 _removeAll = false;
00442
00443 _authInfo.reset();
00444 }
00445
00446 protected:
00448 string _name;
00449
00451 vector<struct NameServer> _nameserver_add;
00452
00454 vector<struct NameServer> _nameserver_rem;
00455
00457 map< string, string, less<string> > _contact_add;
00458
00460 map< string, string, less<string> > _contact_rem;
00461
00463 set<struct Status> _status_add;
00464
00466 set<struct Status> _status_rem;
00467
00469 string _registrant;
00470
00472 bool _registrant_f;
00473
00475 AuthInfo _authInfo;
00476
00478 string _secDnsVersion;
00479
00481 unsigned int _max_sig_life;
00482
00484 list<DSInfo> _ds_list_add;
00485
00487 list<DSInfo> _ds_list_rem;
00488
00491 list<unsigned int> _ds_list_rem_1_0;
00492
00494 list<DSInfo> _ds_list_chg;
00495
00497 list<KeyData> _dnskey_list_add;
00498
00500 list<KeyData> _dnskey_list_rem;
00501
00503 bool _urgentFlag;
00504
00506 bool _removeAll;
00507 };
00508
00509 LIBEPP_NICBR_NS_END
00510 #endif //__DOMAIN_UPDATE_CMD_H__