2 This file is part of GNUnet.
3 (C) 2001 - 2011 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 * @author Bartlomiej Polot
30 #include <gnunet_mesh_service_new.h>
31 #include "gnunet_common.h"
33 /******************************************************************************/
34 /******************** MESH LOCAL MESSAGES *************************/
35 /******************************************************************************/
36 /* Any API call should be documented in the folowing table under API CALL.
37 * Also, any message type should be documented in the following table, with the
40 * API CALL (GNUNET_MESH_*) MESSAGE USED
41 * ------------------------ ------------
42 * connect GNUNET_MESH_ClientConnect
43 * disconnect None (network level disconnect)
45 * tunnel_create GNUNET_MESH_TunnelMessage
46 * tunnel_destroy GNUNET_MESH_TunnelMessage
48 * peer_request_connect_add GNUNET_MESH_PeerControl
49 * peer_request_connect_del GNUNET_MESH_PeerControl
50 * peer_request_connect_by_type GNUNET_MESH_ConnectPeerByType
52 * notify_transmit_ready GNUNET_MESH_TransmitReady
53 * notify_transmit_ready_cancel None (clear of internal data structures)
59 * notify_transmit_ready reply GNUNET_MESH_TransmitReady
60 * notify_transmit_ready data GNUNET_MESH_Data OR
61 * GNUNET_MESH_DataBroadcast
62 * new incoming tunnel GNUNET_MESH_PeerControl
63 * peer connects to a tunnel GNUNET_MESH_PeerControl
64 * peer disconnects from a tunnel GNUNET_MESH_PeerControl
68 * Message for a client to register to the service
70 struct GNUNET_MESH_ClientConnect {
72 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT
74 * Size: sizeof(struct GNUNET_MESH_ClientConnect) +
75 * sizeof(uint16_t) * types +
76 * sizeof(MESH_ApplicationType) * applications
78 struct GNUNET_MessageHeader header;
79 uint16_t types GNUNET_PACKED;
80 uint16_t applications GNUNET_PACKED;
81 /* uint16_t list_types[types] */
82 /* uint16_t list_apps[applications] */
87 * Type for tunnel numbering.
88 * - Local tunnel numbers are >= 0x80000000
89 * - Global tunnel numbers are < 0x80000000
91 typedef uint32_t MESH_TunnelID;
94 * Message for a client to create and destroy tunnels.
96 struct GNUNET_MESH_TunnelMessage {
98 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_[CREATE|DESTROY]
100 * Size: sizeof(struct GNUNET_MESH_TunnelMessage)
102 struct GNUNET_MessageHeader header;
105 * ID of a tunnel controlled by this client.
107 MESH_TunnelID tunnel_id GNUNET_PACKED;
112 * - request adding and deleting peers from a tunnel
113 * - notify the client that peers have connected:
115 * -- unrequested (new incoming tunnels)
116 * - notify the client that peers have disconnected
118 struct GNUNET_MESH_PeerControl {
121 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_[ADD|DEL]
122 * (client to service, client created tunnel)
123 * GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_[CONNECTED|DISCONNECTED]
124 * (service to client)
126 * Size: sizeof(struct GNUNET_MESH_PeerControl)
128 struct GNUNET_MessageHeader header;
131 * ID of a tunnel controlled by this client.
133 MESH_TunnelID tunnel_id GNUNET_PACKED;
136 * Peer to connect/disconnect.
138 struct GNUNET_PeerIdentity peer;
143 * Message for connecting to peers offering a certain service.
145 struct GNUNET_MESH_ConnectPeerByType {
147 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_BY_TYPE
149 struct GNUNET_MessageHeader header;
152 * ID of a tunnel controlled by this client.
154 MESH_TunnelID tunnel_id GNUNET_PACKED;
159 GNUNET_MESH_ApplicationType type GNUNET_PACKED;
164 * Message for notifying the service that the client wants to send data or
165 * notifying a client that the service is ready to accept data.
167 struct GNUNET_MESH_TransmitReady {
169 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_REQUEST_TRANSMIT_READY
170 * GNUNET_MESSAGE_TYPE_MESH_LOCAL_NOTIFY_TRANSMIT_READY
172 struct GNUNET_MessageHeader header;
175 * ID of a tunnel controlled by this client.
177 MESH_TunnelID tunnel_id GNUNET_PACKED;
180 * Size of message we would like to transmit to this tunnel
182 uint32_t msg_size GNUNET_PACKED;
187 * Message to encapsulate data transmitted to/from the service
189 struct GNUNET_MESH_Data {
191 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA
192 * (client to service, or service to client)
193 * Size: sizeof(struct GNUNET_MESH_Data) + sizeof (data)
195 struct GNUNET_MessageHeader header;
198 * ID of a tunnel controlled by this client.
200 MESH_TunnelID tunnel_id GNUNET_PACKED;
203 * Source or destination of the message (depending on direction).
205 struct GNUNET_PeerIdentity peer_id;
211 * Message to encapsulate broadcast data transmitted to the service
213 struct GNUNET_MESH_DataBroadcast {
215 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA_BROADCAST
216 * (client to service only, client created tunnel)
217 * Size: sizeof(struct GNUNET_MESH_DataBroadcast) + sizeof (data)
219 struct GNUNET_MessageHeader header;
222 * ID of a tunnel controlled by this client.
224 MESH_TunnelID tunnel_id GNUNET_PACKED;