2020-06-11 16:07:42 +00:00
|
|
|
#ifndef WF_ADAPTER_IMPL_CLIENT_PROTOCOL_H
|
|
|
|
#define WF_ADAPTER_IMPL_CLIENT_PROTOCOL_H
|
|
|
|
|
|
|
|
#include "webfuse/adapter/client_callback.h"
|
2020-06-12 18:38:20 +00:00
|
|
|
#include "webfuse/core/slist.h"
|
2020-06-11 16:07:42 +00:00
|
|
|
|
2020-06-11 20:57:56 +00:00
|
|
|
#ifndef __cplusplus
|
|
|
|
#include <stdbool.h>
|
|
|
|
#endif
|
|
|
|
|
2020-06-11 16:07:42 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct lws_protocols;
|
2020-06-11 20:57:56 +00:00
|
|
|
struct lws_context;
|
2020-06-11 16:07:42 +00:00
|
|
|
|
2020-06-12 18:38:20 +00:00
|
|
|
struct wf_jsonrpc_proxy;
|
|
|
|
struct wf_timer_manager;
|
|
|
|
|
2020-06-11 16:07:42 +00:00
|
|
|
typedef void
|
|
|
|
wf_client_protocol_callback_fn(
|
|
|
|
void * user_data,
|
|
|
|
int reason,
|
|
|
|
void * arg);
|
|
|
|
|
|
|
|
struct wf_client_protocol
|
|
|
|
{
|
2020-06-11 20:57:56 +00:00
|
|
|
bool is_connected;
|
|
|
|
bool is_shutdown_requested;
|
|
|
|
struct lws * wsi;
|
2020-06-11 16:07:42 +00:00
|
|
|
wf_client_callback_fn * callback;
|
|
|
|
void * user_data;
|
2020-06-12 18:38:20 +00:00
|
|
|
struct wf_timer_manager * timer_manager;
|
|
|
|
struct wf_jsonrpc_proxy * proxy;
|
|
|
|
struct wf_slist messages;
|
2020-06-11 16:07:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern void
|
|
|
|
wf_impl_client_protocol_init(
|
|
|
|
struct wf_client_protocol * protocol,
|
|
|
|
wf_client_callback_fn * callback,
|
|
|
|
void * user_data);
|
|
|
|
|
|
|
|
extern void
|
|
|
|
wf_impl_client_protocol_cleanup(
|
|
|
|
struct wf_client_protocol * protocol);
|
|
|
|
|
|
|
|
extern void
|
|
|
|
wf_impl_client_protocol_callback(
|
|
|
|
struct wf_client_protocol * protocol,
|
|
|
|
int reason,
|
|
|
|
void * arg);
|
|
|
|
|
|
|
|
extern void
|
|
|
|
wf_impl_client_protocol_init_lws(
|
|
|
|
struct wf_client_protocol * protocol,
|
|
|
|
struct lws_protocols * lws_protocol);
|
|
|
|
|
2020-06-11 17:12:07 +00:00
|
|
|
extern void
|
|
|
|
wf_impl_client_protocol_connect(
|
|
|
|
struct wf_client_protocol * protocol,
|
2020-06-11 20:57:56 +00:00
|
|
|
struct lws_context * conext,
|
2020-06-11 17:12:07 +00:00
|
|
|
char const * url);
|
|
|
|
|
|
|
|
extern void
|
|
|
|
wf_impl_client_protocol_disconnect(
|
|
|
|
struct wf_client_protocol * protocol);
|
|
|
|
|
2020-06-12 18:38:20 +00:00
|
|
|
extern void
|
|
|
|
wf_impl_client_protocol_authenticate(
|
|
|
|
struct wf_client_protocol * protocol);
|
|
|
|
|
2020-06-11 16:07:42 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|