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 CONTACT_CHECK = 10,
00030 CONTACT_CREATE,
00031 CONTACT_INFO,
00032 CONTACT_TRANSFER,
00033 CONTACT_UPDATE,
00034 DOMAIN_CHECK = 20,
00035 DOMAIN_CREATE,
00036 DOMAIN_INFO,
00037 DOMAIN_RENEW,
00038 DOMAIN_UPDATE,
00039 BR_DOMAIN_CHECK = 30,
00040 BR_DOMAIN_INFO,
00041 BR_DOMAIN_CREATE,
00042 BR_DOMAIN_UPDATE,
00043 BR_ORG_CHECK = 40,
00044 BR_ORG_INFO,
00045 BR_ORG_CREATE,
00046 BR_ORG_UPDATE,
00047 DOMAIN_PANDATA = 50,
00048 CONTACT_PANDATA,
00049 BR_ORG_PANDATA = 60
00050 };
00051
00053 class AuthInfo {
00054 public:
00055 AuthInfo& operator=(const AuthInfo &authInfo) {
00056 _roid = authInfo._roid;
00057 _pw = authInfo._pw;
00058 return *this;
00059 }
00060
00062 AuthInfo()
00063 {
00064 this->reset();
00065 }
00066
00068
00071 void set_roid(string roid) { _roid = roid; }
00072
00074
00077 string get_roid() { return _roid; }
00078
00080
00083 void set_pw(string pw) { _pw = pw; }
00084
00086
00089 string get_pw() { return _pw; }
00090
00092 void reset()
00093 {
00094 _roid = "";
00095 _pw = "";
00096 }
00097
00098 protected:
00100 string _roid;
00101
00103 string _pw;
00104 };
00105
00106 struct NSIPAddr {
00107 string version;
00108 string addr;
00109 bool operator<(const NSIPAddr &ip) const {
00110 return addr < ip.addr;
00111 }
00112 };
00113
00114 struct NameServer {
00115 string name;
00116 set<NSIPAddr> ips;
00117 bool operator<(const NameServer &n) const {
00118 return name < n.name;
00119 }
00120 };
00121
00123 class CommonData
00124 {
00125 public:
00126
00127 struct PostalInfo {
00128 string type;
00129 string name;
00130 string org;
00131 string str1;
00132 string str2;
00133 string str3;
00134 string city;
00135 string sp;
00136 string pc;
00137 string cc;
00138 };
00139
00140 struct Disclose {
00141 bool flag;
00142 bool name_int;
00143 bool name_loc;
00144 bool org_int;
00145 bool org_loc;
00146 bool addr_int;
00147 bool addr_loc;
00148 bool voice;
00149 bool fax;
00150 bool email;
00151 Disclose() {
00152 flag = false;
00153 name_int = false;
00154 name_loc = false;
00155 org_int = false;
00156 org_loc = false;
00157 addr_int = false;
00158 addr_loc = false;
00159 voice = false;
00160 fax = false;
00161 email = false;
00162 }
00163
00164 bool is_set() {
00165 return (name_int || name_loc || org_int || org_loc || addr_int ||
00166 addr_loc || voice || fax || email);
00167 }
00168 };
00169
00170 struct Phone {
00171 string ext;
00172 string number;
00173 };
00174
00175
00177 CommonData() {}
00178
00180
00183 void set_id(const string &id);
00184
00186
00189 void insert_postal_info(const PostalInfo& postal_info);
00190
00192
00195 void set_voice(const Phone& voice);
00196
00198
00201 void set_fax(const Phone& fax);
00202
00204
00207 void set_email(const string &email);
00208
00210
00213 void set_disclose(const Disclose &disclose);
00214
00216
00219 string get_id();
00220
00222
00225 vector<PostalInfo> get_postal_info();
00226
00228
00231 Phone get_voice();
00232
00234
00237 Phone get_fax();
00238
00240
00243 string get_email();
00244
00246
00249 Disclose get_disclose();
00250
00252 void reset();
00253
00254 protected:
00255
00257 string _id;
00258
00260 vector<PostalInfo> _postal_info;
00261
00263 Phone _voice;
00264
00266 Phone _fax;
00267
00269 string _email;
00270
00272 Disclose _disclose;
00273 };
00274
00275 LIBEPP_NICBR_NS_END
00276 #endif //__COMMON_DATA_H__