diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-01-25 22:58:30 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-01-25 22:58:30 +0000 |
commit | 143cde208ce477883102bf23f67a1d31aaa4ed11 (patch) | |
tree | 962c46c9e701944fd3ea34337a35d67eaa704a0c /src/fs/gnunet-service-fs_lc.h | |
parent | bf0a4b7fa0587deb75111cf1cdaaef2b3b3a39a6 (diff) | |
download | gnunet-143cde208ce477883102bf23f67a1d31aaa4ed11.tar.gz gnunet-143cde208ce477883102bf23f67a1d31aaa4ed11.zip |
hdrs
Diffstat (limited to 'src/fs/gnunet-service-fs_lc.h')
-rw-r--r-- | src/fs/gnunet-service-fs_lc.h | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/src/fs/gnunet-service-fs_lc.h b/src/fs/gnunet-service-fs_lc.h new file mode 100644 index 000000000..edc199fd8 --- /dev/null +++ b/src/fs/gnunet-service-fs_lc.h | |||
@@ -0,0 +1,119 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2011 Christian Grothoff (and other contributing authors) | ||
4 | |||
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. | ||
9 | |||
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. | ||
14 | |||
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. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file fs/gnunet-service-fs_lc.h | ||
23 | * @brief API to handle 'connected peers' | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #ifndef GNUNET_SERVICE_FS_LC_H | ||
27 | #define GNUNET_SERVICE_FS_LC_H | ||
28 | |||
29 | #include "gnunet-service-fs.h" | ||
30 | |||
31 | |||
32 | /** | ||
33 | * Look up a local client record or create one if it | ||
34 | * doesn't exist yet. | ||
35 | * | ||
36 | * @param client handle of the client | ||
37 | * @return handle to local client entry | ||
38 | */ | ||
39 | struct GSF_LocalClient * | ||
40 | GSF_local_client_lookup_ (struct GNUNET_SERVER_Client *client); | ||
41 | |||
42 | |||
43 | /** | ||
44 | * Handle START_SEARCH-message (search request from local client). | ||
45 | * | ||
46 | * @param cls closure | ||
47 | * @param client identification of the client | ||
48 | * @param message the actual message | ||
49 | */ | ||
50 | void | ||
51 | GSF_local_client_start_search_handler_ (void *cls, | ||
52 | struct GNUNET_SERVER_Client *client, | ||
53 | const struct GNUNET_MessageHeader *message); | ||
54 | |||
55 | |||
56 | /** | ||
57 | * Transmit a message to the given local client as soon as possible. | ||
58 | * If the client disconnects before transmission, the message is | ||
59 | * simply discarded. | ||
60 | * | ||
61 | * @param lc recipient | ||
62 | * @param msg message to transmit to client | ||
63 | */ | ||
64 | void | ||
65 | GSF_local_client_transmit_ (struct GSF_LocalClient *lc, | ||
66 | const struct GNUNET_MessageHeader *msg); | ||
67 | |||
68 | |||
69 | /** | ||
70 | * A local client disconnected from us. Tear down the local client | ||
71 | * record. | ||
72 | * | ||
73 | * @param cls unused | ||
74 | * @param client handle of the client | ||
75 | */ | ||
76 | void | ||
77 | GSF_local_client_disconnect_handler_ (void *cls, | ||
78 | const struct GNUNET_SERVER_Client *client); | ||
79 | |||
80 | |||
81 | |||
82 | /** | ||
83 | * Signature of function called on a local client | ||
84 | * | ||
85 | * @param cls closure | ||
86 | * @param lc local client handle | ||
87 | */ | ||
88 | typedef int (*GSF_LocalClientIterator)(void *cls, | ||
89 | struct GSF_LocalClient *lc); | ||
90 | |||
91 | |||
92 | |||
93 | /** | ||
94 | * Register callback to invoke on local client disconnect. | ||
95 | * | ||
96 | * @param lc client to monitor | ||
97 | * @param it function to call on disconnect | ||
98 | * @param it_cls closure for it | ||
99 | */ | ||
100 | void | ||
101 | GSF_local_client_register_disconnect_callback_ (struct GSF_LocalClient *lc, | ||
102 | GSF_LocalClientIterator it, | ||
103 | void *it_cls); | ||
104 | |||
105 | |||
106 | /** | ||
107 | * Register callback to invoke on local client disconnect. | ||
108 | * | ||
109 | * @param lc client to stop monitoring | ||
110 | * @param it function to no longer call on disconnect | ||
111 | * @param it_cls closure for it | ||
112 | */ | ||
113 | void | ||
114 | GSF_connected_peer_unregister_disconnect_callback_ (struct GSF_ConnectedPeer *cp, | ||
115 | GSF_PendingRequestIterator it, | ||
116 | void *it_cls); | ||
117 | |||
118 | #endif | ||
119 | /* end of gnunet-service-fs_lc.h */ | ||