diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-12-06 14:55:21 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-12-06 14:55:21 +0000 |
commit | 1bf79006d9c303944d1edf640e98131505c2ec17 (patch) | |
tree | 0ca5948e633fc67c20e74319341b4ed380312a48 /src | |
parent | a08a8c698ad069857e5787db662388be09801152 (diff) | |
download | gnunet-1bf79006d9c303944d1edf640e98131505c2ec17.tar.gz gnunet-1bf79006d9c303944d1edf640e98131505c2ec17.zip |
- wip
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/gnunet-mesh.c | 81 |
1 files changed, 50 insertions, 31 deletions
diff --git a/src/mesh/gnunet-mesh.c b/src/mesh/gnunet-mesh.c index 6faee5cb0..7450d8dc3 100644 --- a/src/mesh/gnunet-mesh.c +++ b/src/mesh/gnunet-mesh.c | |||
@@ -98,6 +98,56 @@ shutdown_task (void *cls, | |||
98 | 98 | ||
99 | 99 | ||
100 | /** | 100 | /** |
101 | * Function called whenever a channel is destroyed. Should clean up | ||
102 | * any associated state. | ||
103 | * | ||
104 | * It must NOT call #GNUNET_MESH_channel_destroy on the channel. | ||
105 | * | ||
106 | * @param cls closure (set from #GNUNET_MESH_connect) | ||
107 | * @param channel connection to the other end (henceforth invalid) | ||
108 | * @param channel_ctx place where local state associated | ||
109 | * with the channel is stored | ||
110 | */ | ||
111 | static void | ||
112 | channel_ended (void *cls, | ||
113 | const struct GNUNET_MESH_Channel *channel, | ||
114 | void *channel_ctx) | ||
115 | { | ||
116 | FPRINTF (stdout, "Channel ended!\n"); | ||
117 | } | ||
118 | |||
119 | |||
120 | /** | ||
121 | * Method called whenever another peer has added us to a channel | ||
122 | * the other peer initiated. | ||
123 | * Only called (once) upon reception of data with a message type which was | ||
124 | * subscribed to in #GNUNET_MESH_connect. | ||
125 | * | ||
126 | * A call to #GNUNET_MESH_channel_destroy causes te channel to be ignored. In | ||
127 | * this case the handler MUST return NULL. | ||
128 | * | ||
129 | * @param cls closure | ||
130 | * @param channel new handle to the channel | ||
131 | * @param initiator peer that started the channel | ||
132 | * @param port Port this channel is for. | ||
133 | * @param options MeshOption flag field, with all active option bits set to 1. | ||
134 | * | ||
135 | * @return initial channel context for the channel | ||
136 | * (can be NULL -- that's not an error) | ||
137 | */ | ||
138 | void * | ||
139 | channel_incoming (void *cls, | ||
140 | struct GNUNET_MESH_Channel * channel, | ||
141 | const struct GNUNET_PeerIdentity * initiator, | ||
142 | uint32_t port, enum MeshOption options) | ||
143 | { | ||
144 | FPRINTF (stdout, "Incoming channel!\n"); | ||
145 | return NULL; | ||
146 | } | ||
147 | |||
148 | |||
149 | |||
150 | /** | ||
101 | * Call MESH's monitor API, get info of one connection. | 151 | * Call MESH's monitor API, get info of one connection. |
102 | * | 152 | * |
103 | * @param cls Closure (unused). | 153 | * @param cls Closure (unused). |
@@ -234,37 +284,6 @@ show_connection (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
234 | } | 284 | } |
235 | 285 | ||
236 | 286 | ||
237 | |||
238 | /** | ||
239 | * Method called whenever another peer has added us to a channel | ||
240 | * the other peer initiated. | ||
241 | * Only called (once) upon reception of data with a message type which was | ||
242 | * subscribed to in #GNUNET_MESH_connect. | ||
243 | * | ||
244 | * A call to #GNUNET_MESH_channel_destroy causes te channel to be ignored. In | ||
245 | * this case the handler MUST return NULL. | ||
246 | * | ||
247 | * @param cls closure | ||
248 | * @param channel new handle to the channel | ||
249 | * @param initiator peer that started the channel | ||
250 | * @param port Port this channel is for. | ||
251 | * @param options MeshOption flag field, with all active option bits set to 1. | ||
252 | * | ||
253 | * @return initial channel context for the channel | ||
254 | * (can be NULL -- that's not an error) | ||
255 | */ | ||
256 | void * | ||
257 | incoming_channel (void *cls, | ||
258 | struct GNUNET_MESH_Channel * channel, | ||
259 | const struct GNUNET_PeerIdentity * initiator, | ||
260 | uint32_t port, enum MeshOption options) | ||
261 | { | ||
262 | FPRINTF (stdout, "Incoming channel!\n"); | ||
263 | return NULL; | ||
264 | } | ||
265 | |||
266 | |||
267 | |||
268 | /** | 287 | /** |
269 | * Main function that will be run by the scheduler. | 288 | * Main function that will be run by the scheduler. |
270 | * | 289 | * |