DomainPlug-insDocumentation
|
#include "eppxml.h" #include "epptcpssl.h" using namespace STLRT; int main (void) { Log::Entry log("[${DATETIME} TEST TR${TRID} ${LVL}]", Log::cout); log.prefix["TRID"] = "123"; /* * Inside a container use log()/ths->log() to get instance */ EPPXML* eppxml = new EPPXML(log); //1) -------------------- Login Form -------------------- eppxml->FormLogin("<TheLogin>", "<ThePassword>"); cout << "LOGIN=" << eppxml->getXML() << endl; //2) -------------------- Logout Form -------------------- eppxml->FormLogout(); cout << "LOGOUT=" << eppxml->getXML() << endl; //3) -------------------- Check Contacts -------------------- list <Str> cids; cids.push_back("<contact_id_1>"); cids.push_back("<contact_id_2>"); eppxml->FormCheckContact(cids); cout << "FormCheckContac=" << eppxml->getXML() << endl; //4) -------------------- Create Contact -------------------- struct EPPContact CI; CI.ID="UniqueID"; CI.Name = "John Smith"; CI.AddrStreet = "1st Ally Street"; CI.AddrCC = "RU"; CI.Voice = "+79879879877"; CI.Email = "test@domain.com"; CI.Password = "1q2w3e"; eppxml->FormCreateContactLoc(CI); cout << "CREATECONTACT=" << eppxml->getXML() << endl; //5) -------------------- Check Domain -------------------- list<Str> domains; domains.push_back("test1.com"); domains.push_back("test2.com"); eppxml->FormCheckDomain(domains); cout << "CHECKDOMAIN=" << eppxml->getXML() << endl; // 6) -------------------- Create Domain -------------------- // 6.1) contacts map<Str, Str> contacts; contacts.insert(pair<Str,Str>("owner", "HANDLE-OWNER")); contacts.insert(pair<Str,Str>("tech", "HANDLE-TECH")); contacts.insert(pair<Str,Str>("bill", "HANDLE-BILL")); // 6.2) name servers EPPNS a_ns1; EPPNS a_ns2; a_ns1.hostName = "ns1.qar.sw.ru"; a_ns2.hostName = "ns2.qar.sw.ru"; list<EPPNS> nses; nses.push_back(a_ns1); nses.push_back(a_ns2); int iPeriod = 1; Str sPassword = "password"; eppxml->FormCreateDomain("test.com", iPeriod, contacts, sPassword, nses); cout << "CREATEDOMAIN=" << eppxml->getXML() << endl; //eppxml->ParseCreateDomain(Str(CREATEDOMAIN_EXAMPLE)); // 7) -------------------- Get Domain Info ------------------------------- eppxml->FormInfoDomain("test.com"); cout << "INFODOMAIN=" << eppxml->getXML() << endl; //eppxml->ParseInfoDomain(Str(INFODOMAIN_EXAMPLE)); //8) --------------------- Update Domain ---------------------------------- //8.1) Name Servers EPPNS ns1, ns2, ns3, ns4; ns1.hostName = "ns1.qar.sw.ru"; ns2.hostName = "ns2.qar.sw.ru"; ns3.hostName = "ns3.qar.sw.ru"; ns4.hostName = "ns4.qar.sw.ru"; list<EPPNS> old_nses; old_nses.push_back(ns1); old_nses.push_back(ns2); old_nses.push_back(ns3); list<EPPNS> new_nses; new_nses.push_back(ns2); new_nses.push_back(ns3); new_nses.push_back(ns4); //8.2) Contacts map<Str, Str> old_contacts; old_contacts.insert(pair<Str, Str> ("tech", "HANDLE-XXX")); old_contacts.insert(pair<Str, Str> ("bill", "HANDLE-XXX")); map<Str, Str> new_contacts; new_contacts.insert(pair<Str, Str> ("tech", "HANDLE-YYY")); new_contacts.insert(pair<Str, Str> ("bill", "HANDLE-XXX")); eppxml->FormUpdateDomain("parallels.com", old_nses, new_nses, old_contacts, new_contacts); cout << "UPDATEDOMAIN=" << eppxml->getXML() << endl; //eppxml->ParseInfoDomain(Str(INFODOMAIN_EXAMPLE)); // 9) ---------------------- Renew Domain ---------------------- iPeriod = 3; Str sExpDate = "2008-04-03"; eppxml->FormRenewDomain("test.com", "2008-04-03", 3); cout << "RENEWDOMAIN=" << eppxml->getXML() << endl; // 10) ---------------------- Transfer Domain ---------------------- eppxml->FormTransferDomain("test.com", "<passwd>"); cout << "TRANSFERDOMAIN=" << eppxml->getXML() << endl; // 11) ---------------------- Delete Domain ---------------------- eppxml->FormDeleteDomain("parallels.com"); cout << "DELETEDOMAIN=" << eppxml->getXML() << endl; // 12) ---------------------- Transport ---------------------- map<Str,Str> params_extension; int iPort = 0; EPPTCPSSL transport("<conf.Host>", iPort, "<login>", "<password>", eppxml/*Some concrete Form*/, params_extension); transport.send(); Str sResult = transport.recv(); cout << "Response" << sResult << endl; return 1; }