From: Daniel M. <tub...@us...> - 2003-06-02 21:24:29
|
Update of /cvsroot/epp-rtk/epp-rtk/c++/src In directory sc8-pr-cvs1:/tmp/cvs-serv29895 Modified Files: main_hostcheck.cc main_hostcreate.cc main_hostdelete.cc main_hostinfo.cc main_hostupdate.cc testTools.cc Log Message: bringing host check, info, create, update and delete uptodate with current param methods. make getExtraDataMap() optionally use "~" as a key/value pair separator to allow for ":" in ipv6 strings Index: main_hostcheck.cc =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/c++/src/main_hostcheck.cc,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** main_hostcheck.cc 28 Apr 2003 20:50:32 -0000 1.12 --- main_hostcheck.cc 2 Jun 2003 21:24:25 -0000 1.13 *************** *** 26,29 **** --- 26,31 ---- ************************************************************************/ + /* $Header$ */ + #include <vector> #include <iostream> *************** *** 90,104 **** string username, password; ! if(!handleArgs(test, argc, argv, username, password)) return 1; ! map<unsigned int,string> testDataMap; if(argc > 1) { for(int parm = 1; parm < argc; parm++) { ! if (!strncmp(argv[parm], "-testdata=", 10)) { ! string td = &argv[parm][10]; ! testDataMap = getTestDataMap(td); } } --- 92,108 ---- string username, password; ! string extra_usage = "[-extradata=trid=xxx:name1=abc:name2=def:...]"; ! if(!handleArgs(test, argc, argv, username, password, extra_usage)) return 1; ! map<string,string> extraDataMap; if(argc > 1) { for(int parm = 1; parm < argc; parm++) { ! if (!strncmp(argv[parm], "-extradata=", 11)) { ! cout << "Found extra data param..." << endl; ! string td = &argv[parm][11]; ! extraDataMap = getExtraDataMap(td); } } *************** *** 112,117 **** string trID; ! if(testDataMap.empty()) trID = "ABC-12345"; ! else trID = testDataMap[1]; l_req->m_cmd.ref(new epp_Command(NULL, --- 116,121 ---- string trID; ! if(extraDataMap.find("trid") == extraDataMap.end()) trID = "ABC-12345"; ! else trID = extraDataMap["trid"]; l_req->m_cmd.ref(new epp_Command(NULL, *************** *** 121,125 **** epp_string_seq_ref names(new epp_string_seq()); ! if(testDataMap.empty()) { names->push_back("ns1.example.com"); names->push_back("ns2.example.com"); --- 125,129 ---- epp_string_seq_ref names(new epp_string_seq()); ! if(extraDataMap.find("name1") == extraDataMap.end()) { names->push_back("ns1.example.com"); names->push_back("ns2.example.com"); *************** *** 127,132 **** } else { ! for(unsigned int n = 2; n <= testDataMap.size(); n++) { ! names->push_back(testDataMap[n]); } } --- 131,139 ---- } else { ! char key[7]; ! for(unsigned int n = 1; n <= 30; n++) { ! sprintf(key,"name%d",n); ! if ( extraDataMap[key].empty() ) break; ! names->push_back(extraDataMap[key]); } } Index: main_hostcreate.cc =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/c++/src/main_hostcreate.cc,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** main_hostcreate.cc 28 Apr 2003 20:50:33 -0000 1.14 --- main_hostcreate.cc 2 Jun 2003 21:24:25 -0000 1.15 *************** *** 26,29 **** --- 26,31 ---- ************************************************************************/ + /* $Header$ */ + #include <vector> #include <iostream> *************** *** 76,90 **** string username, password; ! if(!handleArgs(test, argc, argv, username, password)) return 1; ! ! map<unsigned int,string> testDataMap; if(argc > 1) { for(int parm = 1; parm < argc; parm++) { ! if (!strncmp(argv[parm], "-testdata=", 10)) { ! string td = &argv[parm][10]; ! testDataMap = getTestDataMap(td); } } --- 78,94 ---- string username, password; ! string extra_usage = "[-extradata=trid=xxx~name=abc~ip1=v4/1.2.3.4~ip2=v6/1080:0:0:0:8:800:200C:417A{~...}]"; ! if(!handleArgs(test, argc, argv, username, password, extra_usage)) return 1; ! ! map<string,string> extraDataMap; if(argc > 1) { for(int parm = 1; parm < argc; parm++) { ! if (!strncmp(argv[parm], "-extradata=", 11)) { ! cout << "Found extra data param..." << endl; ! string td = &argv[parm][11]; ! extraDataMap = getExtraDataMap(td); } } *************** *** 98,103 **** string trID; ! if(testDataMap.empty()) trID = "ABC-12345"; ! else trID = testDataMap[1]; l_req->m_cmd.ref(new epp_Command(NULL, --- 102,107 ---- string trID; ! if(extraDataMap.find("trid") == extraDataMap.end()) trID = "ABC-12345"; ! else trID = extraDataMap["trid"]; l_req->m_cmd.ref(new epp_Command(NULL, *************** *** 105,109 **** epp_trid(trID))); ! if(testDataMap.empty()) { epp_HostAddress host1(IPV4, epp_string("192.1.2.3")); epp_HostAddress host2(IPV4, epp_string("198.1.2.3")); --- 109,119 ---- epp_trid(trID))); ! if ( extraDataMap.find("name") == extraDataMap.end() ) { ! l_req->m_name.ref(new epp_string("ns1.example.com")); ! } else { ! l_req->m_name.ref(new epp_string(extraDataMap["name"])); ! } ! ! if ( extraDataMap.find("ip1") == extraDataMap.end() ) { epp_HostAddress host1(IPV4, epp_string("192.1.2.3")); epp_HostAddress host2(IPV4, epp_string("198.1.2.3")); *************** *** 118,146 **** ipadr->push_back(host4); - l_req->m_name.ref(new epp_string("ns1.example.com")); l_req->m_addresses = ipadr; ! } ! else { ! if(testDataMap[2] != "-1") l_req->m_name.ref(new epp_string(testDataMap[2])); ! if(!testDataMap[3].empty()) { ! epp_host_address_seq_ref ipadr(new epp_host_address_seq); ! ! for(unsigned int n = 3; n <= testDataMap.size(); n++) { ! ! string::size_type space = testDataMap[n].find(" "); ! ! if(space != string::npos) { ! string ip = testDataMap[n].substr(0,space); ! string iptype = testDataMap[n].substr(space+1, testDataMap[n].length()); ! ! epp_HostAddress host(returnIPTypeEnum(epp_string(iptype)), epp_string(ip)); ! ipadr->push_back(host); ! } } - - l_req->m_addresses = ipadr; } } --- 128,153 ---- ipadr->push_back(host4); l_req->m_addresses = ipadr; ! } else { ! epp_host_address_seq_ref ipadr(new epp_host_address_seq); ! char key[5]; ! for(unsigned int n = 1; n <= 14; n++) { ! ! sprintf(key,"ip%d",n); ! if ( extraDataMap.find(key) == extraDataMap.end() ) break; ! string ipstring = extraDataMap[key]; ! if ( ipstring == "-1" ) break; ! unsigned int sep = ipstring.find("/"); ! if(sep != string::npos) { ! string iptype = ipstring.substr(0,sep); ! string ip = ipstring.substr(sep+1); ! epp_HostAddress host(returnIPTypeEnum(epp_string(iptype)), epp_string(ip)); ! ipadr->push_back(host); } } + + l_req->m_addresses = ipadr; } Index: main_hostdelete.cc =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/c++/src/main_hostdelete.cc,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** main_hostdelete.cc 28 Apr 2003 20:50:34 -0000 1.12 --- main_hostdelete.cc 2 Jun 2003 21:24:25 -0000 1.13 *************** *** 26,29 **** --- 26,31 ---- ************************************************************************/ + /* $Header$ */ + #include <string> #include <iostream> *************** *** 60,74 **** string username, password; ! if(!handleArgs(test, argc, argv, username, password)) return 1; ! map<unsigned int,string> testDataMap; if(argc > 1) { for(int parm = 1; parm < argc; parm++) { ! if (!strncmp(argv[parm], "-testdata=", 10)) { ! string td = &argv[parm][10]; ! testDataMap = getTestDataMap(td); } } --- 62,78 ---- string username, password; ! string extra_usage = "[-extradata=trid=xxx:name=abc]"; ! if(!handleArgs(test, argc, argv, username, password, extra_usage)) return 1; ! map<string,string> extraDataMap; if(argc > 1) { for(int parm = 1; parm < argc; parm++) { ! if (!strncmp(argv[parm], "-extradata=", 11)) { ! cout << "Found extra data param..." << endl; ! string td = &argv[parm][11]; ! extraDataMap = getExtraDataMap(td); } } *************** *** 82,87 **** string trID; ! if(testDataMap.empty()) trID = "ABC-12345"; ! else trID = testDataMap[1]; l_req->m_cmd.ref(new epp_Command(NULL, --- 86,91 ---- string trID; ! if(extraDataMap.find("trid") == extraDataMap.end()) trID = "ABC-12345"; ! else trID = extraDataMap["trid"]; l_req->m_cmd.ref(new epp_Command(NULL, *************** *** 89,97 **** epp_trid(trID))); ! if(testDataMap.empty()) { l_req->m_name.ref(new epp_string("ns1.example.com")); } else { ! l_req->m_name.ref(new epp_string(testDataMap[2])); } --- 93,101 ---- epp_trid(trID))); ! if(extraDataMap.find("name") == extraDataMap.end()) { l_req->m_name.ref(new epp_string("ns1.example.com")); } else { ! l_req->m_name.ref(new epp_string(extraDataMap["name"])); } Index: main_hostinfo.cc =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/c++/src/main_hostinfo.cc,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** main_hostinfo.cc 28 Apr 2003 20:50:35 -0000 1.13 --- main_hostinfo.cc 2 Jun 2003 21:24:25 -0000 1.14 *************** *** 26,29 **** --- 26,31 ---- ************************************************************************/ + /* $Header$ */ + #include <string> #include <iostream> *************** *** 131,145 **** string username, password; ! if(!handleArgs(test, argc, argv, username, password)) return 1; ! ! map<unsigned int,string> testDataMap; if(argc > 1) { for(int parm = 1; parm < argc; parm++) { ! if (!strncmp(argv[parm], "-testdata=", 10)) { ! string td = &argv[parm][10]; ! testDataMap = getTestDataMap(td); } } --- 133,149 ---- string username, password; ! string extra_usage = "[-extradata=trid=xxx:name=abc]"; ! if(!handleArgs(test, argc, argv, username, password, extra_usage)) return 1; ! ! map<string,string> extraDataMap; if(argc > 1) { for(int parm = 1; parm < argc; parm++) { ! if (!strncmp(argv[parm], "-extradata=", 11)) { ! cout << "Found extra data param..." << endl; ! string td = &argv[parm][11]; ! extraDataMap = getExtraDataMap(td); } } *************** *** 153,158 **** string trID; ! if(testDataMap.empty()) trID = "ABC-12345"; ! else trID = testDataMap[1]; l_req->m_cmd.ref(new epp_Command(NULL, --- 157,162 ---- string trID; ! if(extraDataMap.find("trid") == extraDataMap.end()) trID = "ABC-12345"; ! else trID = extraDataMap["trid"]; l_req->m_cmd.ref(new epp_Command(NULL, *************** *** 160,168 **** epp_trid(trID))); ! if(testDataMap.empty()) { l_req->m_name.ref(new epp_string("ns1.example.com")); } else { ! l_req->m_name.ref(new epp_string(testDataMap[2])); } --- 164,172 ---- epp_trid(trID))); ! if(extraDataMap.find("name") == extraDataMap.end()) { l_req->m_name.ref(new epp_string("ns1.example.com")); } else { ! l_req->m_name.ref(new epp_string(extraDataMap["name"])); } Index: main_hostupdate.cc =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/c++/src/main_hostupdate.cc,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** main_hostupdate.cc 28 Apr 2003 20:50:35 -0000 1.14 --- main_hostupdate.cc 2 Jun 2003 21:24:25 -0000 1.15 *************** *** 26,29 **** --- 26,31 ---- ************************************************************************/ + /* $Header$ */ + #include <vector> #include <iostream> Index: testTools.cc =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/c++/src/testTools.cc,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** testTools.cc 2 Jun 2003 20:37:50 -0000 1.23 --- testTools.cc 2 Jun 2003 21:24:25 -0000 1.24 *************** *** 473,481 **** string tmpstring = extradata; cout << "The entire extradata string is ["<<tmpstring<<"]" << endl; if(tmpstring.length() > 0) { unsigned int end = 1; ! while((end = tmpstring.find(':')) != string::npos) { string tmp = tmpstring.substr(0,end); --- 473,487 ---- string tmpstring = extradata; + string sep = ":"; + // how's this for a hack -- use ":" for the separator, + // unless there are ~'s in the string, then use that + // instead -- only because in the host examples, the IPV6 + // addresses contain ":" characters. + if ( tmpstring.find('~') != string::npos ) sep = "~"; cout << "The entire extradata string is ["<<tmpstring<<"]" << endl; if(tmpstring.length() > 0) { unsigned int end = 1; ! while((end = tmpstring.find(sep)) != string::npos) { string tmp = tmpstring.substr(0,end); |