2020-02-17 20:53:42 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
/// \file provider/client.h
|
|
|
|
/// \brief Webfuse provider client.
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
#ifndef WF_PROVIDER_CLIENT_H
|
|
|
|
#define WF_PROVIDER_CLIENT_H
|
|
|
|
|
|
|
|
#include "webfuse/provider/api.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
|
2020-02-17 20:53:42 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
/// \struct wfp_client
|
|
|
|
/// \brief Webfuse provider client.
|
|
|
|
//------------------------------------------------------------------------------
|
2019-03-26 22:04:53 +00:00
|
|
|
struct wfp_client;
|
2020-02-17 20:53:42 +00:00
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
struct wfp_client_config;
|
|
|
|
|
2020-02-17 20:53:42 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
/// \brief Creates a webfuse provider client.
|
|
|
|
///
|
|
|
|
/// \note Client configuration is not managed by the client.
|
|
|
|
///
|
|
|
|
/// \param config pointer to client configuration.
|
|
|
|
/// \return newly created client or NULL in case of an error.
|
|
|
|
//------------------------------------------------------------------------------
|
2019-03-26 22:04:53 +00:00
|
|
|
extern WFP_API struct wfp_client * wfp_client_create(
|
|
|
|
struct wfp_client_config * config);
|
|
|
|
|
2020-02-17 20:53:42 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
/// \brief Connects the client to a remote webfuse adapter server.
|
|
|
|
///
|
|
|
|
/// \note This call starts to establish a connection. A callback is invoked,
|
|
|
|
/// when the connection is estanlished.
|
|
|
|
///
|
|
|
|
/// \param client pointer to client
|
|
|
|
/// \param url URL of remote webfuse adapter server
|
|
|
|
///
|
|
|
|
/// \see wfp_connected_fn
|
|
|
|
/// \see wfp_client_config_set_onconnected
|
|
|
|
//------------------------------------------------------------------------------
|
2019-03-26 22:04:53 +00:00
|
|
|
extern WFP_API void wfp_client_connect(
|
|
|
|
struct wfp_client * client,
|
|
|
|
char const * url);
|
|
|
|
|
2020-02-17 20:53:42 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
/// \brief Disconnects a connected client.
|
|
|
|
///
|
|
|
|
/// \note This call starts to disconnect the connection. A callback is invoked
|
|
|
|
/// when conntection is disconnected.
|
|
|
|
///
|
|
|
|
/// \param client pointer to client
|
|
|
|
///
|
|
|
|
/// \see wfp_disconnected_fn
|
|
|
|
/// \see wfp_client_config_set_ondisconnected
|
|
|
|
//------------------------------------------------------------------------------
|
2019-03-26 22:04:53 +00:00
|
|
|
extern WFP_API void wfp_client_disconnect(
|
|
|
|
struct wfp_client * client);
|
|
|
|
|
2020-02-17 20:53:42 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
/// \brief Disposes a client.
|
|
|
|
///
|
|
|
|
/// \note Client configuration is not managed by client.
|
|
|
|
///
|
|
|
|
/// \param client pointer to client
|
|
|
|
//------------------------------------------------------------------------------
|
2019-03-26 22:04:53 +00:00
|
|
|
extern WFP_API void wfp_client_dispose(
|
|
|
|
struct wfp_client * client);
|
|
|
|
|
2020-02-17 20:53:42 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
/// \brief Triggers the client.
|
|
|
|
///
|
|
|
|
/// This function must be invoked in a loop while the client is running. It
|
|
|
|
/// makes the server wait for the next event and processes it.
|
|
|
|
///
|
|
|
|
/// \param client pointer to client
|
2020-03-07 14:27:04 +00:00
|
|
|
///
|
|
|
|
/// \see wfp_client_interrupt
|
2020-02-17 20:53:42 +00:00
|
|
|
//------------------------------------------------------------------------------
|
2019-04-26 18:51:24 +00:00
|
|
|
extern WFP_API void wfp_client_service(
|
2020-04-06 18:44:18 +00:00
|
|
|
struct wfp_client * client);
|
2019-03-26 22:04:53 +00:00
|
|
|
|
2020-03-07 14:27:04 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
/// \brief interrupt wfp_client_service
|
|
|
|
///
|
|
|
|
/// This function can be called from another thread.
|
|
|
|
///
|
|
|
|
/// \param client pointer to client
|
|
|
|
///
|
|
|
|
/// \see wfp_client_service
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
extern WFP_API void wfp_client_interrupt(
|
|
|
|
struct wfp_client * client);
|
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|