diff options
Diffstat (limited to 'src/mesh/mesh_common.c')
-rw-r--r-- | src/mesh/mesh_common.c | 185 |
1 files changed, 185 insertions, 0 deletions
diff --git a/src/mesh/mesh_common.c b/src/mesh/mesh_common.c new file mode 100644 index 000000000..cfc2f00ce --- /dev/null +++ b/src/mesh/mesh_common.c | |||
@@ -0,0 +1,185 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2012 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 mesh/mesh.c | ||
23 | * @brief MESH helper functions | ||
24 | * @author Bartlomiej Polot | ||
25 | */ | ||
26 | |||
27 | #include "mesh.h" | ||
28 | |||
29 | #if !defined(GNUNET_CULL_LOGGING) | ||
30 | const char * | ||
31 | GNUNET_MESH_DEBUG_M2S (uint16_t m) | ||
32 | { | ||
33 | static char buf[32]; | ||
34 | switch (m) | ||
35 | { | ||
36 | /** | ||
37 | * Request the creation of a path | ||
38 | */ | ||
39 | case 256: return "GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE"; break; | ||
40 | |||
41 | /** | ||
42 | * Request the modification of an existing path | ||
43 | */ | ||
44 | case 257: return "GNUNET_MESSAGE_TYPE_MESH_PATH_CHANGE"; break; | ||
45 | |||
46 | /** | ||
47 | * Notify that a connection of a path is no longer valid | ||
48 | */ | ||
49 | case 258: return "GNUNET_MESSAGE_TYPE_MESH_PATH_BROKEN"; break; | ||
50 | |||
51 | /** | ||
52 | * At some point, the route will spontaneously change | ||
53 | */ | ||
54 | case 259: return "GNUNET_MESSAGE_TYPE_MESH_PATH_CHANGED"; break; | ||
55 | |||
56 | /** | ||
57 | * Transport data in the mesh (origin->end) unicast | ||
58 | */ | ||
59 | case 260: return "GNUNET_MESSAGE_TYPE_MESH_UNICAST"; break; | ||
60 | |||
61 | /** | ||
62 | * Transport data to all peers in a tunnel | ||
63 | */ | ||
64 | case 261: return "GNUNET_MESSAGE_TYPE_MESH_MULTICAST"; break; | ||
65 | |||
66 | /** | ||
67 | * Transport data back in the mesh (end->origin) | ||
68 | */ | ||
69 | case 262: return "GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN"; break; | ||
70 | |||
71 | /** | ||
72 | * Send origin an ACK that the path is complete | ||
73 | */ | ||
74 | case 263: return "GNUNET_MESSAGE_TYPE_MESH_PATH_ACK"; break; | ||
75 | |||
76 | /** | ||
77 | * Avoid path timeouts | ||
78 | */ | ||
79 | case 264: return "GNUNET_MESSAGE_TYPE_MESH_PATH_KEEPALIVE"; break; | ||
80 | |||
81 | /** | ||
82 | * Request the destuction of a path | ||
83 | */ | ||
84 | case 265: return "GNUNET_MESSAGE_TYPE_MESH_PATH_DESTROY"; break; | ||
85 | |||
86 | /** | ||
87 | * Request the destruction of a whole tunnel | ||
88 | */ | ||
89 | case 266: return "GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY"; break; | ||
90 | |||
91 | /** | ||
92 | * ACK for a data packet. | ||
93 | */ | ||
94 | case 267: return "GNUNET_MESSAGE_TYPE_MESH_ACK"; break; | ||
95 | |||
96 | /** | ||
97 | * Connect to the mesh service, specifying subscriptions | ||
98 | */ | ||
99 | case 272: return "GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT"; break; | ||
100 | |||
101 | /** | ||
102 | * Ask the mesh service to create a new tunnel | ||
103 | */ | ||
104 | case 273: return "GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_CREATE"; break; | ||
105 | |||
106 | /** | ||
107 | * Ask the mesh service to destroy a tunnel | ||
108 | */ | ||
109 | case 274: return "GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_DESTROY"; break; | ||
110 | |||
111 | /** | ||
112 | * Ask the mesh service to add a peer to an existing tunnel | ||
113 | */ | ||
114 | case 275: return "GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_ADD"; break; | ||
115 | |||
116 | /** | ||
117 | * Ask the mesh service to remove a peer from a tunnel | ||
118 | */ | ||
119 | case 276: return "GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_DEL"; break; | ||
120 | |||
121 | /** | ||
122 | * Ask the mesh service to add a peer offering a service to an existing tunnel | ||
123 | */ | ||
124 | case 277: return "GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_ADD_BY_TYPE"; break; | ||
125 | |||
126 | /** | ||
127 | * Ask the mesh service to add a peer described by a service string | ||
128 | */ | ||
129 | case 278: return "GNUNET_MESSAGE_TYPE_MESH_LOCAL_ANNOUNCE_REGEX"; break; | ||
130 | |||
131 | /** | ||
132 | * Ask the mesh service to add a peer described by a service string | ||
133 | */ | ||
134 | case 279: return "GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_ADD_BY_STRING"; break; | ||
135 | |||
136 | /** | ||
137 | * Ask the mesh service to add a peer to the blacklist of an existing tunnel | ||
138 | */ | ||
139 | case 280: return "GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_BLACKLIST"; break; | ||
140 | |||
141 | /** | ||
142 | * Ask the mesh service to remove a peer from the blacklist of a tunnel | ||
143 | */ | ||
144 | case 281: return "GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_UNBLACKLIST"; break; | ||
145 | |||
146 | /** | ||
147 | * Set tunnel speed to slowest peer | ||
148 | */ | ||
149 | case 282: return "GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_MIN"; break; | ||
150 | |||
151 | /** | ||
152 | * Set tunnel speed to fastest peer | ||
153 | */ | ||
154 | case 283: return "GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_MAX"; break; | ||
155 | |||
156 | /** | ||
157 | * Set tunnel buffering on. | ||
158 | */ | ||
159 | case 284: return "GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_BUFFER"; break; | ||
160 | |||
161 | /** | ||
162 | * Set tunnel buffering off. | ||
163 | */ | ||
164 | case 285: return "GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_NOBUFFER"; break; | ||
165 | |||
166 | /** | ||
167 | * Local ACK for data. | ||
168 | */ | ||
169 | case 286: return "GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK"; break; | ||
170 | |||
171 | /** | ||
172 | * 640kb should be enough for everybody | ||
173 | */ | ||
174 | case 299: return "GNUNET_MESSAGE_TYPE_MESH_RESERVE_END"; break; | ||
175 | } | ||
176 | sprintf(buf, "%u (UNKNOWN TYPE)", m); | ||
177 | return buf; | ||
178 | } | ||
179 | #else | ||
180 | const char * | ||
181 | GNUNET_MESH_DEBUG_M2S (uint16_t m) | ||
182 | { | ||
183 | return ""; | ||
184 | } | ||
185 | #endif | ||