aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2014-02-19 20:02:18 +0000
committerBart Polot <bart@net.in.tum.de>2014-02-19 20:02:18 +0000
commit277ac0f165cbe254559e9513549c3f317db16ee4 (patch)
tree5898c1e5e42eeec77a115f0cbed76543d759d550 /src
parente08eed589810b54828db183b6cfb329b6562fab6 (diff)
downloadgnunet-277ac0f165cbe254559e9513549c3f317db16ee4.tar.gz
gnunet-277ac0f165cbe254559e9513549c3f317db16ee4.zip
- use fixed-width message type names
Diffstat (limited to 'src')
-rw-r--r--src/mesh/mesh_common.c136
1 files changed, 102 insertions, 34 deletions
diff --git a/src/mesh/mesh_common.c b/src/mesh/mesh_common.c
index 3f9258132..e65eb8a4d 100644
--- a/src/mesh/mesh_common.c
+++ b/src/mesh/mesh_common.c
@@ -82,164 +82,232 @@ const char *
82GM_m2s (uint16_t m) 82GM_m2s (uint16_t m)
83{ 83{
84 static char buf[32]; 84 static char buf[32];
85 const char *t;
86
85 switch (m) 87 switch (m)
86 { 88 {
87 /** 89 /**
88 * Request the creation of a path 90 * Request the creation of a path
89 */ 91 */
90 case 256: return "CONNECTION_CREATE"; 92 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE:
93 t = "CONNECTION_CREATE";
94 break;
91 95
92 /** 96 /**
93 * Request the modification of an existing path 97 * Request the modification of an existing path
94 */ 98 */
95 case 257: return "CONNECTION_ACK"; 99 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK:
100 t = "CONNECTION_ACK";
101 break;
96 102
97 /** 103 /**
98 * Notify that a connection of a path is no longer valid 104 * Notify that a connection of a path is no longer valid
99 */ 105 */
100 case 258: return "CONNECTION_BROKEN"; 106 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN:
107 t = "CONNECTION_BROKEN";
108 break;
101 109
102 /** 110 /**
103 * At some point, the route will spontaneously change 111 * At some point, the route will spontaneously change
104 */ 112 */
105 case 259: return "PATH_CHANGED"; 113 case GNUNET_MESSAGE_TYPE_MESH_PATH_CHANGED:
114 t = "PATH_CHANGED";
115 break;
106 116
107 /** 117 /**
108 * Transport payload data. 118 * Transport payload data.
109 */ 119 */
110 case 260: return "DATA"; 120 case GNUNET_MESSAGE_TYPE_MESH_DATA:
121 t = "DATA";
122 break;
111 123
112 /** 124 /**
113 * Confirm receipt of payload data. 125 * Confirm receipt of payload data.
114 */ 126 */
115 case 261: return "DATA_ACK"; 127 case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK:
128 t = "DATA_ACK";
129 break;
116 130
117 /** 131 /**
118 * Key exchange encapsulation. 132 * Key exchange encapsulation.
119 */ 133 */
120 case 262: return "KX"; 134 case GNUNET_MESSAGE_TYPE_MESH_KX:
135 t = "KX";
136 break;
121 137
122 /** 138 /**
123 * New ephemeral key. 139 * New ephemeral key.
124 */ 140 */
125 case 263: return "KX_EPHEMERAL"; 141 case GNUNET_MESSAGE_TYPE_MESH_KX_EPHEMERAL:
142 t = "KX_EPHEMERAL";
143 break;
126 144
127 /** 145 /**
128 * Challenge to test peer's session key. 146 * Challenge to test peer's session key.
129 */ 147 */
130 case 264: return "KX_PING"; 148 case GNUNET_MESSAGE_TYPE_MESH_KX_PING:
149 t = "KX_PING";
150 break;
131 151
132 /** 152 /**
133 * Answer to session key challenge. 153 * Answer to session key challenge.
134 */ 154 */
135 case 265: return "KX_PONG"; 155 case GNUNET_MESSAGE_TYPE_MESH_KX_PONG:
156 t = "KX_PONG";
157 break;
136 158
137 /** 159 /**
138 * Request the destuction of a path 160 * Request the destuction of a path
139 */ 161 */
140 case 266: return "CONNECTION_DESTROY"; 162 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY:
163 t = "CONNECTION_DESTROY";
164 break;
141 165
142 /** 166 /**
143 * ACK for a data packet. 167 * ACK for a data packet.
144 */ 168 */
145 case 268: return "ACK"; 169 case GNUNET_MESSAGE_TYPE_MESH_ACK:
170 t = "ACK";
171 break;
146 172
147 /** 173 /**
148 * POLL for ACK. 174 * POLL for ACK.
149 */ 175 */
150 case 269: return "POLL"; 176 case GNUNET_MESSAGE_TYPE_MESH_POLL:
177 t = "POLL";
178 break;
151 179
152 /** 180 /**
153 * Announce origin is still alive. 181 * Announce origin is still alive.
154 */ 182 */
155 case 270: return "KEEPALIVE"; 183 case GNUNET_MESSAGE_TYPE_MESH_KEEPALIVE:
184 t = "KEEPALIVE";
185 break;
156 186
157 /** 187 /**
158 * Connect to the mesh service, specifying subscriptions 188 * Connect to the mesh service, specifying subscriptions
159 */ 189 */
160 case 272: return "LOCAL_CONNECT"; 190 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT:
191 t = "LOCAL_CONNECT";
192 break;
161 193
162 /** 194 /**
163 * Ask the mesh service to create a new tunnel 195 * Ask the mesh service to create a new tunnel
164 */ 196 */
165 case 273: return "CHANNEL_CREATE"; 197 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE:
198 t = "CHANNEL_CREATE";
199 break;
166 200
167 /** 201 /**
168 * Ask the mesh service to destroy a tunnel 202 * Ask the mesh service to destroy a tunnel
169 */ 203 */
170 case 274: return "CHANNEL_DESTROY"; 204 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY:
205 t = "CHANNEL_DESTROY";
206 break;
171 207
172 /** 208 /**
173 * Confirm the creation of a channel. 209 * Confirm the creation of a channel.
174 */ 210 */
175 case 275: return "CHANNEL_ACK"; 211 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK:
212 t = "CHANNEL_ACK";
213 break;
176 214
177 /** 215 /**
178 * Confirm the creation of a channel. 216 * Confirm the creation of a channel.
179 */ 217 */
180 case 276: return "CHANNEL_NACK"; 218 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK:
219 t = "CHANNEL_NACK";
220 break;
181 221
182 /** 222 /**
183 * Encrypted payload. 223 * Encrypted payload.
184 */ 224 */
185 case 280: return "ENCRYPTED"; 225 case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED:
226 t = "ENCRYPTED";
227 break;
186 228
187 /** 229 /**
188 * Local payload traffic 230 * Local payload traffic
189 */ 231 */
190 case 285: return "LOCAL_DATA"; 232 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA:
233 t = "LOCAL_DATA";
234 break;
191 235
192 /** 236 /**
193 * Local ACK for data. 237 * Local ACK for data.
194 */ 238 */
195 case 286: return "LOCAL_ACK"; 239 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK:
240 t = "LOCAL_ACK";
241 break;
196 242
197 /** 243 /**
198 * Local monitoring of service. 244 * Local monitoring of service.
199 */ 245 */
200 case 287: return "LOCAL_NACK"; 246 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_NACK:
247 t = "LOCAL_NACK";
248 break;
201 249
202 /** 250 /**
203 * Local monitoring of service. 251 * Local monitoring of service.
204 */ 252 */
205 case 292: return "LOCAL_INFO_TUNNELS"; 253 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS:
254 t = "LOCAL_INFO_TUNNELS";
255 break;
206 256
207 /** 257 /**
208 * Local monitoring of service. 258 * Local monitoring of service.
209 */ 259 */
210 case 293: return "LOCAL_INFO_TUNNEL"; 260 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNEL:
261 t = "LOCAL_INFO_TUNNEL";
262 break;
211 263
212 /** 264 /**
213 * Local information about all connections of service. 265 * Local information about all connections of service.
214 */ 266 */
215 case 294: return "LOCAL_INFO_CONNECTIONS"; 267 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CONNECTIONS:
268 t = "LOCAL_INFO_CONNECTIONS";
269 break;
216 270
217 /** 271 /**
218 * Local information of service about a specific connection. 272 * Local information of service about a specific connection.
219 */ 273 */
220 case 295: return "LOCAL_INFO_CONNECTION"; 274 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CONNECTION:
275 t = "LOCAL_INFO_CONNECTION";
276 break;
221 277
222 /** 278 /**
223 * Local information about all peers known to the service. 279 * Local information about all peers known to the service.
224 */ 280 */
225 case 296: return "LOCAL_INFO_PEERS"; 281 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEERS:
282 t = "LOCAL_INFO_PEERS";
283 break;
226 284
227 /** 285 /**
228 * Local information of service about a specific peer. 286 * Local information of service about a specific peer.
229 */ 287 */
230 case 297: return "LOCAL_INFO_PEER"; 288 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEER:
289 t = "LOCAL_INFO_PEER";
290 break;
231 291
232 /** 292 /**
233 * Traffic (net-cat style) used by the Command Line Interface. 293 * Traffic (net-cat style) used by the Command Line Interface.
234 */ 294 */
235 case 298: return "CLI"; 295 case GNUNET_MESSAGE_TYPE_MESH_CLI:
296 t = "CLI";
297 break;
236 298
237 /** 299 /**
238 * 640kb should be enough for everybody 300 * 640kb should be enough for everybody
239 */ 301 */
240 case 299: return "RESERVE_END"; 302 case 299:
241 } 303 t = "RESERVE_END";
242 sprintf(buf, "%u (UNKNOWN TYPE)", m); 304 break;
305
306 default:
307 sprintf(buf, "%u (UNKNOWN TYPE)", m);
308 return buf;
309 }
310 sprintf(buf, "%31s", t);
243 return buf; 311 return buf;
244} 312}
245#else 313#else