}
-/**
- * Search for a channel among the channels for a client
- *
- * @param c the client whose channels to search in
- * @param chid the local id of the channel
- *
- * @return channel handler, NULL if doesn't exist
- */
-static struct MeshChannel *
-channel_get_by_local_id (struct MeshClient *c, MESH_ChannelNumber chid)
-{
- LOG (GNUNET_ERROR_TYPE_DEBUG, " -- get CHID %X\n", chid);
- if (0 == (chid & GNUNET_MESH_LOCAL_CHANNEL_ID_CLI))
- {
- GNUNET_break_op (0);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "CHID %X not a local chid\n", chid);
- return NULL;
- }
- if (chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV)
- return GNUNET_CONTAINER_multihashmap32_get (c->incoming_channels, chid);
- return GNUNET_CONTAINER_multihashmap32_get (c->own_channels, chid);
-}
-
-
/**
* Add a client to a channel, initializing all needed data structures.
*
}
/* Assign local id as destination */
- while (NULL != channel_get_by_local_id (c, t->next_local_chid))
+ while (NULL != GML_channel_get (c, t->next_local_chid))
t->next_local_chid = (t->next_local_chid + 1) | GNUNET_MESH_LOCAL_CHANNEL_ID_SERV;
ch->lid_dest = t->next_local_chid++;
t->next_local_chid = t->next_local_chid | GNUNET_MESH_LOCAL_CHANNEL_ID_SERV;
peer2s (ch->t->peer),
ch->gid);
- if (channel_is_terminal (ch, GNUNET_NO))
+ if (GMCH_is_terminal (ch, GNUNET_NO))
{
if (NULL != ch->root && GNUNET_NO == ch->root->shutting_down)
{
GMCH_send_prebuilt_message (&msg.header, ch, GNUNET_NO);
}
- if (channel_is_terminal (ch, GNUNET_YES))
+ if (GMCH_is_terminal (ch, GNUNET_YES))
{
if (NULL != ch->dest && GNUNET_NO == ch->dest->shutting_down)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, " %s\n",
GNUNET_MESH_DEBUG_M2S (ntohs (message->type)));
- if (channel_is_terminal (ch, fwd) || ch->t->peer->id == myid)
+ if (GMCH_is_terminal (ch, fwd) || ch->t->peer->id == myid)
{
GMT_handle_decrypted (ch->t, message, fwd);
return;
}
}
+/**
+ * Get a chennel from a client
+ *
+ * @param c the client to check
+ * @param chid Channel ID, must be local (> 0x800...)
+ *
+ * @return non-NULL if channel exists in the clients lists
+ */
+struct MeshChannel *
+GML_channel_get (struct MeshClient *c, MESH_ChannelNumber chid)
+{
+ if (0 == (chid & GNUNET_MESH_LOCAL_CHANNEL_ID_CLI))
+ {
+ GNUNET_break_op (0);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "CHID %X not a local chid\n", chid);
+ return NULL;
+ }
+ if (chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV)
+ return GNUNET_CONTAINER_multihashmap32_get (c->incoming_channels, chid);
+ return GNUNET_CONTAINER_multihashmap32_get (c->own_channels, chid);
+}
/**
* Check if client has registered with the service and has not disconnected