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 01:13:14 UTC

cvs commit: xml-security/c/src/tools/xklient xklient.cpp

blautenb    2004/10/02 16:13:14

  Modified:    c/src/tools/xklient xklient.cpp
  Log:
  Support for pending requests
  
  Revision  Changes    Path
  1.16      +58 -3     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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- xklient.cpp	21 Sep 2004 12:33:52 -0000	1.15
  +++ xklient.cpp	2 Oct 2004 23:13:14 -0000	1.16
  @@ -40,6 +40,7 @@
   
   #include <xsec/xkms/XKMSCompoundRequest.hpp>
   #include <xsec/xkms/XKMSCompoundResult.hpp>
  +#include <xsec/xkms/XKMSPendingRequest.hpp>
   #include <xsec/xkms/XKMSMessageAbstractType.hpp>
   #include <xsec/xkms/XKMSLocateRequest.hpp>
   #include <xsec/xkms/XKMSLocateResult.hpp>
  @@ -858,12 +859,45 @@
   }
   
   // --------------------------------------------------------------------------------
  +//           Create a PendingRequest
  +// --------------------------------------------------------------------------------
  +
  +void printPendingRequestUsage(void) {
  +
  +	cerr << "\nUsage PendingRequest [--help|-h] <service URI> <OriginalRequestId> <ResponseId>\n";
  +	cerr << "   --help/-h                : print this screen and exit\n\n";
  +
  +}
  +
  +XKMSMessageAbstractType * createPendingRequest(XSECProvider &prov, DOMDocument **doc, int argc, char ** argv, int paramCount) {
  +
  +	if (paramCount +2 >= argc || 
  +		(stricmp(argv[paramCount], "--help") == 0) ||
  +		(stricmp(argv[paramCount], "-h") == 0)) {
  +
  +		printPendingRequestUsage();
  +		return NULL;
  +	}
  +
  +	/* First create the basic request */
  +	XKMSMessageFactory * factory = 
  +		prov.getXKMSMessageFactory();
  +	XKMSPendingRequest * pr = 
  +		factory->createPendingRequest(MAKE_UNICODE_STRING(argv[paramCount++]), doc);
  +
  +	pr->setOriginalRequestId(MAKE_UNICODE_STRING(argv[paramCount++]));
  +	pr->setResponseId(MAKE_UNICODE_STRING(argv[paramCount++]));
  +
  +	return pr;
  +}
  +
  +// --------------------------------------------------------------------------------
   //           Create a CompoundRequest
   // --------------------------------------------------------------------------------
   
   void printCompoundRequestUsage(void) {
   
  -	cerr << "\nUsage CompoundRequest [--help|-h] <service URI> <LocateRequest|ValidateRequest> .... [-- LocateRequest|ValidateRequest]*\n";
  +	cerr << "\nUsage CompoundRequest [--help|-h] <service URI> <LocateRequest|ValidateRequest> .... [-- LocateRequest|ValidateRequest|PendingRequest]*\n";
   	cerr << "   --help/-h                : print this screen and exit\n\n";
   
   }
  @@ -1487,7 +1521,7 @@
   
   void printDoRequestUsage(void) {
   
  -	cerr << "\nUsage request [options] {CompoundRequest|LocateRequest|ValidateRequest} [msg specific options]\n";
  +	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";
   
  @@ -1551,6 +1585,23 @@
   			parmsDone = true;
   
   		}
  +		else if ((stricmp(argv[paramCount], "PendingRequest") == 0) ||
  +			(stricmp(argv[paramCount], "pr") == 0)) {
  +
  +			paramCount++;
  +			XKMSPendingRequest * r = 
  +				dynamic_cast<XKMSPendingRequest *> (createPendingRequest(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)) {
   
  @@ -1819,8 +1870,12 @@
   	cerr << "     msgdump   : Read an XKMS message and print details\n";
   	cerr << "     msgcreate : Create a message of type :\n";
   	cerr << "                 LocateRequest\n";
  +	cerr << "                 ValidateRequest\n";
  +	cerr << "                 PendingRequest\n";
   	cerr << "     request   : Create message of type : \n";
   	cerr << "                 LocateRequest\n";
  +	cerr << "                 ValidateRequest\n";
  +	cerr << "                 PendingRequest\n";
   	cerr << "                 send to service URI and output result\n\n";
   	cerr << "     Where options are :\n\n";
   	cerr << "     --text/-t\n";