Mixe for Privacy and Anonymity in the Internet
CAMix.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 __CAMIX__
29 #define __CAMIX__
30 
31 #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_MIDDLE_MIX || defined INCLUDE_LAST_MIX
32 
33 class CAMultiSignature;
34 class CAInfoService;
35 //class DOM_Element;
37 
38 #ifdef DATA_RETENTION_LOG
39 #include "CADataRetentionLog.hpp"
40 #endif
41 
42 #define KEYINFO_NODE_TNC_INFOS "TermsAndConditionsInfos"
43 #define KEYINFO_NODE_TNC_INFO "TermsAndConditionsInfo"
44 
45 #define KEYINFO_NODE_EXTENSIONS "Extensions"
46 #define KEYINFO_NODE_TNC_EXTENSION "TermsAndConditionsExtension"
47 
48 class CAMix
49  {
50  public:
51  enum tMixType
52  {
56  JAP
57  };
58 
60 
61  public:
62  CAMix();
63  virtual ~CAMix();
64  SINT32 start();
65  virtual SINT32 reconfigure()
66  {
67  return E_SUCCESS;
68  }
69  virtual tMixType getType() const =0;
70 
71  virtual void shutDown()
72  {
73  m_bShutDown = true;
74  m_bLoop=false;
75  }
76 
77  virtual bool isShutDown()
78  {
79  return m_bShutDown;
80  }
81 
82 #ifdef DYNAMIC_MIX
83  void setReconfiguring(bool a_val)
84  {
85  m_bReconfiguring = a_val;
86  }
87  SINT32 dynaReconfigure(bool a_bChangeMixType);
88 #endif
89 
96  SINT32 getMixCascadeInfo(XERCES_CPP_NAMESPACE::DOMDocument* & docMixCascadeInfo)
97  {
98  if (m_docMixCascadeInfo != NULL)
99  {
100  docMixCascadeInfo = m_docMixCascadeInfo;
101  return E_SUCCESS;
102  }
103  else
104  {
105  return E_UNKNOWN;
106  }
107  }
108 
109  // added by ronin <ronin2@web.de>
111  {
113  }
114 
116  {
118  }
119 
121  {
123  }
124 
126  {
127  return m_lLastConnectionTime;
128  }
129 
130  bool isConnected()
131  {
132  return m_bConnected;
133  }
134  protected:
135  volatile bool m_bLoop;
136 
137 #ifdef DYNAMIC_MIX
138  virtual void stopCascade() =0;
139  bool m_bLoop;
140  bool m_bCascadeEstablished;
141  bool m_bReconfigured;
142 #endif
144  volatile bool m_bShutDown;
145  virtual SINT32 clean()=0;
146  virtual SINT32 initOnce();
147  virtual SINT32 init()=0;
148  virtual SINT32 loop()=0;
149 
150  SINT32 checkCompatibility(DOMNode* a_parent, const char* a_mixPosition);
151  SINT32 appendCompatibilityInfo(DOMNode* a_parent);
152  SINT32 addMixInfo(DOMNode* a_element, bool a_bForceFirstNode);
153 
154 #ifdef PAYMENT
161  DOMNode *appendTermsAndConditionsExtension(XERCES_CPP_NAMESPACE::DOMDocument *doc,
162  DOMElement *root);
163 
168  DOMNode *termsAndConditionsInfoNode(XERCES_CPP_NAMESPACE::DOMDocument *ownerDoc);
169 
170 #endif
171  // added by ronin <ronin2@web.de>
173  /*{
174  return E_SUCCESS;
175  }*/
176 
177  // added by ronin <ronin2@web.de>
178  virtual SINT32 initMixCascadeInfo(DOMElement* elemMixes);
179 
180  SINT32 signXML(DOMNode* a_element);
181 
182  //CASignature* m_pSignature;
185 
188 
190  volatile bool m_bConnected;
192  // added by ronin <ronin2@web.de>
193  XERCES_CPP_NAMESPACE::DOMDocument* m_docMixCascadeInfo;
194 
197 
198 #ifdef DATA_RETENTION_LOG
199  CADataRetentionLog* m_pDataRetentionLog;
200 #endif
201 
202  private:
203  // added by ronin <ronin2@web.de>
204  bool needAutoConfig();
205  };
206 #endif
207 #endif //ONLY_LOCAL_PROXY
signed int SINT32
Definition: basetypedefs.h:132
unsigned int UINT32
Definition: basetypedefs.h:131
This class "dispatches" messages which it receives via proccessMixPacket() to the associated control ...
Definition: CAMix.hpp:49
volatile bool m_bConnected
Definition: CAMix.hpp:190
bool m_bReconfiguring
Definition: CAMix.hpp:143
virtual SINT32 loop()=0
virtual ~CAMix()
Definition: CAMix.cpp:66
volatile bool m_bLoop
Definition: CAMix.hpp:135
virtual void shutDown()
Definition: CAMix.hpp:71
SINT32 appendCompatibilityInfo(DOMNode *a_parent)
Definition: CAMix.cpp:634
SINT32 checkCompatibility(DOMNode *a_parent, const char *a_mixPosition)
Definition: CAMix.cpp:670
SINT32 start()
Definition: CAMix.cpp:104
virtual bool isShutDown()
Definition: CAMix.hpp:77
CAInfoService * m_pInfoService
Definition: CAMix.hpp:184
SINT32 signXML(DOMNode *a_element)
Definition: CAMix.cpp:806
static const UINT32 TIMEOUT_MIX_CONNECTION_ESTABLISHEMENT
Definition: CAMix.hpp:59
volatile UINT32 m_lLastConnectionTime
Definition: CAMix.hpp:191
SINT32 addMixInfo(DOMNode *a_element, bool a_bForceFirstNode)
Definition: CAMix.cpp:437
CAControlChannelDispatcher * m_pMuxOutControlChannelDispatcher
Definition: CAMix.hpp:195
CAControlChannelDispatcher * m_pMuxInControlChannelDispatcher
Definition: CAMix.hpp:196
virtual SINT32 clean()=0
CAControlChannelDispatcher * getDownstreamControlChannelDispatcher() const
Definition: CAMix.hpp:115
virtual SINT32 processKeyExchange()=0
UINT32 m_u32KeepAliveRecvInterval
Definition: CAMix.hpp:186
CAMultiSignature * m_pMultiSignature
Definition: CAMix.hpp:183
virtual SINT32 initMixCascadeInfo(DOMElement *elemMixes)
This will initialize the XML Cascade Info struct XMLFirstMixToInfoService that is sent to the InfoSer...
Definition: CAMix.cpp:299
virtual tMixType getType() const =0
bool needAutoConfig()
This method checks if target interfaces (network adress and port of next mix) have been specified in ...
Definition: CAMix.cpp:263
bool isConnected()
Definition: CAMix.hpp:130
virtual SINT32 initOnce()
Definition: CAMix.cpp:78
virtual SINT32 reconfigure()
Definition: CAMix.hpp:65
virtual SINT32 init()=0
volatile bool m_bShutDown
Definition: CAMix.hpp:144
XERCES_CPP_NAMESPACE::DOMDocument * m_docMixCascadeInfo
Definition: CAMix.hpp:193
tMixType
Definition: CAMix.hpp:52
@ LAST_MIX
Definition: CAMix.hpp:55
@ FIRST_MIX
Definition: CAMix.hpp:53
@ JAP
Definition: CAMix.hpp:56
@ MIDDLE_MIX
Definition: CAMix.hpp:54
UINT32 m_u32KeepAliveSendInterval
Definition: CAMix.hpp:187
bool acceptsReconfiguration()
Definition: CAMix.hpp:110
bool m_acceptReconfiguration
Definition: CAMix.hpp:189
UINT32 getLastConnectionTime()
Definition: CAMix.hpp:125
CAMix()
Definition: CAMix.cpp:39
SINT32 getMixCascadeInfo(XERCES_CPP_NAMESPACE::DOMDocument *&docMixCascadeInfo)
Returns the Mix-Cascade info which should be send to the InfoService.
Definition: CAMix.hpp:96
CAControlChannelDispatcher * getUpstreamControlChannelDispatcher() const
Definition: CAMix.hpp:120
const SINT32 E_SUCCESS
Definition: errorcodes.hpp:2
#define E_UNKNOWN
Definition: errorcodes.hpp:3