Mixe for Privacy and Anonymity in the Internet
CAXMLPriceCert.hpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2000, The JAP-Team
3 All rights reserved.
4 Redistribution and use in source and binary forms, with or without modification,
5 are permitted provided that the following conditions are met:
6 
7  - Redistributions of source code must retain the above copyright notice,
8  this list of conditions and the following disclaimer.
9 
10  - Redistributions in binary form must reproduce the above copyright notice,
11  this list of conditions and the following disclaimer in the documentation and/or
12  other materials provided with the distribution.
13 
14  - Neither the name of the University of Technology Dresden, Germany nor the names of its contributors
15  may be used to endorse or promote products derived from this software without specific
16  prior written permission.
17 
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
20 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
22 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
27 */
28 #ifndef CAXMLPRICECERT_H_
29 #define CAXMLPRICECERT_H_
30 #ifdef PAYMENT
31 #include "xml/DOM_Output.hpp"
33 #include "CAMsg.hpp"
41 class CAXMLPriceCert : public CAAbstractXMLSignable
42 {
43  public:
48  static CAXMLPriceCert* getInstance(const UINT8 * strXmlData,UINT32 strXMLDataLength);
49 
50  static CAXMLPriceCert* getInstance(DOMElement* elemRoot);
51  ~CAXMLPriceCert();
52 
53  SINT32 toXmlElement(XERCES_CPP_NAMESPACE::DOMDocument* a_doc, DOMElement* & elemRoot);
54 
56  UINT8* dumpToMem(UINT32* pLen)
57  {
58  if(m_domDocument==NULL)
59  return NULL;
60  return DOM_Output::dumpToMem(m_domDocument,pLen);
61  }
62 
64  SINT32 toXMLString(UINT8* buff,UINT32* bufflen)
65  {
66  if(DOM_Output::dumpToMem(m_domDocument,buff,bufflen)!=E_SUCCESS)
67  return E_UNKNOWN;
68  buff[*bufflen]=0;
69  return E_SUCCESS;
70  }
71 
75  UINT8 * getSubjectKeyIdentifier()
76  {
77  UINT8* pTmpStr = NULL;
78  if(m_StrSubjectKeyIdentifier!=NULL)
79  {
80  pTmpStr = new UINT8[strlen((char*)m_StrSubjectKeyIdentifier)+1];
81  strcpy((char*)pTmpStr, (char*)m_StrSubjectKeyIdentifier);
82  }
83  return pTmpStr;
84 
85  }
86 
87  double getRate()
88  {
89  return m_lRate;
90  }
91 
95  UINT8* getSignatureTime()
96  {
97  UINT8* pTmpStr = NULL;
98  if(m_StrSignatureTime!=NULL)
99  {
100  pTmpStr = new UINT8[strlen((char*)m_StrSignatureTime)+1];
101  strcpy((char*)pTmpStr, (char*)m_StrSignatureTime);
102  }
103  return pTmpStr;
104  }
105 
109  UINT8* getBiID()
110  {
111  UINT8* pTmpStr = NULL;
112  if(m_StrBiID!=NULL)
113  {
114  pTmpStr = new UINT8[strlen((char*)m_StrBiID)+1];
115  strcpy((char*)pTmpStr, (char*)m_StrBiID);
116  }
117  return pTmpStr;
118  }
119 
120  static const char* const getXMLElementName()
121  {
122  return ms_pStrElemName;
123  }
124 
125  XERCES_CPP_NAMESPACE::DOMDocument* getXMLDocument()
126  {
127  return m_domDocument;
128  }
129 
130 
131 
132 
133  private:
134  CAXMLPriceCert();
135  SINT32 setValues();
136 
137  UINT8* m_StrSubjectKeyIdentifier;
138  double m_lRate;
139  UINT8* m_StrSignatureTime;
140  UINT8* m_StrBiID;
141  DOMElement* m_signature;
142  XERCES_CPP_NAMESPACE::DOMDocument* m_domDocument;
143  static const char* const ms_pStrElemName;
144 
145 };
146 
147 #endif //PAYMENT
148 #endif /*CAXMLPRICECERT_H_*/
signed int SINT32
Definition: basetypedefs.h:132
unsigned char UINT8
Definition: basetypedefs.h:135
unsigned int UINT32
Definition: basetypedefs.h:131
An abstract base class for signable XML structures.
static SINT32 dumpToMem(const DOMNode *node, UINT8 *buff, UINT32 *size)
Dumps the node and all childs into buff.
Definition: DOM_Output.hpp:161
const SINT32 E_SUCCESS
Definition: errorcodes.hpp:2
#define E_UNKNOWN
Definition: errorcodes.hpp:3