2 This file is part of GNUnet.
3 (C) 2013 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/gnunet-service-mesh_local.h
23 * @brief mesh service; dealing with local clients
24 * @author Bartlomiej Polot
26 * All functions in this file should use the prefix GML (Gnunet Mesh Local)
29 #ifndef GNUNET_SERVICE_MESH_LOCAL_H
30 #define GNUNET_SERVICE_MESH_LOCAL_H
35 #if 0 /* keep Emacsens' auto-indent happy */
41 #include "gnunet_util_lib.h"
44 * Struct containing information about a client of the service
48 #include "gnunet-service-mesh_channel.h"
50 /******************************************************************************/
51 /******************************** API ***********************************/
52 /******************************************************************************/
55 * Initialize server subsystem.
57 * @param handle Server handle.
60 GML_init (struct GNUNET_SERVER_Handle *handle);
63 * Install server (service) handlers and start listening to clients.
75 * Get a chennel from a client
77 * @param client the client to check
78 * @param chid Channel ID
80 * @return non-NULL if channel exists in the global DLL
83 GML_channel_get (struct MeshClient *client, uint32_t chid);
86 * Add a channel to a client
88 * @param client Client.
89 * @param chid Channel ID.
93 GML_channel_add (struct MeshClient *client,
95 struct MeshChannel *ch);
98 * Remove a channel from a client
100 * @param client Client.
101 * @param chid Channel ID.
105 GML_channel_remove (struct MeshClient *client,
107 struct MeshChannel *ch);
110 * Get the tunnel's next free local channel ID.
114 * @return LID of a channel free to use.
117 GML_get_next_chid (struct MeshClient *c);
120 * Check if client has registered with the service and has not disconnected
122 * @param client the client to check
124 * @return non-NULL if client exists in the global DLL
127 GML_client_get (struct GNUNET_SERVER_Client *client);
130 * Find a client that has opened a port
132 * @param port Port to check.
134 * @return non-NULL if a client has the port.
137 GML_client_get_by_port (uint32_t port);
140 * Deletes a tunnel from a client (either owner or destination).
142 * @param c Client whose tunnel to delete.
143 * @param ch Channel which should be deleted.
144 * @param id Channel ID.
147 GML_client_delete_channel (struct MeshClient *c,
148 struct MeshChannel *ch,
149 MESH_ChannelNumber id);
152 * Build a local ACK message and send it to a local client, if needed.
154 * If the client was already allowed to send data, do nothing.
156 * @param c Client to whom send the ACK.
157 * @param id Channel ID to use
160 GML_send_ack (struct MeshClient *c, MESH_ChannelNumber id);
163 * Notify the appropriate client that a new incoming channel was created.
165 * @param ch Channel that was created.
168 GML_send_channel_create (struct MeshClient *c,
169 uint32_t id, uint32_t port, uint32_t opt,
170 const struct GNUNET_PeerIdentity *peer);
173 * Notify a client that a channel is no longer valid.
176 * @param id ID of the channel that is destroyed.
179 GML_send_channel_destroy (struct MeshClient *c, uint32_t id);
182 * Modify the mesh message ID from global to local and send to client.
184 * @param c Client to send to.
185 * @param msg Message to modify and send.
186 * @param id Channel ID to use (c can be both owner and client).
189 GML_send_data (struct MeshClient *c,
190 const struct GNUNET_MESH_Data *msg,
191 MESH_ChannelNumber id);
194 * Get the static string to represent a client.
198 * @return Static string for the client.
201 GML_2s (const struct MeshClient *c);
204 #if 0 /* keep Emacsens' auto-indent happy */
211 /* ifndef GNUNET_MESH_SERVICE_LOCAL_H */
213 /* end of gnunet-mesh-service_LOCAL.h */