diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-09-12 11:31:50 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-09-12 11:31:50 +0000 |
commit | 02ccdcf0ef5c039224a397f057b2a76f54364d92 (patch) | |
tree | db9e4faee6831b965fedb5648915a556be5ff091 /src/cadet | |
parent | 17987cc9db00b169dd8bff5a620e5d5ab51ff044 (diff) | |
download | gnunet-02ccdcf0ef5c039224a397f057b2a76f54364d92.tar.gz gnunet-02ccdcf0ef5c039224a397f057b2a76f54364d92.zip |
realigning CADET messages and bumping message types to avoid interactions with incompatible old versions complicating diagnostics
Diffstat (limited to 'src/cadet')
-rw-r--r-- | src/cadet/cadet.h | 108 | ||||
-rw-r--r-- | src/cadet/cadet_protocol.h | 57 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_channel.c | 200 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_channel.h | 10 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_connection.h | 2 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_local.c | 65 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_tunnel.h | 41 |
7 files changed, 263 insertions, 220 deletions
diff --git a/src/cadet/cadet.h b/src/cadet/cadet.h index 063711fd2..3ff93c254 100644 --- a/src/cadet/cadet.h +++ b/src/cadet/cadet.h | |||
@@ -69,16 +69,17 @@ GNUNET_NETWORK_STRUCT_BEGIN | |||
69 | */ | 69 | */ |
70 | struct GNUNET_CADET_PortMessage | 70 | struct GNUNET_CADET_PortMessage |
71 | { | 71 | { |
72 | /** | 72 | /** |
73 | * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_[OPEN|CLOSE] | 73 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_OPEN |
74 | * | 74 | * or #GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE |
75 | * Size: sizeof(struct GNUNET_CADET_ChannelMessage) | 75 | * |
76 | */ | 76 | * Size: sizeof(struct GNUNET_CADET_ChannelMessage) |
77 | */ | ||
77 | struct GNUNET_MessageHeader header; | 78 | struct GNUNET_MessageHeader header; |
78 | 79 | ||
79 | /** | 80 | /** |
80 | * Port to open/close. | 81 | * Port to open/close. |
81 | */ | 82 | */ |
82 | struct GNUNET_HashCode port GNUNET_PACKED; | 83 | struct GNUNET_HashCode port GNUNET_PACKED; |
83 | }; | 84 | }; |
84 | 85 | ||
@@ -96,31 +97,31 @@ typedef uint32_t CADET_ChannelNumber; | |||
96 | */ | 97 | */ |
97 | struct GNUNET_CADET_ChannelCreateMessage | 98 | struct GNUNET_CADET_ChannelCreateMessage |
98 | { | 99 | { |
99 | /** | 100 | /** |
100 | * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_CREATE | 101 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_CREATE |
101 | * | 102 | * |
102 | * Size: sizeof(struct GNUNET_CADET_ChannelCreateMessage) | 103 | * Size: sizeof(struct GNUNET_CADET_ChannelCreateMessage) |
103 | */ | 104 | */ |
104 | struct GNUNET_MessageHeader header; | 105 | struct GNUNET_MessageHeader header; |
105 | 106 | ||
106 | /** | 107 | /** |
107 | * ID of a channel controlled by this client. | 108 | * ID of a channel controlled by this client. |
108 | */ | 109 | */ |
109 | CADET_ChannelNumber channel_id GNUNET_PACKED; | 110 | CADET_ChannelNumber channel_id GNUNET_PACKED; |
110 | 111 | ||
111 | /** | 112 | /** |
112 | * Channel's peer | 113 | * Channel's peer |
113 | */ | 114 | */ |
114 | struct GNUNET_PeerIdentity peer; | 115 | struct GNUNET_PeerIdentity peer; |
115 | 116 | ||
116 | /** | 117 | /** |
117 | * Port of the channel. | 118 | * Port of the channel. |
118 | */ | 119 | */ |
119 | struct GNUNET_HashCode port; | 120 | struct GNUNET_HashCode port; |
120 | 121 | ||
121 | /** | 122 | /** |
122 | * Options. | 123 | * Options. |
123 | */ | 124 | */ |
124 | uint32_t opt GNUNET_PACKED; | 125 | uint32_t opt GNUNET_PACKED; |
125 | }; | 126 | }; |
126 | 127 | ||
@@ -130,16 +131,16 @@ struct GNUNET_CADET_ChannelCreateMessage | |||
130 | */ | 131 | */ |
131 | struct GNUNET_CADET_ChannelDestroyMessage | 132 | struct GNUNET_CADET_ChannelDestroyMessage |
132 | { | 133 | { |
133 | /** | 134 | /** |
134 | * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_DESTROY | 135 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_DESTROY |
135 | * | 136 | * |
136 | * Size: sizeof(struct GNUNET_CADET_ChannelDestroyMessage) | 137 | * Size: sizeof(struct GNUNET_CADET_ChannelDestroyMessage) |
137 | */ | 138 | */ |
138 | struct GNUNET_MessageHeader header; | 139 | struct GNUNET_MessageHeader header; |
139 | 140 | ||
140 | /** | 141 | /** |
141 | * ID of a channel controlled by this client. | 142 | * ID of a channel controlled by this client. |
142 | */ | 143 | */ |
143 | CADET_ChannelNumber channel_id GNUNET_PACKED; | 144 | CADET_ChannelNumber channel_id GNUNET_PACKED; |
144 | }; | 145 | }; |
145 | 146 | ||
@@ -149,19 +150,19 @@ struct GNUNET_CADET_ChannelDestroyMessage | |||
149 | */ | 150 | */ |
150 | struct GNUNET_CADET_LocalData | 151 | struct GNUNET_CADET_LocalData |
151 | { | 152 | { |
152 | /** | 153 | /** |
153 | * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA | 154 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA |
154 | */ | 155 | */ |
155 | struct GNUNET_MessageHeader header; | 156 | struct GNUNET_MessageHeader header; |
156 | 157 | ||
157 | /** | 158 | /** |
158 | * ID of the channel | 159 | * ID of the channel |
159 | */ | 160 | */ |
160 | uint32_t id GNUNET_PACKED; | 161 | uint32_t id GNUNET_PACKED; |
161 | 162 | ||
162 | /** | 163 | /** |
163 | * Payload follows | 164 | * Payload follows |
164 | */ | 165 | */ |
165 | }; | 166 | }; |
166 | 167 | ||
167 | 168 | ||
@@ -171,14 +172,14 @@ struct GNUNET_CADET_LocalData | |||
171 | */ | 172 | */ |
172 | struct GNUNET_CADET_LocalAck | 173 | struct GNUNET_CADET_LocalAck |
173 | { | 174 | { |
174 | /** | 175 | /** |
175 | * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK | 176 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK |
176 | */ | 177 | */ |
177 | struct GNUNET_MessageHeader header; | 178 | struct GNUNET_MessageHeader header; |
178 | 179 | ||
179 | /** | 180 | /** |
180 | * ID of the channel allowed to send more data. | 181 | * ID of the channel allowed to send more data. |
181 | */ | 182 | */ |
182 | CADET_ChannelNumber channel_id GNUNET_PACKED; | 183 | CADET_ChannelNumber channel_id GNUNET_PACKED; |
183 | 184 | ||
184 | }; | 185 | }; |
@@ -190,7 +191,8 @@ struct GNUNET_CADET_LocalAck | |||
190 | struct GNUNET_CADET_LocalInfo | 191 | struct GNUNET_CADET_LocalInfo |
191 | { | 192 | { |
192 | /** | 193 | /** |
193 | * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO[_TUNNEL,_PEER] | 194 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL or |
195 | * #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER | ||
194 | */ | 196 | */ |
195 | struct GNUNET_MessageHeader header; | 197 | struct GNUNET_MessageHeader header; |
196 | 198 | ||
@@ -217,7 +219,8 @@ struct GNUNET_CADET_LocalInfo | |||
217 | struct GNUNET_CADET_LocalInfoPeer | 219 | struct GNUNET_CADET_LocalInfoPeer |
218 | { | 220 | { |
219 | /** | 221 | /** |
220 | * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER[S] | 222 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER or |
223 | * #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS | ||
221 | */ | 224 | */ |
222 | struct GNUNET_MessageHeader header; | 225 | struct GNUNET_MessageHeader header; |
223 | 226 | ||
@@ -246,7 +249,8 @@ struct GNUNET_CADET_LocalInfoPeer | |||
246 | struct GNUNET_CADET_LocalInfoTunnel | 249 | struct GNUNET_CADET_LocalInfoTunnel |
247 | { | 250 | { |
248 | /** | 251 | /** |
249 | * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL[S] | 252 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL |
253 | * or #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS | ||
250 | */ | 254 | */ |
251 | struct GNUNET_MessageHeader header; | 255 | struct GNUNET_MessageHeader header; |
252 | 256 | ||
diff --git a/src/cadet/cadet_protocol.h b/src/cadet/cadet_protocol.h index e40fa0e7b..2df652e34 100644 --- a/src/cadet/cadet_protocol.h +++ b/src/cadet/cadet_protocol.h | |||
@@ -61,6 +61,11 @@ struct GNUNET_CADET_ConnectionCreate | |||
61 | struct GNUNET_MessageHeader header; | 61 | struct GNUNET_MessageHeader header; |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * For alignment. | ||
65 | */ | ||
66 | uint32_t reserved GNUNET_PACKED; | ||
67 | |||
68 | /** | ||
64 | * ID of the connection | 69 | * ID of the connection |
65 | */ | 70 | */ |
66 | struct GNUNET_CADET_Hash cid; | 71 | struct GNUNET_CADET_Hash cid; |
@@ -78,14 +83,19 @@ struct GNUNET_CADET_ConnectionCreate | |||
78 | */ | 83 | */ |
79 | struct GNUNET_CADET_ConnectionACK | 84 | struct GNUNET_CADET_ConnectionACK |
80 | { | 85 | { |
81 | /** | 86 | /** |
82 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK | 87 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK |
83 | */ | 88 | */ |
84 | struct GNUNET_MessageHeader header; | 89 | struct GNUNET_MessageHeader header; |
85 | 90 | ||
86 | /** | 91 | /** |
87 | * ID of the connection. | 92 | * For alignment. |
88 | */ | 93 | */ |
94 | uint32_t reserved GNUNET_PACKED; | ||
95 | |||
96 | /** | ||
97 | * ID of the connection. | ||
98 | */ | ||
89 | struct GNUNET_CADET_Hash cid; | 99 | struct GNUNET_CADET_Hash cid; |
90 | 100 | ||
91 | }; | 101 | }; |
@@ -96,14 +106,19 @@ struct GNUNET_CADET_ConnectionACK | |||
96 | */ | 106 | */ |
97 | struct GNUNET_CADET_KX | 107 | struct GNUNET_CADET_KX |
98 | { | 108 | { |
99 | /** | 109 | /** |
100 | * Type: #GNUNET_MESSAGE_TYPE_CADET_KX. | 110 | * Type: #GNUNET_MESSAGE_TYPE_CADET_KX. |
101 | */ | 111 | */ |
102 | struct GNUNET_MessageHeader header; | 112 | struct GNUNET_MessageHeader header; |
113 | |||
114 | /** | ||
115 | * For alignment. | ||
116 | */ | ||
117 | uint32_t reserved GNUNET_PACKED; | ||
103 | 118 | ||
104 | /** | 119 | /** |
105 | * ID of the connection. | 120 | * ID of the connection. |
106 | */ | 121 | */ |
107 | struct GNUNET_CADET_Hash cid; | 122 | struct GNUNET_CADET_Hash cid; |
108 | 123 | ||
109 | /* Specific KX message follows. */ | 124 | /* Specific KX message follows. */ |
@@ -222,9 +237,9 @@ struct GNUNET_CADET_ChannelCreate | |||
222 | struct GNUNET_MessageHeader header; | 237 | struct GNUNET_MessageHeader header; |
223 | 238 | ||
224 | /** | 239 | /** |
225 | * ID of the channel | 240 | * Channel options. |
226 | */ | 241 | */ |
227 | CADET_ChannelNumber chid GNUNET_PACKED; | 242 | uint32_t opt GNUNET_PACKED; |
228 | 243 | ||
229 | /** | 244 | /** |
230 | * Destination port. | 245 | * Destination port. |
@@ -232,9 +247,9 @@ struct GNUNET_CADET_ChannelCreate | |||
232 | struct GNUNET_HashCode port; | 247 | struct GNUNET_HashCode port; |
233 | 248 | ||
234 | /** | 249 | /** |
235 | * Channel options. | 250 | * ID of the channel |
236 | */ | 251 | */ |
237 | uint32_t opt GNUNET_PACKED; | 252 | CADET_ChannelNumber chid GNUNET_PACKED; |
238 | }; | 253 | }; |
239 | 254 | ||
240 | 255 | ||
@@ -367,6 +382,11 @@ struct GNUNET_CADET_ConnectionBroken | |||
367 | struct GNUNET_MessageHeader header; | 382 | struct GNUNET_MessageHeader header; |
368 | 383 | ||
369 | /** | 384 | /** |
385 | * For alignment. | ||
386 | */ | ||
387 | uint32_t reserved GNUNET_PACKED; | ||
388 | |||
389 | /** | ||
370 | * ID of the connection. | 390 | * ID of the connection. |
371 | */ | 391 | */ |
372 | struct GNUNET_CADET_Hash cid; | 392 | struct GNUNET_CADET_Hash cid; |
@@ -394,6 +414,11 @@ struct GNUNET_CADET_ConnectionDestroy | |||
394 | struct GNUNET_MessageHeader header; | 414 | struct GNUNET_MessageHeader header; |
395 | 415 | ||
396 | /** | 416 | /** |
417 | * For alignment. | ||
418 | */ | ||
419 | uint32_t reserved GNUNET_PACKED; | ||
420 | |||
421 | /** | ||
397 | * ID of the connection. | 422 | * ID of the connection. |
398 | */ | 423 | */ |
399 | struct GNUNET_CADET_Hash cid; | 424 | struct GNUNET_CADET_Hash cid; |
diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c index d1dcfdd2d..0e9b7a3af 100644 --- a/src/cadet/gnunet-service-cadet_channel.c +++ b/src/cadet/gnunet-service-cadet_channel.c | |||
@@ -94,25 +94,25 @@ struct CadetChannelQueue | |||
94 | */ | 94 | */ |
95 | struct CadetReliableMessage | 95 | struct CadetReliableMessage |
96 | { | 96 | { |
97 | /** | 97 | /** |
98 | * Double linked list, FIFO style | 98 | * Double linked list, FIFO style |
99 | */ | 99 | */ |
100 | struct CadetReliableMessage *next; | 100 | struct CadetReliableMessage *next; |
101 | struct CadetReliableMessage *prev; | 101 | struct CadetReliableMessage *prev; |
102 | 102 | ||
103 | /** | 103 | /** |
104 | * Type of message (payload, channel management). | 104 | * Type of message (payload, channel management). |
105 | */ | 105 | */ |
106 | int16_t type; | 106 | int16_t type; |
107 | 107 | ||
108 | /** | 108 | /** |
109 | * Tunnel Reliability queue this message is in. | 109 | * Tunnel Reliability queue this message is in. |
110 | */ | 110 | */ |
111 | struct CadetChannelReliability *rel; | 111 | struct CadetChannelReliability *rel; |
112 | 112 | ||
113 | /** | 113 | /** |
114 | * ID of the message (ACK needed to free) | 114 | * ID of the message (ACK needed to free) |
115 | */ | 115 | */ |
116 | uint32_t mid; | 116 | uint32_t mid; |
117 | 117 | ||
118 | /** | 118 | /** |
@@ -120,9 +120,9 @@ struct CadetReliableMessage | |||
120 | */ | 120 | */ |
121 | struct CadetChannelQueue *chq; | 121 | struct CadetChannelQueue *chq; |
122 | 122 | ||
123 | /** | 123 | /** |
124 | * When was this message issued (to calculate ACK delay) | 124 | * When was this message issued (to calculate ACK delay) |
125 | */ | 125 | */ |
126 | struct GNUNET_TIME_Absolute timestamp; | 126 | struct GNUNET_TIME_Absolute timestamp; |
127 | 127 | ||
128 | /* struct GNUNET_CADET_Data with payload */ | 128 | /* struct GNUNET_CADET_Data with payload */ |
@@ -134,46 +134,46 @@ struct CadetReliableMessage | |||
134 | */ | 134 | */ |
135 | struct CadetChannelReliability | 135 | struct CadetChannelReliability |
136 | { | 136 | { |
137 | /** | 137 | /** |
138 | * Channel this is about. | 138 | * Channel this is about. |
139 | */ | 139 | */ |
140 | struct CadetChannel *ch; | 140 | struct CadetChannel *ch; |
141 | 141 | ||
142 | /** | 142 | /** |
143 | * DLL of messages sent and not yet ACK'd. | 143 | * DLL of messages sent and not yet ACK'd. |
144 | */ | 144 | */ |
145 | struct CadetReliableMessage *head_sent; | 145 | struct CadetReliableMessage *head_sent; |
146 | struct CadetReliableMessage *tail_sent; | 146 | struct CadetReliableMessage *tail_sent; |
147 | 147 | ||
148 | /** | 148 | /** |
149 | * DLL of messages received out of order. | 149 | * DLL of messages received out of order. |
150 | */ | 150 | */ |
151 | struct CadetReliableMessage *head_recv; | 151 | struct CadetReliableMessage *head_recv; |
152 | struct CadetReliableMessage *tail_recv; | 152 | struct CadetReliableMessage *tail_recv; |
153 | 153 | ||
154 | /** | 154 | /** |
155 | * Messages received. | 155 | * Messages received. |
156 | */ | 156 | */ |
157 | unsigned int n_recv; | 157 | unsigned int n_recv; |
158 | 158 | ||
159 | /** | 159 | /** |
160 | * Next MID to use for outgoing traffic. | 160 | * Next MID to use for outgoing traffic. |
161 | */ | 161 | */ |
162 | uint32_t mid_send; | 162 | uint32_t mid_send; |
163 | 163 | ||
164 | /** | 164 | /** |
165 | * Next MID expected for incoming traffic. | 165 | * Next MID expected for incoming traffic. |
166 | */ | 166 | */ |
167 | uint32_t mid_recv; | 167 | uint32_t mid_recv; |
168 | 168 | ||
169 | /** | 169 | /** |
170 | * Handle for queued unique data CREATE, DATA_ACK. | 170 | * Handle for queued unique data CREATE, DATA_ACK. |
171 | */ | 171 | */ |
172 | struct CadetChannelQueue *uniq; | 172 | struct CadetChannelQueue *uniq; |
173 | 173 | ||
174 | /** | 174 | /** |
175 | * Can we send data to the client? | 175 | * Can we send data to the client? |
176 | */ | 176 | */ |
177 | int client_ready; | 177 | int client_ready; |
178 | 178 | ||
179 | /** | 179 | /** |
@@ -181,19 +181,19 @@ struct CadetChannelReliability | |||
181 | */ | 181 | */ |
182 | int client_allowed; | 182 | int client_allowed; |
183 | 183 | ||
184 | /** | 184 | /** |
185 | * Task to resend/poll in case no ACK is received. | 185 | * Task to resend/poll in case no ACK is received. |
186 | */ | 186 | */ |
187 | struct GNUNET_SCHEDULER_Task * retry_task; | 187 | struct GNUNET_SCHEDULER_Task * retry_task; |
188 | 188 | ||
189 | /** | 189 | /** |
190 | * Counter for exponential backoff. | 190 | * Counter for exponential backoff. |
191 | */ | 191 | */ |
192 | struct GNUNET_TIME_Relative retry_timer; | 192 | struct GNUNET_TIME_Relative retry_timer; |
193 | 193 | ||
194 | /** | 194 | /** |
195 | * How long does it usually take to get an ACK. | 195 | * How long does it usually take to get an ACK. |
196 | */ | 196 | */ |
197 | struct GNUNET_TIME_Relative expected_delay; | 197 | struct GNUNET_TIME_Relative expected_delay; |
198 | }; | 198 | }; |
199 | 199 | ||
@@ -203,85 +203,85 @@ struct CadetChannelReliability | |||
203 | */ | 203 | */ |
204 | struct CadetChannel | 204 | struct CadetChannel |
205 | { | 205 | { |
206 | /** | 206 | /** |
207 | * Tunnel this channel is in. | 207 | * Tunnel this channel is in. |
208 | */ | 208 | */ |
209 | struct CadetTunnel *t; | 209 | struct CadetTunnel *t; |
210 | 210 | ||
211 | /** | 211 | /** |
212 | * Destination port of the channel. | 212 | * Destination port of the channel. |
213 | */ | 213 | */ |
214 | struct GNUNET_HashCode port; | 214 | struct GNUNET_HashCode port; |
215 | 215 | ||
216 | /** | 216 | /** |
217 | * Global channel number ( < GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) | 217 | * Global channel number ( < GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) |
218 | */ | 218 | */ |
219 | CADET_ChannelNumber gid; | 219 | CADET_ChannelNumber gid; |
220 | 220 | ||
221 | /** | 221 | /** |
222 | * Local tunnel number for root (owner) client. | 222 | * Local tunnel number for root (owner) client. |
223 | * ( >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI or 0 ) | 223 | * ( >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI or 0 ) |
224 | */ | 224 | */ |
225 | CADET_ChannelNumber lid_root; | 225 | CADET_ChannelNumber lid_root; |
226 | 226 | ||
227 | /** | 227 | /** |
228 | * Local tunnel number for local destination clients (incoming number) | 228 | * Local tunnel number for local destination clients (incoming number) |
229 | * ( >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV or 0). | 229 | * ( >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV or 0). |
230 | */ | 230 | */ |
231 | CADET_ChannelNumber lid_dest; | 231 | CADET_ChannelNumber lid_dest; |
232 | 232 | ||
233 | /** | 233 | /** |
234 | * Channel state. | 234 | * Channel state. |
235 | */ | 235 | */ |
236 | enum CadetChannelState state; | 236 | enum CadetChannelState state; |
237 | 237 | ||
238 | /** | 238 | /** |
239 | * Is the tunnel bufferless (minimum latency)? | 239 | * Is the tunnel bufferless (minimum latency)? |
240 | */ | 240 | */ |
241 | int nobuffer; | 241 | int nobuffer; |
242 | 242 | ||
243 | /** | 243 | /** |
244 | * Is the tunnel reliable? | 244 | * Is the tunnel reliable? |
245 | */ | 245 | */ |
246 | int reliable; | 246 | int reliable; |
247 | 247 | ||
248 | /** | 248 | /** |
249 | * Last time the channel was used | 249 | * Last time the channel was used |
250 | */ | 250 | */ |
251 | struct GNUNET_TIME_Absolute timestamp; | 251 | struct GNUNET_TIME_Absolute timestamp; |
252 | 252 | ||
253 | /** | 253 | /** |
254 | * Client owner of the tunnel, if any | 254 | * Client owner of the tunnel, if any |
255 | */ | 255 | */ |
256 | struct CadetClient *root; | 256 | struct CadetClient *root; |
257 | 257 | ||
258 | /** | 258 | /** |
259 | * Client destination of the tunnel, if any. | 259 | * Client destination of the tunnel, if any. |
260 | */ | 260 | */ |
261 | struct CadetClient *dest; | 261 | struct CadetClient *dest; |
262 | 262 | ||
263 | /** | 263 | /** |
264 | * Flag to signal the destruction of the channel. | 264 | * Flag to signal the destruction of the channel. |
265 | * If this is set GNUNET_YES the channel will be destroyed | 265 | * If this is set to #GNUNET_YES the channel will be destroyed |
266 | * when the queue is empty. | 266 | * when the queue is empty. |
267 | */ | 267 | */ |
268 | int destroy; | 268 | int destroy; |
269 | 269 | ||
270 | /** | 270 | /** |
271 | * Total (reliable) messages pending ACK for this channel. | 271 | * Total (reliable) messages pending ACK for this channel. |
272 | */ | 272 | */ |
273 | unsigned int pending_messages; | 273 | unsigned int pending_messages; |
274 | 274 | ||
275 | /** | 275 | /** |
276 | * Reliability data. | 276 | * Reliability data. |
277 | * Only present (non-NULL) at the owner of a tunnel. | 277 | * Only present (non-NULL) at the owner of a tunnel. |
278 | */ | 278 | */ |
279 | struct CadetChannelReliability *root_rel; | 279 | struct CadetChannelReliability *root_rel; |
280 | 280 | ||
281 | /** | 281 | /** |
282 | * Reliability data. | 282 | * Reliability data. |
283 | * Only present (non-NULL) at the destination of a tunnel. | 283 | * Only present (non-NULL) at the destination of a tunnel. |
284 | */ | 284 | */ |
285 | struct CadetChannelReliability *dest_rel; | 285 | struct CadetChannelReliability *dest_rel; |
286 | 286 | ||
287 | }; | 287 | }; |
diff --git a/src/cadet/gnunet-service-cadet_channel.h b/src/cadet/gnunet-service-cadet_channel.h index cc1eb4d8a..eeea02712 100644 --- a/src/cadet/gnunet-service-cadet_channel.h +++ b/src/cadet/gnunet-service-cadet_channel.h | |||
@@ -211,6 +211,7 @@ GCCH_handle_local_destroy (struct CadetChannel *ch, | |||
211 | struct CadetClient *c, | 211 | struct CadetClient *c, |
212 | int is_root); | 212 | int is_root); |
213 | 213 | ||
214 | |||
214 | /** | 215 | /** |
215 | * Handle a channel create requested by a client. | 216 | * Handle a channel create requested by a client. |
216 | * | 217 | * |
@@ -219,7 +220,7 @@ GCCH_handle_local_destroy (struct CadetChannel *ch, | |||
219 | * @param c Client that requested the creation (will be the root). | 220 | * @param c Client that requested the creation (will be the root). |
220 | * @param msg Create Channel message. | 221 | * @param msg Create Channel message. |
221 | * | 222 | * |
222 | * @return GNUNET_OK if everything went fine, GNUNET_SYSERR otherwise. | 223 | * @return #GNUNET_OK if everything went fine, #GNUNET_SYSERR otherwise. |
223 | */ | 224 | */ |
224 | int | 225 | int |
225 | GCCH_handle_local_create (struct CadetClient *c, | 226 | GCCH_handle_local_create (struct CadetClient *c, |
@@ -240,6 +241,7 @@ GCCH_handle_data (struct CadetChannel *ch, | |||
240 | const struct GNUNET_CADET_Data *msg, | 241 | const struct GNUNET_CADET_Data *msg, |
241 | int fwd); | 242 | int fwd); |
242 | 243 | ||
244 | |||
243 | /** | 245 | /** |
244 | * Handler for cadet network traffic end-to-end ACKs. | 246 | * Handler for cadet network traffic end-to-end ACKs. |
245 | * | 247 | * |
@@ -255,6 +257,7 @@ GCCH_handle_data_ack (struct CadetChannel *ch, | |||
255 | const struct GNUNET_CADET_DataACK *msg, | 257 | const struct GNUNET_CADET_DataACK *msg, |
256 | int fwd); | 258 | int fwd); |
257 | 259 | ||
260 | |||
258 | /** | 261 | /** |
259 | * Handler for channel create messages. | 262 | * Handler for channel create messages. |
260 | * | 263 | * |
@@ -267,6 +270,7 @@ struct CadetChannel * | |||
267 | GCCH_handle_create (struct CadetTunnel *t, | 270 | GCCH_handle_create (struct CadetTunnel *t, |
268 | const struct GNUNET_CADET_ChannelCreate *msg); | 271 | const struct GNUNET_CADET_ChannelCreate *msg); |
269 | 272 | ||
273 | |||
270 | /** | 274 | /** |
271 | * Handler for channel NACK messages. | 275 | * Handler for channel NACK messages. |
272 | * | 276 | * |
@@ -277,6 +281,7 @@ GCCH_handle_create (struct CadetTunnel *t, | |||
277 | void | 281 | void |
278 | GCCH_handle_nack (struct CadetChannel *ch); | 282 | GCCH_handle_nack (struct CadetChannel *ch); |
279 | 283 | ||
284 | |||
280 | /** | 285 | /** |
281 | * Handler for channel ack messages. | 286 | * Handler for channel ack messages. |
282 | * | 287 | * |
@@ -292,6 +297,7 @@ GCCH_handle_ack (struct CadetChannel *ch, | |||
292 | const struct GNUNET_CADET_ChannelManage *msg, | 297 | const struct GNUNET_CADET_ChannelManage *msg, |
293 | int fwd); | 298 | int fwd); |
294 | 299 | ||
300 | |||
295 | /** | 301 | /** |
296 | * Handler for channel destroy messages. | 302 | * Handler for channel destroy messages. |
297 | * | 303 | * |
@@ -307,6 +313,7 @@ GCCH_handle_destroy (struct CadetChannel *ch, | |||
307 | const struct GNUNET_CADET_ChannelManage *msg, | 313 | const struct GNUNET_CADET_ChannelManage *msg, |
308 | int fwd); | 314 | int fwd); |
309 | 315 | ||
316 | |||
310 | /** | 317 | /** |
311 | * Sends an already built message on a channel. | 318 | * Sends an already built message on a channel. |
312 | * | 319 | * |
@@ -328,6 +335,7 @@ GCCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
328 | struct CadetChannel *ch, int fwd, | 335 | struct CadetChannel *ch, int fwd, |
329 | void *existing_copy); | 336 | void *existing_copy); |
330 | 337 | ||
338 | |||
331 | /** | 339 | /** |
332 | * Get the static string for identification of the channel. | 340 | * Get the static string for identification of the channel. |
333 | * | 341 | * |
diff --git a/src/cadet/gnunet-service-cadet_connection.h b/src/cadet/gnunet-service-cadet_connection.h index 261dd1067..e96e2f24c 100644 --- a/src/cadet/gnunet-service-cadet_connection.h +++ b/src/cadet/gnunet-service-cadet_connection.h | |||
@@ -96,7 +96,7 @@ struct CadetConnectionQueue; | |||
96 | * Check invariants for all connections using #check_neighbours(). | 96 | * Check invariants for all connections using #check_neighbours(). |
97 | */ | 97 | */ |
98 | void | 98 | void |
99 | GCC_check_connections (); | 99 | GCC_check_connections (void); |
100 | 100 | ||
101 | 101 | ||
102 | /** | 102 | /** |
diff --git a/src/cadet/gnunet-service-cadet_local.c b/src/cadet/gnunet-service-cadet_local.c index 4213ad278..303eaee86 100644 --- a/src/cadet/gnunet-service-cadet_local.c +++ b/src/cadet/gnunet-service-cadet_local.c | |||
@@ -47,51 +47,51 @@ | |||
47 | */ | 47 | */ |
48 | struct CadetClient | 48 | struct CadetClient |
49 | { | 49 | { |
50 | /** | 50 | /** |
51 | * Linked list next | 51 | * Linked list next |
52 | */ | 52 | */ |
53 | struct CadetClient *next; | 53 | struct CadetClient *next; |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * Linked list prev | 56 | * Linked list prev |
57 | */ | 57 | */ |
58 | struct CadetClient *prev; | 58 | struct CadetClient *prev; |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * Tunnels that belong to this client, indexed by local id | 61 | * Tunnels that belong to this client, indexed by local id |
62 | */ | 62 | */ |
63 | struct GNUNET_CONTAINER_MultiHashMap32 *own_channels; | 63 | struct GNUNET_CONTAINER_MultiHashMap32 *own_channels; |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * Tunnels this client has accepted, indexed by incoming local id | 66 | * Tunnels this client has accepted, indexed by incoming local id |
67 | */ | 67 | */ |
68 | struct GNUNET_CONTAINER_MultiHashMap32 *incoming_channels; | 68 | struct GNUNET_CONTAINER_MultiHashMap32 *incoming_channels; |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * Channel ID for the next incoming channel. | 71 | * Channel ID for the next incoming channel. |
72 | */ | 72 | */ |
73 | CADET_ChannelNumber next_chid; | 73 | CADET_ChannelNumber next_chid; |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * Handle to communicate with the client | 76 | * Handle to communicate with the client |
77 | */ | 77 | */ |
78 | struct GNUNET_SERVER_Client *handle; | 78 | struct GNUNET_SERVER_Client *handle; |
79 | 79 | ||
80 | /** | 80 | /** |
81 | * Ports that this client has declared interest in. | 81 | * Ports that this client has declared interest in. |
82 | * Indexed by port, contains *Client. | 82 | * Indexed by port, contains *Client. |
83 | */ | 83 | */ |
84 | struct GNUNET_CONTAINER_MultiHashMap *ports; | 84 | struct GNUNET_CONTAINER_MultiHashMap *ports; |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * Whether the client is active or shutting down (don't send confirmations | 87 | * Whether the client is active or shutting down (don't send confirmations |
88 | * to a client that is shutting down. | 88 | * to a client that is shutting down. |
89 | */ | 89 | */ |
90 | int shutting_down; | 90 | int shutting_down; |
91 | 91 | ||
92 | /** | 92 | /** |
93 | * ID of the client, mainly for debug messages | 93 | * ID of the client, mainly for debug messages |
94 | */ | 94 | */ |
95 | unsigned int id; | 95 | unsigned int id; |
96 | }; | 96 | }; |
97 | 97 | ||
@@ -146,7 +146,7 @@ static struct GNUNET_SERVER_NotificationContext *nc; | |||
146 | * @param key Port. | 146 | * @param key Port. |
147 | * @param value Client structure. | 147 | * @param value Client structure. |
148 | * | 148 | * |
149 | * @return GNUNET_OK, keep iterating. | 149 | * @return #GNUNET_OK, keep iterating. |
150 | */ | 150 | */ |
151 | static int | 151 | static int |
152 | client_release_ports (void *cls, | 152 | client_release_ports (void *cls, |
@@ -174,7 +174,7 @@ client_release_ports (void *cls, | |||
174 | * @param key The local channel id (used to access the hashmap). | 174 | * @param key The local channel id (used to access the hashmap). |
175 | * @param value The value stored at the key (channel to destroy). | 175 | * @param value The value stored at the key (channel to destroy). |
176 | * | 176 | * |
177 | * @return GNUNET_OK, keep iterating. | 177 | * @return #GNUNET_OK, keep iterating. |
178 | */ | 178 | */ |
179 | static int | 179 | static int |
180 | channel_destroy_iterator (void *cls, | 180 | channel_destroy_iterator (void *cls, |
@@ -230,6 +230,7 @@ client_destroy (struct CadetClient *c) | |||
230 | GNUNET_free (c); | 230 | GNUNET_free (c); |
231 | } | 231 | } |
232 | 232 | ||
233 | |||
233 | /** | 234 | /** |
234 | * Create a client record, register data and initialize memory. | 235 | * Create a client record, register data and initialize memory. |
235 | * | 236 | * |
diff --git a/src/cadet/gnunet-service-cadet_tunnel.h b/src/cadet/gnunet-service-cadet_tunnel.h index e836e4b24..ca553a7d3 100644 --- a/src/cadet/gnunet-service-cadet_tunnel.h +++ b/src/cadet/gnunet-service-cadet_tunnel.h | |||
@@ -47,24 +47,24 @@ extern "C" | |||
47 | */ | 47 | */ |
48 | enum CadetTunnelCState | 48 | enum CadetTunnelCState |
49 | { | 49 | { |
50 | /** | 50 | /** |
51 | * Uninitialized status, should never appear in operation. | 51 | * Uninitialized status, should never appear in operation. |
52 | */ | 52 | */ |
53 | CADET_TUNNEL_NEW, | 53 | CADET_TUNNEL_NEW, |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * No path to the peer known yet. | 56 | * No path to the peer known yet. |
57 | */ | 57 | */ |
58 | CADET_TUNNEL_SEARCHING, | 58 | CADET_TUNNEL_SEARCHING, |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * Request sent, not yet answered. | 61 | * Request sent, not yet answered. |
62 | */ | 62 | */ |
63 | CADET_TUNNEL_WAITING, | 63 | CADET_TUNNEL_WAITING, |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * Peer connected and ready to accept data. | 66 | * Peer connected and ready to accept data. |
67 | */ | 67 | */ |
68 | CADET_TUNNEL_READY, | 68 | CADET_TUNNEL_READY, |
69 | 69 | ||
70 | /** | 70 | /** |
@@ -142,13 +142,18 @@ struct CadetTunnelQueue; | |||
142 | * @param type Type of message sent. | 142 | * @param type Type of message sent. |
143 | * @param size Size of the message. | 143 | * @param size Size of the message. |
144 | */ | 144 | */ |
145 | typedef void (*GCT_sent) (void *cls, | 145 | typedef void |
146 | struct CadetTunnel *t, | 146 | (*GCT_sent) (void *cls, |
147 | struct CadetTunnelQueue *q, | 147 | struct CadetTunnel *t, |
148 | uint16_t type, size_t size); | 148 | struct CadetTunnelQueue *q, |
149 | uint16_t type, size_t size); | ||
150 | |||
151 | typedef void | ||
152 | (*GCT_conn_iter) (void *cls, struct CadetConnection *c); | ||
153 | |||
149 | 154 | ||
150 | typedef void (*GCT_conn_iter) (void *cls, struct CadetConnection *c); | 155 | typedef void |
151 | typedef void (*GCT_chan_iter) (void *cls, struct CadetChannel *ch); | 156 | (*GCT_chan_iter) (void *cls, struct CadetChannel *ch); |
152 | 157 | ||
153 | 158 | ||
154 | /******************************************************************************/ | 159 | /******************************************************************************/ |