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/07/11 14:08:12 UTC

cvs commit: xml-security/c/src/xkms/impl XKMSStatusImpl.cpp XKMSStatusImpl.hpp XKMSKeyBindingImpl.cpp XKMSKeyBindingImpl.hpp XKMSValidateResultImpl.cpp XKMSValidateResultImpl.hpp

blautenb    2004/07/11 05:08:12

  Modified:    c/Projects/VC6.0/xsec/xsec_lib xsec_lib.dsp
               c/src/framework XSECError.cpp XSECException.hpp
               c/src/tools/xklient xklient.cpp
               c/src/xkms XKMSConstants.cpp XKMSConstants.hpp
                        XKMSKeyBinding.hpp XKMSValidateResult.hpp
               c/src/xkms/impl XKMSKeyBindingImpl.cpp
                        XKMSKeyBindingImpl.hpp XKMSValidateResultImpl.cpp
                        XKMSValidateResultImpl.hpp
  Added:       c/src/xkms XKMSStatus.hpp
               c/src/xkms/impl XKMSStatusImpl.cpp XKMSStatusImpl.hpp
  Log:
  Incorporated Status elements
  
  Revision  Changes    Path
  1.34      +12 -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.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- xsec_lib.dsp	3 Jul 2004 12:44:59 -0000	1.33
  +++ xsec_lib.dsp	11 Jul 2004 12:08:12 -0000	1.34
  @@ -1168,6 +1168,14 @@
   # End Source File
   # Begin Source File
   
  +SOURCE=..\..\..\..\src\xkms\impl\XKMSStatusImpl.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\..\..\..\src\xkms\impl\XKMSStatusImpl.hpp
  +# End Source File
  +# Begin Source File
  +
   SOURCE=..\..\..\..\src\xkms\impl\XKMSUnverifiedKeyBindingImpl.cpp
   # End Source File
   # Begin Source File
  @@ -1250,6 +1258,10 @@
   # Begin Source File
   
   SOURCE=..\..\..\..\src\xkms\XKMSResultType.hpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\..\..\..\src\xkms\XKMSStatus.hpp
   # End Source File
   # Begin Source File
   
  
  
  
  1.14      +1 -0      xml-security/c/src/framework/XSECError.cpp
  
  Index: XSECError.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/framework/XSECError.cpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- XSECError.cpp	9 Jun 2004 04:05:46 -0000	1.13
  +++ XSECError.cpp	11 Jul 2004 12:08:12 -0000	1.14
  @@ -87,6 +87,7 @@
   	"An error occurred processing a MessageAbstractType object",
   	"An error occurred processing a RequestAbstractType object",
   	"An error occurred processing a ResultType object",
  +	"An error occurred processing a Status object",
   	"Unknown Error type",
   
   };
  
  
  
  1.16      +3 -2      xml-security/c/src/framework/XSECException.hpp
  
  Index: XSECException.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/framework/XSECException.hpp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- XSECException.hpp	9 Jun 2004 04:05:46 -0000	1.15
  +++ XSECException.hpp	11 Jul 2004 12:08:12 -0000	1.16
  @@ -118,7 +118,8 @@
   		MessageAbstractTypeError	= 53,
   		RequestAbstractTypeError	= 54,
   		ResultTypeError				= 55,
  -		UnknownError				= 56		// Must be last!
  +		StatusError 				= 56,
  +		UnknownError				= 57		// Must be last!
   
   	};
   
  
  
  
  1.10      +166 -5    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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- xklient.cpp	3 Jul 2004 12:44:59 -0000	1.9
  +++ xklient.cpp	11 Jul 2004 12:08:12 -0000	1.10
  @@ -70,8 +70,13 @@
   #include <xercesc/parsers/XercesDOMParser.hpp>
   #include <xercesc/framework/StdOutFormatTarget.hpp>
   #include <xercesc/util/XMLException.hpp>
  +#include <xercesc/framework/LocalFileInputSource.hpp>
   #include <xercesc/util/XMLUri.hpp>
   #include <xercesc/util/Janitor.hpp>
  +#include <xercesc/sax/ErrorHandler.hpp>
  +#include <xercesc/sax/SAXParseException.hpp>
  +#include <xercesc/sax/EntityResolver.hpp>
  +#include <xercesc/sax/InputSource.hpp>
   
   XERCES_CPP_NAMESPACE_USE
   
  @@ -257,6 +262,66 @@
   
   #endif
   
  +class xkmsErrorHandler : public ErrorHandler {
  +
  +public:
  +	
  +	xkmsErrorHandler() {}
  +	~xkmsErrorHandler() {}
  +
  +	// Interface
  +	virtual void 	warning (const SAXParseException &exc);
  +	virtual void 	error (const SAXParseException &exc);
  +	virtual void 	fatalError (const SAXParseException &exc);
  +	virtual void 	resetErrors ();
  +	
  +private:
  +
  +	void outputError(const SAXParseException &exc);
  +
  +};
  +
  +void xkmsErrorHandler::outputError(const SAXParseException &exc) {
  +
  +	char * systemId = XMLString::transcode(exc.getSystemId());
  +	char * msg = XMLString::transcode(exc.getMessage());
  +	if (exc.getLineNumber() > 0 || exc.getColumnNumber() > 0) {
  +		cerr << "File: " << systemId << " Line : " << exc.getLineNumber() << " Column : " 
  +			<< exc.getColumnNumber() << ". " << msg << endl;
  +	}
  +	else {
  +		cerr << msg << endl;
  +	}
  +	XMLString::release(&msg);
  +	XMLString::release(&systemId);
  +
  +}
  +
  +void xkmsErrorHandler::warning(const SAXParseException &exc) {
  +
  +	cerr << "Parser warning - ";
  +	outputError(exc);
  +
  +}
  +
  +void xkmsErrorHandler::error (const SAXParseException &exc) {
  +
  +	cerr << "Parser error - ";
  +	outputError(exc);
  +
  +}
  +
  +void xkmsErrorHandler::fatalError (const SAXParseException &exc) {
  +
  +	cerr << "Parser fatal error - ";
  +	outputError(exc);
  +
  +}
  +
  +void xkmsErrorHandler::resetErrors () {
  +
  +}
  +
   
   // --------------------------------------------------------------------------------
   //           Create a LocateRequest
  @@ -846,8 +911,41 @@
   
   }
   
  +void doStatusReasonDump(XKMSStatus::StatusValue v, XKMSStatus *s, int level) {
  +
  +	char * sr = XMLString::transcode(XKMSConstants::s_tagStatusValueCodes[v]);
  +	for (XKMSStatus::StatusReason i = XKMSStatus::Signature; i > XKMSStatus::ReasonUndefined; i = (XKMSStatus::StatusReason) (i-1)) {
  +
  +		if (s->getStatusReason(v, i)) {
  +			levelSet(level);
  +			char * rc = XMLString::transcode(XKMSConstants::s_tagStatusReasonCodes[i]);
  +			cout << sr << "Reason = " << rc << endl;
  +			XMLString::release(&rc);
  +		}
  +	}
  +	XMLString::release(&sr);
  +
  +}
  +
   void doKeyBindingDump(XKMSKeyBinding * kb, int level) {
   
  +	/* Dump the status */
  +
  +	XKMSStatus * s = kb->getStatus();
  +	if (s == NULL)
  +		return;
  +
  +	char * sr = XMLString::transcode(XKMSConstants::s_tagStatusValueCodes[s->getStatusValue()]);
  +	levelSet(level);
  +	cout << "Status = " << sr << endl;
  +	XMLString::release(&sr);
  +
  +	/* Dump the status reasons */
  +	doStatusReasonDump(XKMSStatus::Valid, s, level+1);
  +	doStatusReasonDump(XKMSStatus::Invalid, s, level+1);
  +	doStatusReasonDump(XKMSStatus::Indeterminate, s, level+1);
  +
  +	/* Now the actual key */
   	doKeyBindingAbstractDump((XKMSKeyBindingAbstractType *) kb, level);
   
   }
  @@ -1233,10 +1331,37 @@
   // --------------------------------------------------------------------------------
   
   
  +#if 0
  +class XMLSchemaDTDResolver : public EntityResolver { 
  +
  +public: 
  +
  +	XMLSchemaDTDResolver() {}
  +	~XMLSchemaDTDResolver() {}
  +	
  +	InputSource * resolveEntity (const XMLCh* const publicId, const XMLCh* const systemId);
  +	
  +};
  +
  +InputSource * XMLSchemaDTDResolver::resolveEntity (const XMLCh* const publicId, 
  +												   const XMLCh* const systemId) { 
  +	
  +
  +	
  +	if (strEquals(systemId, "http://www.w3.org/2001/XMLSchema")) { 	
  +		return new LocalFileInputSource(MAKE_UNICODE_STRING("C:\\prog\\SRC\\xml-security\\c\\Build\\Win32\\VC6\\Debug\\XMLSchema.dtd")); 
  +	} 
  +	else { 
  +		return NULL; 
  +	}
  +
  +}
  +#endif
   void printMsgDumpUsage(void) {
   
   	cerr << "\nUsage msgdump [options] <filename>\n";
  -	cerr << "   --help/-h    : print this screen and exit\n\n";
  +	cerr << "   --help/-h      : print this screen and exit\n";
  +	cerr << "   --validate/-v  : validate the input messages\n\n";
       cerr << "   filename = name of file containing XKMS msg to dump\n\n";
   
   }
  @@ -1244,10 +1369,31 @@
   int doMsgDump(int argc, char ** argv, int paramCount) {
   
   	char * inputFile = NULL;
  +	bool doValidate = false;
   
  -	if (paramCount != (argc - 1) || 
  +	if (paramCount >= argc || 
   		(stricmp(argv[paramCount], "--help") == 0) ||
  -		(stricmp(argv[paramCount], "-h") ==0)) {
  +		(stricmp(argv[paramCount], "-h") == 0)) {
  +		printMsgDumpUsage();
  +		return -1;
  +	}
  +
  +	while (paramCount < argc-1) {
  +		if ((stricmp(argv[paramCount], "--validate") == 0) ||
  +			(stricmp(argv[paramCount], "-v") == 0)) {
  +
  +			doValidate = true;
  +			paramCount++;
  +
  +		}
  +		else {
  +
  +			printMsgDumpUsage();
  +			return -1;
  +		}
  +	}
  +
  +	if (paramCount >= argc) {
   		printMsgDumpUsage();
   		return -1;
   	}
  @@ -1265,7 +1411,22 @@
   	parser->setDoNamespaces(true);
   	parser->setCreateEntityReferenceNodes(true);
   
  -	// Now parse out file
  +	// Error handling
  +	xkmsErrorHandler xeh;
  +	parser->setErrorHandler(&xeh);
  +
  +#if 0
  +	// Local load of XMLSchema.dtd
  +	XMLSchemaDTDResolver sdr;
  +	parser->setEntityResolver(&sdr);
  +#endif
  +
  +	// Schema handling
  +	if (doValidate) {
  +		parser->setDoSchema(true);
  +		parser->setDoValidation(true);
  +		parser->setExternalSchemaLocation("http://www.w3.org/2002/03/xkms# http://www.w3.org/TR/xkms2/Schemas/xkms.xsd");
  +	}
   
   	bool errorsOccured = false;
   	int errorCount = 0;
  
  
  
  1.5       +227 -17   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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XKMSConstants.cpp	3 Jul 2004 12:44:59 -0000	1.4
  +++ XKMSConstants.cpp	11 Jul 2004 12:08:12 -0000	1.5
  @@ -105,6 +105,48 @@
   	chNull
   };
   
  +const XMLCh XKMSConstants::s_tagInvalidReason[] = {
  +
  +	chLatin_I,
  +	chLatin_n,
  +	chLatin_v,
  +	chLatin_a,
  +	chLatin_l,
  +	chLatin_i,
  +	chLatin_d,
  +	chLatin_R,
  +	chLatin_e,
  +	chLatin_a,
  +	chLatin_s,
  +	chLatin_o,
  +	chLatin_n,
  +	chNull
  +};
  +
  +const XMLCh XKMSConstants::s_tagIndeterminateReason[] = {
  +
  +	chLatin_I,
  +	chLatin_n,
  +	chLatin_d,
  +	chLatin_e,
  +	chLatin_t,
  +	chLatin_e,
  +	chLatin_r,
  +	chLatin_m,
  +	chLatin_i,
  +	chLatin_n,
  +	chLatin_a,
  +	chLatin_t,
  +	chLatin_e,
  +	chLatin_R,
  +	chLatin_e,
  +	chLatin_a,
  +	chLatin_s,
  +	chLatin_o,
  +	chLatin_n,
  +	chNull
  +};
  +
   const XMLCh XKMSConstants::s_tagKeyBinding[] = {
   
   	chLatin_K,
  @@ -322,6 +364,33 @@
   	chNull
   };
   
  +const XMLCh XKMSConstants::s_tagStatus[] = {
  +
  +	chLatin_S,
  +	chLatin_t,
  +	chLatin_a,
  +	chLatin_t,
  +	chLatin_u,
  +	chLatin_s,
  +	chNull
  +};
  +
  +const XMLCh XKMSConstants::s_tagStatusValue[] = {
  +
  +	chLatin_S,
  +	chLatin_t,
  +	chLatin_a,
  +	chLatin_t,
  +	chLatin_u,
  +	chLatin_s,
  +	chLatin_V,
  +	chLatin_a,
  +	chLatin_l,
  +	chLatin_u,
  +	chLatin_e,
  +	chNull
  +};
  +
   const XMLCh XKMSConstants::s_tagUnverifiedKeyBinding[] = {
   
   	chLatin_U,
  @@ -401,6 +470,22 @@
   	chNull
   };
   
  +const XMLCh XKMSConstants::s_tagValidReason[] = {
  +
  +	chLatin_V,
  +	chLatin_a,
  +	chLatin_l,
  +	chLatin_i,
  +	chLatin_d,
  +	chLatin_R,
  +	chLatin_e,
  +	chLatin_a,
  +	chLatin_s,
  +	chLatin_o,
  +	chLatin_n,
  +	chNull
  +};
  +
   const XMLCh XKMSConstants::s_tagResultMajorCodes[][16] = {
   
   	{
  @@ -671,22 +756,147 @@
   	},
   
   };
  -	
  -/*	
  -	enum ResultMinor {
  -		None,
  -		NoMatch,
  -		TooManyResponses,
  -		Incomplete,
  -		Failure,
  -		Refused,
  -		NoAuthentication,
  -		MessageNotSupported,
  -		UnknownResponseId,
  -		RepresentRequired,
  -		NotSynchronous
  -*/
  -// --------------------------------------------------------------------------------
  +
  +const XMLCh XKMSConstants::s_tagStatusValueCodes[][15] = {
  +
  +	{
  +		chLatin_U,
  +		chLatin_n,
  +		chLatin_d,
  +		chLatin_e,
  +		chLatin_f,
  +		chLatin_i,
  +		chLatin_n,
  +		chLatin_e,
  +		chLatin_d,
  +		chNull
  +	},
  +
  +	{			
  +		chLatin_V,
  +		chLatin_a,
  +		chLatin_l,
  +		chLatin_i,
  +		chLatin_d,
  +		chNull
  +	},
  +
  +	{
  +		chLatin_I,
  +		chLatin_n,
  +		chLatin_v,
  +		chLatin_a,
  +		chLatin_l,
  +		chLatin_i,
  +		chLatin_d,
  +		chNull
  +	},
  +
  +	{
  +		chLatin_I,
  +		chLatin_n,
  +		chLatin_d,
  +		chLatin_e,
  +		chLatin_t,
  +		chLatin_e,
  +		chLatin_r,
  +		chLatin_m,
  +		chLatin_i,
  +		chLatin_n,
  +		chLatin_a,
  +		chLatin_t,
  +		chLatin_e,
  +		chNull
  +	},
  +
  +};
  +
  +const XMLCh XKMSConstants::s_tagStatusReasonCodes[][17] = {
  +
  +	{
  +		chLatin_U,
  +		chLatin_n,
  +		chLatin_d,
  +		chLatin_e,
  +		chLatin_f,
  +		chLatin_i,
  +		chLatin_n,
  +		chLatin_e,
  +		chLatin_d,
  +		chNull
  +	},
  +
  +	{
  +		chLatin_I,
  +		chLatin_s,
  +		chLatin_s,
  +		chLatin_u,
  +		chLatin_e,
  +		chLatin_r,
  +		chLatin_T,
  +		chLatin_r,
  +		chLatin_u,
  +		chLatin_s,
  +		chLatin_t,
  +		chNull
  +	},
  +
  +	{			
  +		chLatin_R,
  +		chLatin_e,
  +		chLatin_v,
  +		chLatin_o,
  +		chLatin_c,
  +		chLatin_a,
  +		chLatin_t,
  +		chLatin_i,
  +		chLatin_o,
  +		chLatin_n,
  +		chLatin_S,
  +		chLatin_t,
  +		chLatin_a,
  +		chLatin_t,
  +		chLatin_u,
  +		chLatin_s,
  +		chNull
  +	},
  +
  +	{
  +		chLatin_V,
  +		chLatin_a,
  +		chLatin_l,
  +		chLatin_i,
  +		chLatin_d,
  +		chLatin_i,
  +		chLatin_t,
  +		chLatin_y,
  +		chLatin_I,
  +		chLatin_n,
  +		chLatin_t,
  +		chLatin_e,
  +		chLatin_r,
  +		chLatin_v,
  +		chLatin_a,
  +		chLatin_l,
  +		chNull
  +	},
  +
  +	{
  +		chLatin_S,
  +		chLatin_i,
  +		chLatin_g,
  +		chLatin_n,
  +		chLatin_a,
  +		chLatin_t,
  +		chLatin_u,
  +		chLatin_r,
  +		chLatin_e,
  +		chNull
  +	},
  +
  +};
  +
  +	// --------------------------------------------------------------------------------
   //           Constant Strings Creation and Deletion
   // --------------------------------------------------------------------------------
   
  
  
  
  1.6       +8 -1      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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XKMSConstants.hpp	3 Jul 2004 12:44:59 -0000	1.5
  +++ XKMSConstants.hpp	11 Jul 2004 12:08:12 -0000	1.6
  @@ -55,6 +55,8 @@
   	static const XMLCh s_tagExchange[];
   	static const XMLCh s_tagId[];
   	static const XMLCh s_tagIdentifier[];
  +	static const XMLCh s_tagIndeterminateReason[];
  +	static const XMLCh s_tagInvalidReason[];
   	static const XMLCh s_tagKeyBinding[];
   	static const XMLCh s_tagKeyInfo[];
   	static const XMLCh s_tagKeyUsage[];
  @@ -70,15 +72,20 @@
   	static const XMLCh s_tagResultMinor[];
   	static const XMLCh s_tagService[];
   	static const XMLCh s_tagSignature[];
  +	static const XMLCh s_tagStatus[];
  +	static const XMLCh s_tagStatusValue[];
   	static const XMLCh s_tagUnverifiedKeyBinding[];
   	static const XMLCh s_tagUseKeyWith[];
   	static const XMLCh s_tagValidateRequest[];
   	static const XMLCh s_tagValidateResult[];
  +	static const XMLCh s_tagValidReason[];
   
   	// ResultMajor codes
   
   	static const XMLCh s_tagResultMajorCodes[][16];
   	static const XMLCh s_tagResultMinorCodes[][20];
  +	static const XMLCh s_tagStatusValueCodes[][15];
  +	static const XMLCh s_tagStatusReasonCodes[][17];
   
   	XKMSConstants();
   
  
  
  
  1.2       +20 -1     xml-security/c/src/xkms/XKMSKeyBinding.hpp
  
  Index: XKMSKeyBinding.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xkms/XKMSKeyBinding.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XKMSKeyBinding.hpp	3 Jul 2004 12:44:59 -0000	1.1
  +++ XKMSKeyBinding.hpp	11 Jul 2004 12:08:12 -0000	1.2
  @@ -59,6 +59,7 @@
      <!-- /KeyBinding -->\endverbatim
    */
   
  +class XKMSStatus;
   
   class XKMSKeyBinding : public XKMSKeyBindingAbstractType {
   
  @@ -73,6 +74,24 @@
   
   	virtual ~XKMSKeyBinding() {};
   
  +	//@}
  +
  +	/** @name Status handling */
  +	//@{
  +
  +	/**
  +	 * \brief Obtain the status element for this KeyBinding
  +	 *
  +	 * The \<Status\> element is used to describe to the caller the
  +	 * validity of they key being described.  This call is used to
  +	 * obtain the status element
  +	 *
  +	 * @return A pointer to the XKMSStatus element
  +	 */
  +
  +	virtual XKMSStatus * getStatus(void) const = 0;
  +
  +	//@}
   
   private:
   
  
  
  
  1.2       +5 -2      xml-security/c/src/xkms/XKMSValidateResult.hpp
  
  Index: XKMSValidateResult.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xkms/XKMSValidateResult.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XKMSValidateResult.hpp	3 Jul 2004 12:44:59 -0000	1.1
  +++ XKMSValidateResult.hpp	11 Jul 2004 12:08:12 -0000	1.2
  @@ -30,6 +30,7 @@
   
   #include <xsec/framework/XSECDefs.hpp>
   #include <xsec/xkms/XKMSResultType.hpp>
  +#include <xsec/xkms/XKMSStatus.hpp>
   
   class XKMSKeyBinding;
   class XKMSUnverifiedKeyBinding;
  @@ -116,11 +117,13 @@
   	 * The item is initially empty of KeyInfo elements - these must be added
   	 * by the caller.
   	 *
  +	 * @param status The status (Valid, Invalid or Indeterminate) of this
  +	 * key
   	 * @returns the newly created KeyBinding object (already inserted
   	 * in the ValidateResult
   	 */
   
  -	virtual XKMSKeyBinding * appendKeyBindingItem(void ) = 0;
  +	virtual XKMSKeyBinding * appendKeyBindingItem(XKMSStatus::StatusValue status) = 0;
   
   	//@}
   
  
  
  
  1.1                  xml-security/c/src/xkms/XKMSStatus.hpp
  
  Index: XKMSStatus.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
   *
   * XKMSStatus := Interface for Status elements (in KeyBinding)
   *
   * $Id: XKMSStatus.hpp,v 1.1 2004/07/11 12:08:12 blautenb Exp $
   *
   */
  
  #ifndef XKMSSTATUS_INCLUDE
  #define XKMSSTATUS_INCLUDE
  
  // XSEC Includes
  
  #include <xsec/framework/XSECDefs.hpp>
  
  /**
   * @ingroup xkms
   * @{
   */
  
  /**
   * @brief Interface definition for the Status elements
   *
   * The \<Status\> Element is used in a KeyBinding message to a client
   * to provide status information for keys that are returned in a
   * ValidateResult message
   *
   * The schema definition for KeyBinding is as follows :
   *
   * \verbatim
     <!-- Status -->
     <element name="Status" type="xkms:StatusType"/>
     <complexType name="StatusType">
        <sequence>
           <element ref="xkms:ValidReason" minOccurs="0" 
                 maxOccurs="unbounded"/>
           <element ref="xkms:IndeterminateReason" minOccurs="0" 
                 maxOccurs="unbounded"/>
           <element ref="xkms:InvalidReason" minOccurs="0" 
                 maxOccurs="unbounded"/>
        </sequence>
        <attribute name="StatusValue" type="xkms:KeyBindingStatus" 
              use="required"/>
     </complexType>
     <simpleType name="KeyBindingStatus">
        <restriction base="QName">
           <enumeration value="xkms:Valid"/>
           <enumeration value="xkms:Invalid"/>
           <enumeration value="xkms:Indeterminate"/>
        </restriction>
     </simpleType>
     <!-- /Status -->
   \endverbatim
   */
  
  
  class XKMSStatus {
  
  	/** @name Constructors and Destructors */
  	//@{
  
  protected:
  
  	XKMSStatus() {};
  
  public:
  
  	virtual ~XKMSStatus() {};
  
  	//@}
  
  	enum StatusValue {
  
  		StatusUndefined = 0,	/** Error - the status value is undefined */
  		Valid = 1,				/** Good key! */
  		Invalid = 2,			/** Bad key! */
  		Indeterminate = 3		/** Smarmy key! */
  
  	};
  
  	enum StatusReason {
  
  		ReasonUndefined = 0,    /** The reason is undefined or unknown */
  		IssuerTrust = 1,		/** The issuer of the info is considered good */
  		RevocationStatus = 2,	/** Key is/is not revoked */
  		ValidityInterval = 3,	/** Key not expired */
  		Signature = 4			/** Signature on the provided data is good */
  
  	};
  
  	/** @name Getter methods */
  	//@{
  
  	/**
  	 * \brief Get the KeyBinding status assertion
  	 *
  	 * The Status element has a StatusValue attribute that defines
  	 * the validity of the key in question
  	 *
  	 * @return the status assertion
  	 */
  
  	virtual StatusValue getStatusValue(void) const = 0;
  
  	/**
  	 * \brief Find the Reason for a particular facet of status codes
  	 *
  	 * For each status reason, a Status can define a number of reasons
  	 * to return to a client.  There are some controls on this (e.g. you cannot
  	 * have an InvalidReason if the actual KeyBindingStatus is Valid), but
  	 * you can have things in ValidReason and IndeterminateReason for an Invalid
  	 * result.  This call allows you to find out about any facet of a reason
  	 *
  	 * @param status The particular status value you want to find a reason for
  	 * @param reason The particular reason that you want to determine is or is not
  	 * set
  	 * @return true if the particular reason is set for the given status, false
  	 * otherwise
  	 */
  
  	virtual bool getStatusReason(StatusValue status, StatusReason reason) const = 0;
  
  	//@}
  
  	/** @name Setter Methods */
  	//@{
  
  	/**
  	 * \brief Activate or de-activate a particular reason in the status result
  	 *
  	 * For each status reason, a Status can define a number of reasons
  	 * to return to a client.  There are some controls on this (e.g. you cannot
  	 * have an InvalidReason if the actual KeyBindingStatus is Valid), but
  	 * you can have things in ValidReason and IndeterminateReason for an Invalid
  	 * result.  This call allows you to set any facet of a reason
  	 *
  	 * @param status The particular status value you want to set a reason for
  	 * @param reason The particular reason that you want to set
  	 * @param value true to turn on the reason, false to turn it off
  	 */
  
  	virtual void setStatusReason(StatusValue status, StatusReason reason, bool value) = 0;
  
  	//@}
  
  private:
  
  	// Unimplemented
  	XKMSStatus(const XKMSStatus &);
  	XKMSStatus & operator = (const XKMSStatus &);
  
  };
  
  #endif /* XKMSSTATUS_INCLUDE */
  
  
  
  1.2       +37 -3     xml-security/c/src/xkms/impl/XKMSKeyBindingImpl.cpp
  
  Index: XKMSKeyBindingImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xkms/impl/XKMSKeyBindingImpl.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XKMSKeyBindingImpl.cpp	3 Jul 2004 12:44:59 -0000	1.1
  +++ XKMSKeyBindingImpl.cpp	11 Jul 2004 12:08:12 -0000	1.2
  @@ -27,11 +27,13 @@
   
   #include <xsec/framework/XSECDefs.hpp>
   #include <xsec/framework/XSECError.hpp>
  +#include <xsec/framework/XSECEnv.hpp>
   #include <xsec/xkms/XKMSConstants.hpp>
   
   #include <xercesc/dom/DOM.hpp>
   
   #include "XKMSKeyBindingImpl.hpp"
  +#include "XKMSStatusImpl.hpp"
   
   XERCES_CPP_NAMESPACE_USE
   
  @@ -69,16 +71,48 @@
   
   	XKMSKeyBindingAbstractTypeImpl::load();
   
  +	/* Find the status element */
  +	DOMNodeList * nl = mp_keyBindingAbstractTypeElement->getElementsByTagNameNS(
  +		XKMSConstants::s_unicodeStrURIXKMS,
  +		XKMSConstants::s_tagStatus);
  +
  +	if (nl == NULL || nl->getLength() != 1) {
  +		throw XSECException(XSECException::ExpectedXKMSChildNotFound,
  +			"XKMSKeyBinding::load - Status value not found");
  +	}
  +
  +	XSECnew(mp_status, XKMSStatusImpl(mp_env, (DOMElement*) nl->item(0)));
  +	mp_status->load();
  +
   }
   
   // --------------------------------------------------------------------------------
   //           Create
   // --------------------------------------------------------------------------------
   
  -DOMElement * XKMSKeyBindingImpl::createBlankKeyBinding(void) {
  +DOMElement * XKMSKeyBindingImpl::createBlankKeyBinding(XKMSStatus::StatusValue status) {
   
  -	return XKMSKeyBindingAbstractTypeImpl::
  +	DOMElement * ret = XKMSKeyBindingAbstractTypeImpl::
   				createBlankKeyBindingAbstractType(XKMSConstants::s_tagKeyBinding);
  +
  +	mp_env->doPrettyPrint(ret);
  +
  +	// Create the status element
  +	XSECnew(mp_status, XKMSStatusImpl(mp_env));
  +	ret->appendChild(mp_status->createBlankStatus(status));
  +	mp_env->doPrettyPrint(ret);
  +
  +	return ret;
  +
  +}
  +
  +// --------------------------------------------------------------------------------
  +//           Status handling
  +// --------------------------------------------------------------------------------
  +
  +XKMSStatus * XKMSKeyBindingImpl::getStatus(void) const {
  +
  +	return mp_status;
   
   }
   
  
  
  
  1.2       +10 -2     xml-security/c/src/xkms/impl/XKMSKeyBindingImpl.hpp
  
  Index: XKMSKeyBindingImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xkms/impl/XKMSKeyBindingImpl.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XKMSKeyBindingImpl.hpp	3 Jul 2004 12:44:59 -0000	1.1
  +++ XKMSKeyBindingImpl.hpp	11 Jul 2004 12:08:12 -0000	1.2
  @@ -30,9 +30,12 @@
   
   #include <xsec/framework/XSECDefs.hpp>
   #include <xsec/xkms/XKMSKeyBinding.hpp>
  +#include <xsec/xkms/XKMSStatus.hpp>
   
   #include "XKMSKeyBindingAbstractTypeImpl.hpp"
   
  +class XKMSStatusImpl;
  +
   class XKMSKeyBindingImpl : public XKMSKeyBinding, public XKMSKeyBindingAbstractTypeImpl {
   
   public:
  @@ -53,12 +56,17 @@
   
   	// Create
   	XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
  -		createBlankKeyBinding(void);
  +		createBlankKeyBinding(XKMSStatus::StatusValue status);
  +
  +	// Interface
  +	virtual XKMSStatus * getStatus(void) const;
   
   	// Import methods from XKMSKeyBindingAbstractType
   	XKMS_KEYBINDINGABSTRACTYPE_IMPL_METHODS
   
   private:
  +
  +	XKMSStatusImpl		* mp_status;
   
   	// Unimplemented
   	XKMSKeyBindingImpl(void);
  
  
  
  1.2       +3 -3      xml-security/c/src/xkms/impl/XKMSValidateResultImpl.cpp
  
  Index: XKMSValidateResultImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xkms/impl/XKMSValidateResultImpl.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XKMSValidateResultImpl.cpp	3 Jul 2004 12:44:59 -0000	1.1
  +++ XKMSValidateResultImpl.cpp	11 Jul 2004 12:08:12 -0000	1.2
  @@ -159,7 +159,7 @@
   
   }
   
  -XKMSKeyBinding * XKMSValidateResultImpl::appendKeyBindingItem(void) {
  +XKMSKeyBinding * XKMSValidateResultImpl::appendKeyBindingItem(XKMSStatus::StatusValue status) {
   
   	XKMSKeyBindingImpl * u;
   
  @@ -167,7 +167,7 @@
   
   	m_keyBindingList.push_back(u);
   
  -	DOMElement * e = u->createBlankKeyBinding();
  +	DOMElement * e = u->createBlankKeyBinding(status);
   
   	// Append the element
   
  
  
  
  1.2       +2 -2      xml-security/c/src/xkms/impl/XKMSValidateResultImpl.hpp
  
  Index: XKMSValidateResultImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xkms/impl/XKMSValidateResultImpl.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XKMSValidateResultImpl.hpp	3 Jul 2004 12:44:59 -0000	1.1
  +++ XKMSValidateResultImpl.hpp	11 Jul 2004 12:08:12 -0000	1.2
  @@ -66,7 +66,7 @@
   	// Interface methods
   	virtual int getKeyBindingSize(void) const;
   	virtual XKMSKeyBinding * getKeyBindingItem(int item) const;
  -	virtual XKMSKeyBinding * appendKeyBindingItem(void);
  +	virtual XKMSKeyBinding * appendKeyBindingItem(XKMSStatus::StatusValue status);
   
   
   	/* Implemented from MessageAbstractType */
  
  
  
  1.1                  xml-security/c/src/xkms/impl/XKMSStatusImpl.cpp
  
  Index: XKMSStatusImpl.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
   *
   * XKMSStatusImpl := Implementation for Status elements (in KeyBinding)
   *
   * $Id: XKMSStatusImpl.cpp,v 1.1 2004/07/11 12:08:12 blautenb Exp $
   *
   */
  
  // XSEC Includes
  
  #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 "XKMSStatusImpl.hpp"
  
  #include <xercesc/dom/DOM.hpp>
  #include <xercesc/util/XMLUniDefs.hpp>
  
  XERCES_CPP_NAMESPACE_USE
  
  // --------------------------------------------------------------------------------
  //           Construct/Destruct
  // --------------------------------------------------------------------------------
  
  XKMSStatusImpl::XKMSStatusImpl(
  		const XSECEnv * env) :
  mp_env(env),
  mp_statusElement(NULL) {
  
  	m_statusValue = XKMSStatus::StatusUndefined;
  
  	StatusValue i;
  	StatusReason j;
  
  	/* Clean out status codes */
  	for (i = Indeterminate ; i > StatusUndefined; i = (StatusValue)(i-1)) {
  		for (j = XKMSStatus::Signature; j != XKMSStatus::ReasonUndefined; j = (XKMSStatus::StatusReason) (j-1)) {
  	
  			m_statusReasons[i-1][j-1] = NULL;
  
  		}
  	}
  
  }
  
  XKMSStatusImpl::XKMSStatusImpl(
  		const XSECEnv * env, 
  		XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
  mp_env(env),
  mp_statusElement(node) {
  
  	m_statusValue = XKMSStatus::StatusUndefined;
  
  	StatusValue i;
  	StatusReason j;
  
  	/* Clean out status codes */
  	for (i = Indeterminate ; i > StatusUndefined; i = (StatusValue)(i-1)) {
  		for (j = XKMSStatus::Signature; j != XKMSStatus::ReasonUndefined; j = (XKMSStatus::StatusReason) (j-1)) {
  	
  			m_statusReasons[i-1][j-1] = NULL;
  
  		}
  	}
  
  }
  
  XKMSStatusImpl::~XKMSStatusImpl() {
  
  
  }
  
  // --------------------------------------------------------------------------------
  //           Load
  // --------------------------------------------------------------------------------
  
  void XKMSStatusImpl::load() {
  
  	if (mp_statusElement == NULL) {
  
  		// Attempt to load an empty element
  		throw XSECException(XSECException::StatusError,
  			"XKMSStatus::load - called on empty DOM");
  
  	}
  
  	/* Load the StatusValue attribute */
  
  	mp_statusValueAttr = 
  		mp_statusElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagStatusValue);
  
  	/* Decode as appropriate*/
  	if (mp_statusValueAttr == NULL) {
  		// Attempt to load an empty element
  		throw XSECException(XSECException::StatusError,
  			"XKMSStatus::load - No StatusValue attribute found");
  	}
  
  	const XMLCh * res = mp_statusValueAttr->getNodeValue();
  
  	// This is actually an QName, but we cheat and find the ':' character by hand
  	// without actually checking the qualifier.
  	// TODO - CHECK the qualifier.
  
  	int res2 = XMLString::indexOf(res, chColon);
  	if (res2 != -1) {
  		if (XMLString::compareNString(res, mp_statusElement->getPrefix(), res2)) {
  			throw XSECException(XSECException::StatusError,
  				"XKMSStatus::load - StatusValue not in XKMS Name Space");
  		}
  
  		res = &res[res2+1];
  	}
  	else {
  		if (mp_statusElement->getPrefix() != NULL) {
  			throw XSECException(XSECException::StatusError,
  				"XKMSStatus::load - StatusValue not in XKMS Name Space");
  		}
  	}
  
  	for (m_statusValue = XKMSStatus::Indeterminate; 
  		m_statusValue > XKMSStatus::StatusUndefined; 
  		m_statusValue = (XKMSStatus::StatusValue) (m_statusValue-1)) {
  
  		if (strEquals(XKMSConstants::s_tagStatusValueCodes[m_statusValue], res))
  			break;
  
  		
  	}
  
  	if (m_statusValue == XKMSStatus::StatusUndefined) {
  
  		throw XSECException(XSECException::StatusError,
  			"XKMSStatus::load - Unknown StatusValue provided");
  
  	}
  
  	/* Now we need to run through the status values */
  	DOMElement * e = findFirstElementChild(mp_statusElement);
  	while (e != NULL) {
  
  		const XMLCh * vs = getXKMSLocalName(e);
  
  		StatusValue v;
  
  		if (strEquals(vs, XKMSConstants::s_tagValidReason)) {
  			v = Valid;
  		}
  		else if (strEquals(vs, XKMSConstants::s_tagInvalidReason)) {
  			v = Invalid;
  		}
  		else if (strEquals(vs, XKMSConstants::s_tagIndeterminateReason)) {
  			v = Indeterminate;
  		}
  		else {
  			throw XSECException(XSECException::StatusError,
  				"XKMSStatus::load - Unknown Reason element");
  		}
  
  		DOMNode *t = findFirstChildOfType(e, DOMNode::TEXT_NODE);
  		if (t == NULL) {
  			throw XSECException(XSECException::StatusError,
  				"XKMSStatus::load - Expected text node child of reason element");
  		}
  
  		/* Strip out the qname */
  		const XMLCh * reason = t->getNodeValue();
  
  		int res = XMLString::indexOf(reason, chColon);
  		if (res != -1) {
  			if (XMLString::compareNString(reason, e->getPrefix(), res)) {
  				throw XSECException(XSECException::StatusError,
  					"XKMSStatus::load - StatusReason not in XKMS Name Space");
  			}
  
  			reason = &reason[res+1];
  		}
  		else {
  			if (e->getPrefix() != NULL) {
  				throw XSECException(XSECException::StatusError,
  					"XKMSStatus::load - StatusReason not in XKMS Name Space");
  			}
  		}
  
  		/* Found out what we are! */
  		XKMSStatus::StatusReason i;
  		for (i = XKMSStatus::Signature; i != XKMSStatus::ReasonUndefined; i = (XKMSStatus::StatusReason) (i-1)) {
  
  			if (strEquals(XKMSConstants::s_tagStatusReasonCodes[i], reason))
  				break;
  
  		}
  
  		if (i == XKMSStatus::ReasonUndefined) {
  			throw XSECException(XSECException::StatusError,
  				"XKMSStatus::load - Unknown StatusReason");
  		}
  
  		m_statusReasons[v-1][i-1] = e;
  
  		e = findNextElementChild(e);
  
  	}
  
  }
  
  // --------------------------------------------------------------------------------
  //           Create Blank Status
  // --------------------------------------------------------------------------------
  
  DOMElement * XKMSStatusImpl::createBlankStatus(StatusValue status) {
  
  	// Get some setup values
  	safeBuffer str;
  	DOMDocument *doc = mp_env->getParentDocument();
  	const XMLCh * prefix = mp_env->getXKMSNSPrefix();
  
  	makeQName(str, prefix, XKMSConstants::s_tagStatus);
  
  	mp_statusElement = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS, 
  												str.rawXMLChBuffer());
  
  	mp_env->doPrettyPrint(mp_statusElement);
  
  	/* Now add the StatusValue element */
  
  	makeQName(str, prefix, XKMSConstants::s_tagStatusValueCodes[status]);
  
  	mp_statusElement->setAttributeNS(NULL, 
  		XKMSConstants::s_tagStatusValue,
  		str.rawXMLChBuffer());
  
  	mp_statusValueAttr = 
  		mp_statusElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagStatusValue);
  
  	m_statusValue = status;
  
  	return mp_statusElement;
  
  }
  
  // --------------------------------------------------------------------------------
  //           Get methods
  // --------------------------------------------------------------------------------
  
  	/* Getter Interface Methods */
  XKMSStatus::StatusValue XKMSStatusImpl::getStatusValue(void) const {
  
  	return m_statusValue;
  
  }
  
  bool XKMSStatusImpl::getStatusReason(StatusValue status, StatusReason reason) const {
  
  	if (status == StatusUndefined || reason == ReasonUndefined) {
  		throw XSECException(XSECException::StatusError,
  			"XKMSStatus::getStatusReason - status or reason undefined");
  	}
  
  	return (m_statusReasons[status-1][reason-1] != NULL);
  
  }
  
  
  // --------------------------------------------------------------------------------
  //           Set methods
  // --------------------------------------------------------------------------------
  
  void XKMSStatusImpl::setStatusReason(StatusValue status, StatusReason reason, bool value) {
  
  	if (status == StatusUndefined || reason == ReasonUndefined) {
  		throw XSECException(XSECException::StatusError,
  			"XKMSStatus::setStatusReason - status or reason undefined");
  	}
  
  	if ((m_statusReasons[status-1][reason-1] != NULL) == value)
  		return;
  
  	/* Delete if necessary */
  	if (value == false) {
  
  		DOMNode * c = m_statusReasons[status-1][reason-1];
  		mp_statusElement->removeChild(c);
  		c->release();
  		m_statusReasons[status-1][reason-1] = NULL;
  		return;
  
  	}
  
  		
  	/* Find a previously found element to insert before*/
  	DOMNode * found = NULL;
  
  	m_statusValue = XKMSStatus::StatusUndefined;
  
  	StatusValue i;
  	StatusReason j;
  
  	/* Clean out status codes */
  	for (i = Indeterminate ; i > StatusUndefined && !(i == status && j == reason); i = (StatusValue)(i-1)) {
  		for (j = XKMSStatus::Signature; j != XKMSStatus::ReasonUndefined && !(i == status && j == reason); j = (XKMSStatus::StatusReason) (j-1)) {
  	
  			if (m_statusReasons[i-1][j-1] != NULL)
  				found = m_statusReasons[i-1][j-1];
  
  		}
  	}
  
  	/* Now lets create our new element and its text child */
  	safeBuffer str;
  	DOMDocument *doc = mp_env->getParentDocument();
  	const XMLCh * prefix = mp_env->getXKMSNSPrefix();
  
  	if (status == Valid) {
  		makeQName(str, prefix, XKMSConstants::s_tagValidReason);
  	}
  	else if (status == Invalid) {
  		makeQName(str, prefix, XKMSConstants::s_tagInvalidReason);
  	}
  	else {
  		makeQName(str, prefix, XKMSConstants::s_tagIndeterminateReason);
  	}
  
  	DOMElement * e = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS, 
  												str.rawXMLChBuffer());
  
  	/* Create the text node child */
  	makeQName(str, prefix, XKMSConstants::s_tagStatusReasonCodes[reason]);
  	e->appendChild(doc->createTextNode(str.rawXMLChBuffer()));
  
  	/* Insert at correct place */
  	if (found == NULL) {
  
  		mp_statusElement->appendChild(e);
  		mp_env->doPrettyPrint(mp_statusElement);
  
  	}
  	else {
  
  		mp_statusElement->insertBefore(e, found);
  		if (mp_env->getPrettyPrintFlag() == true)
  			mp_statusElement->insertBefore(doc->createTextNode(DSIGConstants::s_unicodeStrNL), found);
  
  	}
  
  	m_statusReasons[status-1][reason-1] = e;
  
  }
  
  
  1.1                  xml-security/c/src/xkms/impl/XKMSStatusImpl.hpp
  
  Index: XKMSStatusImpl.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
   *
   * XKMSStatusImpl := Implementation for Status elements (in KeyBinding)
   *
   * $Id: XKMSStatusImpl.hpp,v 1.1 2004/07/11 12:08:12 blautenb Exp $
   *
   */
  
  #ifndef XKMSSTATUSIMPL_INCLUDE
  #define XKMSSTATUSIMPL_INCLUDE
  
  // XSEC Includes
  
  #include <xsec/framework/XSECDefs.hpp>
  #include <xsec/xkms/XKMSStatus.hpp>
  
  
  
  class XKMSStatusImpl : public XKMSStatus {
  
  public:
  
  	XKMSStatusImpl(
  		const XSECEnv * env
  	);
  
  	XKMSStatusImpl(
  		const XSECEnv * env, 
  		XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
  	);
  
  	virtual ~XKMSStatusImpl();
  
  	// Load elements
  	void load();
  
  	// Creation
  	XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * 
  		createBlankStatus(StatusValue status);
  
  	/* Getter Interface Methods */
  	virtual StatusValue getStatusValue(void) const;
  	virtual bool getStatusReason(StatusValue status, StatusReason reason) const;
  
  	/* Setter Methods */
  	virtual void setStatusReason(StatusValue status, StatusReason reason, bool value);
  
  private:
  
  	const XSECEnv		* mp_env;
  	XERCES_CPP_NAMESPACE_QUALIFIER DOMElement 
  							* mp_statusElement;
  	XERCES_CPP_NAMESPACE_QUALIFIER DOMNode 
  							* mp_statusValueAttr;
  
  	StatusValue			m_statusValue;
  
  	/* Record values of each status */
  	XERCES_CPP_NAMESPACE_QUALIFIER DOMNode
  						* m_statusReasons[3][4];
  
  
  	// Unimplemented
  	XKMSStatusImpl(const XKMSStatusImpl &);
  	XKMSStatusImpl & operator = (const XKMSStatusImpl &);
  
  };
  
  #endif /* XKMSSTATUSIMPL_INCLUDE */