2 This file is part of GNUnet.
3 (C) 2012 Christian Grothoff (and other contributing authors)
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.
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.
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.
22 * @file mesh/mesh_common.c
23 * @brief MESH helper functions
24 * @author Bartlomiej Polot
30 * @brief Translate a fwd variable into a string representation, for logging.
32 * @param fwd Is FWD? (#GNUNET_YES or #GNUNET_NO)
34 * @return String representing FWD or BCK.
39 if (GNUNET_YES == fwd)
43 else if (GNUNET_NO == fwd)
55 GM_is_pid_bigger (uint32_t bigger, uint32_t smaller)
57 return (GNUNET_YES == PID_OVERFLOW (smaller, bigger) ||
58 (bigger > smaller && GNUNET_NO == PID_OVERFLOW (bigger, smaller)));
63 GM_max_pid (uint32_t a, uint32_t b)
65 if (GM_is_pid_bigger(a, b))
72 GM_min_pid (uint32_t a, uint32_t b)
74 if (GM_is_pid_bigger(a, b))
80 #if !defined(GNUNET_CULL_LOGGING)
88 * Request the creation of a path
90 case 256: return "CONNECTION_CREATE";
93 * Request the modification of an existing path
95 case 257: return "CONNECTION_ACK";
98 * Notify that a connection of a path is no longer valid
100 case 258: return "CONNECTION_BROKEN";
103 * At some point, the route will spontaneously change
105 case 259: return "PATH_CHANGED";
108 * Transport payload data.
110 case 260: return "DATA";
113 * Confirm receipt of payload data.
115 case 261: return "DATA_ACK";
118 * Key exchange encapsulation.
120 case 262: return "KX";
125 case 263: return "KX_EPHEMERAL";
128 * Challenge to test peer's session key.
130 case 264: return "KX_PING";
133 * Answer to session key challenge.
135 case 265: return "KX_PONG";
138 * Request the destuction of a path
140 case 266: return "CONNECTION_DESTROY";
143 * ACK for a data packet.
145 case 268: return "ACK";
150 case 269: return "POLL";
153 * Announce origin is still alive.
155 case 270: return "KEEPALIVE";
158 * Connect to the mesh service, specifying subscriptions
160 case 272: return "LOCAL_CONNECT";
163 * Ask the mesh service to create a new tunnel
165 case 273: return "CHANNEL_CREATE";
168 * Ask the mesh service to destroy a tunnel
170 case 274: return "CHANNEL_DESTROY";
173 * Confirm the creation of a channel.
175 case 275: return "CHANNEL_ACK";
178 * Confirm the creation of a channel.
180 case 276: return "CHANNEL_NACK";
185 case 280: return "ENCRYPTED";
188 * Local payload traffic
190 case 285: return "LOCAL_DATA";
193 * Local ACK for data.
195 case 286: return "LOCAL_ACK";
198 * Local monitoring of service.
200 case 287: return "LOCAL_NACK";
203 * Local monitoring of service.
205 case 292: return "LOCAL_INFO_TUNNELS";
208 * Local monitoring of service.
210 case 293: return "LOCAL_INFO_TUNNEL";
213 * Local information about all connections of service.
215 case 294: return "LOCAL_INFO_CONNECTIONS";
218 * Local information of service about a specific connection.
220 case 295: return "LOCAL_INFO_CONNECTION";
223 * Local information about all peers known to the service.
225 case 296: return "LOCAL_INFO_PEERS";
228 * Local information of service about a specific peer.
230 case 297: return "LOCAL_INFO_PEER";
233 * Traffic (net-cat style) used by the Command Line Interface.
235 case 298: return "CLI";
238 * 640kb should be enough for everybody
240 case 299: return "RESERVE_END";
242 sprintf(buf, "%u (UNKNOWN TYPE)", m);