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 * data GNUNET_MESH_Data OR
60 * GNUNET_MESH_DataBroadcast
61 * new incoming tunnel GNUNET_MESH_PeerControl
62 * peer connects to a tunnel GNUNET_MESH_PeerControl
63 * peer disconnects from a tunnel GNUNET_MESH_PeerControl
66 /******************************************************************************/
67 /************************** CONSTANTS ******************************/
68 /******************************************************************************/
70 #define GNUNET_MESH_LOCAL_TUNNEL_ID_MARK 0x80000000
73 /******************************************************************************/
74 /************************** MESSAGES ******************************/
75 /******************************************************************************/
78 * Message for a client to register to the service
80 struct GNUNET_MESH_ClientConnect
83 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT
85 * Size: sizeof(struct GNUNET_MESH_ClientConnect) +
86 * sizeof(uint16_t) * types +
87 * sizeof(MESH_ApplicationType) * applications
89 struct GNUNET_MessageHeader header;
90 uint16_t types GNUNET_PACKED;
91 uint16_t applications GNUNET_PACKED;
92 /* uint16_t list_types[types] */
93 /* uint16_t list_apps[applications] */
98 * Type for tunnel numbering.
99 * - Local tunnel numbers are >= 0x80000000
100 * - Global tunnel numbers are < 0x80000000
102 typedef uint32_t MESH_TunnelNumber;
105 * Message for a client to create and destroy tunnels.
107 struct GNUNET_MESH_TunnelMessage
110 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_[CREATE|DESTROY]
112 * Size: sizeof(struct GNUNET_MESH_TunnelMessage)
114 struct GNUNET_MessageHeader header;
117 * ID of a tunnel controlled by this client.
119 MESH_TunnelNumber tunnel_id GNUNET_PACKED;
124 * - request adding and deleting peers from a tunnel
125 * - notify the client that peers have connected:
127 * -- unrequested (new incoming tunnels)
128 * - notify the client that peers have disconnected
130 struct GNUNET_MESH_PeerControl
134 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_[ADD|DEL]
135 * (client to service, client created tunnel)
136 * GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_[CONNECTED|DISCONNECTED]
137 * (service to client)
139 * Size: sizeof(struct GNUNET_MESH_PeerControl)
141 struct GNUNET_MessageHeader header;
144 * ID of a tunnel controlled by this client.
146 MESH_TunnelNumber tunnel_id GNUNET_PACKED;
149 * Peer to connect/disconnect.
151 struct GNUNET_PeerIdentity peer;
156 * Message for connecting to peers offering a certain service.
158 struct GNUNET_MESH_ConnectPeerByType
161 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_BY_TYPE |
162 * GNUNET_MESSAGE_TYPE_MESH_LOCAL_DISCONNECT_PEER_BY_TYPE
164 struct GNUNET_MessageHeader header;
167 * ID of a tunnel controlled by this client.
169 MESH_TunnelNumber tunnel_id GNUNET_PACKED;
174 GNUNET_MESH_ApplicationType type GNUNET_PACKED;