2020-02-17 20:53:42 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
/// \file provider/client_protocol.h
|
|
|
|
/// \brief Provides low level access to libwebsockets protocol.
|
|
|
|
///
|
|
|
|
/// By default, libwebfuse encapsulates libwebsockets protocol by \ref
|
|
|
|
/// wfp_client. But sometimes it might come in handy to have access to
|
|
|
|
/// libwebsockets protocol. This allows to integrate libwebfuse in existing
|
|
|
|
/// libwebsockets applications.
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
#ifndef WF_PROVIDER_CLIENT_PROTOCOL_H
|
|
|
|
#define WF_PROVIDER_CLIENT_PROTOCOL_H
|
|
|
|
|
|
|
|
#include "webfuse/provider/api.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
|
2020-02-17 20:53:42 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
/// \struct wfp_client_protocol
|
|
|
|
/// \brief Opaque webfuse client protocol..
|
|
|
|
//------------------------------------------------------------------------------
|
2019-03-26 22:04:53 +00:00
|
|
|
struct wfp_client_protocol;
|
2020-02-17 20:53:42 +00:00
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
/// \struct wfp_provider
|
|
|
|
/// \brief Provider.
|
|
|
|
///
|
|
|
|
/// \todo How is a user supposed to get a provider's instance?
|
|
|
|
//------------------------------------------------------------------------------
|
2019-03-26 22:04:53 +00:00
|
|
|
struct wfp_provider;
|
2020-02-17 20:53:42 +00:00
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
/// \struct lws_protocols
|
|
|
|
/// \brief Forward declaration of libwebsockets protocols structure.
|
|
|
|
//------------------------------------------------------------------------------
|
2019-03-26 22:04:53 +00:00
|
|
|
struct lws_protocols;
|
|
|
|
|
2020-02-17 20:53:42 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
/// \brief Creates a new webfuse provider client protocol.
|
|
|
|
///
|
|
|
|
/// \note The user is responsible to manage lifetime of \arg user_data.
|
|
|
|
///
|
|
|
|
/// \todo How is a user supposed to get a provider's instance?
|
|
|
|
///
|
|
|
|
/// \param provider pointer to provider
|
|
|
|
/// \param user_data user defined context
|
|
|
|
/// \return newly created protocol
|
|
|
|
//------------------------------------------------------------------------------
|
2019-03-26 22:04:53 +00:00
|
|
|
extern WFP_API struct wfp_client_protocol * wfp_client_protocol_create(
|
|
|
|
struct wfp_provider const * provider,
|
|
|
|
void * user_data);
|
|
|
|
|
2020-02-17 20:53:42 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
/// \brief Disposes a protocol.
|
|
|
|
///
|
|
|
|
/// \note The user defined context is not managed by the protocol.
|
|
|
|
///
|
|
|
|
/// \param protocol pointer to protocol.
|
|
|
|
//------------------------------------------------------------------------------
|
2019-03-26 22:04:53 +00:00
|
|
|
extern WFP_API void wfp_client_protocol_dispose(
|
|
|
|
struct wfp_client_protocol * protocol);
|
|
|
|
|
2020-02-17 20:53:42 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
/// \brief Initialized libwebsockets protocol structure.
|
|
|
|
///
|
|
|
|
/// \param protocol pointer to protocol
|
|
|
|
/// \param lws_protocol pointer to libwebsockets protocol structure.
|
|
|
|
//------------------------------------------------------------------------------
|
2019-03-26 22:04:53 +00:00
|
|
|
extern WFP_API void wfp_client_protocol_init_lws(
|
|
|
|
struct wfp_client_protocol * protocol,
|
|
|
|
struct lws_protocols * lws_protocol);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|