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 BR_ORG_CHECK = 30,
00043 BR_ORG_INFO,
00044 BR_ORG_CREATE,
00045 BR_ORG_UPDATE,
00046 BR_ORG_PANDATA,
00047 BR_DOMAIN_CHECK = 40,
00048 BR_DOMAIN_INFO,
00049 BR_DOMAIN_CREATE,
00050 BR_DOMAIN_RENEW,
00051 BR_DOMAIN_UPDATE,
00052 BR_DOMAIN_PANDATA
00053 };
00054
00056 class AuthInfo {
00057 public:
00058 AuthInfo& operator=(const AuthInfo &authInfo) {
00059 _roid = authInfo._roid;
00060 _roid_f = authInfo._roid_f;
00061 _pw = authInfo._pw;
00062 _pw_f = authInfo._pw_f;
00063 return *this;
00064 }
00065
00067 AuthInfo()
00068 {
00069 this->reset();
00070 }
00071
00073
00076 void set_roid(string roid)
00077 {
00078 _roid = roid;
00079 if (roid != "") {
00080 _roid_f = true;
00081 }
00082 }
00083
00085
00088 string get_roid() { return _roid; }
00089
00091
00094 bool get_roid_f()
00095 {
00096 return _roid_f;
00097 }
00098
00100
00103 void set_pw(string pw)
00104 {
00105 _pw = pw;
00106 _pw_f = true;
00107 }
00108
00110
00113 string get_pw() { return _pw; }
00114
00116
00119 bool get_pw_f()
00120 {
00121 return _pw_f;
00122 }
00123
00125 void reset()
00126 {
00127 _roid = "";
00128 _roid_f = false;
00129 _pw = "";
00130 _pw_f = false;
00131 }
00132
00133 protected:
00135 string _roid;
00136
00138 bool _roid_f;
00139
00141 string _pw;
00142
00144 bool _pw_f;
00145
00146 };
00147
00148 struct NSIPAddr {
00149 string version;
00150 string addr;
00151 bool operator<(const NSIPAddr &ip) const {
00152 return addr < ip.addr;
00153 }
00154 };
00155
00156 struct NameServer {
00157 string name;
00158 set<NSIPAddr> ips;
00159 bool operator<(const NameServer &n) const {
00160 return name < n.name;
00161 }
00162 };
00163
00165 class PostalInfo {
00166 public:
00167 PostalInfo() {
00168 this->reset();
00169 }
00170
00171 void reset() {
00172 _type_f = false;
00173 _name_f = false;
00174 _org_f = false;
00175 _str1_f = false;
00176 _str2_f = false;
00177 _str3_f = false;
00178 _city_f = false;
00179 _sp_f = false;
00180 _pc_f = false;
00181 _cc_f = false;
00182 }
00183
00184 string get_type()
00185 {
00186 return _type;
00187 }
00188
00189 void set_type(string type)
00190 {
00191 _type = type;
00192 _type_f = true;
00193 }
00194
00195 string get_name()
00196 {
00197 return _name;
00198 }
00199
00200 void set_name(string name)
00201 {
00202 _name = name;
00203 _name_f = true;
00204 }
00205
00206 string get_org()
00207 {
00208 return _org;
00209 }
00210
00211 void set_org(string org)
00212 {
00213 _org = org;
00214 _org_f = true;
00215 }
00216
00217 string get_str1()
00218 {
00219 return _str1;
00220 }
00221
00222 void set_str1(string str1)
00223 {
00224 _str1 = str1;
00225 _str1_f = true;
00226 }
00227
00228 string get_str2()
00229 {
00230 return _str2;
00231 }
00232
00233 void set_str2(string str2)
00234 {
00235 _str2 = str2;
00236 _str2_f = true;
00237 }
00238
00239 string get_str3()
00240 {
00241 return _str3;
00242 }
00243
00244 void set_str3(string str3)
00245 {
00246 _str3 = str3;
00247 _str3_f = true;
00248 }
00249
00250 string get_city()
00251 {
00252 return _city;
00253 }
00254
00255 void set_city(string city)
00256 {
00257 _city = city;
00258 _city_f = true;
00259 }
00260
00261 string get_sp()
00262 {
00263 return _sp;
00264 }
00265
00266 void set_sp(string sp)
00267 {
00268 _sp = sp;
00269 _sp_f = true;
00270 }
00271
00272 string get_pc()
00273 {
00274 return _pc;
00275 }
00276
00277 void set_pc(string pc)
00278 {
00279 _pc = pc;
00280 _pc_f = true;
00281 }
00282
00283 string get_cc()
00284 {
00285 return _cc;
00286 }
00287
00288 void set_cc(string cc)
00289 {
00290 _cc = cc;
00291 _cc_f = true;
00292 }
00293
00294 bool get_type_f()
00295 {
00296 return _type_f;
00297 }
00298
00299 bool get_name_f()
00300 {
00301 return _name_f;
00302 }
00303
00304 bool get_org_f()
00305 {
00306 return _org_f;
00307 }
00308
00309 bool get_str1_f()
00310 {
00311 return _str1_f;
00312 }
00313
00314 bool get_str2_f()
00315 {
00316 return _str2_f;
00317 }
00318
00319 bool get_str3_f()
00320 {
00321 return _str3_f;
00322 }
00323
00324 bool get_city_f()
00325 {
00326 return _city_f;
00327 }
00328
00329 bool get_sp_f()
00330 {
00331 return _sp_f;
00332 }
00333
00334 bool get_pc_f()
00335 {
00336 return _pc_f;
00337 }
00338
00339 bool get_cc_f()
00340 {
00341 return _cc_f;
00342 }
00343
00344 private:
00345
00346 bool _type_f;
00347 bool _name_f;
00348 bool _org_f;
00349 bool _str1_f;
00350 bool _str2_f;
00351 bool _str3_f;
00352 bool _city_f;
00353 bool _sp_f;
00354 bool _pc_f;
00355 bool _cc_f;
00356
00357
00358 string _type;
00359 string _name;
00360 string _org;
00361 string _str1;
00362 string _str2;
00363 string _str3;
00364 string _city;
00365 string _sp;
00366 string _pc;
00367 string _cc;
00368 };
00369
00371 class CommonData
00372 {
00373 public:
00374
00375 struct Disclose {
00376 int flag;
00377
00378 bool name_int;
00379 bool name_loc;
00380 bool org_int;
00381 bool org_loc;
00382 bool addr_int;
00383 bool addr_loc;
00384 bool voice;
00385 bool fax;
00386 bool email;
00387
00388 Disclose() {
00389 flag = -1;
00390 name_int = false;
00391 name_loc = false;
00392 org_int = false;
00393 org_loc = false;
00394 addr_int = false;
00395 addr_loc = false;
00396 voice = false;
00397 fax = false;
00398 email = false;
00399 }
00400
00401 bool is_set() {
00402 return ((flag == 0 || flag == 1) &&
00403 (name_int || name_loc || org_int || org_loc || addr_int ||
00404 addr_loc || voice || fax || email));
00405 }
00406 };
00407
00408 struct Phone {
00409 string ext;
00410 string number;
00411 };
00412
00414 CommonData()
00415 {
00416 this->reset();
00417 }
00418
00420
00423 void set_id(const string &id);
00424
00426
00429 void insert_postal_info(const PostalInfo& postal_info);
00430
00432
00435 void set_voice(const Phone& voice);
00436
00438
00441 void set_fax(const Phone& fax);
00442
00444
00447 void set_email(const string &email);
00448
00450
00453 void set_disclose(const Disclose &disclose);
00454
00456
00459 string get_id();
00460
00462
00465 vector<PostalInfo> get_postal_info();
00466
00468
00471 Phone get_voice();
00472
00474
00477 bool get_voice_f()
00478 {
00479 return _voice_f;
00480 }
00481
00483
00486 Phone get_fax();
00487
00489
00492 bool get_fax_f()
00493 {
00494 return _fax_f;
00495 }
00496
00498
00501 string get_email();
00502
00504
00507 bool get_email_f()
00508 {
00509 return _email_f;
00510 }
00511
00513
00516 Disclose get_disclose();
00517
00519 void reset();
00520
00521 protected:
00522
00524 string _id;
00525
00527 vector<PostalInfo> _postal_info;
00528
00530 Phone _voice;
00531
00533 bool _voice_f;
00534
00536 Phone _fax;
00537
00539 bool _fax_f;
00540
00542 string _email;
00543
00545 bool _email_f;
00546
00548 Disclose _disclose;
00549 };
00550
00551 LIBEPP_NICBR_NS_END
00552 #endif //__COMMON_DATA_H__