Mixe for Privacy and Anonymity in the Internet
typedefsb.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2006, The JAP-Team
3  * All rights reserved.
4  * Redistribution and use in source and binary forms, with or without
5  * modification, 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
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  *
14  * - Neither the name of the University of Technology Dresden, Germany nor
15  * the names of its contributors may be used to endorse or promote
16  * products derived from this software without specific prior written
17  * permission.
18  *
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
24  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE
31  */
32 #ifndef __TYPEDEFSB__
33 #define __TYPEDEFSB__
34 
35 #define CHANNEL_DOWNSTREAM_PACKETS 10
36 #define CHANNEL_TIMEOUT 15
37 #define CHAIN_TIMEOUT 30
38 #define DEADLINE_TIMEOUT 5
39 
40 #define CHAIN_ID_LENGTH 8
41 
42 #ifdef DELAY_CHANNELS
43  /* The maximum delay-bucket size of the data-chains. It's defined here
44  * because currently only type-B mixes support it.
45  */
46  #define MAX_DELAY_BUCKET_SIZE 30000
47 #endif
48 
49 
50 #ifdef LOG_CHANNEL
51  /* channel logging doesn't make much sense for type-B mixes -> we will log
52  * chains instead of channels
53  */
54  //#define LOG_CHAIN_STATISTICS
55 #endif
56 
57 
58 // chainflags for both directions
59 #define CHAINFLAG_STREAM_CLOSED 0x4000
60 
61 // chainflags for upstream
62 #define CHAINFLAG_NEW_CHAIN 0x2000
63 #define CHAINFLAG_FAST_RESPONSE 0x8000
64 
65 // chainflags for downstream
66 #define CHAINFLAG_CONNECTION_ERROR 0x8000
67 #define CHAINFLAG_UNKNOWN_CHAIN 0x2000
68 
69 #define CHAINFLAG_LENGTH_MASK 0x03FF
70 
71 #define MAX_FIRST_UPSTREAM_CHAINCELL_PAYLOAD DATA_SIZE - 2 - 1
72 #define MAX_SEQUEL_UPSTREAM_CHAINCELL_PAYLOAD DATA_SIZE - 2 - CHAIN_ID_LENGTH
73 
74 #if ((defined(WIN32) || defined(__sgi)) && !defined(__GNUC__))
75  #pragma pack(push, t_upstream_chain_cell)
76  #pragma pack(1)
77 
79  UINT8 type;
81  };
82 
86  };
87 
88  struct t_upstream_chain_cell {
90  union {
93  };
94  };
95 
96  #pragma pack(pop, t_upstream_chain_cell)
97 #else
101  } __attribute__ ((__packed__));
102 
106  } __attribute__ ((__packed__));
107 
110  union {
113  };
114  } __attribute__ ((__packed__));
115 #endif //WIN32
116 
118 
119 #define MAX_FIRST_DOWNSTREAM_CHAINCELL_PAYLOAD DATA_SIZE - 2 - CHAIN_ID_LENGTH
120 #define MAX_SEQUEL_DOWNSTREAM_CHAINCELL_PAYLOAD DATA_SIZE - 2
121 
122 #if ((defined(WIN32) || defined(__sgi)) && !defined(__GNUC__))
123  #pragma pack(push, t_downstream_chain_cell)
124  #pragma pack(1)
125 
129  };
130 
133  };
134 
135  struct t_downstream_chain_cell {
137  union {
140  };
141  };
142 
143  #pragma pack(pop, t_downstream_chain_cell)
144 #else
148  } __attribute__ ((__packed__));
149 
152  } __attribute__ ((__packed__));
153 
156  union {
159  };
160  } __attribute__ ((__packed__));
161 #endif //WIN32
162 
164 
165 
166 #endif //__TYPEDEFSB__
unsigned short UINT16
Definition: basetypedefs.h:133
unsigned char UINT8
Definition: basetypedefs.h:135
t_first_downstream_chain_cell firstCell
Definition: typedefsb.hpp:157
t_sequel_downstream_chain_cell sequelCell
Definition: typedefsb.hpp:158
UINT8 chainId[CHAIN_ID_LENGTH]
Definition: typedefsb.hpp:146
UINT8 data[MAX_FIRST_DOWNSTREAM_CHAINCELL_PAYLOAD]
Definition: typedefsb.hpp:147
UINT8 data[MAX_FIRST_UPSTREAM_CHAINCELL_PAYLOAD]
Definition: typedefsb.hpp:100
UINT8 data[MAX_SEQUEL_DOWNSTREAM_CHAINCELL_PAYLOAD]
Definition: typedefsb.hpp:151
UINT8 chainId[CHAIN_ID_LENGTH]
Definition: typedefsb.hpp:104
UINT8 data[MAX_SEQUEL_UPSTREAM_CHAINCELL_PAYLOAD]
Definition: typedefsb.hpp:105
t_sequel_upstream_chain_cell sequelCell
Definition: typedefsb.hpp:112
t_first_upstream_chain_cell firstCell
Definition: typedefsb.hpp:111
t_downstream_chain_cell t_downstreamChainCell
Definition: typedefsb.hpp:163
#define MAX_FIRST_UPSTREAM_CHAINCELL_PAYLOAD
Definition: typedefsb.hpp:71
#define MAX_SEQUEL_DOWNSTREAM_CHAINCELL_PAYLOAD
Definition: typedefsb.hpp:120
#define CHAIN_ID_LENGTH
Definition: typedefsb.hpp:40
#define MAX_FIRST_DOWNSTREAM_CHAINCELL_PAYLOAD
Definition: typedefsb.hpp:119
#define MAX_SEQUEL_UPSTREAM_CHAINCELL_PAYLOAD
Definition: typedefsb.hpp:72
t_upstream_chain_cell t_upstreamChainCell
Definition: typedefsb.hpp:117
struct t_first_upstream_chain_cell __attribute__((__packed__))