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
31 GMC_is_pid_bigger (uint32_t bigger, uint32_t smaller)
33 return (GNUNET_YES == PID_OVERFLOW (smaller, bigger) ||
34 (bigger > smaller && GNUNET_NO == PID_OVERFLOW (bigger, smaller)));
39 GMC_max_pid (uint32_t a, uint32_t b)
41 if (GMC_is_pid_bigger(a, b))
48 GMC_min_pid (uint32_t a, uint32_t b)
50 if (GMC_is_pid_bigger(a, b))
56 #if !defined(GNUNET_CULL_LOGGING)
58 GNUNET_MESH_DEBUG_M2S (uint16_t m)
64 * Request the creation of a path
66 case 256: return "GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE";
69 * Request the modification of an existing path
71 case 257: return "GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK";
74 * Notify that a connection of a path is no longer valid
76 case 258: return "GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN";
79 * At some point, the route will spontaneously change
81 case 259: return "GNUNET_MESSAGE_TYPE_MESH_PATH_CHANGED";
84 * Transport data in the mesh (origin->end) unicast
86 case 260: return "GNUNET_MESSAGE_TYPE_MESH_UNICAST";
89 * Transport data back in the mesh (end->origin)
91 case 262: return "GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN";
94 * Send origin an ACK that UNICAST arrived
96 case 263: return "GNUNET_MESSAGE_TYPE_MESH_UNICAST_ACK";
99 * Send origin an ACK that TO_ORIGIN arrived
101 case 264: return "GNUNET_MESSAGE_TYPE_MESH_TO_ORIG_ACK";
104 * Request the destuction of a path
106 case 266: return "GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY";
109 * Request the destruction of a whole tunnel
111 case 267: return "GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY";
114 * ACK for a data packet.
116 case 268: return "GNUNET_MESSAGE_TYPE_MESH_ACK";
121 case 269: return "GNUNET_MESSAGE_TYPE_MESH_POLL";
124 * Announce origin is still alive.
126 case 270: return "GNUNET_MESSAGE_TYPE_MESH_FWD_KEEPALIVE";
129 * Announce destination is still alive.
131 case 271: return "GNUNET_MESSAGE_TYPE_MESH_BCK_KEEPALIVE";
134 * Connect to the mesh service, specifying subscriptions
136 case 272: return "GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT";
139 * Ask the mesh service to create a new tunnel
141 case 273: return "GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE";
144 * Ask the mesh service to destroy a tunnel
146 case 274: return "GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY";
149 * Confirm the creation of a channel
151 case 275: return "GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK";
154 * Ask the mesh service to create a new tunnel
156 case 280: return "GNUNET_MESSAGE_TYPE_MESH_FWD";
159 * Ask the mesh service to destroy a tunnel
161 case 281: return "GNUNET_MESSAGE_TYPE_MESH_BCK";
164 * Local payload traffic
166 case 285: return "GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA";
169 * Local ACK for data.
171 case 286: return "GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK";
174 * Local monitoring of service.
176 case 287: return "GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS";
179 * Local monitoring of service of a specific tunnel.
181 case 288: return "GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNEL";
184 * 640kb should be enough for everybody
186 case 299: return "GNUNET_MESSAGE_TYPE_MESH_RESERVE_END";
188 sprintf(buf, "%u (UNKNOWN TYPE)", m);
193 GNUNET_MESH_DEBUG_M2S (uint16_t m)