2 This file is part of GNUnet.
3 Copyright (C) 2001-2013, 2016 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your 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 Affero General Public License for more details.
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 SPDX-License-Identifier: AGPL3.0-or-later
22 * @author Christian Grothoff
25 * Functions related to accessing services
27 * @defgroup client Client library
28 * Generic client-side communication with services
30 * @see [Documentation](https://gnunet.org/ipc)
35 #ifndef GNUNET_CLIENT_LIB_H
36 #define GNUNET_CLIENT_LIB_H
41 #if 0 /* keep Emacsens' auto-indent happy */
46 #include "gnunet_mq_lib.h"
50 * Test if the port or UNIXPATH of the given @a service_name
51 * is in use and thus (most likely) the respective service is up.
53 * @param cfg our configuration
54 * @param service_name name of the service to connect to
55 * @return #GNUNET_YES if the service is (likely) up (or running remotely),
56 * #GNUNET_NO if the service is (definitively) down,
57 * #GNUNET_SYSERR if the configuration does not give us
58 * the necessary information about the service, or if
59 * we could not check (i.e. socket() failed)
62 GNUNET_CLIENT_test (const struct GNUNET_CONFIGURATION_Handle *cfg,
63 const char *service_name);
67 * Create a message queue to connect to a GNUnet service.
68 * If handlers are specfied, receive messages from the connection.
70 * @param connection the client connection
71 * @param handlers handlers for receiving messages, can be NULL
72 * @param error_handler error handler
73 * @param error_handler_cls closure for the @a error_handler
74 * @return the message queue, NULL on error
76 struct GNUNET_MQ_Handle *
77 GNUNET_CLIENT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
78 const char *service_name,
79 const struct GNUNET_MQ_MessageHandler *handlers,
80 GNUNET_MQ_ErrorHandler error_handler,
81 void *error_handler_cls);
84 #if 0 /* keep Emacsens' auto-indent happy */
91 /* ifndef GNUNET_CLIENT_LIB_H */
94 /** @} */ /* end of group client */
96 /* end of gnunet_client_lib.h */