diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-10-23 16:03:54 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-10-23 16:03:54 +0000 |
commit | 48f8bbc215fc84a295993fb5bc529a9fe9b11b7e (patch) | |
tree | 1bdaede9381fe465fec7e7149d35a562a0fa7dc8 /src/include/gnunet_client_lib.h | |
parent | 4eecf868f0ed39d472884cf6b415bb3b3460dee7 (diff) | |
download | gnunet-48f8bbc215fc84a295993fb5bc529a9fe9b11b7e.tar.gz gnunet-48f8bbc215fc84a295993fb5bc529a9fe9b11b7e.zip |
move to new client API: remove old client API
Diffstat (limited to 'src/include/gnunet_client_lib.h')
-rw-r--r-- | src/include/gnunet_client_lib.h | 210 |
1 files changed, 1 insertions, 209 deletions
diff --git a/src/include/gnunet_client_lib.h b/src/include/gnunet_client_lib.h index aa32b55ad..f98620dfa 100644 --- a/src/include/gnunet_client_lib.h +++ b/src/include/gnunet_client_lib.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2001-2013 GNUnet e.V. | 3 | Copyright (C) 2001-2013, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 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 | 6 | it under the terms of the GNU General Public License as published |
@@ -45,11 +45,6 @@ extern "C" | |||
45 | 45 | ||
46 | #include "gnunet_mq_lib.h" | 46 | #include "gnunet_mq_lib.h" |
47 | 47 | ||
48 | /** | ||
49 | * Opaque handle for a connection to a service. | ||
50 | */ | ||
51 | struct GNUNET_CLIENT_Connection; | ||
52 | |||
53 | 48 | ||
54 | /** | 49 | /** |
55 | * Create a message queue to connect to a GNUnet service. | 50 | * Create a message queue to connect to a GNUnet service. |
@@ -69,209 +64,6 @@ GNUNET_CLIENT_connecT (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
69 | void *error_handler_cls); | 64 | void *error_handler_cls); |
70 | 65 | ||
71 | 66 | ||
72 | /** | ||
73 | * Create a message queue for a GNUNET_CLIENT_Connection. | ||
74 | * If handlers are specfied, receive messages from the connection. | ||
75 | * | ||
76 | * @param connection the client connection, taken over and freed by the MQ | ||
77 | * @param handlers handlers for receiving messages | ||
78 | * @param error_handler error handler | ||
79 | * @param error_handler_cls closure for the @a error_handler | ||
80 | * @return the message queue | ||
81 | * @deprecated use #GNUNET_CLIENT_connecT | ||
82 | */ | ||
83 | struct GNUNET_MQ_Handle * | ||
84 | GNUNET_MQ_queue_for_connection_client (struct GNUNET_CLIENT_Connection *connection, | ||
85 | const struct GNUNET_MQ_MessageHandler *handlers, | ||
86 | GNUNET_MQ_ErrorHandler error_handler, | ||
87 | void *error_handler_cls); | ||
88 | |||
89 | |||
90 | /** | ||
91 | * Get a connection with a service. | ||
92 | * | ||
93 | * @param service_name name of the service | ||
94 | * @param cfg configuration to use | ||
95 | * @return NULL on error (service unknown to configuration) | ||
96 | * @deprecated use #GNUNET_CLIENT_connect2 | ||
97 | */ | ||
98 | struct GNUNET_CLIENT_Connection * | ||
99 | GNUNET_CLIENT_connect (const char *service_name, | ||
100 | const struct GNUNET_CONFIGURATION_Handle *cfg); | ||
101 | |||
102 | |||
103 | /** | ||
104 | * Destroy connection with the service. This will automatically | ||
105 | * cancel any pending "receive" request (however, the handler will | ||
106 | * *NOT* be called, not even with a NULL message). Any pending | ||
107 | * transmission request will also be cancelled UNLESS the callback for | ||
108 | * the transmission request has already been called, in which case the | ||
109 | * transmission 'finish_pending_write' argument determines whether or | ||
110 | * not the write is guaranteed to complete before the socket is fully | ||
111 | * destroyed (unless, of course, there is an error with the server in | ||
112 | * which case the message may still be lost). | ||
113 | * | ||
114 | * @param client handle to the service connection | ||
115 | * @deprecated | ||
116 | */ | ||
117 | void | ||
118 | GNUNET_CLIENT_disconnect (struct GNUNET_CLIENT_Connection *client); | ||
119 | |||
120 | |||
121 | /** | ||
122 | * Type of a function to call when we receive a message | ||
123 | * from the service. | ||
124 | * | ||
125 | * @param cls closure | ||
126 | * @param msg message received, NULL on timeout or fatal error | ||
127 | */ | ||
128 | typedef void | ||
129 | (*GNUNET_CLIENT_MessageHandler) (void *cls, | ||
130 | const struct GNUNET_MessageHeader *msg); | ||
131 | |||
132 | |||
133 | /** | ||
134 | * Read from the service. | ||
135 | * | ||
136 | * @param client connection to the service | ||
137 | * @param handler function to call with the message | ||
138 | * @param handler_cls closure for @a handler | ||
139 | * @param timeout how long to wait until timing out | ||
140 | * @deprecated | ||
141 | */ | ||
142 | void | ||
143 | GNUNET_CLIENT_receive (struct GNUNET_CLIENT_Connection *client, | ||
144 | GNUNET_CLIENT_MessageHandler handler, | ||
145 | void *handler_cls, | ||
146 | struct GNUNET_TIME_Relative timeout); | ||
147 | |||
148 | |||
149 | /** | ||
150 | * Transmit handle for client connections. | ||
151 | */ | ||
152 | struct GNUNET_CLIENT_TransmitHandle; | ||
153 | |||
154 | |||
155 | /** | ||
156 | * Ask the client to call us once the specified number of bytes | ||
157 | * are free in the transmission buffer. Will never call the @a notify | ||
158 | * callback in this task, but always first go into the scheduler. | ||
159 | * | ||
160 | * @param client connection to the service | ||
161 | * @param size number of bytes to send | ||
162 | * @param timeout after how long should we give up (and call | ||
163 | * @a notify with buf NULL and size 0)? | ||
164 | * @param auto_retry if the connection to the service dies, should we | ||
165 | * automatically re-connect and retry (within the timeout period) | ||
166 | * or should we immediately fail in this case? Pass #GNUNET_YES | ||
167 | * if the caller does not care about temporary connection errors, | ||
168 | * for example because the protocol is stateless | ||
169 | * @param notify function to call | ||
170 | * @param notify_cls closure for @a notify | ||
171 | * @return NULL if someone else is already waiting to be notified | ||
172 | * non-NULL if the notify callback was queued (can be used to cancel | ||
173 | * using #GNUNET_CONNECTION_notify_transmit_ready_cancel) | ||
174 | * @deprecated | ||
175 | */ | ||
176 | struct GNUNET_CLIENT_TransmitHandle * | ||
177 | GNUNET_CLIENT_notify_transmit_ready (struct GNUNET_CLIENT_Connection *client, | ||
178 | size_t size, | ||
179 | struct GNUNET_TIME_Relative timeout, | ||
180 | int auto_retry, | ||
181 | GNUNET_CONNECTION_TransmitReadyNotify notify, | ||
182 | void *notify_cls); | ||
183 | |||
184 | |||
185 | /** | ||
186 | * Cancel a request for notification. | ||
187 | * | ||
188 | * @param th handle from the original request. | ||
189 | * @deprecated | ||
190 | */ | ||
191 | void | ||
192 | GNUNET_CLIENT_notify_transmit_ready_cancel (struct GNUNET_CLIENT_TransmitHandle *th); | ||
193 | |||
194 | |||
195 | /** | ||
196 | * Convenience API that combines sending a request | ||
197 | * to the service and waiting for a response. | ||
198 | * If either operation times out, the callback | ||
199 | * will be called with a "NULL" response (in which | ||
200 | * case the connection should probably be destroyed). | ||
201 | * | ||
202 | * @param client connection to use | ||
203 | * @param hdr message to transmit | ||
204 | * @param timeout when to give up (for both transmission | ||
205 | * and for waiting for a response) | ||
206 | * @param auto_retry if the connection to the service dies, should we | ||
207 | * automatically re-connect and retry (within the timeout period) | ||
208 | * or should we immediately fail in this case? Pass #GNUNET_YES | ||
209 | * if the caller does not care about temporary connection errors, | ||
210 | * for example because the protocol is stateless | ||
211 | * @param rn function to call with the response | ||
212 | * @param rn_cls closure for @a rn | ||
213 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if a request | ||
214 | * is already pending | ||
215 | * @deprecated | ||
216 | */ | ||
217 | int | ||
218 | GNUNET_CLIENT_transmit_and_get_response (struct GNUNET_CLIENT_Connection *client, | ||
219 | const struct GNUNET_MessageHeader *hdr, | ||
220 | struct GNUNET_TIME_Relative timeout, | ||
221 | int auto_retry, | ||
222 | GNUNET_CLIENT_MessageHandler rn, | ||
223 | void *rn_cls); | ||
224 | |||
225 | |||
226 | /** | ||
227 | * Handle for a test to check if a service is running. | ||
228 | */ | ||
229 | struct GNUNET_CLIENT_TestHandle; | ||
230 | |||
231 | /** | ||
232 | * Function called with the result on the service test. | ||
233 | * | ||
234 | * @param cls closure | ||
235 | * @param result #GNUNET_YES if the service is running, | ||
236 | * #GNUNET_NO if the service is not running | ||
237 | * #GNUNET_SYSERR if the configuration is invalid | ||
238 | */ | ||
239 | typedef void | ||
240 | (*GNUNET_CLIENT_TestResultCallback)(void *cls, | ||
241 | int result); | ||
242 | |||
243 | |||
244 | /** | ||
245 | * Test if the service is running. If we are given a UNIXPATH or a | ||
246 | * local address, we do this NOT by trying to connect to the service, | ||
247 | * but by trying to BIND to the same port. If the BIND fails, we know | ||
248 | * the service is running. | ||
249 | * | ||
250 | * @param service name of the service to wait for | ||
251 | * @param cfg configuration to use | ||
252 | * @param timeout how long to wait at most | ||
253 | * @param cb function to call with the result | ||
254 | * @param cb_cls closure for @a cb | ||
255 | * @return handle to cancel the test | ||
256 | * @deprecated | ||
257 | */ | ||
258 | struct GNUNET_CLIENT_TestHandle * | ||
259 | GNUNET_CLIENT_service_test (const char *service, | ||
260 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
261 | struct GNUNET_TIME_Relative timeout, | ||
262 | GNUNET_CLIENT_TestResultCallback cb, void *cb_cls); | ||
263 | |||
264 | |||
265 | /** | ||
266 | * Abort testing for service. | ||
267 | * | ||
268 | * @param th test handle | ||
269 | * @deprecated | ||
270 | */ | ||
271 | void | ||
272 | GNUNET_CLIENT_service_test_cancel (struct GNUNET_CLIENT_TestHandle *th); | ||
273 | |||
274 | |||
275 | #if 0 /* keep Emacsens' auto-indent happy */ | 67 | #if 0 /* keep Emacsens' auto-indent happy */ |
276 | { | 68 | { |
277 | #endif | 69 | #endif |