This commit is contained in:
parent
1019546b94
commit
d9ec3a171b
|
@ -79,6 +79,7 @@ include $(foreach name,$(srcs_all),$(basename $(name)).d)
|
||||||
|
|
||||||
vpath %.cpp ./ \
|
vpath %.cpp ./ \
|
||||||
./se\
|
./se\
|
||||||
|
.OTE \
|
||||||
./se/secDNS\
|
./se/secDNS\
|
||||||
./xml\
|
./xml\
|
||||||
./common\
|
./common\
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
#ifndef __LPE_CHECK_COMMAND_HPP
|
||||||
|
#define __LPE_CHECK_COMMAND_HPP
|
||||||
|
|
||||||
|
#include "se/CheckCommand.hpp"
|
||||||
|
#include "se/StandardObjectType.hpp"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A LPECheckCommand is used to check the availability of domain objects
|
||||||
|
* in a Registry. Instances of this class generate RFC3730 and RFC3731
|
||||||
|
* compliant domain check EPP command service elements via the toXML method.
|
||||||
|
*
|
||||||
|
* @see LPECheckResponse
|
||||||
|
*/
|
||||||
|
class LPECheckCommand : public CheckCommand
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Check the availability of the single identified domain.
|
||||||
|
*
|
||||||
|
* @param name The name of the domain to check the availability of.
|
||||||
|
*/
|
||||||
|
LPECheckCommand (const std::string &name)
|
||||||
|
: CheckCommand (StandardObjectType::DOMAIN(), name) {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check the availability of at least one domain.
|
||||||
|
*
|
||||||
|
* @param names The names of the domains to check the availability of.
|
||||||
|
*/
|
||||||
|
LPECheckCommand (std::vector<std::string> &names)
|
||||||
|
: CheckCommand (StandardObjectType::DOMAIN(), names) {};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __DOMAIN_CHECK_COMMAND_HPP
|
|
@ -0,0 +1,31 @@
|
||||||
|
#include "common/init.hpp"
|
||||||
|
#include "common/Test.hpp"
|
||||||
|
#include "se/CLTRID.hpp"
|
||||||
|
#include "se/LPECheckCommand.hpp"
|
||||||
|
#include "session/Timer.hpp"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
void doWork()
|
||||||
|
{
|
||||||
|
init("/home/drde/etc/toolkit2.conf");
|
||||||
|
{
|
||||||
|
CLTRID::setClID("JTKUTEST");
|
||||||
|
Timer::setTime("20070101.010101");
|
||||||
|
|
||||||
|
LPECheckCommand cmd("test.com.au");
|
||||||
|
const string xml(cmd.toXML());
|
||||||
|
|
||||||
|
ASSERT_EQ(cmd.getCommandType()->getCommandName(), "check");
|
||||||
|
ASSERT_EQ(cmd.getObjectType()->getName(), "domain");
|
||||||
|
ASSERT_EQ(xml, "<?xml version=\"1.0\" encoding=\"UTF-8\"?><epp xmlns=\"urn:ietf:params:xml:ns:epp-1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd\"><command><check><check xmlns=\"urn:ietf:params:xml:ns:domain-1.0\" xsi:schemaLocation=\"urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd\"><name>test.com.au</name></check></check><clTRID>JTKUTEST.20070101.010101.0</clTRID></command></epp>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
TEST_run(doWork);
|
||||||
|
return TEST_errorCount();
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
#include "se/LPECheckResponse.hpp"
|
||||||
|
#include "common/StringUtils.hpp"
|
||||||
|
#include "se/StandardObjectType.hpp"
|
||||||
|
|
||||||
|
const std::string& LPECheckResponse::DOM_CHKDATA_COUNT_EXPR()
|
||||||
|
{
|
||||||
|
static const std::string expr = LPECheckResponse::exprReplace (CheckResponse::CHKDATA_COUNT_EXPR());
|
||||||
|
return expr;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string& LPECheckResponse::DOM_CHKDATA_IND_EXPR()
|
||||||
|
{
|
||||||
|
static const std::string expr = LPECheckResponse::exprReplace (CheckResponse::CHKDATA_IND_EXPR());
|
||||||
|
return expr;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string& LPECheckResponse::DOM_CHKDATA_IDENT_EXPR()
|
||||||
|
{
|
||||||
|
static const std::string expr = LPECheckResponse::exprReplace (CheckResponse::CHKDATA_IDENT_EXPR());
|
||||||
|
return expr;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string& LPECheckResponse::DOM_CHKDATA_AVAIL_EXPR()
|
||||||
|
{
|
||||||
|
static const std::string expr = LPECheckResponse::exprReplace (CheckResponse::CHKDATA_AVAIL_EXPR());
|
||||||
|
return expr;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string& LPECheckResponse::DOM_CHKDATA_REASON_EXPR()
|
||||||
|
{
|
||||||
|
static const std::string expr = LPECheckResponse::exprReplace (CheckResponse::CHKDATA_REASON_EXPR());
|
||||||
|
return expr;
|
||||||
|
}
|
||||||
|
|
||||||
|
LPECheckResponse::LPECheckResponse()
|
||||||
|
: CheckResponse (StandardObjectType::DOMAIN())
|
||||||
|
{ }
|
||||||
|
|
||||||
|
std::string LPECheckResponse::exprReplace (const std::string &expr)
|
||||||
|
{
|
||||||
|
return StringUtils::replaceAll(
|
||||||
|
StringUtils::replaceAll(
|
||||||
|
expr,
|
||||||
|
DataResponse::OBJ(),
|
||||||
|
StandardObjectType::DOMAIN()->getName()),
|
||||||
|
"IDENT",
|
||||||
|
"name");
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
#ifndef __LPE_CHECK_RESPONSE_HPP
|
||||||
|
#define __LPE_CHECK_RESPONSE_HPP
|
||||||
|
|
||||||
|
#include "se/CheckResponse.hpp"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this to access availability data for domains as provided in an EPP
|
||||||
|
* domain check response compliant with RFCs 3730 and 3731. Such a service
|
||||||
|
* element is sent by a compliant EPP server in response to a valid domain
|
||||||
|
* check command, implemented by the DomainCheckCommand class.
|
||||||
|
*
|
||||||
|
* @see DomainCheckCommand
|
||||||
|
*/
|
||||||
|
class DomainCheckResponse : public CheckResponse
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DomainCheckResponse ();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
const std::string& chkDataCountExpr() const { return DOM_CHKDATA_COUNT_EXPR(); };
|
||||||
|
const std::string& chkDataIndexExpr() const { return DOM_CHKDATA_IND_EXPR(); };
|
||||||
|
const std::string& chkDataTextExpr() const { return DOM_CHKDATA_IDENT_EXPR(); };
|
||||||
|
const std::string& chkDataAvailExpr() const { return DOM_CHKDATA_AVAIL_EXPR(); };
|
||||||
|
const std::string& chkDataReasonExpr() const { return DOM_CHKDATA_REASON_EXPR(); };
|
||||||
|
|
||||||
|
static std::string exprReplace (const std::string &expr);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const std::string& DOM_CHKDATA_COUNT_EXPR();
|
||||||
|
static const std::string& DOM_CHKDATA_IND_EXPR();
|
||||||
|
static const std::string& DOM_CHKDATA_IDENT_EXPR();
|
||||||
|
static const std::string& DOM_CHKDATA_AVAIL_EXPR();
|
||||||
|
static const std::string& DOM_CHKDATA_REASON_EXPR();
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif // __DOMAIN_CHECK_RESPONSE_HPP
|
|
@ -0,0 +1,37 @@
|
||||||
|
#include "se/LPECheckResponse.hpp"
|
||||||
|
// #include "session/TestEnvironment.hpp"
|
||||||
|
#include "xml/XMLParser.hpp"
|
||||||
|
#include "xml/XMLDocument.hpp"
|
||||||
|
|
||||||
|
#include "common/init.hpp"
|
||||||
|
#include "common/Test.hpp"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
void doWork()
|
||||||
|
{
|
||||||
|
init("/home/drde/etc/toolkit2.conf");
|
||||||
|
|
||||||
|
const string xml =
|
||||||
|
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><epp xmlns=\"urn:ietf:params:xml:ns:epp-1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd\"><response><result code=\"1000\"><msg>Command completed successfully</msg></result><resData><domain:chkData xmlns:domain=\"urn:ietf:params:xml:ns:domain-1.0\" xsi:schemaLocation=\"urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd\"><domain:cd><domain:name avail=\"1\">example.com</domain:name></domain:cd><domain:cd><domain:name avail=\"0\">example.net</domain:name><domain:reason>In use</domain:reason></domain:cd><domain:cd><domain:name avail=\"1\">example.org</domain:name></domain:cd></domain:chkData></resData><trID><clTRID>ABC-12345</clTRID><svTRID>54322-XYZ</svTRID></trID></response></epp>";
|
||||||
|
XMLParser parser;
|
||||||
|
auto_ptr<XMLDocument> doc(parser.parse(xml));
|
||||||
|
LPECheckResponse response;
|
||||||
|
response.fromXML(doc.get());
|
||||||
|
|
||||||
|
ASSERT_EQ(response.isAvailable("example.com"), true);
|
||||||
|
ASSERT_EQ(response.getReason("example.net"), "In use");
|
||||||
|
ASSERT_EQ("In use", response.getReason(1));
|
||||||
|
ASSERT_EQ(3, response.getAvailableList().size());
|
||||||
|
ASSERT_EQ(3, response.getReasonList().size());
|
||||||
|
ASSERT_EQ(1000, response.getResults()[0].getResultCode());
|
||||||
|
ASSERT_EQ("ABC-12345", response.getCLTRID());
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
TEST_run(doWork);
|
||||||
|
return TEST_errorCount();
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
#include "se/LPECreateCommand.hpp"
|
||||||
|
#include "se/StandardObjectType.hpp"
|
||||||
|
#include "xml/XMLHelper.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
LPECreateCommand::LPECreateCommand (const std::string& name,
|
||||||
|
const std::string& pw,
|
||||||
|
const std::string* registrantID,
|
||||||
|
const std::vector<std::string>* techContacts,
|
||||||
|
const std::vector<std::string>* nameservers,
|
||||||
|
const std::vector<std::string>* adminContacts,
|
||||||
|
const std::vector<std::string>* billingContacts,
|
||||||
|
const Period* period)
|
||||||
|
: CreateCommand(StandardObjectType::DOMAIN(), name)
|
||||||
|
{
|
||||||
|
std::vector<std::string>::const_iterator p;
|
||||||
|
|
||||||
|
if (period)
|
||||||
|
period->appendPeriod (xmlWriter, objElement);
|
||||||
|
|
||||||
|
if (nameservers)
|
||||||
|
{
|
||||||
|
DOMElement *ns = xmlWriter->appendChild (objElement, "ns");
|
||||||
|
for (p = nameservers->begin(); p != nameservers->end(); p++)
|
||||||
|
XMLHelper::setTextContent
|
||||||
|
(xmlWriter->appendChild (ns, "hostObj"), *p);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (registrantID)
|
||||||
|
{
|
||||||
|
XMLHelper::setTextContent
|
||||||
|
(xmlWriter->appendChild(objElement, "registrant"), *registrantID);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (adminContacts)
|
||||||
|
for (p = adminContacts->begin(); p != adminContacts->end(); p++)
|
||||||
|
xmlWriter->appendChild(objElement, "contact", *p, "type", "admin");
|
||||||
|
|
||||||
|
if (techContacts)
|
||||||
|
for (p = techContacts->begin(); p != techContacts->end(); p++)
|
||||||
|
xmlWriter->appendChild(objElement, "contact", *p, "type", "tech");
|
||||||
|
|
||||||
|
if (billingContacts)
|
||||||
|
for (p = billingContacts->begin(); p != billingContacts->end(); p++)
|
||||||
|
xmlWriter->appendChild(objElement, "contact", *p, "type", "billing");
|
||||||
|
|
||||||
|
XMLHelper::setTextContent
|
||||||
|
(xmlWriter->appendChild
|
||||||
|
(xmlWriter->appendChild
|
||||||
|
(objElement,
|
||||||
|
"authInfo"),
|
||||||
|
"pw"),
|
||||||
|
pw);
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
#ifndef __LPECREATECOMMAND_HPP
|
||||||
|
#define __LPECREATECOMMAND_HPP
|
||||||
|
|
||||||
|
#include "se/CreateCommand.hpp"
|
||||||
|
#include "se/Period.hpp"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapping of EPP urn:ietf:params:xml:ns:domain-1.0 create command specified in
|
||||||
|
* RFC3731. Command-response extensions to the domain:create command are
|
||||||
|
* implemented as subclasses of this.
|
||||||
|
* Use this class to generate a standards-compliant XML document, given simple
|
||||||
|
* input parameters. The toXML method in Command serialises this object to
|
||||||
|
* XML.
|
||||||
|
*/
|
||||||
|
class DomainCreateCommand : public CreateCommand
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Constructor for a domain:create EPP command. All core EPP domain:create
|
||||||
|
* attributes may be set using this constructor.
|
||||||
|
*/
|
||||||
|
LPECreateCommand (const std::string& name,
|
||||||
|
const std::string& pw,
|
||||||
|
const std::string* registrantID,
|
||||||
|
const std::vector<std::string>* techContacts = NULL,
|
||||||
|
const std::vector<std::string>* nameservers = NULL,
|
||||||
|
const std::vector<std::string>* adminContacts = NULL,
|
||||||
|
const std::vector<std::string>* billingContacts = NULL,
|
||||||
|
const Period* period = NULL);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __DOMAINCREATECOMMAND_HPP
|
|
@ -0,0 +1,54 @@
|
||||||
|
#include "se/LPECreateResponse.hpp"
|
||||||
|
#include "se/StandardObjectType.hpp"
|
||||||
|
#include "se/EPPDateFormatter.hpp"
|
||||||
|
#include "common/StringUtils.hpp"
|
||||||
|
|
||||||
|
const std::string LPECreateResponse::DOM_CR_DATE_EXPR
|
||||||
|
(LPECreateResponse::exprReplace
|
||||||
|
(CreateResponse::CR_DATE_EXPR()));
|
||||||
|
|
||||||
|
const std::string LPECreateResponse::DOM_NAME_EXPR
|
||||||
|
(LPECreateResponse::exprReplace
|
||||||
|
(CreateResponse::CRE_DATA_EXPR()) +
|
||||||
|
"/domain:name/text()");
|
||||||
|
|
||||||
|
const std::string LPECreateResponse::DOM_EX_DATE_EXPR
|
||||||
|
(LPECreateResponse::exprReplace
|
||||||
|
(CreateResponse::CRE_DATA_EXPR()) +
|
||||||
|
"/domain:exDate/text()");
|
||||||
|
|
||||||
|
LPECreateResponse::LPECreateResponse()
|
||||||
|
: CreateResponse(StandardObjectType::DOMAIN())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LPECreateResponse::fromXML (XMLDocument *xmlDoc) throw (ParsingException)
|
||||||
|
{
|
||||||
|
CreateResponse::fromXML (xmlDoc);
|
||||||
|
|
||||||
|
if (!(resultArray[0].succeeded())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
name = xmlDoc->getNodeValue (DOM_NAME_EXPR);
|
||||||
|
std::string exDateStr = xmlDoc->getNodeValue (DOM_EX_DATE_EXPR);
|
||||||
|
exDate = std::auto_ptr<XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime(exDateStr));
|
||||||
|
}
|
||||||
|
catch (XPathExpressionException& e)
|
||||||
|
{
|
||||||
|
maintLogger->warning(e.getMessage());
|
||||||
|
ParsingException pe;
|
||||||
|
pe.causedBy(e);
|
||||||
|
throw pe;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string LPECreateResponse::exprReplace (const std::string &expr)
|
||||||
|
{
|
||||||
|
return StringUtils::replaceAll (expr,
|
||||||
|
CreateResponse::OBJ(),
|
||||||
|
StandardObjectType::DOMAIN()->getName());
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
#ifndef __LPE_CREATE_RESPONSE_HPP
|
||||||
|
#define __LPE_CREATE_RESPONSE_HPP
|
||||||
|
|
||||||
|
#include "se/CreateResponse.hpp"
|
||||||
|
#include "se/XMLGregorianCalendar.hpp"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this to access create data for a domain as provided in an EPP domain
|
||||||
|
* create response compliant with RFCs 3730 and 3731. Such a service element
|
||||||
|
* is sent by a compliant EPP server in response to a valid domain create
|
||||||
|
* command, implemented by the DomainCreateCommand.
|
||||||
|
*
|
||||||
|
* @see DomainCreateCommand
|
||||||
|
*/
|
||||||
|
class DomainCreateResponse : public CreateResponse
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DomainCreateResponse();
|
||||||
|
|
||||||
|
const std::string & getName() const { return name; };
|
||||||
|
const XMLGregorianCalendar* getExpiryDate() const { return exDate.get(); };
|
||||||
|
|
||||||
|
virtual void fromXML (XMLDocument *xmlDoc) throw (ParsingException);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
const std::string & crDateExpr() const { return DOM_CR_DATE_EXPR; };
|
||||||
|
|
||||||
|
static std::string exprReplace (const std::string &expr);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const std::string DOM_CR_DATE_EXPR,
|
||||||
|
DOM_NAME_EXPR,
|
||||||
|
DOM_EX_DATE_EXPR;
|
||||||
|
std::string name;
|
||||||
|
std::auto_ptr<XMLGregorianCalendar> exDate;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __DOMAIN_CREATE_RESPONSE_HPP
|
|
@ -0,0 +1,57 @@
|
||||||
|
#include "se/OteDomainInfoResponse.hpp"
|
||||||
|
#include "se/StandardObjectType.hpp"
|
||||||
|
|
||||||
|
#include <stdlib.h> // atoi()
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
*oteext:infData");
|
||||||
|
*oteProperties");
|
||||||
|
*oteext:registrantName/text()");
|
||||||
|
*oteext:registrantID/text()");
|
||||||
|
*oteext:registrantID/@type");
|
||||||
|
*oteext:eligibilityType/text()");
|
||||||
|
*oteext:eligibilityName/text()");
|
||||||
|
*oteext:eligibilityID/text()");
|
||||||
|
*oteext:eligibilityID/@type");
|
||||||
|
*oteext:policyReason/text()");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
OteDomainInfoResponse::OteDomainInfoResponse() : DomainInfoResponse()
|
||||||
|
{
|
||||||
|
policyReason = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OteDomainInfoResponse::fromXML (XMLDocument *xmlDoc) throw (ParsingException)
|
||||||
|
{
|
||||||
|
DomainInfoResponse::fromXML(xmlDoc);
|
||||||
|
|
||||||
|
if (!(resultArray[0].succeeded())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
registrantName = xmlDoc->getNodeValue (OTE_REGISTRANT_NAME_EXPR);
|
||||||
|
registrantID = xmlDoc->getNodeValue (OTE_REGISTRANT_ID_EXPR);
|
||||||
|
registrantIDType = xmlDoc->getNodeValue (OTE_REGISTRANT_ID_TYPE_EXPR);
|
||||||
|
eligibilityType = xmlDoc->getNodeValue (OTE_ELI_TYPE_EXPR);
|
||||||
|
eligibilityName = xmlDoc->getNodeValue (OTE_ELI_NAME_EXPR);
|
||||||
|
eligibilityID = xmlDoc->getNodeValue (OTE_ELI_ID_EXPR);
|
||||||
|
eligibilityIDType = xmlDoc->getNodeValue (OTE_ELI_ID_TYPE_EXPR);
|
||||||
|
|
||||||
|
string polReasonStr = xmlDoc->getNodeValue (OTE_POLICY_REASON_EXPR);
|
||||||
|
if (polReasonStr.length() > 0) {
|
||||||
|
policyReason = atoi (polReasonStr.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (XPathExpressionException& e)
|
||||||
|
{
|
||||||
|
maintLogger->warning(e.getMessage());
|
||||||
|
ParsingException pe("Could not parse OteDomainInfoResponse object.");
|
||||||
|
pe.causedBy(e);
|
||||||
|
throw pe;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
#ifndef __OTE_DOMAIN_INFO_RESPONSE_HPP
|
||||||
|
#define __OTE_DOMAIN_INFO_RESPONSE_HPP
|
||||||
|
|
||||||
|
#include "common/Deprecated.hpp"
|
||||||
|
#include "se/DomainInfoResponse.hpp"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extension of the domain mapping of the EPP info response, as defined in
|
||||||
|
* RFC3730 and RFC3731, to .ae domain names, the specification of which is in
|
||||||
|
* the XML schema definition urn:X-ae:params:xml:ns:aeext-1.0.
|
||||||
|
* Instances of this class provide an interface to access all of the
|
||||||
|
* information available through EPP for a .ae domain name.
|
||||||
|
* This relies on the instance first being initialised by a suitable EPP domain
|
||||||
|
* info response using the method fromXML. For flexibility, this
|
||||||
|
* implementation extracts the data from the response using XPath queries, the
|
||||||
|
* expressions for which are defined statically.
|
||||||
|
|
||||||
|
* @deprecated AE eligibility extensions should now be managed through the
|
||||||
|
* @c <kvlist> extension defined in the
|
||||||
|
* <tt>urn:X-ar:params:xml:ns:kv-1.0</tt> namespace. This can be done
|
||||||
|
* through the toolkit by using a @c DomainInfoResponse and
|
||||||
|
* registering a @c DomainInfoKVResponseExtension object, which
|
||||||
|
* will contain the AE eligibility extensions.
|
||||||
|
*
|
||||||
|
* See
|
||||||
|
* {@link DomainInfoResponse.registerExtension(ResponseExtension)}
|
||||||
|
* and
|
||||||
|
* {@link DomainInfoKVResponseExtension}.
|
||||||
|
*/
|
||||||
|
class OteDomainInfoResponse : public DomainInfoResponse
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DEPRECATED(OteDomainInfoResponse());
|
||||||
|
|
||||||
|
const std::string& getRegistrantName() const { return registrantName; };
|
||||||
|
const std::string& getAERegistrantID() const { return registrantID; };
|
||||||
|
const std::string& getRegistrantIDType() const { return registrantIDType; };
|
||||||
|
const std::string& getEligibilityType() const { return eligibilityType; };
|
||||||
|
const std::string& getEligibilityName() const { return eligibilityName; };
|
||||||
|
const std::string& getEligibilityID() const { return eligibilityID; };
|
||||||
|
const std::string& getEligibilityIDType() const { return eligibilityIDType; };
|
||||||
|
int getPolicyReason() const { return policyReason; };
|
||||||
|
|
||||||
|
virtual void fromXML (XMLDocument *xmlDoc) throw (ParsingException);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const std::string AEEXT_EXPR,
|
||||||
|
AE_PROPERTIES_EXPR,
|
||||||
|
AE_REGISTRANT_NAME_EXPR,
|
||||||
|
AE_REGISTRANT_ID_EXPR,
|
||||||
|
AE_REGISTRANT_ID_TYPE_EXPR,
|
||||||
|
AE_ELI_TYPE_EXPR,
|
||||||
|
AE_ELI_NAME_EXPR,
|
||||||
|
AE_ELI_ID_EXPR,
|
||||||
|
AE_ELI_ID_TYPE_EXPR,
|
||||||
|
AE_POLICY_REASON_EXPR;
|
||||||
|
|
||||||
|
std::string registrantName,
|
||||||
|
registrantID,
|
||||||
|
registrantIDType,
|
||||||
|
eligibilityType,
|
||||||
|
eligibilityName,
|
||||||
|
eligibilityID,
|
||||||
|
eligibilityIDType;
|
||||||
|
|
||||||
|
int policyReason;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __AE_DOMAIN_INFO_RESPONSE_HPP
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
#include "se/OteDomainModifyRegistrantCommand.hpp"
|
||||||
|
#include "common/ErrorPkg.hpp"
|
||||||
|
#include "se/OteExtension.hpp"
|
||||||
|
#include "xml/XMLHelper.hpp"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
*oteExtension() {
|
||||||
|
*oteExtension = new OteExtension();
|
||||||
|
*oteExtension;
|
||||||
|
}
|
||||||
|
}; // anonymous namespace
|
||||||
|
|
||||||
|
OteDomainModifyRegistrantCommand::OteDomainModifyRegistrantCommand(
|
||||||
|
const std::string& name,
|
||||||
|
const std::string& registrantName,
|
||||||
|
const std::string& explanation,
|
||||||
|
const std::string* eligibilityType,
|
||||||
|
int policyReason,
|
||||||
|
const std::string* registrantID,
|
||||||
|
const std::string* registrantIDType,
|
||||||
|
const std::string* eligibilityName,
|
||||||
|
const std::string* eligibilityID,
|
||||||
|
const std::string* eligibilityIDType) : DomainUpdateCommand(name)
|
||||||
|
{
|
||||||
|
if (eligibilityType == NULL
|
||||||
|
|| (registrantID == NULL && registrantIDType != NULL)
|
||||||
|
|| (registrantID != NULL && registrantIDType == NULL)
|
||||||
|
|| (eligibilityID == NULL && eligibilityIDType != NULL)
|
||||||
|
|| (eligibilityID != NULL && eligibilityIDType == NULL))
|
||||||
|
{
|
||||||
|
throw IllegalArgException(
|
||||||
|
*ote.missing_arg"));
|
||||||
|
}
|
||||||
|
|
||||||
|
*oteextUpdate = xmlWriter->appendChild(
|
||||||
|
xmlWriter->appendChild(command, "extension"),
|
||||||
|
"update",
|
||||||
|
*oteExtension().getURI());
|
||||||
|
|
||||||
|
*oteextUpdate->setAttribute(
|
||||||
|
XStr("xsi:schemaLocation").str(),
|
||||||
|
*oteExtension().getSchemaLocation()).str());
|
||||||
|
|
||||||
|
*oteextUpdate,
|
||||||
|
*oteProperties");
|
||||||
|
|
||||||
|
XMLHelper::setTextContent(
|
||||||
|
*oteProperties, "registrantName"),
|
||||||
|
registrantName);
|
||||||
|
|
||||||
|
if (registrantID != NULL && registrantIDType != NULL)
|
||||||
|
{
|
||||||
|
xmlWriter->appendChild(
|
||||||
|
*oteProperties,
|
||||||
|
"registrantID",
|
||||||
|
*registrantID,
|
||||||
|
"type",
|
||||||
|
*registrantIDType);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eligibilityType != NULL)
|
||||||
|
{
|
||||||
|
XMLHelper::setTextContent(
|
||||||
|
*oteProperties, "eligibilityType"),
|
||||||
|
*eligibilityType);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eligibilityName != NULL)
|
||||||
|
{
|
||||||
|
XMLHelper::setTextContent(
|
||||||
|
*oteProperties, "eligibilityName"),
|
||||||
|
*eligibilityName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eligibilityID != NULL && eligibilityIDType != NULL)
|
||||||
|
{
|
||||||
|
xmlWriter->appendChild(
|
||||||
|
*oteProperties,
|
||||||
|
"eligibilityID",
|
||||||
|
*eligibilityID,
|
||||||
|
"type",
|
||||||
|
*eligibilityIDType);
|
||||||
|
}
|
||||||
|
|
||||||
|
XMLHelper::setTextContent(
|
||||||
|
*oteProperties, "policyReason"),
|
||||||
|
policyReason);
|
||||||
|
|
||||||
|
XMLHelper::setTextContent(
|
||||||
|
*oteextUpdate, "explanation"),
|
||||||
|
explanation);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
#ifndef __OTE_DOMAIN_MODIFY_REGISTRANT_COMMAND_HPP
|
||||||
|
#define __OTE_DOMAIN_MODIFY_REGISTRANT_COMMAND_HPP
|
||||||
|
|
||||||
|
#include "common/Deprecated.hpp"
|
||||||
|
#include "se/DomainUpdateCommand.hpp"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An extension of the domain mapping of the EPP update command, as defined in
|
||||||
|
* RFC3730 and RFC3731, to .ae domain names, the specification of which is in
|
||||||
|
* the XML schema definition urn:X-ae:params:xml:ns:aeext-1.0.
|
||||||
|
* This class should only be used to correct ae extension data for .ae domain
|
||||||
|
* names, and only where the legal registrant has not changed.
|
||||||
|
* Use this class to generate a standards-compliant XML document, given simple
|
||||||
|
* input parameters. The toXML method in Command serialises this object to
|
||||||
|
* XML.
|
||||||
|
*
|
||||||
|
* @deprecated AE eligibility extensions should now be managed through the
|
||||||
|
* @c <kvlist> extension defined in the
|
||||||
|
* <tt>urn:X-ar:params:xml:ns:kv-1.0</tt> namespace. This can be done
|
||||||
|
* through the toolkit by using a @c DomainUpdateCommand and
|
||||||
|
* appending a @c DomainKVCommandExtension object containing
|
||||||
|
* the AE eligibility extensions.
|
||||||
|
*
|
||||||
|
* See
|
||||||
|
* {@link DomainUpdateCommand.appendExtension(CommandExtension)}
|
||||||
|
* and
|
||||||
|
* {@link DomainKVCommandExtension}.
|
||||||
|
*/
|
||||||
|
class AeDomainModifyRegistrantCommand : public DomainUpdateCommand
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DEPRECATED(
|
||||||
|
AeDomainModifyRegistrantCommand(const std::string& name,
|
||||||
|
const std::string& registrantName,
|
||||||
|
const std::string& explanation,
|
||||||
|
const std::string* eligibilityType = NULL,
|
||||||
|
int policyReason = 0,
|
||||||
|
const std::string* registrantID = NULL,
|
||||||
|
const std::string* registrantIDType = NULL,
|
||||||
|
const std::string* eligibilityName = NULL,
|
||||||
|
const std::string* eligibilityID = NULL,
|
||||||
|
const std::string* eligibilityIDType = NULL));
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __AE_DOMAIN_MODIFY_REGISTRANT_COMMAND_HPP
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
#include "OteDomainObjectType.hpp"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
const std::string& OteDomainObjectType::getName() const {
|
||||||
|
*otedom";
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string& OteDomainObjectType::getURI() const {
|
||||||
|
*otedomain-1.0";
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string& OteDomainObjectType::getSchemaLocation() const {
|
||||||
|
static const std::string schemaLocation =
|
||||||
|
*otedomain-1.0.xsd";
|
||||||
|
return schemaLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string& OteDomainObjectType::getIdentType() const {
|
||||||
|
static const std::string ident = "name";
|
||||||
|
return ident;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
#ifndef AEDOMAIN_OBJECT_TYPE
|
||||||
|
#define AEDOMAIN_OBJECT_TYPE
|
||||||
|
|
||||||
|
#include "ObjectType.hpp"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class AeDomainObjectType : public ObjectType {
|
||||||
|
public:
|
||||||
|
virtual ~AeDomainObjectType(void) { }
|
||||||
|
|
||||||
|
virtual const std::string& getName() const;
|
||||||
|
virtual const std::string& getURI() const;
|
||||||
|
virtual const std::string& getSchemaLocation() const;
|
||||||
|
virtual const std::string& getIdentType() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // AEDOMAIN_OBJECT_TYPE
|
||||||
|
|
|
@ -0,0 +1,92 @@
|
||||||
|
#include "se/OteDomainTransferRegistrantCommand.hpp"
|
||||||
|
#include "se/XMLGregorianCalendar.hpp"
|
||||||
|
|
||||||
|
#include "se/OteExtension.hpp"
|
||||||
|
#include "se/OteDomainObjectType.hpp"
|
||||||
|
#include "se/RegistrantTransferCommandType.hpp"
|
||||||
|
#include "se/CommandType.hpp"
|
||||||
|
#include "se/Period.hpp"
|
||||||
|
#include "common/ErrorPkg.hpp"
|
||||||
|
|
||||||
|
#include "se/EPPDateFormatter.hpp"
|
||||||
|
|
||||||
|
#include "xml/XMLHelper.hpp"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
*oteExtension() {
|
||||||
|
*oteExt = new OteExtension();
|
||||||
|
*oteExt;
|
||||||
|
}
|
||||||
|
|
||||||
|
const RegistrantTransferCommandType rtrnType;
|
||||||
|
*otedomType;
|
||||||
|
} // anonymous namespace
|
||||||
|
|
||||||
|
OteDomainTransferRegistrantCommand::OteDomainTransferRegistrantCommand (
|
||||||
|
const std::string& name,
|
||||||
|
const XMLGregorianCalendar& curExpDate,
|
||||||
|
const std::string& eligibilityType,
|
||||||
|
int policyReason,
|
||||||
|
const std::string& registrantName,
|
||||||
|
const std::string& explanation,
|
||||||
|
const std::string* registrantID,
|
||||||
|
const std::string* registrantIDType,
|
||||||
|
const std::string* eligibilityName,
|
||||||
|
const std::string* eligibilityID,
|
||||||
|
const std::string* eligibilityIDType,
|
||||||
|
const Period* period) : ProtocolExtensionCommand(
|
||||||
|
*oteExtension())
|
||||||
|
{
|
||||||
|
if ((registrantID && registrantIDType == NULL)
|
||||||
|
|| (registrantIDType == NULL && registrantIDType)
|
||||||
|
|| (eligibilityName && (eligibilityID == NULL || eligibilityIDType == NULL))
|
||||||
|
|| (eligibilityName == NULL && (eligibilityID || eligibilityIDType)))
|
||||||
|
{
|
||||||
|
// If provided, a registrantID must have a type.
|
||||||
|
// If provided, an eligibilityName must have both an eligibilityID and type.
|
||||||
|
throw IllegalArgException(
|
||||||
|
*ote.missing_arg"));
|
||||||
|
}
|
||||||
|
|
||||||
|
DOMElement *element;
|
||||||
|
|
||||||
|
std::string curExpDateStr = EPPDateFormatter::toXSDate(curExpDate);
|
||||||
|
XMLHelper::setTextContent(
|
||||||
|
xmlWriter->appendChild(objElement, "curExpDate"), curExpDateStr);
|
||||||
|
|
||||||
|
if (period)
|
||||||
|
period->appendPeriod(xmlWriter, objElement);
|
||||||
|
|
||||||
|
*oteProperties");
|
||||||
|
|
||||||
|
XMLHelper::setTextContent(
|
||||||
|
*oteProperties, "registrantName"), registrantName);
|
||||||
|
|
||||||
|
if (registrantID)
|
||||||
|
{
|
||||||
|
*oteProperties, "registrantID");
|
||||||
|
XMLHelper::setTextContent(element, *registrantID);
|
||||||
|
XMLHelper::setAttribute(element, "type", *registrantIDType);
|
||||||
|
}
|
||||||
|
XMLHelper::setTextContent
|
||||||
|
*oteProperties, "eligibilityType"), eligibilityType);
|
||||||
|
|
||||||
|
if (eligibilityName)
|
||||||
|
{
|
||||||
|
XMLHelper::setTextContent(
|
||||||
|
*oteProperties, "eligibilityName"), *eligibilityName);
|
||||||
|
|
||||||
|
*oteProperties, "eligibilityID");
|
||||||
|
XMLHelper::setTextContent(element, *eligibilityID);
|
||||||
|
XMLHelper::setAttribute(element, "type", *eligibilityIDType);
|
||||||
|
}
|
||||||
|
|
||||||
|
XMLHelper::setTextContent(
|
||||||
|
*oteProperties, "policyReason"),
|
||||||
|
policyReason);
|
||||||
|
|
||||||
|
XMLHelper::setTextContent(
|
||||||
|
xmlWriter->appendChild(objElement, "explanation"),
|
||||||
|
explanation);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,88 @@
|
||||||
|
#ifndef __AE_DOMAIN_TRANSFER_REGISTRANT_COMMAND_HPP
|
||||||
|
#define __AE_DOMAIN_TRANSFER_REGISTRANT_COMMAND_HPP
|
||||||
|
|
||||||
|
#include "common/Deprecated.hpp"
|
||||||
|
#include "se/ProtocolExtensionCommand.hpp"
|
||||||
|
class XMLGregorianCalendar;
|
||||||
|
class Period;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* In cases where the legal registrant of a .ae domain name has changed, this
|
||||||
|
* class should be used to request a transfer of registrant. This is a
|
||||||
|
* different action to correcting extension data which was originally specified
|
||||||
|
* incorrectly, and should only be used in the situation described. This
|
||||||
|
* command will result in the validity period of the domain name being updated
|
||||||
|
* and the requesting client being charged the usual create fee upon success of
|
||||||
|
* this operation.
|
||||||
|
* Use this class to generate a standards-compliant XML document, given simple
|
||||||
|
* input parameters. The toXML method in Command serialises this object to
|
||||||
|
* XML.
|
||||||
|
|
||||||
|
* @deprecated AE eligibility extensions should now be managed through the
|
||||||
|
* @c <kvlist> extension defined in the
|
||||||
|
* <tt>urn:X-ar:params:xml:ns:kv-1.0</tt> namespace. The Registrant
|
||||||
|
* Transfer command that utilises this extension is defined in the
|
||||||
|
* <tt>urn:X-ar:params:xml:ns:registrant-1.0</tt> namespace. This can
|
||||||
|
* be done through the toolkit by using a
|
||||||
|
* @c DomainRegistrantTransferCommand and specifying
|
||||||
|
* @c "ae" as the kvListName.
|
||||||
|
*
|
||||||
|
* See
|
||||||
|
* {@link DomainRegistrantTransferCommand}
|
||||||
|
* and
|
||||||
|
* {@link DomainRegistrantTransferCommand.addItem(std::string, std::string)}
|
||||||
|
*/
|
||||||
|
class AeDomainTransferRegistrantCommand : public ProtocolExtensionCommand
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request that the named .ae domain name be transferred to the legal
|
||||||
|
* entity specified by the given ae extension data.
|
||||||
|
*
|
||||||
|
* @param name The domain name to transfer.
|
||||||
|
*
|
||||||
|
* @param curExpDate The current expiry of the identified domain name.
|
||||||
|
* This is required in order to prevent repeated transfer of the name due
|
||||||
|
* to protocol transmission failures.
|
||||||
|
*
|
||||||
|
* @param eligibilityType
|
||||||
|
*
|
||||||
|
* @param policyReason
|
||||||
|
*
|
||||||
|
* @param registrantName
|
||||||
|
*
|
||||||
|
* @param explanation An explanation of how the transfer was effected.
|
||||||
|
*
|
||||||
|
* @param registrantID
|
||||||
|
*
|
||||||
|
* @param registrantIDType
|
||||||
|
*
|
||||||
|
* @param eligibilityName
|
||||||
|
*
|
||||||
|
* @param eligibilityID
|
||||||
|
*
|
||||||
|
* @param eligibilityIDType
|
||||||
|
*
|
||||||
|
* @param period The desired new validity period, starting from the time
|
||||||
|
* the transfer completes successfully.
|
||||||
|
*
|
||||||
|
* @param explanation An explanation of how the transfer was effected.
|
||||||
|
*/
|
||||||
|
DEPRECATED(
|
||||||
|
AeDomainTransferRegistrantCommand (const std::string& name,
|
||||||
|
const XMLGregorianCalendar& curExpDate,
|
||||||
|
const std::string& eligibilityType,
|
||||||
|
int policyReason,
|
||||||
|
const std::string& registrantName,
|
||||||
|
const std::string& explanation,
|
||||||
|
const std::string* registrantID = NULL,
|
||||||
|
const std::string* registrantIDType = NULL,
|
||||||
|
const std::string* eligibilityName = NULL,
|
||||||
|
const std::string* eligibilityID = NULL,
|
||||||
|
const std::string* eligibilityIDType = NULL,
|
||||||
|
const Period* period = NULL));
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __AE_DOMAIN_TRANSFER_REGISTRANT_COMMAND_HPP
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
#include "se/OteDomainTransferRegistrantResponse.hpp"
|
||||||
|
#include "se/OteDomainObjectType.hpp"
|
||||||
|
#include "se/RegistrantTransferCommandType.hpp"
|
||||||
|
#include "se/EPPDateFormatter.hpp"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
const RegistrantTransferCommandType rtrnType;
|
||||||
|
*otedomType;
|
||||||
|
} // anonymous namespace
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
const string OteDomainTransferRegistrantResponse::OTEDOM_NAME_EXPR =
|
||||||
|
*otedom:name/text()";
|
||||||
|
|
||||||
|
const string OteDomainTransferRegistrantResponse::OTEDOM_EX_DATE_EXPR =
|
||||||
|
*otedom:exDate/text()";
|
||||||
|
|
||||||
|
OteDomainTransferRegistrantResponse::OteDomainTransferRegistrantResponse()
|
||||||
|
*otedomType)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void OteDomainTransferRegistrantResponse::fromXML(XMLDocument* xmlDoc) throw (ParsingException)
|
||||||
|
{
|
||||||
|
DataResponse::fromXML(xmlDoc);
|
||||||
|
|
||||||
|
if (!(resultArray[0].succeeded())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
name = xmlDoc->getNodeValue(OTEDOM_NAME_EXPR);
|
||||||
|
std::string exDateStr = xmlDoc->getNodeValue(OTEDOM_EX_DATE_EXPR);
|
||||||
|
exDate = std::auto_ptr<XMLGregorianCalendar>(
|
||||||
|
EPPDateFormatter::fromXSDateTime(exDateStr));
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
#ifndef __AE_DOMAIN_TRANSFER_REGISTRANT_RESPONSE
|
||||||
|
#define __AE_DOMAIN_TRANSFER_REGISTRANT_RESPONSE
|
||||||
|
|
||||||
|
#include "common/Deprecated.hpp"
|
||||||
|
#include "se/DataResponse.hpp"
|
||||||
|
#include "se/XMLGregorianCalendar.hpp"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this to access create data for a domain as provided in an EPP domain
|
||||||
|
* create response compliant with RFCs 3730 and 3731. Such a service element
|
||||||
|
* is sent by a compliant EPP server in response to a valid domain create
|
||||||
|
* command, implemented by the DomainCreateCommand.
|
||||||
|
*
|
||||||
|
* @see DomainCreateCommand
|
||||||
|
|
||||||
|
* @deprecated Performing a registrant transfer with AE eligibility extensions
|
||||||
|
* should now be managed through the use of the
|
||||||
|
* @c DomainRegistrantTransferCommand and
|
||||||
|
* @c DomainRegistrantTransferResponse
|
||||||
|
*
|
||||||
|
* See
|
||||||
|
* {@link DomainRegistrantTransferCommand}
|
||||||
|
* and
|
||||||
|
* {@link DomainRegistrantTransferResponse}.
|
||||||
|
*/
|
||||||
|
class AeDomainTransferRegistrantResponse : public DataResponse
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DEPRECATED(AeDomainTransferRegistrantResponse());
|
||||||
|
|
||||||
|
const std::string& getName() { return name; }
|
||||||
|
const XMLGregorianCalendar* getExpiryDate() { return exDate.get(); }
|
||||||
|
void fromXML(XMLDocument* xmlDoc) throw (ParsingException);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const std::string AEDOM_NAME_EXPR;
|
||||||
|
static const std::string AEDOM_EX_DATE_EXPR;
|
||||||
|
|
||||||
|
std::string name;
|
||||||
|
std::auto_ptr<XMLGregorianCalendar> exDate;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __AE_DOMAIN_TRANSFER_REGISTRANT_RESPONSE
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#include "se/OteExtension.hpp"
|
||||||
|
|
||||||
|
std::string& OteExtension::getURI() const
|
||||||
|
{
|
||||||
|
*oteext-1.0";
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string& OteExtension::getSchemaLocation() const
|
||||||
|
{
|
||||||
|
*oteext-1.0.xsd";
|
||||||
|
return loc;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
#ifndef __AEEXTENSION_HPP
|
||||||
|
#define __AEEXTENSION_HPP
|
||||||
|
|
||||||
|
#include "se/Extension.hpp"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A bundled set of constants representing the .ae EPP extension
|
||||||
|
* schema. The namespace URI uniquely identifies the extension.
|
||||||
|
*/
|
||||||
|
class AeExtension : public Extension
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual ~AeExtension(void) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the globally unique namespace URI which identifies this extension.
|
||||||
|
*/
|
||||||
|
virtual std::string& getURI() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the location hint for the XML schema used to validate EPP service
|
||||||
|
* element instances using this extension.
|
||||||
|
*/
|
||||||
|
virtual std::string& getSchemaLocation() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __AEEXTENSION_HPP
|
||||||
|
|
|
@ -0,0 +1,132 @@
|
||||||
|
#include "se/OteLPECreateCommand.hpp"
|
||||||
|
#include "xml/XMLHelper.hpp"
|
||||||
|
#include "se/OteExtension.hpp"
|
||||||
|
#include "common/ErrorPkg.hpp"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
*oteExtension() {
|
||||||
|
*oteExtension = new OteExtension();
|
||||||
|
*oteExtension;
|
||||||
|
}
|
||||||
|
}; // anonymous namespace
|
||||||
|
|
||||||
|
OteLPECreateCommand::OteLPECreateCommand (
|
||||||
|
const std::string& name,
|
||||||
|
const std::string& pw,
|
||||||
|
const std::string* registrantID,
|
||||||
|
const std::vector<std::string>* techContacts,
|
||||||
|
*oteEligibilityType,
|
||||||
|
*otePolicyReason,
|
||||||
|
*oteRegistrantName) : LPECreateCommand (
|
||||||
|
name, pw, registrantID, techContacts)
|
||||||
|
{
|
||||||
|
*oteRegistrantName);
|
||||||
|
}
|
||||||
|
|
||||||
|
OteLPECreateCommand::OteLPECreateCommand (
|
||||||
|
const std::string& name,
|
||||||
|
const std::string& pw,
|
||||||
|
const std::string* registrantID,
|
||||||
|
const std::vector<std::string>* techContacts,
|
||||||
|
const std::vector<std::string>* adminContacts,
|
||||||
|
const std::vector<std::string>* billingContacts,
|
||||||
|
const std::vector<std::string>* nameservers,
|
||||||
|
const Period* period,
|
||||||
|
*oteEligibilityType,
|
||||||
|
*otePolicyReason,
|
||||||
|
*oteRegistrantName,
|
||||||
|
*oteRegistrantID,
|
||||||
|
*oteRegistrantIDType,
|
||||||
|
*oteEligibilityName,
|
||||||
|
*oteEligibilityID,
|
||||||
|
*oteEligibilityIDType) : LPECreateCommand (
|
||||||
|
name, pw, registrantID, techContacts, nameservers,
|
||||||
|
adminContacts, billingContacts, period)
|
||||||
|
{
|
||||||
|
*otePolicyReason,
|
||||||
|
*oteRegistrantIDType,
|
||||||
|
*oteEligibilityIDType);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OteLPECreateCommand::setExtension (const std::string& eligibilityType,
|
||||||
|
int policyReason,
|
||||||
|
const std::string& registrantName)
|
||||||
|
{
|
||||||
|
setExtension (eligibilityType, policyReason, registrantName,
|
||||||
|
NULL, NULL, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OteLPECreateCommand::setExtension (
|
||||||
|
const std::string& eligibilityType,
|
||||||
|
int policyReason,
|
||||||
|
const std::string ®istrantName,
|
||||||
|
const std::string* registrantID,
|
||||||
|
const std::string ®istrantIDType)
|
||||||
|
{
|
||||||
|
setExtension (eligibilityType, policyReason, registrantName,
|
||||||
|
registrantID, ®istrantIDType, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OteLPECreateCommand::setExtension (
|
||||||
|
const std::string& eligibilityType,
|
||||||
|
int policyReason,
|
||||||
|
const std::string& registrantName,
|
||||||
|
const std::string* registrantID,
|
||||||
|
const std::string* registrantIDType,
|
||||||
|
const std::string* eligibilityName,
|
||||||
|
const std::string* eligibilityID,
|
||||||
|
const std::string* eligibilityIDType)
|
||||||
|
{
|
||||||
|
if ((registrantID && registrantIDType == NULL)
|
||||||
|
|| (registrantID == NULL && registrantIDType)
|
||||||
|
|| (eligibilityID && eligibilityIDType == NULL)
|
||||||
|
|| (eligibilityID == NULL && eligibilityIDType))
|
||||||
|
{
|
||||||
|
throw IllegalArgException(ErrorPkg::getMessage(
|
||||||
|
*ote.missing_ar"));
|
||||||
|
}
|
||||||
|
|
||||||
|
*oteextCreate = xmlWriter->appendChild(
|
||||||
|
xmlWriter->appendChild(
|
||||||
|
command,
|
||||||
|
"extension"),
|
||||||
|
"create",
|
||||||
|
*oteExtension().getURI());
|
||||||
|
|
||||||
|
*oteextCreate,
|
||||||
|
"xsi:schemaLocation",
|
||||||
|
*oteExtension().getSchemaLocation());
|
||||||
|
|
||||||
|
*oteProperties = xmlWriter->appendChild(
|
||||||
|
*oteProperties");
|
||||||
|
|
||||||
|
XMLHelper::setTextContent(
|
||||||
|
*oteProperties, "registrantName"),
|
||||||
|
registrantName);
|
||||||
|
|
||||||
|
if (registrantID && registrantIDType)
|
||||||
|
*oteProperties,
|
||||||
|
"registrantID", *registrantID,
|
||||||
|
"type", *registrantIDType);
|
||||||
|
|
||||||
|
XMLHelper::setTextContent(
|
||||||
|
*oteProperties, "eligibilityType"),
|
||||||
|
eligibilityType);
|
||||||
|
|
||||||
|
if (eligibilityName)
|
||||||
|
{
|
||||||
|
XMLHelper::setTextContent(
|
||||||
|
*oteProperties, "eligibilityName"),
|
||||||
|
*eligibilityName);
|
||||||
|
|
||||||
|
if (eligibilityID && eligibilityIDType)
|
||||||
|
*oteProperties,
|
||||||
|
"eligibilityID", *eligibilityID,
|
||||||
|
"type", *eligibilityIDType);
|
||||||
|
}
|
||||||
|
|
||||||
|
XMLHelper::setTextContent(
|
||||||
|
*oteProperties, "policyReason"),
|
||||||
|
policyReason);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,150 @@
|
||||||
|
#ifndef __AEDOMAINCREATECOMMAND_HPP
|
||||||
|
#define __AEDOMAINCREATECOMMAND_HPP
|
||||||
|
|
||||||
|
#include "common/Deprecated.hpp"
|
||||||
|
#include "se/DomainCreateCommand.hpp"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extension of EPP urn:ietf:params:xml:ns:domain-1.0 create command specified
|
||||||
|
* in RFC3731 to urn:X-ae:params:xml:ns:aeext-1.0. .ae domains must be
|
||||||
|
* provisioned using this class rather than {@link DomainCreateCommand}, as the
|
||||||
|
* ae extension data is mandatory.
|
||||||
|
* Use this class to generate a standards-compliant XML document, given simple
|
||||||
|
* input parameters. The toXML method in Command serialises this object to
|
||||||
|
* XML.
|
||||||
|
* The response expected from a server should be handled by a {@link
|
||||||
|
* DomainCreateResponse} object.
|
||||||
|
*
|
||||||
|
* @deprecated AE eligibility extensions should now be managed through the
|
||||||
|
* @c <kvlist> extension defined in the
|
||||||
|
* <tt>urn:X-ar:params:xml:ns:kv-1.0</tt> namespace. This can be done
|
||||||
|
* through the toolkit by using a @c DomainCreateCommand and
|
||||||
|
* appending a @c DomainKVCommandExtension object containing
|
||||||
|
* the AE eligibility extensions.
|
||||||
|
*
|
||||||
|
* See
|
||||||
|
* {@link DomainCreateCommand.appendExtension(CommandExtension)}
|
||||||
|
* and
|
||||||
|
* {@link DomainKVCommandExtension}.
|
||||||
|
*/
|
||||||
|
class AeDomainCreateCommand : public DomainCreateCommand
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Minimal constructor for creating a domain:create + aeext:create
|
||||||
|
* EPP command. These parameters are the least required for a valid
|
||||||
|
* .ae domain create command.
|
||||||
|
*/
|
||||||
|
DEPRECATED(
|
||||||
|
AeDomainCreateCommand (const std::string& name,
|
||||||
|
const std::string& pw,
|
||||||
|
const std::string* registrantID,
|
||||||
|
const std::vector<std::string>* techContacts,
|
||||||
|
const std::string &aeEligibilityType,
|
||||||
|
int aePolicyReason,
|
||||||
|
const std::string& aeRegistrantName));
|
||||||
|
/**
|
||||||
|
* Full data specification constructor for a domain:create + aeext:create
|
||||||
|
* EPP command. Please refer to the urn:X-ae:params:xml:ns:aeext-1.0 schema
|
||||||
|
* for specification of the required fields.
|
||||||
|
* The mapping of parameter names to ae extension fields is given in the
|
||||||
|
* parameter documentation.
|
||||||
|
*
|
||||||
|
* @param name The name of the new domain.
|
||||||
|
*
|
||||||
|
* @param pw The password to assign to the domain (also known as authInfo
|
||||||
|
* or authorisation information).
|
||||||
|
*
|
||||||
|
* @param registrantID The identifier of an existing contact to assign as
|
||||||
|
* the registrant contact for this domain. Failure to ensure the contact
|
||||||
|
* exists prior to using them in this way will result in an EPP result of
|
||||||
|
* '2303 "Object does not exist"'.
|
||||||
|
*
|
||||||
|
* @param techContacts The identifiers of existing contacts to assign as
|
||||||
|
* technical contacts for this domain. Failure to ensure the contacts
|
||||||
|
* exist prior to using them in this way will result in an EPP result of
|
||||||
|
* '2303 "Object does not exist"'.
|
||||||
|
*
|
||||||
|
* @param adminContacts See techContacts (substitute administrative for
|
||||||
|
* technical).
|
||||||
|
*
|
||||||
|
* @param billingContacts See techContacts (substitute billing for
|
||||||
|
* technical).
|
||||||
|
*
|
||||||
|
* @param nameservers The names of existing hosts to delegate the domain
|
||||||
|
* being created to. Failure to ensure the hosts exist prior to using them
|
||||||
|
* in this way will result in an EPP result of '2303 "Object does not
|
||||||
|
* exist"'.
|
||||||
|
*
|
||||||
|
* @param period The initial registration period of the domain object. A
|
||||||
|
* server may define a default initial registration period if not specified
|
||||||
|
* by the client.
|
||||||
|
*
|
||||||
|
* @param aeEligibilityType aeext:eligType.
|
||||||
|
*
|
||||||
|
* @param aePolicyReason aeext:policyReason.
|
||||||
|
*
|
||||||
|
* @param aeRegistrantName aeext:registrantName.
|
||||||
|
*
|
||||||
|
* @param aeRegistrantID aeext:registrantID.
|
||||||
|
*
|
||||||
|
* @param aeRegistrantIDType aeext:registrantID type attribute.
|
||||||
|
*
|
||||||
|
* @param aeEligibilityName aeext:eligibilityName.
|
||||||
|
*
|
||||||
|
* @param aeEligibilityID aeext:eligibilityID.
|
||||||
|
*
|
||||||
|
* @param aeEligibilityIDType aeext:eligibilityID type attribute.
|
||||||
|
*/
|
||||||
|
DEPRECATED(
|
||||||
|
AeDomainCreateCommand (const std::string& name,
|
||||||
|
const std::string& pw,
|
||||||
|
const std::string* registrantID,
|
||||||
|
const std::vector<std::string>* techContacts,
|
||||||
|
const std::vector<std::string>* adminContacts,
|
||||||
|
const std::vector<std::string>* billingContacts,
|
||||||
|
const std::vector<std::string>* nameservers,
|
||||||
|
const Period *period,
|
||||||
|
const std::string &aeEligibilityType,
|
||||||
|
int aePolicyReason,
|
||||||
|
const std::string& aeRegistrantName,
|
||||||
|
const std::string* aeRegistrantID,
|
||||||
|
const std::string* aeRegistrantIDType,
|
||||||
|
const std::string* aeEligibilityName,
|
||||||
|
const std::string* aeEligibilityID,
|
||||||
|
const std::string* aeEligibilityIDType));
|
||||||
|
private:
|
||||||
|
void setExtension (const std::string& eligibilityType,
|
||||||
|
int PolicyReason,
|
||||||
|
const std::string& registrantName);
|
||||||
|
|
||||||
|
void setExtension (const std::string& eligibilityType,
|
||||||
|
int PolicyReason,
|
||||||
|
const std::string& registrantName,
|
||||||
|
const std::string* registrantID,
|
||||||
|
const std::string& registrantIDType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <extension>
|
||||||
|
* <create xmlns="urn:X-ae:params:xml:ns:aeext-1.0">
|
||||||
|
* <registrantName>registrantName</registrantName>
|
||||||
|
* <registrantID type="registrantIDType">registrantID</registrantID>
|
||||||
|
* <eligibilityType>eligibilityType</eligibilityType>
|
||||||
|
* <eligibilityName>eligibilityName</eligibilityName>
|
||||||
|
* <eligibilityID type="eligibilityIDType">eligibilityID</eligibilityID>
|
||||||
|
* <policyReason>policyReason</policyReason>
|
||||||
|
* </create>
|
||||||
|
* </extension>
|
||||||
|
*/
|
||||||
|
void setExtension (const std::string& eligibilityType,
|
||||||
|
int policyReason,
|
||||||
|
const std::string& registrantName,
|
||||||
|
const std::string* registrantID,
|
||||||
|
const std::string* registrantIDType,
|
||||||
|
const std::string* eligibilityName,
|
||||||
|
const std::string* eligibilityID,
|
||||||
|
const std::string* eligibilityIDType);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // __AEDOMAINCREATECOMMAND_HPP
|
|
@ -0,0 +1,86 @@
|
||||||
|
#include "se/ContactCheckCommand.hpp"
|
||||||
|
#include "se/OteLPECreateCommand.hpp"
|
||||||
|
#include "se/CLTRID.hpp"
|
||||||
|
#include "session/Timer.hpp"
|
||||||
|
#include "common/init.hpp"
|
||||||
|
#include "common/Test.hpp"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
void doWork()
|
||||||
|
{
|
||||||
|
init("/home/drde/etc/toolkit2.conf");
|
||||||
|
|
||||||
|
const string registrantName = "AusRegistry";
|
||||||
|
const string registrantID = "01241326211";
|
||||||
|
const string registrantIDType = "Trade License";
|
||||||
|
const string eligibilityType = "Trade License (IT)";
|
||||||
|
const int policyReason = 1;
|
||||||
|
const string eligibilityName = "Blah";
|
||||||
|
const string eligibilityID = "1231239523";
|
||||||
|
const string eligibilityIDType = "Trademark";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that the XML string generated for a minimal create domain command
|
||||||
|
* matches the expected XML for an EPP create domain command with those
|
||||||
|
* parameters.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
Timer::setTime("20070101.010101");
|
||||||
|
CLTRID::setClID("JTKUTEST");
|
||||||
|
|
||||||
|
vector<string> techIds;
|
||||||
|
techIds.push_back("JTKCON2");
|
||||||
|
string registrant("JTKCON");
|
||||||
|
*ote", "jtkUT3st", ®istrant, &techIds,
|
||||||
|
eligibilityType, policyReason, registrantName);
|
||||||
|
const string xml(cmd.toXML());
|
||||||
|
ASSERT_EQ(xml,
|
||||||
|
*oteProperties></create></extension><clTRID>JTKUTEST.20070101.010101.0</clTRID></command></epp>");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that the XML string generated for a sample create domain command
|
||||||
|
* specified with all available parameters matches the expected XML for
|
||||||
|
* an EPP create domain command with those parameters.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
Timer::setTime("20070101.010101");
|
||||||
|
CLTRID::setClID("JTKUTEST");
|
||||||
|
|
||||||
|
vector<string> techIds;
|
||||||
|
techIds.push_back("JTKCON2");
|
||||||
|
|
||||||
|
vector<string> adminContacts;
|
||||||
|
adminContacts.push_back("JTKCON");
|
||||||
|
adminContacts.push_back("JTKCON2");
|
||||||
|
|
||||||
|
string registrant("JTKCON");
|
||||||
|
|
||||||
|
vector<string> nameServers;
|
||||||
|
nameServers.push_back("ns1.ausregistry.net");
|
||||||
|
nameServers.push_back("ns2.ausregistry.net");
|
||||||
|
|
||||||
|
Period period(48, PeriodUnit::MONTHS());
|
||||||
|
|
||||||
|
OteLPECreateCommand cmd(
|
||||||
|
*ote", "jtkUT3st", ®istrant,
|
||||||
|
&techIds, &adminContacts,
|
||||||
|
NULL, &nameServers, &period,
|
||||||
|
eligibilityType, policyReason,
|
||||||
|
registrantName, ®istrantID,
|
||||||
|
®istrantIDType, &eligibilityName,
|
||||||
|
&eligibilityID, &eligibilityIDType);
|
||||||
|
const string xml(cmd.toXML());
|
||||||
|
*oteProperties></create></extension><clTRID>JTKUTEST.20070101.010101.0</clTRID></command></epp>");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
TEST_run(doWork);
|
||||||
|
return TEST_errorCount();
|
||||||
|
}
|
||||||
|
|
Binary file not shown.
|
@ -281,7 +281,7 @@ void mdCommander::help() {
|
||||||
mvprintw(10,10," !! - run all active");
|
mvprintw(10,10," !! - run all active");
|
||||||
mvprintw(11,10," C<n> - make <n> the current command");
|
mvprintw(11,10," C<n> - make <n> the current command");
|
||||||
mvprintw(12,10," E<n> - display/edit <n> ");
|
mvprintw(12,10," E<n> - display/edit <n> ");
|
||||||
mvprintw(13,10," S<n> - send <n>");
|
mvprintw(13,10," W<n> - write <n> to the AC watched folder");
|
||||||
mvprintw(14,10," X<n> - discard ");
|
mvprintw(14,10," X<n> - discard ");
|
||||||
mvprintw(15,10," <n> - make <n> the target device");
|
mvprintw(15,10," <n> - make <n> the target device");
|
||||||
mvprintw(16,10," log - display this cliever's log");
|
mvprintw(16,10," log - display this cliever's log");
|
||||||
|
@ -289,7 +289,7 @@ void mdCommander::help() {
|
||||||
mvprintw(18,10," done - terminate commander but not process");
|
mvprintw(18,10," done - terminate commander but not process");
|
||||||
mvprintw(19,10," q/quit - terminate this process and its' children");
|
mvprintw(19,10," q/quit - terminate this process and its' children");
|
||||||
mvprintw(23,5,"<n> is an integer, above active everywhere outside data entry (>>)");
|
mvprintw(23,5,"<n> is an integer, above active everywhere outside data entry (>>)");
|
||||||
mvprintw(24,5,"no space before <n>, X0 to delete all commands.");
|
mvprintw(24,5,"no space before <n>, X0/W0 to delete/write all commands.");
|
||||||
|
|
||||||
mvprintw(row-2,1,"%s",prompt);
|
mvprintw(row-2,1,"%s",prompt);
|
||||||
refresh();
|
refresh();
|
||||||
|
|
Loading…
Reference in New Issue