You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by bl...@apache.org on 2004/10/03 14:20:06 UTC

cvs commit: xml-security/c/src/xkms/impl XKMSStatusRequestImpl.cpp XKMSStatusRequestImpl.hpp XKMSStatusResultImpl.cpp XKMSStatusResultImpl.hpp XKMSMessageFactoryImpl.cpp XKMSMessageFactoryImpl.hpp

blautenb    2004/10/03 05:20:06

  Modified:    c/Projects/VC6.0/xsec/xsec_lib xsec_lib.dsp
               c/src/tools/xklient xklient.cpp
               c/src/utils XSECSOAPRequestorSimple.cpp
                        XSECSOAPRequestorSimple.hpp
               c/src/utils/winutils XSECSOAPRequestorSimpleWin32.cpp
               c/src/xkms XKMSConstants.cpp XKMSConstants.hpp
                        XKMSMessageAbstractType.hpp XKMSMessageFactory.hpp
               c/src/xkms/impl XKMSMessageFactoryImpl.cpp
                        XKMSMessageFactoryImpl.hpp
  Added:       c/src/xkms XKMSStatusRequest.hpp XKMSStatusResult.hpp
               c/src/xkms/impl XKMSStatusRequestImpl.cpp
                        XKMSStatusRequestImpl.hpp XKMSStatusResultImpl.cpp
                        XKMSStatusResultImpl.hpp
  Log:
  Implement StatusResult and StatusRequest messages
  
  Revision  Changes    Path
  1.38      +24 -0     xml-security/c/Projects/VC6.0/xsec/xsec_lib/xsec_lib.dsp
  
  Index: xsec_lib.dsp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/Projects/VC6.0/xsec/xsec_lib/xsec_lib.dsp,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- xsec_lib.dsp	2 Oct 2004 23:14:53 -0000	1.37
  +++ xsec_lib.dsp	3 Oct 2004 12:20:05 -0000	1.38
  @@ -1208,6 +1208,22 @@
   # End Source File
   # Begin Source File
   
  +SOURCE=..\..\..\..\src\xkms\impl\XKMSStatusRequestImpl.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\..\..\..\src\xkms\impl\XKMSStatusRequestImpl.hpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\..\..\..\src\xkms\impl\XKMSStatusResultImpl.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\..\..\..\src\xkms\impl\XKMSStatusResultImpl.hpp
  +# End Source File
  +# Begin Source File
  +
   SOURCE=..\..\..\..\src\xkms\impl\XKMSUnverifiedKeyBindingImpl.cpp
   # End Source File
   # Begin Source File
  @@ -1310,6 +1326,14 @@
   # Begin Source File
   
   SOURCE=..\..\..\..\src\xkms\XKMSStatus.hpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\..\..\..\src\xkms\XKMSStatusRequest.hpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\..\..\..\src\xkms\XKMSStatusResult.hpp
   # End Source File
   # Begin Source File
   
  
  
  
  1.18      +120 -2    xml-security/c/src/tools/xklient/xklient.cpp
  
  Index: xklient.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/tools/xklient/xklient.cpp,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- xklient.cpp	3 Oct 2004 03:13:53 -0000	1.17
  +++ xklient.cpp	3 Oct 2004 12:20:05 -0000	1.18
  @@ -44,6 +44,8 @@
   #include <xsec/xkms/XKMSMessageAbstractType.hpp>
   #include <xsec/xkms/XKMSLocateRequest.hpp>
   #include <xsec/xkms/XKMSLocateResult.hpp>
  +#include <xsec/xkms/XKMSStatusRequest.hpp>
  +#include <xsec/xkms/XKMSStatusResult.hpp>
   #include <xsec/xkms/XKMSResult.hpp>
   #include <xsec/xkms/XKMSQueryKeyBinding.hpp>
   #include <xsec/xkms/XKMSKeyBinding.hpp>
  @@ -892,6 +894,39 @@
   }
   
   // --------------------------------------------------------------------------------
  +//           Create a StatusRequest
  +// --------------------------------------------------------------------------------
  +
  +void printStatusRequestUsage(void) {
  +
  +	cerr << "\nUsage StatusRequest [--help|-h] <service URI> <OriginalRequestId> <ResponseId>\n";
  +	cerr << "   --help/-h                : print this screen and exit\n\n";
  +
  +}
  +
  +XKMSMessageAbstractType * createStatusRequest(XSECProvider &prov, DOMDocument **doc, int argc, char ** argv, int paramCount) {
  +
  +	if (paramCount +2 >= argc || 
  +		(stricmp(argv[paramCount], "--help") == 0) ||
  +		(stricmp(argv[paramCount], "-h") == 0)) {
  +
  +		printStatusRequestUsage();
  +		return NULL;
  +	}
  +
  +	/* First create the basic request */
  +	XKMSMessageFactory * factory = 
  +		prov.getXKMSMessageFactory();
  +	XKMSStatusRequest * sr = 
  +		factory->createStatusRequest(MAKE_UNICODE_STRING(argv[paramCount++]), doc);
  +
  +	sr->setOriginalRequestId(MAKE_UNICODE_STRING(argv[paramCount++]));
  +	sr->setResponseId(MAKE_UNICODE_STRING(argv[paramCount++]));
  +
  +	return sr;
  +}
  +
  +// --------------------------------------------------------------------------------
   //           Create a CompoundRequest
   // --------------------------------------------------------------------------------
   
  @@ -1232,6 +1267,17 @@
   	return 0;
   }
   
  +int doStatusRequestDump(XKMSStatusRequest *msg) {
  +
  +	cout << endl << "This is a StatusRequest Message" << endl;
  +	int level = 1;
  +	
  +	doMessageAbstractTypeDump(msg, level);
  +	doRequestAbstractTypeDump(msg, level);
  +
  +	return 0;
  +}
  +
   int doValidateRequestDump(XKMSValidateRequest *msg) {
   
   	cout << endl << "This is a ValidateRequest Message" << endl;
  @@ -1301,6 +1347,17 @@
   	return 0;
   }
   
  +int doStatusResultDump(XKMSStatusResult *msg) {
  +
  +	cout << endl << "This is a StatusResult Message" << endl;
  +	int level = 1;
  +	
  +	doMessageAbstractTypeDump(msg, level);
  +	doResultTypeDump(msg, level);
  +
  +	return 0;
  +}
  +
   int doResultDump(XKMSResult *msg) {
   
   	cout << endl << "This is a Result Message" << endl;
  @@ -1380,6 +1437,16 @@
   		doLocateResultDump(dynamic_cast<XKMSLocateResult *>(msg));
   		break;
   
  +	case XKMSMessageAbstractType::StatusRequest :
  +
  +		doStatusRequestDump(dynamic_cast<XKMSStatusRequest *>(msg));
  +		break;
  +
  +	case XKMSMessageAbstractType::StatusResult :
  +
  +		doStatusResultDump(dynamic_cast<XKMSStatusResult *>(msg));
  +		break;
  +
   	case XKMSMessageAbstractType::Result :
   
   		doResultDump(dynamic_cast<XKMSResult *>(msg));
  @@ -1523,7 +1590,12 @@
   
   	cerr << "\nUsage request [options] {CompoundRequest|LocateRequest|ValidateRequest|PendingRequest} [msg specific options]\n";
   	cerr << "   --help/-h       : Print this screen and exit\n";
  -	cerr << "   --two-phase/-t  : Indicate Two-Phase support in the request message\n\n";
  +	cerr << "   --two-phase/-t  : Indicate Two-Phase support in the request message\n";
  +	cerr << "   --envelope-type/-e [NONE|SOAP11|SOAP12]\n";
  +    cerr << "                   : Set envelope wrapper for request\n";
  +	cerr << "                     NONE   = No wrapper - straight HTTP request\n";
  +	cerr << "                     SOAP11 = Use a SOAP 1.1 envelope\n";
  +	cerr << "                     SOAP12 = Use a SOAP 1.2 envelope\n\n";
   
   }
   
  @@ -1532,6 +1604,8 @@
   	XSECProvider prov;
   	DOMDocument * doc;
   	XKMSMessageAbstractType *msg;
  +	XSECSOAPRequestorSimple::envelopeType et = XSECSOAPRequestorSimple::ENVELOPE_SOAP11;
  +
   	bool twoPhase = false;
   	bool parmsDone = false;
   
  @@ -1550,6 +1624,32 @@
   			paramCount++;
   
   		}
  +		if ((stricmp(argv[paramCount], "--envelope") == 0) ||
  +			(stricmp(argv[paramCount], "-e") == 0)) {
  +
  +			// Set the wrapper envelope type
  +
  +			paramCount++;
  +			if (paramCount == argc) {
  +				printDoRequestUsage();
  +				return -1;
  +			}
  +
  +			if (stricmp(argv[paramCount], "NONE") == 0) {
  +				et = XSECSOAPRequestorSimple::ENVELOPE_NONE;
  +			}
  +			else if (stricmp(argv[paramCount], "SOAP11") == 0) {
  +				et = XSECSOAPRequestorSimple::ENVELOPE_SOAP11;
  +			}
  +			else if (stricmp(argv[paramCount], "SOAP12") == 0) {
  +				et = XSECSOAPRequestorSimple::ENVELOPE_SOAP12;
  +			}
  +			else {
  +				printDoRequestUsage();
  +				return -1;
  +			}
  +			paramCount++;
  +		}
   		if ((stricmp(argv[paramCount], "LocateRequest") == 0) ||
   			(stricmp(argv[paramCount], "lr") == 0)) {
   
  @@ -1602,6 +1702,23 @@
   			parmsDone = true;
   
   		}
  +		else if ((stricmp(argv[paramCount], "StatusRequest") == 0) ||
  +			(stricmp(argv[paramCount], "sr") == 0)) {
  +
  +			paramCount++;
  +			XKMSStatusRequest * r = 
  +				dynamic_cast<XKMSStatusRequest *> (createStatusRequest(prov, &doc, argc, argv, paramCount));
  +
  +			if (r == NULL) {
  +				return -1;
  +			}
  +			if (twoPhase)
  +				r->appendResponseMechanismItem(XKMSConstants::s_tagRepresent);
  +
  +			msg = r;
  +			parmsDone = true;
  +
  +		}
   		else if ((stricmp(argv[paramCount], "CompoundRequest") == 0) ||
   			(stricmp(argv[paramCount], "cr") == 0)) {
   
  @@ -1641,6 +1758,7 @@
   
   	try {
   		XSECSOAPRequestorSimple req(msg->getService());
  +		req.setEnvelopeType(et);
   		responseDoc = req.doRequest(doc);
   
   		/* If two-phase - re-do the request */
  
  
  
  1.4       +77 -30    xml-security/c/src/utils/XSECSOAPRequestorSimple.cpp
  
  Index: XSECSOAPRequestorSimple.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/utils/XSECSOAPRequestorSimple.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XSECSOAPRequestorSimple.cpp	2 Aug 2004 11:06:56 -0000	1.3
  +++ XSECSOAPRequestorSimple.cpp	3 Oct 2004 12:20:06 -0000	1.4
  @@ -101,45 +101,76 @@
   
   char * XSECSOAPRequestorSimple::wrapAndSerialise(DOMDocument * request) {
   
  -	// Create a new document to wrap the request in
  +	// Prepare the serialiser
   
   	XMLCh tempStr[100];
   	XMLString::transcode("Core", tempStr, 99);    
   	DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
  +	DOMWriter         *theSerializer = ((DOMImplementationLS*)impl)->createDOMWriter();
   
  -	safeBuffer str;
  -
  -	makeQName(str, s_prefix, s_Envelope);
  +	theSerializer->setEncoding(MAKE_UNICODE_STRING("UTF-8"));
  +	if (theSerializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, false))
  +		theSerializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, false);
   
  -	DOMDocument *doc = impl->createDocument(
  -		XKMSConstants::s_unicodeStrURISOAP11,
  -				str.rawXMLChBuffer(),
  -				NULL);// DOMDocumentType());  // document type object (DTD).
  +	MemBufFormatTarget *formatTarget = new MemBufFormatTarget;
   
  -	DOMElement *rootElem = doc->getDocumentElement();
  +	if (m_envelopeType != ENVELOPE_NONE) {
   
  -	makeQName(str, s_prefix, s_Body);
  -	DOMElement *body = doc->createElementNS(
  -			XKMSConstants::s_unicodeStrURISOAP11,
  -			str.rawXMLChBuffer());
  +		// Create a new document to wrap the request in
  +		safeBuffer str;
   
  -	rootElem->appendChild(body);
  +		makeQName(str, s_prefix, s_Envelope);
   
  -	// Now replicate the request into the document
  -	DOMElement * reqElement = (DOMElement *) doc->importNode(request->getDocumentElement(), true);
  -	body->appendChild(reqElement);
  +		DOMDocument *doc;
  +		
  +		if (m_envelopeType == ENVELOPE_SOAP11) {
  +			doc = impl->createDocument(
  +				XKMSConstants::s_unicodeStrURISOAP11,
  +						str.rawXMLChBuffer(),
  +						NULL);
  +			DOMElement *rootElem = doc->getDocumentElement();
  +
  +			makeQName(str, s_prefix, s_Body);
  +			DOMElement *body = doc->createElementNS(
  +					XKMSConstants::s_unicodeStrURISOAP11,
  +					str.rawXMLChBuffer());
  +
  +			rootElem->appendChild(body);
  +
  +			// Now replicate the request into the document
  +			DOMElement * reqElement = (DOMElement *) doc->importNode(request->getDocumentElement(), true);
  +			body->appendChild(reqElement);
  +		}
  +		else {
  +			doc = impl->createDocument(
  +				XKMSConstants::s_unicodeStrURISOAP12,
  +						str.rawXMLChBuffer(),
  +						NULL);
  +			DOMElement *rootElem = doc->getDocumentElement();
  +
  +			makeQName(str, s_prefix, s_Body);
  +			DOMElement *body = doc->createElementNS(
  +					XKMSConstants::s_unicodeStrURISOAP12,
  +					str.rawXMLChBuffer());
  +
  +			rootElem->appendChild(body);
  +
  +			// Now replicate the request into the document
  +			DOMElement * reqElement = (DOMElement *) doc->importNode(request->getDocumentElement(), true);
  +			body->appendChild(reqElement);
  +		}
   
  -	// OK - Now we have the SOAP request as a document, we serialise to a string buffer
  -	// and return
   
  -	DOMWriter         *theSerializer = ((DOMImplementationLS*)impl)->createDOMWriter();
  +		// OK - Now we have the SOAP request as a document, we serialise to a string buffer
  +		// and return
   
  -	theSerializer->setEncoding(MAKE_UNICODE_STRING("UTF-8"));
  -	if (theSerializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, false))
  -		theSerializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, false);
  +		theSerializer->writeNode(formatTarget, *doc);
  +		doc->release();
   
  -	MemBufFormatTarget *formatTarget = new MemBufFormatTarget;
  -	theSerializer->writeNode(formatTarget, *doc);
  +	}
  +	else {
  +		theSerializer->writeNode(formatTarget, *request);
  +	}
   
   	// Now replicate the buffer
   	char * ret = XMLString::replicate((const char *) formatTarget->getRawBuffer());
  @@ -147,8 +178,6 @@
   	delete theSerializer;
   	delete formatTarget;
   
  -	doc->release();
  -
   	return ret;
   }
   
  @@ -176,11 +205,19 @@
       errorCount = parser->getErrorCount();
       if (errorCount > 0)
   		throw XSECException(XSECException::HTTPURIInputStreamError,
  -							"Error parsing SOAP response message");
  +							"Error parsing response message");
  +
  +	if (m_envelopeType == ENVELOPE_NONE) {
  +
  +		return parser->adoptDocument();
  +
  +	}
   
       DOMDocument * responseDoc = parser->getDocument();
   
  -	// Now create a new document for the Response message
  +	// Must be a SOAP message of some kind - so lets remove the wrapper.
  +	// First create a new document for the Response message
  +
   	XMLCh tempStr[100];
   	XMLString::transcode("Core", tempStr, 99);    
   	DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
  @@ -260,3 +297,13 @@
   	return retDoc;
   
   }
  +
  +// --------------------------------------------------------------------------------
  +//           Envelope Type handling
  +// --------------------------------------------------------------------------------
  +
  +void XSECSOAPRequestorSimple::setEnvelopeType(envelopeType et) {
  +
  +	m_envelopeType = et;
  +
  +}
  \ No newline at end of file
  
  
  
  1.3       +35 -1     xml-security/c/src/utils/XSECSOAPRequestorSimple.hpp
  
  Index: XSECSOAPRequestorSimple.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/utils/XSECSOAPRequestorSimple.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XSECSOAPRequestorSimple.hpp	9 Jun 2004 04:07:01 -0000	1.2
  +++ XSECSOAPRequestorSimple.hpp	3 Oct 2004 12:20:06 -0000	1.3
  @@ -56,6 +56,18 @@
   
   public :
   
  +	/**
  +	 * Envelope Enumeration
  +	 */
  +
  +	enum envelopeType {
  +
  +		ENVELOPE_NONE,		/** No envelope - straight HTTP request */
  +		ENVELOPE_SOAP11,	/** SOAP 1.1 envelope (default) */
  +		ENVELOPE_SOAP12		/** SOAP 1.2 envelope */
  +
  +	};
  +
   	/** @name Constructors and Destructors */
   	//@{
   
  @@ -75,6 +87,7 @@
   	//@}
   
   	/** @name Interface methods */
  +	//@{
   
   	/**
   	 * \brief Do a SOAP request
  @@ -92,6 +105,25 @@
   	virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *
   		doRequest(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * request);
   
  +	//@}
  +
  +	/** @name Configuration methods */
  +	//@{
  +
  +	/**
  +	 * \brief Set the envelope type
  +	 *
  +	 * The requestor can do a SOAP 1.1, SOAP 1.2 or no envelope around the
  +	 * message.  This call allows the apllication to set the type.
  +	 *
  +	 * By default, the requestor uses a SOAP 1.1 envelope
  +	 *
  +	 * @param et - the type of envelope to use
  +	 */
  +
  +	void setEnvelopeType(envelopeType et);
  +
  +
   private:
   
   	char * wrapAndSerialise(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * request);
  @@ -100,6 +132,8 @@
   
   	XERCES_CPP_NAMESPACE_QUALIFIER XMLUri			
   						m_uri;
  +
  +	envelopeType		m_envelopeType;
   
   };
   
  
  
  
  1.7       +8 -2      xml-security/c/src/utils/winutils/XSECSOAPRequestorSimpleWin32.cpp
  
  Index: XSECSOAPRequestorSimpleWin32.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/utils/winutils/XSECSOAPRequestorSimpleWin32.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XSECSOAPRequestorSimpleWin32.cpp	2 Aug 2004 11:07:45 -0000	1.6
  +++ XSECSOAPRequestorSimpleWin32.cpp	3 Oct 2004 12:20:06 -0000	1.7
  @@ -65,6 +65,7 @@
   XSECSOAPRequestorSimple::XSECSOAPRequestorSimple(const XMLCh * uri) : m_uri(uri) {
   
   	XSECBinHTTPURIInputStream::ExternalInitialize();
  +	m_envelopeType = ENVELOPE_SOAP11;
   
   }
   
  @@ -304,7 +305,7 @@
       if (p == 0)
       {
           throw XSECException(XSECException::HTTPURIInputStreamError,
  -							"Error reported reading socket");
  +							"XSECSOAPRequestorSimple - Error reported reading socket");
       }
   
       int httpResponse = atoi(p);
  @@ -391,6 +392,11 @@
   		else {
   			responseLength = 0;
   		}
  +	}
  +
  +	if (lent <= 0) {
  +        throw XSECException(XSECException::HTTPURIInputStreamError,
  +			"XSECSOAPRequestorSimple - Zero length response from server");
   	}
   
   	return parseAndUnwrap(responseBuffer.rawCharBuffer(), lent);
  
  
  
  1.12      +60 -1     xml-security/c/src/xkms/XKMSConstants.cpp
  
  Index: XKMSConstants.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xkms/XKMSConstants.cpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- XKMSConstants.cpp	2 Oct 2004 23:12:30 -0000	1.11
  +++ XKMSConstants.cpp	3 Oct 2004 12:20:06 -0000	1.12
  @@ -122,6 +122,18 @@
   	chNull
   };
   
  +const XMLCh XKMSConstants::s_tagFailure[] = {
  +
  +	chLatin_F,
  +	chLatin_a,
  +	chLatin_i,
  +	chLatin_l,
  +	chLatin_u,
  +	chLatin_r,
  +	chLatin_e,
  +	chNull
  +};
  +
   const XMLCh XKMSConstants::s_tagId[] = {
   
   	chLatin_I,
  @@ -613,6 +625,41 @@
   	chNull
   };
   
  +const XMLCh XKMSConstants::s_tagStatusRequest[] = {
  +
  +	chLatin_S,
  +	chLatin_t,
  +	chLatin_a,
  +	chLatin_t,
  +	chLatin_u,
  +	chLatin_s,
  +	chLatin_R,
  +	chLatin_e,
  +	chLatin_q,
  +	chLatin_u,
  +	chLatin_e,
  +	chLatin_s,
  +	chLatin_t,
  +	chNull
  +};
  +
  +const XMLCh XKMSConstants::s_tagStatusResult[] = {
  +
  +	chLatin_S,
  +	chLatin_t,
  +	chLatin_a,
  +	chLatin_t,
  +	chLatin_u,
  +	chLatin_s,
  +	chLatin_R,
  +	chLatin_e,
  +	chLatin_s,
  +	chLatin_u,
  +	chLatin_l,
  +	chLatin_t,
  +	chNull
  +};
  +
   const XMLCh XKMSConstants::s_tagStatusValue[] = {
   
   	chLatin_S,
  @@ -626,6 +673,18 @@
   	chLatin_l,
   	chLatin_u,
   	chLatin_e,
  +	chNull
  +};
  +
  +const XMLCh XKMSConstants::s_tagSuccess[] = {
  +
  +	chLatin_S,
  +	chLatin_u,
  +	chLatin_c,
  +	chLatin_c,
  +	chLatin_e,
  +	chLatin_s,
  +	chLatin_s,
   	chNull
   };
   
  
  
  
  1.14      +6 -2      xml-security/c/src/xkms/XKMSConstants.hpp
  
  Index: XKMSConstants.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xkms/XKMSConstants.hpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- XKMSConstants.hpp	2 Oct 2004 23:12:30 -0000	1.13
  +++ XKMSConstants.hpp	3 Oct 2004 12:20:06 -0000	1.14
  @@ -34,7 +34,7 @@
   #define URI_ID_XKMS		"http://www.w3.org/2002/03/xkms#"
   //#define URI_ID_XKMS		"http://www.w3.org/2004/07/xkms#"
   #define URI_ID_SOAP11   "http://schemas.xmlsoap.org/soap/envelope/"
  -#define URI_ID_SOAP12   "http://www.w3.org/2002/06/soap-envelope/"
  +#define URI_ID_SOAP12   "http://www.w3.org/2003/05/soap-envelope"
   
   
   // --------------------------------------------------------------------------------
  @@ -56,6 +56,7 @@
   	static const XMLCh s_tagCompoundResult[];
   	static const XMLCh s_tagEncryption[];
   	static const XMLCh s_tagExchange[];
  +	static const XMLCh s_tagFailure[];
   	static const XMLCh s_tagId[];
   	static const XMLCh s_tagIdentifier[];
   	static const XMLCh s_tagIndeterminateReason[];
  @@ -87,7 +88,10 @@
   	static const XMLCh s_tagService[];
   	static const XMLCh s_tagSignature[];
   	static const XMLCh s_tagStatus[];
  +	static const XMLCh s_tagStatusRequest[];
  +	static const XMLCh s_tagStatusResult[];
   	static const XMLCh s_tagStatusValue[];
  +	static const XMLCh s_tagSuccess[];
   	static const XMLCh s_tagUnverifiedKeyBinding[];
   	static const XMLCh s_tagUseKeyWith[];
   	static const XMLCh s_tagValidateRequest[];
  
  
  
  1.8       +4 -2      xml-security/c/src/xkms/XKMSMessageAbstractType.hpp
  
  Index: XKMSMessageAbstractType.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xkms/XKMSMessageAbstractType.hpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XKMSMessageAbstractType.hpp	2 Oct 2004 23:12:30 -0000	1.7
  +++ XKMSMessageAbstractType.hpp	3 Oct 2004 12:20:06 -0000	1.8
  @@ -102,7 +102,9 @@
   		LocateResult,			/** A LocateResult message */
   		ValidateRequest,		/** A ValidateRequest message */
   		ValidateResult,			/** A ValidateResult message */
  -		PendingRequest,			/** A PendingRequest message (Asynchronous protocol */
  +		PendingRequest,			/** A PendingRequest message (Asynchronous protocol) */
  +		StatusRequest,          /** A StatusRequest message (Asynchronous protocol) */
  +		StatusResult,           /** A StatusResult message (Asynchronous protocol) */
   		Result					/** A non-specific result message */
   
   	};
  
  
  
  1.8       +89 -1     xml-security/c/src/xkms/XKMSMessageFactory.hpp
  
  Index: XKMSMessageFactory.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xkms/XKMSMessageFactory.hpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XKMSMessageFactory.hpp	2 Oct 2004 23:12:30 -0000	1.7
  +++ XKMSMessageFactory.hpp	3 Oct 2004 12:20:06 -0000	1.8
  @@ -42,6 +42,8 @@
   class XKMSValidateRequest;
   class XKMSValidateResult;
   class XKMSPendingRequest;
  +class XKMSStatusRequest;
  +class XKMSStatusResult;
   
   XSEC_DECLARE_XERCES_CLASS(DOMElement);
   
  @@ -271,6 +273,47 @@
   		const XMLCh * id = NULL) = 0;
   
   	/**
  +	 * \brief Create a new \<StatusRequest\> message.
  +	 * 
  +	 * Generates a new StatusRequest message from scratch, building the DOM
  +	 * as it goes.
  +	 *
  +	 * @param service URI
  +	 * @param doc Document to create the DOM structure within.  The caller
  +	 * will need to embed the DOM structure at the appropriate place in the
  +	 * document (using a call to getElement to find the top level element)
  +	 * @param id Value to set in the Id field.  If NULL, the library will
  +	 * generate a new Unique Id value.
  +	 * @returns the new XKMSStatusRequest structure
  +	 */
  +
  +	virtual XKMSStatusRequest * createStatusRequest(
  +		const XMLCh * service,
  +		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
  +		const XMLCh * id = NULL) = 0;
  +		
  +	/**
  +	 * \brief Create a new \<StatusRequest\> message and surrounding document
  +	 * 
  +	 * Generates a new StatusRequest message from scratch, building the DOM
  +	 * as it goes.
  +	 *
  +	 * @param service URI
  +	 * @param doc Will be used to return the newly created document element in.
  +	 * @param id Value to set in the Id field.  If NULL, the library will
  +	 * generate a new Unique Id value.
  +	 * @returns the new XKMSStatusRequest structure
  +	 * @note Like all the xsec library functions, the document is owned by
  +	 * the calling application.  Deleting the StatusRequest object will not
  +	 * delete the DOM document as well.
  +	 */
  +
  +	virtual XKMSStatusRequest * createStatusRequest(
  +		const XMLCh * service,
  +		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
  +		const XMLCh * id = NULL) = 0;
  +
  +	/**
   	 * \brief Create a new \<LocateResult\> message.
   	 * 
   	 * Generates a new LocateResult message from scratch, building the DOM
  @@ -445,6 +488,51 @@
   
   	virtual XKMSResult * createResult(
   		XKMSRequestAbstractType * request,
  +		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
  +		XKMSResultType::ResultMajor rmaj,
  +		XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
  +		const XMLCh * id = NULL) = 0;
  +
  +	/**
  +	 * \brief Create a new \<StatusResult\> message.
  +	 * 
  +	 * Generates a new StatusResult message from scratch, building the DOM
  +	 * as it goes.  The response will be based on a input StatusRequest message
  +	 * which is used to provide Id etc.
  +	 *
  +	 * @param request Request to base response on
  +	 * @param doc Will be used to return the newly created document element in.
  +	 * @param id Value to set in the Id field.  If NULL, the library will
  +	 * generate a new Unique Id value.
  +	 * @returns the new XKMSStatusRessult structure
  +	 */
  +
  +	virtual XKMSStatusResult * createStatusResult(
  +		XKMSStatusRequest * request,
  +		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
  +		XKMSResultType::ResultMajor rmaj,
  +		XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
  +		const XMLCh * id = NULL) = 0;
  +
  +	/**
  +	 * \brief Create a new \<StatusResult\> message and surrounding document
  +	 * 
  +	 * Generates a new StatusResult message from scratch, building the DOM
  +	 * as it goes.  The response will be based on a input StatusRequest message
  +	 * which is used to provide Id etc.
  +	 *
  +	 * @param request Request to base response on
  +	 * @param doc Will be used to return the newly created document element in.
  +	 * @param id Value to set in the Id field.  If NULL, the library will
  +	 * generate a new Unique Id value.
  +	 * @returns the new XKMSStatusResult structure
  +	 * @note Like all the xsec library functions, the document is owned by
  +	 * the calling application.  Deleting the StatusResult object will not
  +	 * delete the DOM document as well.
  +	 */
  +
  +	virtual XKMSStatusResult * createStatusResult(
  +		XKMSStatusRequest * request,
   		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
   		XKMSResultType::ResultMajor rmaj,
   		XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
  
  
  
  1.1                  xml-security/c/src/xkms/XKMSStatusRequest.hpp
  
  Index: XKMSStatusRequest.hpp
  ===================================================================
  /*
   * Copyright 2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * imitations under the License.
   */
  
  /*
   * XSEC
   *
   * XKMSStatusRequest := Interface for StatusRequest Messages
   *
   * $Id: XKMSStatusRequest.hpp,v 1.1 2004/10/03 12:20:06 blautenb Exp $
   *
   */
  
  #ifndef XKMSSTATUSREQUEST_INCLUDE
  #define XKMSSTATUSREQUEST_INCLUDE
  
  // XSEC Includes
  
  #include <xsec/framework/XSECDefs.hpp>
  #include <xsec/xkms/XKMSRequestAbstractType.hpp>
  
  class XKMSQueryKeyBinding;
  
  /**
   * @ingroup xkms
   * @{
   */
  
  /**
   * @brief Interface definition for the StatusRequest elements
   *
   * The \<StatusRequest\> is used in Asynchronous processing.  A client
   * uses the StatusRequest element to request a determine whether a
   * request for which the original response was "Pending" is now ready.
   *
   * The schema definition for StatusRequest is as follows :
   *
   * \verbatim
     <!-- StatusRequest -->
     <element name="StatusRequest" type="xkms:StatusRequestType"/>
     <complexType name="StatusRequestType">
        <complexContent>
           <extension base="xkms:PendingRequestType"/>
        </complexContent>
     </complexType>
     <!-- /StatusRequest -->\endverbatim
   */
  
  class XKMSStatusRequest : virtual public XKMSRequestAbstractType {
  
  	/** @name Constructors and Destructors */
  	//@{
  
  protected:
  
  	XKMSStatusRequest() {};
  
  public:
  
  	virtual ~XKMSStatusRequest() {};
  
  	/** @name Getter Interface Methods */
  	//@{
  
  	/**
  	 * \brief Return the element at the base of the message
  	 */
  
  	virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
  
  	/**
  	 * \brief Return the ResponseId
  	 *
  	 * The ResponseId equates to the Id of the first response the service returned,
  	 * which must (by definition) have had a response code of "Pending".  Together
  	 * with the OriginalRequestId, this can be used by the service to uniquley
  	 * identify the original request for which this StatusRequest refers.
  	 *
  	 * @return A pointer to the XMLCh string holding the ResponseId
  	 */
  
  	virtual const XMLCh * getResponseId(void) const = 0;
  
  	//@}
  
  	/** @name Setter Interface Methods */
  	//@{
  
  	/**
  	 * \brief Set the ResponseId
  	 *
  	 * Allows a calling application to over-ride the configured responseId
  	 *
  	 * @param responseId The new responseId for this element
  	 */
  
  	virtual void setResponseId(const XMLCh * responseId) = 0;
  
  	//@}
  
  private:
  
  	// Unimplemented
  	XKMSStatusRequest(const XKMSStatusRequest &);
  	XKMSStatusRequest & operator = (const XKMSStatusRequest &);
  
  };
  
  #endif /* XKMSSTATUSREQUEST_INCLUDE */
  
  
  
  1.1                  xml-security/c/src/xkms/XKMSStatusResult.hpp
  
  Index: XKMSStatusResult.hpp
  ===================================================================
  /*
   * Copyright 2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * imitations under the License.
   */
  
  /*
   * XSEC
   *
   * XKMSStatusResult := Interface for StatusResult Messages
   *
   * $Id: XKMSStatusResult.hpp,v 1.1 2004/10/03 12:20:06 blautenb Exp $
   *
   */
  
  #ifndef XKMSSTATUSRESULT_INCLUDE
  #define XKMSSTATUSRESULT_INCLUDE
  
  // XSEC Includes
  
  #include <xsec/framework/XSECDefs.hpp>
  #include <xsec/xkms/XKMSResultType.hpp>
  
  class XKMSQueryKeyBinding;
  class XKMSUnverifiedKeyBinding;
  
  /**
   * @ingroup xkms
   * @{
   */
  
  /**
   * @brief Interface definition for the StatusResult elements
   *
   * The \<StatusResult\> is used for Asynchronous processing and
   * allows a client to determing whether a Pending response is ready
   * for return.
   *
   * The schema definition for StatusResponse is as follows :
   *
   * \verbatim
     <!-- StatusResult -->
     <element name="StatusResult" type="xkms:StatusResultType"/>
     <complexType name="StatusResultType">
        <complexContent>
           <extension base="xkms:ResultType">
              <attribute name="Success" type="integer" use="optional"/>
              <attribute name="Failure" type="integer" use="optional"/>
              <attribute name="Pending" type="integer" use="optional"/>
           </extension>
        </complexContent>
     </complexType>
     <!-- /StatusResult -->\endverbatim
   */
  
  class XKMSStatusResult : virtual public XKMSResultType {
  
  	/** @name Constructors and Destructors */
  	//@{
  
  protected:
  
  	XKMSStatusResult() {};
  
  public:
  
  	virtual ~XKMSStatusResult() {};
  
  	/** @name Getter Interface Methods */
  	//@{
  
  	/**
  	 * \brief Return the element at the base of the message
  	 */
  
  	virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
  
  	//@}
  
  	/** @name Count handling  */
  	//@{
  
  	/**
  	 * \brief Find number of Success messages
  	 *
  	 * A StatusResult can have a count of messages within a pending CompoundResponse
  	 * with a Success result code.
  	 *
  	 * @returns the number of Success messages in a pending CompoundResponse
  	 */
  
  	virtual int getSuccessCount(void) const = 0;
  
  	/**
  	 * \brief Find number of Failed messages
  	 *
  	 * A StatusResult can have a count of messages within a pending CompoundResponse
  	 * with a Failure result type.
  	 *
  	 * @returns the number of Failed messages in a pending CompoundResponse
  	 */
  
  	virtual int getFailureCount(void) const = 0;
  
  	/**
  	 * \brief Find number of Pending messages
  	 *
  	 * A StatusResult can have a count of messages within a pending CompoundResponse
  	 * with a Pending result code.
  	 *
  	 * @returns the number of Pending messages in a pending CompoundResponse
  	 */
  
  	virtual int getPendingCount(void) const = 0;
  
  	/**
  	 * \brief Set the number of Success messages
  	 *
  	 * A StatusResult can have a count of messages within a pending CompoundResponse
  	 * with a Success result code.
  	 *
  	 * @param count the number of Success messages in a pending CompoundResponse
  	 */
  
  	virtual void setSuccessCount(int count) = 0;
  
  	/**
  	 * \brief Set the number of Failed messages
  	 *
  	 * A StatusResult can have a count of messages within a pending CompoundResponse
  	 * with a Failed result code.
  	 *
  	 * @param count the number of Failed messages in a pending CompoundResponse
  	 */
  
  	virtual void setFailureCount(int count) = 0;
  
  	/**
  	 * \brief Set the number of Pending messages
  	 *
  	 * A StatusResult can have a count of messages within a pending CompoundResponse
  	 * with a Pending result code.
  	 *
  	 * @param count the number of Pending messages in a pending CompoundResponse
  	 */
  
  	virtual void setPendingCount(int count) = 0;
  
  	//@}
  
  private:
  
  	// Unimplemented
  	XKMSStatusResult(const XKMSStatusResult &);
  	XKMSStatusResult & operator = (const XKMSStatusResult &);
  
  };
  
  #endif /* XKMSSTATUSRESULT_INCLUDE */
  
  
  
  1.10      +114 -1    xml-security/c/src/xkms/impl/XKMSMessageFactoryImpl.cpp
  
  Index: XKMSMessageFactoryImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xkms/impl/XKMSMessageFactoryImpl.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XKMSMessageFactoryImpl.cpp	2 Oct 2004 23:12:30 -0000	1.9
  +++ XKMSMessageFactoryImpl.cpp	3 Oct 2004 12:20:06 -0000	1.10
  @@ -37,6 +37,8 @@
   #include "XKMSMessageFactoryImpl.hpp"
   #include "XKMSLocateRequestImpl.hpp"
   #include "XKMSLocateResultImpl.hpp"
  +#include "XKMSStatusRequestImpl.hpp"
  +#include "XKMSStatusResultImpl.hpp"
   #include "XKMSResultImpl.hpp"
   #include "XKMSValidateRequestImpl.hpp"
   #include "XKMSValidateResultImpl.hpp"
  @@ -251,6 +253,34 @@
   
   	}
   
  +	else if (strEquals(name, XKMSConstants::s_tagStatusRequest)) {
  +
  +		// This is a <StatusRequest> message
  +		XKMSStatusRequestImpl * ret;
  +		XSECnew(ret, XKMSStatusRequestImpl(new XSECEnv(*mp_env), elt));
  +		Janitor<XKMSStatusRequestImpl> j_ret(ret);
  +
  +		ret->load();
  +		
  +		j_ret.release();
  +		return ret;
  +
  +	}
  +
  +	else if (strEquals(name, XKMSConstants::s_tagStatusResult)) {
  +
  +		// This is a <StatusRequest> message
  +		XKMSStatusResultImpl * ret;
  +		XSECnew(ret, XKMSStatusResultImpl(new XSECEnv(*mp_env), elt));
  +		Janitor<XKMSStatusResultImpl> j_ret(ret);
  +
  +		ret->load();
  +		
  +		j_ret.release();
  +		return ret;
  +
  +	}
  +
   	return NULL;
   
   }
  @@ -417,6 +447,45 @@
   	return pri;
   }
   
  +XKMSStatusRequest * XKMSMessageFactoryImpl::createStatusRequest(
  +		const XMLCh * service,
  +		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
  +		const XMLCh * id) {
  +	
  +	XKMSStatusRequestImpl* sri;
  +
  +	XSECEnv * tenv;
  +	XSECnew(tenv, XSECEnv(*mp_env));
  +	tenv->setParentDocument(doc);
  +
  +	XSECnew(sri, XKMSStatusRequestImpl(tenv));
  +	sri->createBlankStatusRequest(service, id);
  +
  +	return sri;
  +
  +}
  +
  +XKMSStatusRequest * XKMSMessageFactoryImpl::createStatusRequest(
  +		const XMLCh * service,
  +		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
  +		const XMLCh * id) {
  +
  +
  +	// Create a document to put the element in
  +
  +	XMLCh tempStr[100];
  +	XMLString::transcode("Core", tempStr, 99);    
  +	DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
  +
  +	*doc = impl->createDocument();
  +
  +	// Embed the new structure in the document
  +	XKMSStatusRequest * sri = createStatusRequest(service, *doc, id);
  +	(*doc)->appendChild(sri->getElement());
  +
  +	return sri;
  +}
  +
   // --------------------------------------------------------------------------------
   //           Create a result based on a request
   // --------------------------------------------------------------------------------
  @@ -463,6 +532,50 @@
   	(*doc)->appendChild(lr->getElement());
   
   	return lr;
  +}
  +
  +XKMSStatusResult * XKMSMessageFactoryImpl::createStatusResult(
  +		XKMSStatusRequest * request,
  +		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc,
  +		XKMSResultType::ResultMajor rmaj,
  +		XKMSResultType::ResultMinor rmin,
  +		const XMLCh * id) {
  +
  +	XKMSStatusResultImpl * sri;
  +
  +	XSECEnv * tenv;
  +	XSECnew(tenv, XSECEnv(*mp_env));
  +	tenv->setParentDocument(doc);
  +
  +	XSECnew(sri, XKMSStatusResultImpl(tenv));
  +	sri->createBlankStatusResult(request->getService(), id, rmaj, rmin);
  +
  +	copyRequestToResult(request, (XKMSResultTypeImpl*) sri);
  +
  +	return sri;
  +
  +}
  +
  +XKMSStatusResult * XKMSMessageFactoryImpl::createStatusResult(
  +		XKMSStatusRequest * request,
  +		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
  +		XKMSResultType::ResultMajor rmaj,
  +		XKMSResultType::ResultMinor rmin,
  +		const XMLCh * id) {
  +
  +	// Create a document to put the element in
  +
  +	XMLCh tempStr[100];
  +	XMLString::transcode("Core", tempStr, 99);    
  +	DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
  +
  +	*doc = impl->createDocument();
  +
  +	// Embed the new structure in the document
  +	XKMSStatusResult * sr = createStatusResult(request, *doc, rmaj, rmin, id);
  +	(*doc)->appendChild(sr->getElement());
  +
  +	return sr;
   }
   
   XKMSResult * XKMSMessageFactoryImpl::createResult(
  
  
  
  1.10      +21 -1     xml-security/c/src/xkms/impl/XKMSMessageFactoryImpl.hpp
  
  Index: XKMSMessageFactoryImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xkms/impl/XKMSMessageFactoryImpl.hpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XKMSMessageFactoryImpl.hpp	2 Oct 2004 23:12:30 -0000	1.9
  +++ XKMSMessageFactoryImpl.hpp	3 Oct 2004 12:20:06 -0000	1.10
  @@ -84,6 +84,14 @@
   		const XMLCh * service,
   		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
   		const XMLCh * id = NULL);
  +	virtual XKMSStatusRequest * createStatusRequest(
  +		const XMLCh * service,
  +		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
  +		const XMLCh * id = NULL);
  +	virtual XKMSStatusRequest * createStatusRequest(
  +		const XMLCh * service,
  +		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
  +		const XMLCh * id = NULL);
   
   
   	virtual XKMSLocateResult * createLocateResult(
  @@ -130,6 +138,18 @@
   		const XMLCh * id = NULL);
   	virtual XKMSCompoundResult * createCompoundResult(
   		XKMSCompoundRequest * request,
  +		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
  +		XKMSResultType::ResultMajor rmaj,
  +		XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
  +		const XMLCh * id = NULL);
  +	virtual XKMSStatusResult * createStatusResult(
  +		XKMSStatusRequest * request,
  +		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
  +		XKMSResultType::ResultMajor rmaj,
  +		XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
  +		const XMLCh * id = NULL);
  +	virtual XKMSStatusResult * createStatusResult(
  +		XKMSStatusRequest * request,
   		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
   		XKMSResultType::ResultMajor rmaj,
   		XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
  
  
  
  1.1                  xml-security/c/src/xkms/impl/XKMSStatusRequestImpl.cpp
  
  Index: XKMSStatusRequestImpl.cpp
  ===================================================================
  /*
   * Copyright 2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * imitations under the License.
   */
  
  /*
   * XSEC
   *
   * XKMSStatusRequestImpl := Implementation of StatusRequest Messages
   *
   * $Id: XKMSStatusRequestImpl.cpp,v 1.1 2004/10/03 12:20:06 blautenb Exp $
   *
   */
  
  #include <xsec/framework/XSECDefs.hpp>
  #include <xsec/framework/XSECError.hpp>
  #include <xsec/framework/XSECEnv.hpp>
  #include <xsec/utils/XSECDOMUtils.hpp>
  #include <xsec/xkms/XKMSConstants.hpp>
  
  #include "XKMSStatusRequestImpl.hpp"
  
  #include <xercesc/dom/DOM.hpp>
  
  XERCES_CPP_NAMESPACE_USE
  
  // --------------------------------------------------------------------------------
  //           Construct/Destruct
  // --------------------------------------------------------------------------------
  
  XKMSStatusRequestImpl::XKMSStatusRequestImpl(
  		const XSECEnv * env) :
  XKMSRequestAbstractTypeImpl(env),
  mp_responseIdAttr(NULL) {
  }
  
  XKMSStatusRequestImpl::XKMSStatusRequestImpl(
  		const XSECEnv * env, 
  		XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
  XKMSRequestAbstractTypeImpl(env, node),
  mp_responseIdAttr(NULL) {
  
  }
  
  XKMSStatusRequestImpl::~XKMSStatusRequestImpl() {
  
  }
  
  
  // --------------------------------------------------------------------------------
  //           Load from DOM
  // --------------------------------------------------------------------------------
  
  // Load elements
  void XKMSStatusRequestImpl::load() {
  
  	if (mp_messageAbstractTypeElement == NULL) {
  
  		// Attempt to load an empty element
  		throw XSECException(XSECException::XKMSError,
  			"XKMSStatusRequest::load - called on empty DOM");
  
  	}
  
  	if (!strEquals(getXKMSLocalName(mp_messageAbstractTypeElement), 
  									XKMSConstants::s_tagStatusRequest)) {
  	
  		throw XSECException(XSECException::XKMSError,
  			"XKMSStatusRequest::load - called incorrect node");
  	
  	}
  
  	// Load the base message
  	XKMSRequestAbstractTypeImpl::load();
  
  	// Now check for ResponseId attribute
  	mp_responseIdAttr = 
  		mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagResponseId);
  
  	if (mp_responseIdAttr == NULL) {
  		// Attempt to load an empty element
  		throw XSECException(XSECException::ExpectedXKMSChildNotFound,
  			"XKMSStatusRequest::load - No ResponseId attribute found");
  	}
  }
  
  // --------------------------------------------------------------------------------
  //           Create a blank one
  // --------------------------------------------------------------------------------
  DOMElement * XKMSStatusRequestImpl::createBlankStatusRequest(
  		const XMLCh * service,
  		const XMLCh * id) {
  
  	return XKMSRequestAbstractTypeImpl::createBlankMessageAbstractType(
  		XKMSConstants::s_tagStatusRequest, service, id);
  //	return XKMSRequestAbstractTypeImpl::createBlankMessageAbstractType(
  //		MAKE_UNICODE_STRING("ValidateRequest"), service, id);
  
  }
  
  // --------------------------------------------------------------------------------
  //           Get interface methods
  // --------------------------------------------------------------------------------
  
  XKMSMessageAbstractType::messageType XKMSStatusRequestImpl::getMessageType(void) {
  
  	return XKMSMessageAbstractType::StatusRequest;
  
  }
  
  
  const XMLCh * XKMSStatusRequestImpl::getResponseId(void) const {
  
  	if (mp_responseIdAttr == NULL) {
  
  		// Attempt read when not initialised
  		throw XSECException(XSECException::MessageAbstractTypeError,
  			"XKMSStatusRequest::getResponseId - called on non-initialised structure");
  
  	}
  
  	return 	mp_responseIdAttr->getNodeValue();
  }
  
  // --------------------------------------------------------------------------------
  //           Setter methods
  // --------------------------------------------------------------------------------
  
  void XKMSStatusRequestImpl::setResponseId(const XMLCh * responseId) {
  
  	if (mp_messageAbstractTypeElement == NULL) {
  
  		// Attempt update when not initialised
  		throw XSECException(XSECException::MessageAbstractTypeError,
  			"XKMSStatusRequest::setResponseId - called on non-initialised structure");
  
  	}
  
  	mp_messageAbstractTypeElement->setAttributeNS(NULL, XKMSConstants::s_tagResponseId, responseId);
  	mp_responseIdAttr = 
  		mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagResponseId);
  
  }
  
  
  
  
  
  1.1                  xml-security/c/src/xkms/impl/XKMSStatusRequestImpl.hpp
  
  Index: XKMSStatusRequestImpl.hpp
  ===================================================================
  /*
   * Copyright 2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * imitations under the License.
   */
  
  /*
   * XSEC
   *
   * XKMSStatusRequestImpl := Implementation of StatusRequest Messages
   *
   * $Id: XKMSStatusRequestImpl.hpp,v 1.1 2004/10/03 12:20:06 blautenb Exp $
   *
   */
  
  #ifndef XKMSSTATUSREQUESTIMPL_INCLUDE
  #define XKMSSTATUSREQUESTIMPL_INCLUDE
  
  // XSEC Includes
  
  #include <xsec/framework/XSECDefs.hpp>
  #include <xsec/xkms/XKMSStatusRequest.hpp>
  
  #include "XKMSRequestAbstractTypeImpl.hpp"
  
  class XKMSStatusRequestImpl : public XKMSRequestAbstractTypeImpl, public XKMSStatusRequest {
  
  public:
  
  	XKMSStatusRequestImpl(
  		const XSECEnv * env
  	);
  
  	XKMSStatusRequestImpl(
  		const XSECEnv * env, 
  		XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
  	);
  
  	virtual ~XKMSStatusRequestImpl();
  
  	// Load elements
  	void load();
  
  	// Creation
  	XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * 
  		createBlankStatusRequest(
  		const XMLCh * service,
  		const XMLCh * id = NULL);
  
  
  	/* Getter Interface Methods */
  	virtual const XMLCh * getResponseId(void) const;
  
  	/* Setter interface methods */
  	virtual void setResponseId(const XMLCh * responseId);
  
  	/* Implemented from MessageAbstractType */
  	virtual messageType getMessageType(void);
  
  	/* Forced inheritance from XKMSMessageAbstractTypeImpl */
  	XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
  
  	/* Forced inheritance from RequestAbstractType */
  	XKMS_REQUESTABSTRACTYPE_IMPL_METHODS
  
  private:
  
  	XERCES_CPP_NAMESPACE_QUALIFIER  DOMAttr
  						* mp_responseIdAttr;
  
  	// Unimplemented
  	XKMSStatusRequestImpl(const XKMSStatusRequestImpl &);
  	XKMSStatusRequestImpl & operator = (const XKMSStatusRequestImpl &);
  
  };
  
  #endif /* XKMSSTATUSREQUESTIMPL_INCLUDE */
  
  
  
  1.1                  xml-security/c/src/xkms/impl/XKMSStatusResultImpl.cpp
  
  Index: XKMSStatusResultImpl.cpp
  ===================================================================
  /*
   * Copyright 2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * imitations under the License.
   */
  
  /*
   * XSEC
   *
   * XKMSStatusResultImpl := Implementation of StatusResult Messages
   *
   * $Id: XKMSStatusResultImpl.cpp,v 1.1 2004/10/03 12:20:06 blautenb Exp $
   *
   */
  
  #include <xsec/framework/XSECDefs.hpp>
  #include <xsec/framework/XSECError.hpp>
  #include <xsec/framework/XSECEnv.hpp>
  #include <xsec/utils/XSECDOMUtils.hpp>
  #include <xsec/xkms/XKMSConstants.hpp>
  
  #include "XKMSStatusResultImpl.hpp"
  #include "XKMSUnverifiedKeyBindingImpl.hpp"
  
  #include <xercesc/dom/DOM.hpp>
  
  XERCES_CPP_NAMESPACE_USE
  
  // --------------------------------------------------------------------------------
  //           Construct/Destruct
  // --------------------------------------------------------------------------------
  
  XKMSStatusResultImpl::XKMSStatusResultImpl(
  		const XSECEnv * env) :
  XKMSResultTypeImpl(env) {
  
  	mp_successAttr = NULL;
  	mp_failureAttr = NULL;
  	mp_pendingAttr = NULL;
  
  }
  
  XKMSStatusResultImpl::XKMSStatusResultImpl(
  		const XSECEnv * env, 
  		XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
  XKMSResultTypeImpl(env, node) {
  
  	mp_successAttr = NULL;
  	mp_failureAttr = NULL;
  	mp_pendingAttr = NULL;
  
  }
  
  XKMSStatusResultImpl::~XKMSStatusResultImpl() {
  
  }
  
  
  // --------------------------------------------------------------------------------
  //           Load from DOM
  // --------------------------------------------------------------------------------
  
  // Load elements
  void XKMSStatusResultImpl::load() {
  
  	if (mp_messageAbstractTypeElement == NULL) {
  
  		// Attempt to load an empty element
  		throw XSECException(XSECException::XKMSError,
  			"XKMSStatusResult::load - called on empty DOM");
  
  	}
  
  	if (!strEquals(getXKMSLocalName(mp_messageAbstractTypeElement), 
  									XKMSConstants::s_tagStatusResult)) {
  	
  		throw XSECException(XSECException::XKMSError,
  			"XKMSStatusResult::load - called incorrect node");
  	
  	}
  
  	// Load the base message
  	XKMSResultTypeImpl::load();
  
  }
  
  // --------------------------------------------------------------------------------
  //           Create a blank one
  // --------------------------------------------------------------------------------
  DOMElement * XKMSStatusResultImpl::createBlankStatusResult(
  		const XMLCh * service,
  		const XMLCh * id,
  		ResultMajor rmaj,
  		ResultMinor rmin) {
  
  	return XKMSResultTypeImpl::createBlankResultType(
  		XKMSConstants::s_tagStatusResult, service, id, rmaj, rmin);
  
  }
  
  // --------------------------------------------------------------------------------
  //           Get interface methods
  // --------------------------------------------------------------------------------
  
  XKMSMessageAbstractType::messageType XKMSStatusResultImpl::getMessageType(void) {
  
  	return XKMSMessageAbstractType::StatusResult;
  
  }
  
  // --------------------------------------------------------------------------------
  //           Result count handling
  // --------------------------------------------------------------------------------
  
  int XKMSStatusResultImpl::getSuccessCount(void) const {
  
  	if (mp_successAttr == NULL)
  		return 0;
  
  	unsigned int val;
  	XMLString::textToBin(mp_successAttr->getNodeValue(), val);
  
  	return (int) val;
  
  }
  
  int XKMSStatusResultImpl::getFailureCount(void) const {
  
  	if (mp_failureAttr == NULL)
  		return 0;
  
  	unsigned int val;
  	XMLString::textToBin(mp_failureAttr->getNodeValue(), val);
  
  	return (int) val;
  
  }
  
  int XKMSStatusResultImpl::getPendingCount(void) const {
  
  	if (mp_pendingAttr == NULL)
  		return 0;
  
  	unsigned int val;
  	XMLString::textToBin(mp_pendingAttr->getNodeValue(), val);
  
  	return (int) val;
  
  }
  
  void XKMSStatusResultImpl::setSuccessCount(int count) {
  
  	if (mp_messageAbstractTypeElement == NULL) {
  
  		// Attempt update when not initialised
  		throw XSECException(XSECException::MessageAbstractTypeError,
  			"XKMSStatusResult::setSuccessCount - called on non-initialised structure");
  
  	}
  
  	XMLCh val[16];
  	XMLString::binToText(count, val, 16, 10);
  
  	mp_messageAbstractTypeElement->setAttributeNS(NULL, XKMSConstants::s_tagSuccess, val);
  	mp_successAttr = 
  		mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagSuccess);
  
  }
  
  void XKMSStatusResultImpl::setFailureCount(int count) {
  
  	if (mp_messageAbstractTypeElement == NULL) {
  
  		// Attempt update when not initialised
  		throw XSECException(XSECException::MessageAbstractTypeError,
  			"XKMSStatusResult::setFailureCount - called on non-initialised structure");
  
  	}
  
  	XMLCh val[16];
  	XMLString::binToText(count, val, 16, 10);
  
  	mp_messageAbstractTypeElement->setAttributeNS(NULL, XKMSConstants::s_tagFailure, val);
  	mp_failureAttr = 
  		mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagFailure);
  
  }
  
  void XKMSStatusResultImpl::setPendingCount(int count) {
  
  	if (mp_messageAbstractTypeElement == NULL) {
  
  		// Attempt update when not initialised
  		throw XSECException(XSECException::MessageAbstractTypeError,
  			"XKMSStatusResult::setPendingCount - called on non-initialised structure");
  
  	}
  
  	XMLCh val[16];
  	XMLString::binToText(count, val, 16, 10);
  
  	mp_messageAbstractTypeElement->setAttributeNS(NULL, XKMSConstants::s_tagPending, val);
  	mp_pendingAttr = 
  		mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagPending);
  
  }
  
  
  
  
  
  1.1                  xml-security/c/src/xkms/impl/XKMSStatusResultImpl.hpp
  
  Index: XKMSStatusResultImpl.hpp
  ===================================================================
  /*
   * Copyright 2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * imitations under the License.
   */
  
  /*
   * XSEC
   *
   * XKMSStatusResultImpl := Implementation of StatusResult Messages
   *
   * $Id: XKMSStatusResultImpl.hpp,v 1.1 2004/10/03 12:20:06 blautenb Exp $
   *
   */
  
  #ifndef XKMSSTATUSRESULTIMPL_INCLUDE
  #define XKMSSTATUSRESULTIMPL_INCLUDE
  
  // XSEC Includes
  
  #include <xsec/framework/XSECDefs.hpp>
  #include <xsec/xkms/XKMSStatusResult.hpp>
  
  #include "XKMSResultTypeImpl.hpp"
  
  #include <vector>
  
  class XKMSUnverifiedKeyBindingImpl;
  
  
  class XKMSStatusResultImpl : public XKMSResultTypeImpl, public XKMSStatusResult {
  
  public:
  
  	XKMSStatusResultImpl(
  		const XSECEnv * env
  	);
  
  	XKMSStatusResultImpl(
  		const XSECEnv * env, 
  		XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
  	);
  
  	virtual ~XKMSStatusResultImpl();
  
  	// Load elements
  	void load();
  
  	// Creation
  	XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * 
  		createBlankStatusResult(
  		const XMLCh * service,
  		const XMLCh * id,
  		ResultMajor rmaj,
  		ResultMinor rmin);
  
  	// Interface methods
  	virtual int getSuccessCount(void) const;
  	virtual int getFailureCount(void) const;
  	virtual int getPendingCount(void) const;
  	virtual void setSuccessCount(int count);
  	virtual void setFailureCount(int count);
  	virtual void setPendingCount(int count);
  
  	/* Implemented from MessageAbstractType */
  	virtual messageType getMessageType(void);
  
  	/* Forced inheritance from XKMSMessageAbstractTypeImpl */
  	XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
  
  	/* Forced inheritance from XKMSResultTypeImpl */
  	XKMS_RESULTTYPE_IMPL_METHODS
  
  private:
  
  	XERCES_CPP_NAMESPACE_QUALIFIER  DOMAttr
  						* mp_successAttr;
  	XERCES_CPP_NAMESPACE_QUALIFIER  DOMAttr
  						* mp_failureAttr;
  	XERCES_CPP_NAMESPACE_QUALIFIER  DOMAttr
  						* mp_pendingAttr;
  
  	// Unimplemented
  	XKMSStatusResultImpl(const XKMSStatusResultImpl &);
  	XKMSStatusResultImpl & operator = (const XKMSStatusResultImpl &);
  
  };
  
  #endif /* XKMSSTATUSRESULTIMPL_INCLUDE */