00001
00002
00007 #ifndef __COMMON_DATA_H__
00008 #define __COMMON_DATA_H__
00009
00010 #include <string>
00011 #include <vector>
00012 #include <set>
00013
00014 #include "libepp_nicbr.H"
00015
00016 using std::string;
00017 using std::vector;
00018 using std::set;
00019
00020 LIBEPP_NICBR_NS_BEGIN
00021
00023 enum ActionType {
00024 UNSET_ACTION = -1,
00025 LOGIN = 0,
00026 LOGOUT,
00027 HELLO,
00028 POLL,
00029 GREETING,
00030 CONTACT_CHECK = 10,
00031 CONTACT_CREATE,
00032 CONTACT_INFO,
00033 CONTACT_TRANSFER,
00034 CONTACT_UPDATE,
00035 CONTACT_PANDATA,
00036 DOMAIN_CHECK = 20,
00037 DOMAIN_CREATE,
00038 DOMAIN_INFO,
00039 DOMAIN_RENEW,
00040 DOMAIN_UPDATE,
00041 DOMAIN_PANDATA,
00042 DOMAIN_DELETE,
00043 BR_ORG_CHECK = 30,
00044 BR_ORG_INFO,
00045 BR_ORG_CREATE,
00046 BR_ORG_UPDATE,
00047 BR_ORG_PANDATA,
00048 BR_DOMAIN_CHECK = 40,
00049 BR_DOMAIN_INFO,
00050 BR_DOMAIN_CREATE,
00051 BR_DOMAIN_RENEW,
00052 BR_DOMAIN_UPDATE,
00053 BR_DOMAIN_PANDATA,
00054 IP_NETWORK_CREATE = 50,
00055 IP_NETWORK_CHECK,
00056 IP_NETWORK_DELETE,
00057 IP_NETWORK_RENEW,
00058 IP_NETWORK_TRANSFER,
00059 IP_NETWORK_INFO,
00060 IP_NETWORK_UPDATE,
00061 ASN_CHECK = 60,
00062 ASN_CREATE,
00063 ASN_DELETE,
00064 ASN_RENEW,
00065 ASN_TRANSFER,
00066 ASN_INFO,
00067 ASN_UPDATE
00068 };
00069
00071 class AuthInfo {
00072 public:
00073 AuthInfo& operator=(const AuthInfo &authInfo) {
00074 _roid = authInfo._roid;
00075 _roid_f = authInfo._roid_f;
00076 _pw = authInfo._pw;
00077 _pw_f = authInfo._pw_f;
00078 return *this;
00079 }
00080
00082 AuthInfo()
00083 {
00084 this->reset();
00085 }
00086
00088
00091 void set_roid(const string& roid)
00092 {
00093 _roid = roid;
00094 if (roid != "") {
00095 _roid_f = true;
00096 }
00097 }
00098
00100
00103 string get_roid() const { return _roid; }
00104
00106
00109 bool get_roid_f() const
00110 {
00111 return _roid_f;
00112 }
00113
00115
00118 void set_pw(const string& pw)
00119 {
00120 _pw = pw;
00121 _pw_f = true;
00122 }
00123
00125
00128 string get_pw() const { return _pw; }
00129
00131
00134 bool get_pw_f() const
00135 {
00136 return _pw_f;
00137 }
00138
00140 void reset()
00141 {
00142 _roid = "";
00143 _roid_f = false;
00144 _pw = "";
00145 _pw_f = false;
00146 }
00147
00148 protected:
00150 string _roid;
00151
00153 bool _roid_f;
00154
00156 string _pw;
00157
00159 bool _pw_f;
00160
00161 };
00162
00163 struct NSIPAddr {
00164 string version;
00165 string addr;
00166 bool operator<(const NSIPAddr &ip) const {
00167 return addr < ip.addr;
00168 }
00169 };
00170
00171 struct NameServer {
00172 string name;
00173 set<NSIPAddr> ips;
00174 bool operator<(const NameServer &n) const {
00175 return name < n.name;
00176 }
00177 };
00178
00180 class IpRange
00181 {
00182 public:
00183 IpRange() {
00184 this->reset();
00185 }
00186
00187 bool operator<(const IpRange &ipRange) const
00188 {
00189 if (_ipBegin.compare(ipRange._ipBegin) < 0) {
00190 return true;
00191 }
00192
00193 if (_ipBegin.compare(ipRange._ipBegin) == 0) {
00194 if (_ipEnd.compare(ipRange._ipEnd) < 0) {
00195 return true;
00196 }
00197
00198 return false;
00199 }
00200
00201 return false;
00202 }
00203
00204 void reset()
00205 {
00206 _version = "";
00207 _ipBegin = "";
00208 _ipEnd = "";
00209 _available = false;
00210 }
00211
00212 void set_version(const string &version)
00213 {
00214 _version = version;
00215 }
00216
00217 string get_version() const
00218 {
00219 return _version;
00220 }
00221
00222 void set_ipBegin(const string &ipBegin)
00223 {
00224 _ipBegin = ipBegin;
00225 }
00226
00227 string get_ipBegin() const
00228 {
00229 return _ipBegin;
00230 }
00231
00232 void set_ipEnd(const string &ipEnd)
00233 {
00234 _ipEnd = ipEnd;
00235 }
00236
00237 string get_ipEnd() const
00238 {
00239 return _ipEnd;
00240 }
00241
00242 void set_available(const bool &available)
00243 {
00244 _available = available;
00245 }
00246
00247 bool get_available() const
00248 {
00249 return _available;
00250 }
00251
00252 private:
00253 string _version;
00254 string _ipBegin;
00255 string _ipEnd;
00256
00257
00258 bool _available;
00259 };
00260
00261 #if USE_IP_MANAGEMENT
00262 struct ReverseDns {
00263 IpRange ipRange;
00264 vector<string> nameservers;
00265 };
00266 #endif //USE_IP_MANAGEMENT
00267
00269 class PostalInfo {
00270 public:
00271 PostalInfo() {
00272 this->reset();
00273 }
00274
00275 void reset() {
00276 _type_f = false;
00277 _name_f = false;
00278 _org_f = false;
00279 _str1_f = false;
00280 _str2_f = false;
00281 _str3_f = false;
00282 _city_f = false;
00283 _sp_f = false;
00284 _pc_f = false;
00285 _cc_f = false;
00286 }
00287
00288 string get_type() const
00289 {
00290 return _type;
00291 }
00292
00293 void set_type(const string& type)
00294 {
00295 _type = type;
00296 _type_f = true;
00297 }
00298
00299 string get_name() const
00300 {
00301 return _name;
00302 }
00303
00304 void set_name(const string& name)
00305 {
00306 _name = name;
00307 _name_f = true;
00308 }
00309
00310 string get_org() const
00311 {
00312 return _org;
00313 }
00314
00315 void set_org(const string& org)
00316 {
00317 _org = org;
00318 _org_f = true;
00319 }
00320
00321 string get_str1() const
00322 {
00323 return _str1;
00324 }
00325
00326 void set_str1(const string& str1)
00327 {
00328 _str1 = str1;
00329 _str1_f = true;
00330 }
00331
00332 string get_str2() const
00333 {
00334 return _str2;
00335 }
00336
00337 void set_str2(const string& str2)
00338 {
00339 _str2 = str2;
00340 _str2_f = true;
00341 }
00342
00343 string get_str3() const
00344 {
00345 return _str3;
00346 }
00347
00348 void set_str3(const string& str3)
00349 {
00350 _str3 = str3;
00351 _str3_f = true;
00352 }
00353
00354 string get_city() const
00355 {
00356 return _city;
00357 }
00358
00359 void set_city(const string& city)
00360 {
00361 _city = city;
00362 _city_f = true;
00363 }
00364
00365 string get_sp() const
00366 {
00367 return _sp;
00368 }
00369
00370 void set_sp(const string& sp)
00371 {
00372 _sp = sp;
00373 _sp_f = true;
00374 }
00375
00376 string get_pc() const
00377 {
00378 return _pc;
00379 }
00380
00381 void set_pc(const string& pc)
00382 {
00383 _pc = pc;
00384 _pc_f = true;
00385 }
00386
00387 string get_cc() const
00388 {
00389 return _cc;
00390 }
00391
00392 void set_cc(const string& cc)
00393 {
00394 _cc = cc;
00395 _cc_f = true;
00396 }
00397
00398 bool get_type_f() const
00399 {
00400 return _type_f;
00401 }
00402
00403 bool get_name_f() const
00404 {
00405 return _name_f;
00406 }
00407
00408 bool get_org_f() const
00409 {
00410 return _org_f;
00411 }
00412
00413 bool get_str1_f() const
00414 {
00415 return _str1_f;
00416 }
00417
00418 bool get_str2_f() const
00419 {
00420 return _str2_f;
00421 }
00422
00423 bool get_str3_f() const
00424 {
00425 return _str3_f;
00426 }
00427
00428 bool get_city_f() const
00429 {
00430 return _city_f;
00431 }
00432
00433 bool get_sp_f() const
00434 {
00435 return _sp_f;
00436 }
00437
00438 bool get_pc_f() const
00439 {
00440 return _pc_f;
00441 }
00442
00443 bool get_cc_f() const
00444 {
00445 return _cc_f;
00446 }
00447
00448 private:
00449
00450 bool _type_f;
00451 bool _name_f;
00452 bool _org_f;
00453 bool _str1_f;
00454 bool _str2_f;
00455 bool _str3_f;
00456 bool _city_f;
00457 bool _sp_f;
00458 bool _pc_f;
00459 bool _cc_f;
00460
00461
00462 string _type;
00463 string _name;
00464 string _org;
00465 string _str1;
00466 string _str2;
00467 string _str3;
00468 string _city;
00469 string _sp;
00470 string _pc;
00471 string _cc;
00472 };
00473
00475 class CommonData
00476 {
00477 public:
00478
00479 struct Disclose {
00480 int flag;
00481
00482 bool name_int;
00483 bool name_loc;
00484 bool org_int;
00485 bool org_loc;
00486 bool addr_int;
00487 bool addr_loc;
00488 bool voice;
00489 bool fax;
00490 bool email;
00491
00492 Disclose() {
00493 flag = -1;
00494 name_int = false;
00495 name_loc = false;
00496 org_int = false;
00497 org_loc = false;
00498 addr_int = false;
00499 addr_loc = false;
00500 voice = false;
00501 fax = false;
00502 email = false;
00503 }
00504
00505 bool is_set() {
00506 return ((flag == 0 || flag == 1) &&
00507 (name_int || name_loc || org_int || org_loc || addr_int ||
00508 addr_loc || voice || fax || email));
00509 }
00510 };
00511
00512 struct Phone {
00513 string ext;
00514 string number;
00515 };
00516
00518 CommonData()
00519 {
00520 this->reset();
00521 }
00522
00524
00527 void set_id(const string &id);
00528
00530
00533 void insert_postal_info(const PostalInfo& postal_info);
00534
00536
00539 void set_voice(const Phone& voice);
00540
00542
00545 void set_fax(const Phone& fax);
00546
00548
00551 void set_email(const string &email);
00552
00554
00557 void set_disclose(const Disclose &disclose);
00558
00560
00563 string get_id() const;
00564
00566
00569 vector<PostalInfo> get_postal_info() const;
00570
00572
00575 Phone get_voice() const;
00576
00578
00581 bool get_voice_f() const
00582 {
00583 return _voice_f;
00584 }
00585
00587
00590 Phone get_fax() const;
00591
00593
00596 bool get_fax_f() const
00597 {
00598 return _fax_f;
00599 }
00600
00602
00605 string get_email() const;
00606
00608
00611 bool get_email_f() const
00612 {
00613 return _email_f;
00614 }
00615
00617
00620 Disclose get_disclose() const;
00621
00623 void reset();
00624
00625 protected:
00626
00628 string _id;
00629
00631 vector<PostalInfo> _postal_info;
00632
00634 Phone _voice;
00635
00637 bool _voice_f;
00638
00640 Phone _fax;
00641
00643 bool _fax_f;
00644
00646 string _email;
00647
00649 bool _email_f;
00650
00652 Disclose _disclose;
00653 };
00654
00655 LIBEPP_NICBR_NS_END
00656 #endif //__COMMON_DATA_H__