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_TRANSFER,
00040 DOMAIN_RENEW,
00041 DOMAIN_UPDATE,
00042 DOMAIN_PANDATA,
00043 DOMAIN_DELETE,
00044 BR_ORG_CHECK = 30,
00045 BR_ORG_INFO,
00046 BR_ORG_CREATE,
00047 BR_ORG_UPDATE,
00048 BR_ORG_PANDATA,
00049 BR_DOMAIN_CHECK = 40,
00050 BR_DOMAIN_INFO,
00051 BR_DOMAIN_CREATE,
00052 BR_DOMAIN_RENEW,
00053 BR_DOMAIN_UPDATE,
00054 BR_DOMAIN_PANDATA,
00055 IP_NETWORK_CREATE = 50,
00056 IP_NETWORK_CHECK,
00057 IP_NETWORK_DELETE,
00058 IP_NETWORK_RENEW,
00059 IP_NETWORK_TRANSFER,
00060 IP_NETWORK_INFO,
00061 IP_NETWORK_UPDATE,
00062 ASN_CHECK = 60,
00063 ASN_CREATE,
00064 ASN_DELETE,
00065 ASN_RENEW,
00066 ASN_TRANSFER,
00067 ASN_INFO,
00068 ASN_UPDATE
00069 };
00070
00072 class AuthInfo {
00073 public:
00074 AuthInfo& operator=(const AuthInfo &authInfo) {
00075 _roid = authInfo._roid;
00076 _roid_f = authInfo._roid_f;
00077 _pw = authInfo._pw;
00078 _pw_f = authInfo._pw_f;
00079 return *this;
00080 }
00081
00083 AuthInfo()
00084 {
00085 this->reset();
00086 }
00087
00089
00092 void set_roid(const string& roid)
00093 {
00094 _roid = roid;
00095 if (roid != "") {
00096 _roid_f = true;
00097 }
00098 }
00099
00101
00104 string get_roid() const { return _roid; }
00105
00107
00110 bool get_roid_f() const
00111 {
00112 return _roid_f;
00113 }
00114
00116
00119 void set_pw(const string& pw)
00120 {
00121 _pw = pw;
00122 _pw_f = true;
00123 }
00124
00126
00129 string get_pw() const { return _pw; }
00130
00132
00135 bool get_pw_f() const
00136 {
00137 return _pw_f;
00138 }
00139
00141 void reset()
00142 {
00143 _roid = "";
00144 _roid_f = false;
00145 _pw = "";
00146 _pw_f = false;
00147 }
00148
00149 protected:
00151 string _roid;
00152
00154 bool _roid_f;
00155
00157 string _pw;
00158
00160 bool _pw_f;
00161
00162 };
00163
00164 struct NSIPAddr {
00165 string version;
00166 string addr;
00167 bool operator<(const NSIPAddr &ip) const {
00168 return addr < ip.addr;
00169 }
00170 };
00171
00172 struct NameServer {
00173 string name;
00174 set<NSIPAddr> ips;
00175 bool operator<(const NameServer &n) const {
00176 return name < n.name;
00177 }
00178 };
00179
00181 class IpRange
00182 {
00183 public:
00184 IpRange() {
00185 this->reset();
00186 }
00187
00188 bool operator<(const IpRange &ipRange) const
00189 {
00190 if (_ipBegin.compare(ipRange._ipBegin) < 0) {
00191 return true;
00192 }
00193
00194 if (_ipBegin.compare(ipRange._ipBegin) == 0) {
00195 if (_ipEnd.compare(ipRange._ipEnd) < 0) {
00196 return true;
00197 }
00198
00199 return false;
00200 }
00201
00202 return false;
00203 }
00204
00205 void reset()
00206 {
00207 _version = "";
00208 _ipBegin = "";
00209 _ipEnd = "";
00210 _available = false;
00211 }
00212
00213 void set_version(const string &version)
00214 {
00215 _version = version;
00216 }
00217
00218 string get_version() const
00219 {
00220 return _version;
00221 }
00222
00223 void set_ipBegin(const string &ipBegin)
00224 {
00225 _ipBegin = ipBegin;
00226 }
00227
00228 string get_ipBegin() const
00229 {
00230 return _ipBegin;
00231 }
00232
00233 void set_ipEnd(const string &ipEnd)
00234 {
00235 _ipEnd = ipEnd;
00236 }
00237
00238 string get_ipEnd() const
00239 {
00240 return _ipEnd;
00241 }
00242
00243 void set_available(const bool &available)
00244 {
00245 _available = available;
00246 }
00247
00248 bool get_available() const
00249 {
00250 return _available;
00251 }
00252
00253 private:
00254 string _version;
00255 string _ipBegin;
00256 string _ipEnd;
00257
00258
00259 bool _available;
00260 };
00261
00262 #if USE_IP_MANAGEMENT
00263 struct ReverseDns {
00264 IpRange ipRange;
00265 vector<string> nameservers;
00266 };
00267 #endif //USE_IP_MANAGEMENT
00268
00270 class PostalInfo {
00271 public:
00272 PostalInfo() {
00273 this->reset();
00274 }
00275
00276 void reset() {
00277 _type_f = false;
00278 _name_f = false;
00279 _org_f = false;
00280 _str1_f = false;
00281 _str2_f = false;
00282 _str3_f = false;
00283 _city_f = false;
00284 _sp_f = false;
00285 _pc_f = false;
00286 _cc_f = false;
00287 }
00288
00289 string get_type() const
00290 {
00291 return _type;
00292 }
00293
00294 void set_type(const string& type)
00295 {
00296 _type = type;
00297 _type_f = true;
00298 }
00299
00300 string get_name() const
00301 {
00302 return _name;
00303 }
00304
00305 void set_name(const string& name)
00306 {
00307 _name = name;
00308 _name_f = true;
00309 }
00310
00311 string get_org() const
00312 {
00313 return _org;
00314 }
00315
00316 void set_org(const string& org)
00317 {
00318 _org = org;
00319 _org_f = true;
00320 }
00321
00322 string get_str1() const
00323 {
00324 return _str1;
00325 }
00326
00327 void set_str1(const string& str1)
00328 {
00329 _str1 = str1;
00330 _str1_f = true;
00331 }
00332
00333 string get_str2() const
00334 {
00335 return _str2;
00336 }
00337
00338 void set_str2(const string& str2)
00339 {
00340 _str2 = str2;
00341 _str2_f = true;
00342 }
00343
00344 string get_str3() const
00345 {
00346 return _str3;
00347 }
00348
00349 void set_str3(const string& str3)
00350 {
00351 _str3 = str3;
00352 _str3_f = true;
00353 }
00354
00355 string get_city() const
00356 {
00357 return _city;
00358 }
00359
00360 void set_city(const string& city)
00361 {
00362 _city = city;
00363 _city_f = true;
00364 }
00365
00366 string get_sp() const
00367 {
00368 return _sp;
00369 }
00370
00371 void set_sp(const string& sp)
00372 {
00373 _sp = sp;
00374 _sp_f = true;
00375 }
00376
00377 string get_pc() const
00378 {
00379 return _pc;
00380 }
00381
00382 void set_pc(const string& pc)
00383 {
00384 _pc = pc;
00385 _pc_f = true;
00386 }
00387
00388 string get_cc() const
00389 {
00390 return _cc;
00391 }
00392
00393 void set_cc(const string& cc)
00394 {
00395 _cc = cc;
00396 _cc_f = true;
00397 }
00398
00399 bool get_type_f() const
00400 {
00401 return _type_f;
00402 }
00403
00404 bool get_name_f() const
00405 {
00406 return _name_f;
00407 }
00408
00409 bool get_org_f() const
00410 {
00411 return _org_f;
00412 }
00413
00414 bool get_str1_f() const
00415 {
00416 return _str1_f;
00417 }
00418
00419 bool get_str2_f() const
00420 {
00421 return _str2_f;
00422 }
00423
00424 bool get_str3_f() const
00425 {
00426 return _str3_f;
00427 }
00428
00429 bool get_city_f() const
00430 {
00431 return _city_f;
00432 }
00433
00434 bool get_sp_f() const
00435 {
00436 return _sp_f;
00437 }
00438
00439 bool get_pc_f() const
00440 {
00441 return _pc_f;
00442 }
00443
00444 bool get_cc_f() const
00445 {
00446 return _cc_f;
00447 }
00448
00449 private:
00450
00451 bool _type_f;
00452 bool _name_f;
00453 bool _org_f;
00454 bool _str1_f;
00455 bool _str2_f;
00456 bool _str3_f;
00457 bool _city_f;
00458 bool _sp_f;
00459 bool _pc_f;
00460 bool _cc_f;
00461
00462
00463 string _type;
00464 string _name;
00465 string _org;
00466 string _str1;
00467 string _str2;
00468 string _str3;
00469 string _city;
00470 string _sp;
00471 string _pc;
00472 string _cc;
00473 };
00474
00476 class CommonData
00477 {
00478 public:
00479
00480 struct Disclose {
00481 int flag;
00482
00483 bool name_int;
00484 bool name_loc;
00485 bool org_int;
00486 bool org_loc;
00487 bool addr_int;
00488 bool addr_loc;
00489 bool voice;
00490 bool fax;
00491 bool email;
00492
00493 Disclose() {
00494 flag = -1;
00495 name_int = false;
00496 name_loc = false;
00497 org_int = false;
00498 org_loc = false;
00499 addr_int = false;
00500 addr_loc = false;
00501 voice = false;
00502 fax = false;
00503 email = false;
00504 }
00505
00506 bool is_set() {
00507 return ((flag == 0 || flag == 1) &&
00508 (name_int || name_loc || org_int || org_loc || addr_int ||
00509 addr_loc || voice || fax || email));
00510 }
00511 };
00512
00513 struct Phone {
00514 string ext;
00515 string number;
00516 };
00517
00519 CommonData()
00520 {
00521 this->reset();
00522 }
00523
00525
00528 void set_id(const string &id);
00529
00531
00534 void insert_postal_info(const PostalInfo& postal_info);
00535
00537
00540 void set_voice(const Phone& voice);
00541
00543
00546 void set_fax(const Phone& fax);
00547
00549
00552 void set_email(const string &email);
00553
00555
00558 void set_disclose(const Disclose &disclose);
00559
00561
00564 string get_id() const;
00565
00567
00570 vector<PostalInfo> get_postal_info() const;
00571
00573
00576 Phone get_voice() const;
00577
00579
00582 bool get_voice_f() const
00583 {
00584 return _voice_f;
00585 }
00586
00588
00591 Phone get_fax() const;
00592
00594
00597 bool get_fax_f() const
00598 {
00599 return _fax_f;
00600 }
00601
00603
00606 string get_email() const;
00607
00609
00612 bool get_email_f() const
00613 {
00614 return _email_f;
00615 }
00616
00618
00621 Disclose get_disclose() const;
00622
00624 void reset();
00625
00626 protected:
00627
00629 string _id;
00630
00632 vector<PostalInfo> _postal_info;
00633
00635 Phone _voice;
00636
00638 bool _voice_f;
00639
00641 Phone _fax;
00642
00644 bool _fax_f;
00645
00647 string _email;
00648
00650 bool _email_f;
00651
00653 Disclose _disclose;
00654 };
00655
00656 LIBEPP_NICBR_NS_END
00657 #endif //__COMMON_DATA_H__