|
Mixe for Privacy and Anonymity in the Internet
|
00001 /* 00002 * Copyright (c) 2006, The JAP-Team 00003 * All rights reserved. 00004 * Redistribution and use in source and binary forms, with or without 00005 * modification, are permitted provided that the following conditions are met: 00006 * 00007 * - Redistributions of source code must retain the above copyright notice, 00008 * this list of conditions and the following disclaimer. 00009 * 00010 * - Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * 00014 * - Neither the name of the University of Technology Dresden, Germany nor 00015 * the names of its contributors may be used to endorse or promote 00016 * products derived from this software without specific prior written 00017 * permission. 00018 * 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00021 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 00022 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00023 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE 00024 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00025 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00026 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00027 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00028 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00029 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00030 * POSSIBILITY OF SUCH DAMAGE 00031 */ 00032 #ifndef __TYPEDEFSB__ 00033 #define __TYPEDEFSB__ 00034 00035 #define CHANNEL_DOWNSTREAM_PACKETS 10 00036 #define CHANNEL_TIMEOUT 15 00037 #define CHAIN_TIMEOUT 30 00038 #define DEADLINE_TIMEOUT 5 00039 00040 #define CHAIN_ID_LENGTH 8 00041 00042 #ifdef DELAY_CHANNELS 00043 /* The maximum delay-bucket size of the data-chains. It's defined here 00044 * because currently only type-B mixes support it. 00045 */ 00046 #define MAX_DELAY_BUCKET_SIZE 30000 00047 #endif 00048 00049 00050 #ifdef LOG_CHANNEL 00051 /* channel logging doesn't make much sense for type-B mixes -> we will log 00052 * chains instead of channels 00053 */ 00054 //#define LOG_CHAIN_STATISTICS 00055 #endif 00056 00057 00058 // chainflags for both directions 00059 #define CHAINFLAG_STREAM_CLOSED 0x4000 00060 00061 // chainflags for upstream 00062 #define CHAINFLAG_NEW_CHAIN 0x2000 00063 #define CHAINFLAG_FAST_RESPONSE 0x8000 00064 00065 // chainflags for downstream 00066 #define CHAINFLAG_CONNECTION_ERROR 0x8000 00067 #define CHAINFLAG_UNKNOWN_CHAIN 0x2000 00068 00069 #define CHAINFLAG_LENGTH_MASK 0x03FF 00070 00071 #define MAX_FIRST_UPSTREAM_CHAINCELL_PAYLOAD DATA_SIZE - 2 - 1 00072 #define MAX_SEQUEL_UPSTREAM_CHAINCELL_PAYLOAD DATA_SIZE - 2 - CHAIN_ID_LENGTH 00073 00074 #if ((defined(WIN32) || defined(__sgi)) && !defined(__GNUC__)) 00075 #pragma pack(push, t_upstream_chain_cell) 00076 #pragma pack(1) 00077 00078 struct t_first_upstream_chain_cell { 00079 UINT8 type; 00080 UINT8 data[MAX_FIRST_UPSTREAM_CHAINCELL_PAYLOAD]; 00081 }; 00082 00083 struct t_sequel_upstream_chain_cell { 00084 UINT8 chainId[CHAIN_ID_LENGTH]; 00085 UINT8 data[MAX_SEQUEL_UPSTREAM_CHAINCELL_PAYLOAD]; 00086 }; 00087 00088 struct t_upstream_chain_cell { 00089 UINT16 lengthAndFlags; 00090 union { 00091 struct t_first_upstream_chain_cell firstCell; 00092 struct t_sequel_upstream_chain_cell sequelCell; 00093 }; 00094 }; 00095 00096 #pragma pack(pop, t_upstream_chain_cell) 00097 #else 00098 struct t_first_upstream_chain_cell { 00099 UINT8 type; 00100 UINT8 data[MAX_FIRST_UPSTREAM_CHAINCELL_PAYLOAD]; 00101 } __attribute__ ((__packed__)); 00102 00103 struct t_sequel_upstream_chain_cell { 00104 UINT8 chainId[CHAIN_ID_LENGTH]; 00105 UINT8 data[MAX_SEQUEL_UPSTREAM_CHAINCELL_PAYLOAD]; 00106 } __attribute__ ((__packed__)); 00107 00108 struct t_upstream_chain_cell { 00109 UINT16 lengthAndFlags; 00110 union { 00111 t_first_upstream_chain_cell firstCell; 00112 t_sequel_upstream_chain_cell sequelCell; 00113 }; 00114 } __attribute__ ((__packed__)); 00115 #endif //WIN32 00116 00117 typedef t_upstream_chain_cell t_upstreamChainCell; 00118 00119 #define MAX_FIRST_DOWNSTREAM_CHAINCELL_PAYLOAD DATA_SIZE - 2 - CHAIN_ID_LENGTH 00120 #define MAX_SEQUEL_DOWNSTREAM_CHAINCELL_PAYLOAD DATA_SIZE - 2 00121 00122 #if ((defined(WIN32) || defined(__sgi)) && !defined(__GNUC__)) 00123 #pragma pack(push, t_downstream_chain_cell) 00124 #pragma pack(1) 00125 00126 struct t_first_downstream_chain_cell { 00127 UINT8 chainId[CHAIN_ID_LENGTH]; 00128 UINT8 data[MAX_FIRST_DOWNSTREAM_CHAINCELL_PAYLOAD]; 00129 }; 00130 00131 struct t_sequel_downstream_chain_cell { 00132 UINT8 data[MAX_SEQUEL_DOWNSTREAM_CHAINCELL_PAYLOAD]; 00133 }; 00134 00135 struct t_downstream_chain_cell { 00136 UINT16 lengthAndFlags; 00137 union { 00138 t_first_downstream_chain_cell firstCell; 00139 t_sequel_downstream_chain_cell sequelCell; 00140 }; 00141 }; 00142 00143 #pragma pack(pop, t_downstream_chain_cell) 00144 #else 00145 struct t_first_downstream_chain_cell { 00146 UINT8 chainId[CHAIN_ID_LENGTH]; 00147 UINT8 data[MAX_FIRST_DOWNSTREAM_CHAINCELL_PAYLOAD]; 00148 } __attribute__ ((__packed__)); 00149 00150 struct t_sequel_downstream_chain_cell { 00151 UINT8 data[MAX_SEQUEL_DOWNSTREAM_CHAINCELL_PAYLOAD]; 00152 } __attribute__ ((__packed__)); 00153 00154 struct t_downstream_chain_cell { 00155 UINT16 lengthAndFlags; 00156 union { 00157 t_first_downstream_chain_cell firstCell; 00158 t_sequel_downstream_chain_cell sequelCell; 00159 }; 00160 } __attribute__ ((__packed__)); 00161 #endif //WIN32 00162 00163 typedef t_downstream_chain_cell t_downstreamChainCell; 00164 00165 00166 #endif //__TYPEDEFSB__
1.7.6.1