diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2010-09-30 12:36:19 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2010-09-30 12:36:19 +0000 |
commit | e7690594d620312ddf3b3877118930eeab8f31df (patch) | |
tree | dd4b6a52f3a7c9308ffaa39de28536a3072668c2 /src/transport | |
parent | a7d1775a88d37dc55da1ef0a03de0d5ad277ebc7 (diff) | |
download | gnunet-e7690594d620312ddf3b3877118930eeab8f31df.tar.gz gnunet-e7690594d620312ddf3b3877118930eeab8f31df.zip |
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/plugin_transport.h | 2 | ||||
-rw-r--r-- | src/transport/transport_selection.h | 164 |
2 files changed, 74 insertions, 92 deletions
diff --git a/src/transport/plugin_transport.h b/src/transport/plugin_transport.h index 175905d80..a8e15ac8a 100644 --- a/src/transport/plugin_transport.h +++ b/src/transport/plugin_transport.h | |||
@@ -175,7 +175,7 @@ typedef void (*GNUNET_TRANSPORT_CostReport) (void *cls, | |||
175 | const struct GNUNET_PeerIdentity *peer, | 175 | const struct GNUNET_PeerIdentity *peer, |
176 | const void *addr, | 176 | const void *addr, |
177 | uint16_t addrlen, | 177 | uint16_t addrlen, |
178 | struct GNUNET_ATS_Cost_Information * cost); | 178 | struct GNUNET_ATS_Information * cost); |
179 | 179 | ||
180 | /** | 180 | /** |
181 | * The transport service will pass a pointer to a struct | 181 | * The transport service will pass a pointer to a struct |
diff --git a/src/transport/transport_selection.h b/src/transport/transport_selection.h index d3a20f5bb..b8080a9a1 100644 --- a/src/transport/transport_selection.h +++ b/src/transport/transport_selection.h | |||
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | /** | 27 | /** |
28 | * The structs defined here are used by the transport plugin to tell ATS about the transport's properties like cost and quality | 28 | * The structs defined here are used by the transport plugin to tell ATS about the transport's properties like cost and quality |
29 | * and on the other side the structs are used by highlevel components to communicate the constraints they have for a transprot to ATS | 29 | * and on the other side the structs are used by highlevel components to communicate the constraints they have for a transport to ATS |
30 | * | 30 | * |
31 | * +---+ | 31 | * +---+ |
32 | * +-----------+ Constraints | | Plugin properties +---------+ | 32 | * +-----------+ Constraints | | Plugin properties +---------+ |
@@ -38,51 +38,61 @@ | |||
38 | */ | 38 | */ |
39 | 39 | ||
40 | #define GNUNET_ATS_ARRAY_TERMINATOR 0 | 40 | #define GNUNET_ATS_ARRAY_TERMINATOR 0 |
41 | |||
41 | /** | 42 | /** |
42 | * Enum defining all known cost types for ATS | 43 | * Enum defining all known property types for ATS |
43 | * Enum values are used in the GNUNET_ATS_Cost_Information struct as (key,value)-pair | 44 | * Enum values are used in the GNUNET_ATS_Information struct as (key,value)-pair |
44 | * Cost are always stored in uint32_t, so all units used to define costs have to be normalized to fit in uint32_t [0 .. 4.294.967.295] | 45 | * Cost are always stored in uint32_t, so all units used to define costs have to be normalized to fit in uint32_t [0 .. 4.294.967.295] |
46 | * To keep the elements ordered | ||
47 | * 1..1024 : Values with a relation to cost | ||
48 | * 1025..2048 : Values with a relation to quality | ||
49 | * | ||
45 | */ | 50 | */ |
46 | enum GNUNET_ATS_Cost_Type | 51 | enum GNUNET_ATS_Property |
47 | { | 52 | { |
48 | /* | ||
49 | * Cost will be passed as struct GNUNET_ATS_Cost_Information[] | ||
50 | * array is 0-terminated: | ||
51 | * the last element in the array is the pair (GNUNET_ATS_ARRAY_TERMINATOR, 0) | ||
52 | */ | ||
53 | //GNUNET_ATS_ARRAY_TERMINATOR= 0, | ||
54 | 53 | ||
55 | /* Volume based cost in financial units to transmit data | 54 | /* Cost related values */ |
56 | * Note: this value is not bound to a specific currency or unit and only used locally | 55 | /* =================== */ |
56 | |||
57 | /** | ||
58 | * Volume based cost in financial units to transmit data | ||
57 | * | 59 | * |
58 | * Unit: [1/MB] | 60 | * Note: This value is not bound to a specific currency or unit and only used locally |
61 | * "cent" just refers the smallest amount of money in the respective currency | ||
62 | * | ||
63 | * Unit: [cent/MB] | ||
59 | * | 64 | * |
60 | * Interpretation: less is better | 65 | * Interpretation: less is better |
61 | * | 66 | * |
62 | * Examples: | 67 | * Examples: |
63 | * LAN: 0 | 68 | * LAN: 0 [cent/MB] |
64 | * 2G: 10 | 69 | * 2G : 10 [cent/MB] |
65 | */ | 70 | */ |
66 | GNUNET_ATS_FINANCIAL_PER_VOLUME_COST = 1, | 71 | GNUNET_ATS_COST_FINANCIAL_PER_VOLUME = 1, |
67 | 72 | ||
68 | /* Time based cost in financial units to transmit data | 73 | /** |
69 | * Note: this value is not bound to a specific currency or unit | 74 | * Time based cost in financial units to transmit data |
70 | * | 75 | * |
71 | * Unit: [1/h] | 76 | * Note: This value is not bound to a specific currency or unit and only used locally |
77 | * "cent" just refers the smallest amount of money in the respective currency | ||
78 | * | ||
79 | * Unit: [cent/h] | ||
72 | * | 80 | * |
73 | * Interpretation: less is better | 81 | * Interpretation: less is better |
74 | * | 82 | * |
75 | * Examples: | 83 | * Examples: |
76 | * LAN: 0 | 84 | * LAN : 0 [cent/h] |
77 | * Dialup: 10 | 85 | * Dialup: 10 [cent/h] |
78 | */ | 86 | */ |
79 | GNUNET_ATS_FINANCIAL_PER_TIME_COST = 2, | 87 | GNUNET_ATS_COST_FINANCIAL_PER_TIME = 2, |
80 | 88 | ||
81 | /* Computational costs | 89 | /** |
82 | * Effort of preparing data to send with this transport | 90 | * Computational costs |
91 | * | ||
92 | * Effort of preparing data to be sent with this transport | ||
83 | * Includes encoding, encryption and conversion of data | 93 | * Includes encoding, encryption and conversion of data |
84 | * Partial values can be summed: c_sum = c_enc + c_conv + c_enc | 94 | * Partial values can be summed up: c_sum = c_enc + c_enc + c_conv |
85 | * Resulting value depends on local system properties, e.g. CPU | 95 | * Resulting values depend on local system properties, e.g. CPU |
86 | * | 96 | * |
87 | * Unit: [ms/GB] | 97 | * Unit: [ms/GB] |
88 | * | 98 | * |
@@ -94,9 +104,11 @@ enum GNUNET_ATS_Cost_Type | |||
94 | * HTTPS with AES CBC-128: 5,279 | 104 | * HTTPS with AES CBC-128: 5,279 |
95 | * HTTPS with RC4-1024: 2,652 | 105 | * HTTPS with RC4-1024: 2,652 |
96 | */ | 106 | */ |
97 | GNUNET_ATS_COMPUTATIONAL_COST = 3, | 107 | GNUNET_ATS_COST_COMPUTATIONAL = 3, |
98 | 108 | ||
99 | /* Energy consumption | 109 | /** |
110 | * Energy consumption | ||
111 | * | ||
100 | * Energy consumption using this transport when sending with a certain power at a certain bitrate | 112 | * Energy consumption using this transport when sending with a certain power at a certain bitrate |
101 | * This is only an approximation based on: | 113 | * This is only an approximation based on: |
102 | * Energy consumption E = P / D | 114 | * Energy consumption E = P / D |
@@ -121,10 +133,10 @@ enum GNUNET_ATS_Cost_Type | |||
121 | * WLAN: 89 (600 mW @ 802.11g /w 54 MBit/s) | 133 | * WLAN: 89 (600 mW @ 802.11g /w 54 MBit/s) |
122 | * Bluetooth: 267 (100 mW @ BT2.0 EDR /w 3 MBit/s) | 134 | * Bluetooth: 267 (100 mW @ BT2.0 EDR /w 3 MBit/s) |
123 | */ | 135 | */ |
124 | GNUNET_ATS_ENERGY_CONSUMPTION = 4, | 136 | GNUNET_ATS_COST_ENERGY_CONSUMPTION = 4, |
125 | 137 | ||
126 | /* Connect cost | 138 | /* Connect cost |
127 | * How expensive is it to initiate a new connection using this transport | 139 | * How many bytes are transmitted to initiate a new connection using this transport? |
128 | * | 140 | * |
129 | * Unit: [bytes] | 141 | * Unit: [bytes] |
130 | * | 142 | * |
@@ -138,10 +150,10 @@ enum GNUNET_ATS_Cost_Type | |||
138 | * HTTPS HTTP+TLS Handshake: 2129 bytes Ethernet, 1975 bytes TCP/IP, 1755 bytes TCP, 1403 bytes HTTPS | 150 | * HTTPS HTTP+TLS Handshake: 2129 bytes Ethernet, 1975 bytes TCP/IP, 1755 bytes TCP, 1403 bytes HTTPS |
139 | * | 151 | * |
140 | * */ | 152 | * */ |
141 | GNUNET_ATS_CONNECT_COST = 5, | 153 | GNUNET_ATS_COST_CONNECT = 5, |
142 | 154 | ||
143 | /* Bandwidth cost | 155 | /* Bandwidth cost |
144 | * How many bandwidth is available to consume | 156 | * How many bandwidth is available to consume? |
145 | * Used to calculate which impact sending data with this transport has | 157 | * Used to calculate which impact sending data with this transport has |
146 | * | 158 | * |
147 | * Unit: [kB/s] | 159 | * Unit: [kB/s] |
@@ -154,98 +166,68 @@ enum GNUNET_ATS_Cost_Type | |||
154 | * Dial-up: 8 (64 Kbit/s) | 166 | * Dial-up: 8 (64 Kbit/s) |
155 | * | 167 | * |
156 | */ | 168 | */ |
157 | GNUNET_ATS_BANDWITH_COST = 6, | 169 | GNUNET_ATS_COST_BANDWITH_AVAILABLE = 6, |
158 | 170 | ||
159 | /* Network overhead | 171 | /* Network overhead |
160 | * a factor used with connect cost, bandwidth cost and energy cost to describe the overhead produced by the transport protocol | 172 | * How many bytes are sent over the wire when 1 kilobyte (1024 bytes) of application data is transmitted? |
173 | * A factor used with connect cost, bandwidth cost and energy cost to describe the overhead produced by the transport protocol | ||
161 | * | 174 | * |
162 | * Unit: [10,000 - (Efficiency in Percent * 100)] | 175 | * Unit: [bytes/kb] |
163 | * | 176 | * |
164 | * Interpretation: less is better | 177 | * Interpretation: less is better |
165 | * | 178 | * |
166 | * Examples: | 179 | * Examples: |
167 | * | 180 | * |
168 | * TCP/IPv4 over Ethernet: 507 (Efficiency: 94,93 %) | 181 | * TCP/IPv4 over Ethernet: 1024 + 38 + 20 + 20 = 1102 [bytes/kb] |
169 | * TCP/IPv6 over Ethernet: 646 (Efficiency: 93,64 %) | 182 | * TCP/IPv6 over Ethernet: 1024 + 38 + 20 + 40 = 1122 [bytes/kb] |
170 | * UDP/IPv4 over Ethernet: 429 (Efficiency: 95,71 %) | 183 | * UDP/IPv4 over Ethernet: 1024 + 38 + 20 + 8 = 1090 [bytes/kb] |
171 | * UDP/IPv6 over Ethernet: 559 (Efficiency: 94,41 %) | 184 | * UDP/IPv6 over Ethernet: 1024 + 38 + 40 + 8 = 1110 [bytes/kb] |
172 | */ | 185 | */ |
173 | GNUNET_ATS_NETWORK_OVERHEAD_COST = 7, | 186 | GNUNET_ATS_COST_NETWORK_OVERHEAD = 7, |
174 | }; | ||
175 | 187 | ||
176 | /** | ||
177 | * This structure will be used by plugins to communicate costs to ATS or by higher level components to tell ATS their constraints | ||
178 | * Always a pair of (GNUNET_ATS_Cost_Types, uint32_t value) | ||
179 | * Value is always uint32_t, so all units used to define costs have to be normalized to fit uint32_t | ||
180 | */ | ||
181 | struct GNUNET_ATS_Cost_Information | ||
182 | { | ||
183 | /** | ||
184 | * ATS Cost Type | ||
185 | */ | ||
186 | uint32_t cost_type; | ||
187 | |||
188 | /** | ||
189 | * ATS Cost value | ||
190 | */ | ||
191 | uint32_t cost_value; | ||
192 | }; | ||
193 | |||
194 | /** | ||
195 | * Enum defining all known quality types for ATS | ||
196 | * Enum values are used in the GNUNET_ATS_Cost_Information struct as (key,value)-pair | ||
197 | * Cost are always stored in uint32_t, so all units used to define costs have to be normalized to fit in uint32_t [0 .. 4.294.967.295] | ||
198 | */ | ||
199 | 188 | ||
200 | enum GNUNET_ATS_Quality_Type | 189 | /* Quality related values */ |
201 | { | 190 | /* ====================== */ |
202 | /* | ||
203 | * Quality will be passed as struct GNUNET_ATS_Quality_Information[] | ||
204 | * array is 0-terminated: | ||
205 | * the last element in the array is the pair (GNUNET_ATS_ARRAY_TERMINATOR, 0) | ||
206 | */ | ||
207 | //GNUNET_ATS_ARRAY_TERMINATOR = 0, | ||
208 | 191 | ||
209 | /* Physical layer quality properties */ | 192 | /* Physical layer quality properties */ |
210 | 193 | ||
211 | GNUNET_ATS_PHY_SIGNAL_STRENGTH = 1, | 194 | GNUNET_ATS_PHY_SIGNAL_STRENGTH = 1025, |
212 | 195 | ||
213 | GNUNET_ATS_PHY_COLLISION_RATE = 2, | 196 | GNUNET_ATS_PHY_COLLISION_RATE = 1026, |
214 | 197 | ||
215 | GNUNET_ATS_PHY_ERROR_RATE = 3, | 198 | GNUNET_ATS_PHY_ERROR_RATE = 1027, |
216 | 199 | ||
217 | /* Network layer quality properties */ | 200 | /* Network layer quality properties */ |
218 | 201 | ||
219 | GNUNET_ATS_NET_DELAY = 4, | 202 | GNUNET_ATS_NET_DELAY = 1028, |
220 | 203 | ||
221 | GNUNET_ATS_NET_LOSSRATE = 5, | 204 | GNUNET_ATS_NET_LOSSRATE = 1029, |
222 | 205 | ||
223 | GNUNET_ATS_NET_ERRORRATE = 6, | 206 | GNUNET_ATS_NET_ERRORRATE = 1030, |
224 | 207 | ||
225 | GNUNET_ATS_NET_DROPRATE = 6, | 208 | GNUNET_ATS_NET_DROPRATE = 1031, |
226 | 209 | ||
227 | GNUNET_ATS_NET_JITTER = 6, | 210 | GNUNET_ATS_NET_JITTER = 1032, |
228 | 211 | ||
229 | GNUNET_ATS_NET_THROUGHPUT = 7, | 212 | GNUNET_ATS_NET_THROUGHPUT = 1033 |
230 | }; | 213 | }; |
231 | 214 | ||
232 | /** | 215 | /** |
233 | * This structure will be used by plugins to communicate quality to ATS or by higher level components to tell ATS their | 216 | * This structure will be used by plugins to communicate costs to ATS or by higher level components to tell ATS their constraints |
234 | * quality constraints | 217 | * Always a pair of (GNUNET_ATS_Property, uint32_t value) |
235 | * | 218 | * Value is always uint32_t, so all units used to define costs have to be normalized to fit uint32_t |
236 | * Always a pair of (GNUNET_ATS_Quality_Type, uint32_t value) | ||
237 | * Value is always uint32_t, so all units used to define quality values have to be normalized to fit uint32_t | ||
238 | */ | 219 | */ |
239 | struct GNUNET_ATS_Quality_Information | 220 | struct GNUNET_ATS_Information |
240 | { | 221 | { |
241 | /** | 222 | /** |
242 | * ATS Quality Type | 223 | * ATS property type |
243 | */ | 224 | */ |
244 | uint32_t quality_type; | 225 | uint32_t type; |
245 | 226 | ||
246 | /** | 227 | /** |
247 | * ATS Quality value | 228 | * ATS property value |
248 | */ | 229 | */ |
249 | uint32_t quality_value; | 230 | uint32_t value; |
250 | }; | 231 | }; |
251 | 232 | ||
233 | |||