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(const string& name) { _name = name; }
00054
00056
00059 string get_name() const { 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() const
00075 {
00076 return _nameserver_add;
00077 }
00078
00080
00083 void insert_nameserver_rem(const struct NameServer &nameserver_rem)
00084 {
00085 _nameserver_rem.push_back(nameserver_rem);
00086 }
00087
00089
00092 vector<struct NameServer> get_nameserver_rem() const
00093 {
00094 return _nameserver_rem;
00095 }
00096
00098
00102 void insert_contact_add(const string& type, const string& identification)
00103 {
00104 _contact_add[type] = identification;
00105 }
00106
00108
00111 map< string, string, less<string> > get_contact_add() const
00112 {
00113 return _contact_add;
00114 }
00115
00117
00121 void insert_contact_rem(const string& type, const string& identification)
00122 {
00123 _contact_rem[type] = identification;
00124 }
00125
00127
00130 map< string, string, less<string> > get_contact_rem() const
00131 {
00132 return _contact_rem;
00133 }
00134
00136
00139 void insert_status_add(const struct Status &status_add)
00140 {
00141 _status_add.insert(status_add);
00142 }
00143
00145
00148 set<struct Status> get_status_add() const { return _status_add; }
00149
00151
00154 void insert_status_rem(const struct Status &status_rem)
00155 {
00156 _status_rem.insert(status_rem);
00157 }
00158
00160
00163 set<struct Status> get_status_rem() const { return _status_rem; }
00164
00166
00169 void set_registrant(const string ®istrant)
00170 {
00171 _registrant = registrant;
00172 _registrant_f = true;
00173 };
00174
00176
00179 string get_registrant() const { return _registrant; };
00180
00182
00185 void set_registrant_f(const bool registrant_f)
00186 {
00187 _registrant_f = registrant_f;
00188 };
00189
00191
00194 bool get_registrant_f() const
00195 {
00196 return _registrant_f;
00197 };
00198
00200
00203 void set_authInfo(const AuthInfo &authInfo)
00204 {
00205 _authInfo = authInfo;
00206 }
00207
00209
00212 AuthInfo get_authInfo() const { return _authInfo; }
00213
00214
00215
00217
00220 void insert_ds_add(const DSInfo &ds_info)
00221 {
00222 _ds_add.push_back(ds_info);
00223 }
00224
00226
00229 list<DSInfo> get_ds_add() const { return _ds_add; }
00230
00232
00235 void insert_ds_rem(const unsigned int &key_tag)
00236 {
00237 _ds_rem.push_back(key_tag);
00238 }
00239
00241
00244 list<unsigned int> get_ds_rem() const { return _ds_rem; }
00245
00247
00250 void insert_ds_chg(const DSInfo &ds_info)
00251 {
00252 _ds_chg.push_back(ds_info);
00253 }
00254
00256
00259 list<DSInfo> get_ds_chg() const { return _ds_chg; }
00260
00262
00265 void setUrgentFlag(const bool urgentFlag)
00266 {
00267 _urgentFlag = urgentFlag;
00268 }
00269
00271
00274 bool isUrgent() const
00275 {
00276 return _urgentFlag;
00277 }
00278
00279
00280
00282 bool has_extension() const {
00283 return has_ds_extension();
00284 };
00285
00287 bool has_ds_extension() const {
00288 return (!_ds_add.empty() || !_ds_rem.empty() || !_ds_chg.empty());
00289 }
00290
00292 void reset()
00293 {
00294 Command::reset();
00295 _name = "";
00296 _nameserver_add.clear();
00297 _nameserver_rem.clear();
00298 _contact_add.clear();
00299 _contact_rem.clear();
00300 _status_add.clear();
00301 _status_rem.clear();
00302 _registrant = "";
00303 _registrant_f = false;
00304
00305
00306 _ds_add.clear();
00307 _ds_rem.clear();
00308 _ds_chg.clear();
00309 _urgentFlag = false;
00310
00311 _authInfo.reset();
00312 }
00313
00314 protected:
00316 string _name;
00317
00319 vector<struct NameServer> _nameserver_add;
00320
00322 vector<struct NameServer> _nameserver_rem;
00323
00325 map< string, string, less<string> > _contact_add;
00326
00328 map< string, string, less<string> > _contact_rem;
00329
00331 set<struct Status> _status_add;
00332
00334 set<struct Status> _status_rem;
00335
00337 string _registrant;
00338
00340 bool _registrant_f;
00341
00343 AuthInfo _authInfo;
00344
00346 list<DSInfo> _ds_add;
00347
00349 list<unsigned int> _ds_rem;
00350
00352 list<DSInfo> _ds_chg;
00353
00355 bool _urgentFlag;
00356 };
00357
00358 LIBEPP_NICBR_NS_END
00359 #endif //__DOMAIN_UPDATE_CMD_H__