aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2010-09-28 15:50:32 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2010-09-28 15:50:32 +0000
commitcd873611eb98058acdaaafdf469de7998c543ae8 (patch)
tree9add68aa98e5338b66471360bbe64974af073ec0 /src/transport
parent081363d01bdceaad3eb2c15cbde5ca7d35b99d1d (diff)
downloadgnunet-cd873611eb98058acdaaafdf469de7998c543ae8.tar.gz
gnunet-cd873611eb98058acdaaafdf469de7998c543ae8.zip
Definition of ATS costs
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/transport_selection.h173
1 files changed, 173 insertions, 0 deletions
diff --git a/src/transport/transport_selection.h b/src/transport/transport_selection.h
new file mode 100644
index 000000000..8bc810f84
--- /dev/null
+++ b/src/transport/transport_selection.h
@@ -0,0 +1,173 @@
1/*
2 This file is part of GNUnet.
3 (C) 2009 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @file transport/transport_selection.h
23 * @brief structure definition for automatic transport selection (ATS)
24 * @author Matthias Wachs
25 */
26
27/**
28 * Enum defining all known cost types for ATS
29 * Enum values are used in the GNUNET_ATS_Cost_Information struct as (key,value)-pair
30 * 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]
31 */
32
33enum GNUNET_ATS_Cost_Type
34{
35 /*
36 * Cost will be passed as struct GNUNET_ATS_Cost_Information[]
37 * array is 0-terminated:
38 * the last element in the array is the pair (GNUNET_ATS_ARRAY_TERMINATOR, 0)
39 */
40 GNUNET_ATS_ARRAY_TERMINATOR= 0,
41
42 /* Volume based cost in financial units to transmit data
43 * Note: this value is not bound to a specific currency or unit and only used locally
44 *
45 * Unit: [1/MB]
46 *
47 * Interpretation: less is better
48 *
49 * Examples:
50 * LAN: 0
51 * 2G: 10
52 */
53 GNUNET_ATS_FINANCIAL_PER_VOLUME_COST = 1,
54
55 /* Time based cost in financial units to transmit data
56 * Note: this value is not bound to a specific currency or unit
57 *
58 * Unit: [1/h]
59 *
60 * Interpretation: less is better
61 *
62 * Examples:
63 * LAN: 0
64 * Dialup: 10
65 */
66 GNUNET_ATS_FINANCIAL_PER_TIME_COST = 2,
67
68 /* Computational costs
69 * Effort of preparing data to send with this transport
70 * Includes encoding, encryption and conversion of data
71 * Partial values can be summed: c_sum = c_enc + c_conv + c_enc
72 * Resulting value depends on local system properties, e.g. CPU
73 *
74 * Unit: [ms/GB]
75 *
76 * Interpretation: less is better
77 *
78 * Examples:
79 *
80 * HTTPS with AES CBC-256: 7,382
81 * HTTPS with AES CBC-128: 5,279
82 * HTTPS with RC4-1024: 2,652
83 */
84 GNUNET_ATS_COMPUTATIONAL_COST = 3,
85
86 /* Energy consumption
87 * Energy consumption using this transport when sending with a certain power at a certain bitrate
88 * This is only an approximation based on:
89 * Energy consumption E = P / D
90 *
91 * with:
92 * Power P in Watt (J/s)
93 * Datarate D in MBit/s
94 *
95 * Unit: [mJ/MB]
96 *
97 * Interpretation: less is better
98 *
99 * Examples:
100 *
101 * LAN: 0
102 * WLAN: 89 (600 mW @ 802.11g /w 54 MBit/s)
103 * Bluetooth: 267 (100 mW @ BT2.0 EDR /w 3 MBit/s)
104 */
105 GNUNET_ATS_ENERGY_CONSUMPTION = 4,
106
107 /* Connect cost
108 * How expensive is it to initiate a new connection using this transport
109 *
110 * Unit: [bytes]
111 *
112 * Interpretation: less is better
113 *
114 * Examples:
115 *
116 * UDP (No connection) : 0 bytes
117 * TCP (TCP 3-Way handshake): 220 bytes Ethernet, 172 bytes TCP/IP, 122 bytes TCP
118 * HTTP (TCP + Header) : 477 bytes Ethernet, 429 bytes TCP/IP, 374 bytes TCP, 278 bytes HTTP
119 * HTTPS HTTP+TLS Handshake: 2129 bytes Ethernet, 1975 bytes TCP/IP, 1755 bytes TCP, 1403 bytes HTTPS
120 *
121 * */
122 GNUNET_ATS_CONNECT_COST = 5,
123
124 /* Bandwidth cost
125 * How many bandwidth is available to consume
126 * Used to calculate which impact sending data with this transport has
127 *
128 * Unit: [kB/s]
129 *
130 * Interpretation: more is better
131 *
132 * Examples:
133 * LAN: 12,800 (100 MBit/s)
134 * WLAN: 6,912 (54 MBit/s)
135 * Dial-up: 8 (64 Kbit/s)
136 *
137 */
138 GNUNET_ATS_BANDWITH_COST = 6,
139
140 /* Network overhead
141 * a factor used with connect cost, bandwidth cost and energy cost to describe the overhead produced by the transport protocol
142 *
143 * Unit: [10,000 - (Efficiency in Percent * 100)]
144 *
145 * Interpretation: less is better
146 *
147 * Examples:
148 *
149 * TCP/IPv4 over Ethernet: 507 (Efficiency: 94,93 %)
150 * TCP/IPv6 over Ethernet: 646 (Efficiency: 93,64 %)
151 * UDP/IPv4 over Ethernet: 429 (Efficiency: 95,71 %)
152 * UDP/IPv6 over Ethernet: 559 (Efficiency: 94,41 %)
153 */
154 GNUNET_ATS_NETWORK_OVERHEAD_COST = 7,
155};
156
157/**
158 * This structure will be used by plugins to communicate costs to ATS
159 * Always a pair of (GNUNET_ATS_Cost_Types, uint32_t value)
160 * Value is always uint32_t, so all units used to define costs have to be normalized to fit uint32_t
161 */
162struct GNUNET_ATS_Cost_Information
163{
164 /**
165 * ATS Cost Type
166 */
167 uint32_t cost_type;
168
169 /**
170 * ATS Cost value
171 */
172 uint32_t cost_value;
173};