aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_client_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-06-05 21:33:58 +0000
committerChristian Grothoff <christian@grothoff.org>2013-06-05 21:33:58 +0000
commita998e0abbd220035bdb333388da229852980e2cc (patch)
treeaddf062abb3cc68ab1103a415fbdec315dd54a63 /src/include/gnunet_client_lib.h
parent4ce2d673d41ad8a8b9e5389b5b97ecb5e77f190d (diff)
downloadgnunet-a998e0abbd220035bdb333388da229852980e2cc.tar.gz
gnunet-a998e0abbd220035bdb333388da229852980e2cc.zip
-cleaning up client api to test for service availability
Diffstat (limited to 'src/include/gnunet_client_lib.h')
-rw-r--r--src/include/gnunet_client_lib.h46
1 files changed, 37 insertions, 9 deletions
diff --git a/src/include/gnunet_client_lib.h b/src/include/gnunet_client_lib.h
index 8642dd941..e402b4295 100644
--- a/src/include/gnunet_client_lib.h
+++ b/src/include/gnunet_client_lib.h
@@ -1,10 +1,10 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 Christian Grothoff (and other contributing authors) 3 (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2013 Christian Grothoff (and other contributing authors)
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
7 by the Free Software Foundation; either version 2, or (at your 7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version. 8 option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
@@ -190,21 +190,49 @@ GNUNET_CLIENT_transmit_and_get_response (struct GNUNET_CLIENT_Connection *client
190 190
191 191
192/** 192/**
193 * Wait until the service is running. 193 * Handle for a test to check if a service is running.
194 */
195struct GNUNET_CLIENT_TestHandle;
196
197/**
198 * Function called with the result on the service test.
199 *
200 * @param cls closure
201 * @param result GNUNET_YES if the service is running,
202 * GNUNET_NO if the service is not running
203 * GNUNET_SYSERR if the configuration is invalid
204 */
205typedef void (*GNUNET_CLIENT_TestResultCallback)(void *cls,
206 int result);
207
208
209/**
210 * Test if the service is running. If we are given a UNIXPATH or a
211 * local address, we do this NOT by trying to connect to the service,
212 * but by trying to BIND to the same port. If the BIND fails, we know
213 * the service is running.
194 * 214 *
195 * @param service name of the service to wait for 215 * @param service name of the service to wait for
196 * @param cfg configuration to use 216 * @param cfg configuration to use
197 * @param timeout how long to wait at most in ms 217 * @param timeout how long to wait at most in ms
198 * @param task task to run if service is running 218 * @param cb function to call with the result
199 * (reason will be "PREREQ_DONE" (service running) 219 * @param cb_cls closure for 'cb'
200 * or "TIMEOUT" (service not known to be running)) 220 * @return handle to cancel the test
201 * @param task_cls closure for task
202 */ 221 */
203void 222struct GNUNET_CLIENT_TestHandle *
204GNUNET_CLIENT_service_test (const char *service, 223GNUNET_CLIENT_service_test (const char *service,
205 const struct GNUNET_CONFIGURATION_Handle *cfg, 224 const struct GNUNET_CONFIGURATION_Handle *cfg,
206 struct GNUNET_TIME_Relative timeout, 225 struct GNUNET_TIME_Relative timeout,
207 GNUNET_SCHEDULER_Task task, void *task_cls); 226 GNUNET_CLIENT_TestResultCallback cb, void *cb_cls);
227
228
229/**
230 * Abort testing for service.
231 *
232 * @param th test handle
233 */
234void
235GNUNET_CLIENT_service_test_cancel (struct GNUNET_CLIENT_TestHandle *th);
208 236
209 237
210#if 0 /* keep Emacsens' auto-indent happy */ 238#if 0 /* keep Emacsens' auto-indent happy */