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_stream.h
23 * @brief non-anonymous file-transfer
24 * @author Christian Grothoff
26 #ifndef GNUNET_SERVICE_FS_STREAM_H
27 #define GNUNET_SERVICE_FS_STREAM_H
30 * Handle for a request that is going out via stream API.
32 struct GSF_StreamRequest;
36 * Function called with a reply from the stream.
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_StreamReplyProcessor)(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_StreamRequest *
62 GSF_stream_query (const struct GNUNET_PeerIdentity *target,
63 const struct GNUNET_HashCode *query,
64 enum GNUNET_BLOCK_Type type,
65 GSF_StreamReplyProcessor proc, void *proc_cls);
69 * Cancel an active request; must not be called after 'proc'
72 * @param sr request to cancel
75 GSF_stream_query_cancel (struct GSF_StreamRequest *sr);
79 * Initialize subsystem for non-anonymous file-sharing.
82 GSF_stream_start (void);
86 * Shutdown subsystem for non-anonymous file-sharing.
89 GSF_stream_stop (void);