2 This file is part of GNUnet.
3 (C) 2012 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 fs/gnunet-service-fs_mesh.h
23 * @brief non-anonymous file-transfer
24 * @author Christian Grothoff
26 #ifndef GNUNET_SERVICE_FS_MESH_H
27 #define GNUNET_SERVICE_FS_MESH_H
30 * Handle for a request that is going out via mesh API.
32 struct GSF_MeshRequest;
36 * Function called with a reply from the mesh.
39 * @param type type of the block, ANY on error
40 * @param expiration expiration time for the block
41 * @param data_size number of bytes in 'data', 0 on error
42 * @param data reply block data, NULL on error
44 typedef void (*GSF_MeshReplyProcessor)(void *cls,
45 enum GNUNET_BLOCK_Type type,
46 struct GNUNET_TIME_Absolute expiration,
52 * Look for a block by directly contacting a particular peer.
54 * @param target peer that should have the block
55 * @param query hash to query for the block
56 * @param type desired type for the block
57 * @param proc function to call with result
58 * @param proc_cls closure for 'proc'
59 * @return handle to cancel the operation
61 struct GSF_MeshRequest *
62 GSF_mesh_query (const struct GNUNET_PeerIdentity *target,
63 const struct GNUNET_HashCode *query,
64 enum GNUNET_BLOCK_Type type,
65 GSF_MeshReplyProcessor proc, void *proc_cls);
69 * Cancel an active request; must not be called after 'proc'
72 * @param sr request to cancel
75 GSF_mesh_query_cancel (struct GSF_MeshRequest *sr);
79 * Initialize subsystem for non-anonymous file-sharing.
82 GSF_mesh_start_server (void);
86 * Shutdown subsystem for non-anonymous file-sharing.
89 GSF_mesh_stop_server (void);
92 * Initialize subsystem for non-anonymous file-sharing.
95 GSF_mesh_start_client (void);
99 * Shutdown subsystem for non-anonymous file-sharing.
102 GSF_mesh_stop_client (void);
105 GNUNET_NETWORK_STRUCT_BEGIN
108 * Query from one peer, asking the other for CHK-data.
110 struct MeshQueryMessage
114 * Type is GNUNET_MESSAGE_TYPE_FS_MESH_QUERY.
116 struct GNUNET_MessageHeader header;
119 * Block type must be DBLOCK or IBLOCK.
121 uint32_t type GNUNET_PACKED;
124 * Query hash from CHK (hash of encrypted block).
126 struct GNUNET_HashCode query;
132 * Reply to a MeshQueryMessage.
134 struct MeshReplyMessage
138 * Type is GNUNET_MESSAGE_TYPE_FS_MESH_REPLY.
140 struct GNUNET_MessageHeader header;
143 * Block type must be DBLOCK or IBLOCK.
145 uint32_t type GNUNET_PACKED;
148 * Expiration time for the block.
150 struct GNUNET_TIME_AbsoluteNBO expiration;
152 /* followed by the encrypted block */
156 GNUNET_NETWORK_STRUCT_END