Mixe for Privacy and Anonymity in the Internet
typedefs.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 __TYEDEFS__
29 #define __TYEDEFS__
31 
33 
34 typedef UINT32 HCHANNEL;
35 #define MIX_PAYLOAD_HTTP 0
36 #define MIX_PAYLOAD_SOCKS 1
37 #define MIX_PAYLOAD_VPN 2
38 
39 
40 #define MIXPACKET_SIZE 998
41 
42 #define CHANNEL_DATA 0x00
43 #define CHANNEL_OPEN 0x08
44 
45 #define CHANNEL_TIMESTAMPS_UP 0x60
46 #define CHANNEL_TIMESTAMPS_DOWN 0x90
47 #define CHANNEL_CLOSE 0x01
48 //#define CHANNEL_SUSPEND 0x02 //no longer in use
49 //#define CHANNEL_RESUME 0x04 //no longer in use
50 #define CHANNEL_DUMMY 0x10
51 #define CHANNEL_DEBUG 0x20
52 
53 #if defined (LOG_CRIME) | defined (ANON_DEBUG_MODE)
54  #define CHANNEL_SIG_CRIME 0x20
55  #define CHANNEL_SIG_CRIME_ID_MASK 0x0000FF00
56  #define CHANNEL_ALLOWED_FLAGS (CHANNEL_OPEN|CHANNEL_CLOSE|CHANNEL_TIMESTAMPS_UP|CHANNEL_TIMESTAMPS_DOWN|CHANNEL_SIG_CRIME|CHANNEL_SIG_CRIME_ID_MASK)
57 #else
58  #define CHANNEL_SIG_CRIME 0x0
59  #define CHANNEL_SIG_CRIME_ID_MASK 0x0
60  #define CHANNEL_ALLOWED_FLAGS (CHANNEL_OPEN|CHANNEL_CLOSE|CHANNEL_TIMESTAMPS_UP|CHANNEL_TIMESTAMPS_DOWN)
61 #endif
62 
63 #define NEW_FLOW_CONTROL_FLAG 0x8000
64 
65 #define INTEGRITY_ERROR_FLAG 0x4000
66 
67 #define CONNECTION_ERROR_FLAG 0x01
68 
69 #define DATA_SIZE 992
70 #ifdef WITH_INTEGRITY_CHECK
71  #define PAYLOAD_SIZE 973
72 #else
73  #define PAYLOAD_SIZE 989
74 #endif
75 
76 #define PAYLOAD_HEADER_SIZE 3
77 
78 #define GCM_MAC_SIZE 16
79 #define PAYLOAD_LEN_MASK 0x03FF;
80 
81 #if (defined(WIN32) ||defined(__sgi))&&!defined(__GNUC__)
82  #define DO_PACKED
83 #else
84  #define DO_PACKED __attribute__ ((__packed__))
85 #endif
86 
87 
88 #if (defined(WIN32) ||defined(__sgi))&&!defined(__GNUC__)
89  #pragma pack( push, t_MixPacket )
90  #pragma pack(1)
91  struct t_MixPacketPayload
92  {
93  UINT16 len;
94  UINT8 type;
96  };
97  struct t_MixPacket
98  {
100  UINT16 flags;
101  union
102  {
105  };
106  };
107  #pragma pack( pop, t_MixPacket )
108 #else
110  {
114  } __attribute__ ((__packed__));
115  struct t_MixPacket
116  {
119  union
120  {
123  };
124  } __attribute__ ((__packed__)); // MUXPACKET __attribute__ ((__packed__));
125 #endif //WIN32
126 
128 
129 #ifdef DATA_RETENTION_LOG
130 #if (defined(WIN32) ||defined(__sgi))&&!defined(__GNUC__)
131  #pragma pack( push, t_DataRetentionLogEntry )
132  #pragma pack(1)
133 #endif
134 struct __t__data_retention_log_entry
135  {
136  UINT32 t_in;
137  UINT32 t_out;
138  union t_union_entity
139  {
140  struct t_first_mix_data_retention_log_entry
141  {
142  HCHANNEL channelid;
143  UINT8 ip_in[4];
144  UINT16 port_in;
145  } DO_PACKED first;
146  struct t_last_mix_data_retention_log_entry
147  {
148  HCHANNEL channelid;
149  UINT8 ip_out[4];
150  UINT16 port_out;
151  } DO_PACKED last;
152  } DO_PACKED entity;
153  }
154 #if (defined(WIN32) ||defined(__sgi))&&!defined(__GNUC__)
155  ;
156  #pragma pack( pop, t_DataRetentionLogEntry )
157 #else
158  DO_PACKED ;
159 #endif
160 
161 typedef struct __t__data_retention_log_entry t_dataretentionLogEntry;
162 #endif //DATA_RETENION_LOG
163 
164 
165 
166 //For that we store in our packet queue...
167 //normally this is just the packet
169  {
171  #if defined(DATA_RETENTION_LOG)
172  t_dataretentionLogEntry dataRetentionLogEntry;
173  #endif
174  #if defined (LOG_PACKET_TIMES) || defined (LOG_CHANNEL)
175  UINT64 timestamp_proccessing_start;
176  UINT64 timestamp_proccessing_start_OP;
177  UINT64 timestamp_proccessing_end;
178  #endif
179  #if defined (LOG_PACKET_TIMES)
180  //without send/receive or queueing times
181  UINT64 timestamp_proccessing_end_OP;
182  #ifdef USE_POOL
183  UINT64 pool_timestamp_in;
184  UINT64 pool_timestamp_out;
185  #endif
186  #endif
187  };
188 typedef struct t_queue_entry tQueueEntry;
189 
190 //for that we store in our pool
191 //normaly this is just the packet
193 
194 /*
195 struct t_proxytest_log
196 {
197  UINT16 len;
198  time_t time;
199 };
200 
201 typedef struct t_proxytest_log tProxytestLog;
202 */
203 
206  {
207  UINT interval; //the current interval number
208  UINT offset; //seconds since start of this interval
209  };
210 
211 typedef struct t_replay_timestamp tReplayTimestamp;
212 
214  {
215  //stores the mix id of the mix
217  // stores the local time in seconds since epoch for interval '0' for this mix
220  };
221 typedef struct t_mix_parameters tMixParameters;
222 
223 
230 #define AUTH_NEW 0x0
231 
233 #define AUTH_GOT_ACCOUNTCERT 0x1
234 
236 #define AUTH_ACCOUNT_OK 0x2
237 
239 #define AUTH_WAITING_FOR_FIRST_SETTLED_CC 0x4
240 
242 #define AUTH_SENT_CC_REQUEST 0x20
243 
245 #define AUTH_DATABASE 0x40
246 
248 #define AUTH_BLOCKED 0x80
249 
251 #define AUTH_SENT_ACCOUNT_REQUEST 0x100
252 
253 #define AUTH_HARD_LIMIT_REACHED 0x200
254 
256 #define AUTH_FAKE 0x400
257 
259 #define AUTH_CHALLENGE_SENT 0x800
260 
262 #define AUTH_ACCOUNT_EMPTY 0x1000
263 
265 #define AUTH_FATAL_ERROR 0x2000
266 
267 #define AUTH_OUTDATED_CC 0x4000
268 
270 #define AUTH_INVALID_ACCOUNT 0x8000
271 
272 // AI is waiting for a necessary message from JAP (e.g. response to challenge)
273 #define AUTH_TIMEOUT_STARTED 0x10000
274 
275 #define AUTH_MULTIPLE_LOGIN 0x20000
276 
277 #define AUTH_UNKNOWN 0x40000
278 
279 // we settled at least one CC for this account in this session
280 #define AUTH_SETTLED_ONCE 0x80000
281 
282 /*
283  * The user corresponding to this entry has closed the connection.
284  * Delete the entry as soon as possible.
285  */
286 #define AUTH_DELETE_ENTRY 0x80000
287 
288 #define AUTH_LOGIN_NOT_FINISHED 0x100000
289 #define AUTH_LOGIN_FAILED 0x200000
290 #define AUTH_LOGIN_SKIP_SETTLEMENT 0x400000
291 
292 class CASignature;
294 class CAMutex;
295 struct t_fmhashtableentry;
301 {
303 
306 
309 
312 
315 
318 
321 
324 
327 
331 
334 
337 
340 
343 
344  //time at which the timeout for waiting for the account certificate has been started
346 
347  // the number of references to this entry in the ai queue
349 
350  // new JonDo clients will send their version number as during challenge-response.
352 };
353 typedef struct t_accountinginfo tAiAccountingInfo;
354 
355 #endif
unsigned short UINT16
Definition: basetypedefs.h:133
unsigned int UINT
Definition: basetypedefs.h:155
signed int SINT32
Definition: basetypedefs.h:132
unsigned char UINT8
Definition: basetypedefs.h:135
unsigned int UINT32
Definition: basetypedefs.h:131
implementation of a per-user control-channel for the AccountingInstance.
HCHANNEL channel
Definition: typedefs.hpp:117
struct t_MixPacketPayload payload
Definition: typedefs.hpp:122
UINT8 data[DATA_SIZE]
Definition: typedefs.hpp:121
UINT16 flags
Definition: typedefs.hpp:118
UINT8 data[PAYLOAD_SIZE]
Definition: typedefs.hpp:113
Structure that holds all per-user payment information Included in CAFirstMixChannelList (struct fmHas...
Definition: typedefs.hpp:301
CAMutex * mutex
Definition: typedefs.hpp:302
CASignature * pPublicKey
the signature verifying instance for this user
Definition: typedefs.hpp:308
UINT64 bytesToConfirm
The bytes the user could confirm in the last CC sent to him.
Definition: typedefs.hpp:320
SINT32 lastHardLimitSeconds
timestamp when last HardLimit was reached
Definition: typedefs.hpp:336
UINT8 * pstrBIID
ID of payment instance belonging to this account.
Definition: typedefs.hpp:342
struct t_fmhashtableentry * ownerRef
Definition: typedefs.hpp:328
SINT32 challengeSentSeconds
timestamp when last PayRequest was sent
Definition: typedefs.hpp:339
SINT32 authTimeoutStartSeconds
Definition: typedefs.hpp:345
UINT8 * pChallenge
we store the challenge here to verify the response later
Definition: typedefs.hpp:305
UINT32 authFlags
Flags, see above AUTH_*.
Definition: typedefs.hpp:333
UINT64 sessionPackets
The number of packets transfered.
Definition: typedefs.hpp:311
UINT64 accountNumber
the user's account number
Definition: typedefs.hpp:323
UINT64 userID
The same value as in fmHashTableEntry.
Definition: typedefs.hpp:326
UINT64 confirmedBytes
the number of bytes that was confirmed by the account user
Definition: typedefs.hpp:317
UINT8 * clientVersion
Definition: typedefs.hpp:351
CAAccountingControlChannel * pControlChannel
a pointer to the user-specific control channel object
Definition: typedefs.hpp:330
UINT64 transferredBytes
the number of bytes that was transferred (as counted by the AI) Elmar: since last CC,...
Definition: typedefs.hpp:314
UINT16 m_u32ReplayBase
Definition: typedefs.hpp:219
UINT32 m_u32ReplayOffset
Definition: typedefs.hpp:218
UINT8 * m_strMixID
Definition: typedefs.hpp:216
Definition: typedefs.hpp:169
MIXPACKET packet
Definition: typedefs.hpp:170
the Replaytimestamp type
Definition: typedefs.hpp:206
TargetType
Definition: typedefs.hpp:32
@ TARGET_VPN_PROXY
Definition: typedefs.hpp:32
@ TARGET_UNKNOWN
Definition: typedefs.hpp:32
@ TARGET_SOCKS_PROXY
Definition: typedefs.hpp:32
@ TARGET_HTTP_PROXY
Definition: typedefs.hpp:32
@ TARGET_MIX
Definition: typedefs.hpp:32
#define DO_PACKED
Definition: typedefs.hpp:84
NetworkType
Definition: typedefs.hpp:30
@ RAW_TCP
Definition: typedefs.hpp:30
@ RAW_UDP
Definition: typedefs.hpp:30
@ SSL_TCP
Definition: typedefs.hpp:30
@ RAW_UNIX
Definition: typedefs.hpp:30
@ SSL_UNIX
Definition: typedefs.hpp:30
@ UNKNOWN_NETWORKTYPE
Definition: typedefs.hpp:30
@ HTTP_TCP
Definition: typedefs.hpp:30
#define PAYLOAD_SIZE
Definition: typedefs.hpp:73
struct t_queue_entry __attribute__
UINT32 HCHANNEL
Definition: typedefs.hpp:34
t_MixPacket MIXPACKET
Definition: typedefs.hpp:127
tQueueEntry tPoolEntry
Definition: typedefs.hpp:192
#define DATA_SIZE
Definition: typedefs.hpp:69