1
0
mirror of https://github.com/falk-werner/webfuse synced 2024-10-27 20:34:10 +00:00
falk-werner_webfuse/lib/webfuse/core/jsonrpc/proxy.h

75 lines
1.8 KiB
C
Raw Normal View History

2020-03-01 15:55:58 +00:00
#ifndef WF_JSONRPC_PROXY_H
#define WF_JSONRPC_PROXY_H
#ifndef __cplusplus
#include <stdarg.h>
#include <stddef.h>
#include <stdbool.h>
#else
#include <cstdarg>
#include <cstddef>
using std::size_t;
#endif
#include <jansson.h>
#include "webfuse/core/jsonrpc/send_fn.h"
#include "webfuse/core/jsonrpc/proxy_finished_fn.h"
2020-02-29 01:32:03 +00:00
#ifdef __cplusplus
extern "C" {
#endif
2020-03-01 15:55:58 +00:00
struct wf_jsonrpc_proxy;
struct wf_timer_manager;
extern struct wf_jsonrpc_proxy *
2020-03-01 15:55:58 +00:00
wf_jsonrpc_proxy_create(
struct wf_timer_manager * manager,
int timeout,
2020-03-01 15:55:58 +00:00
wf_jsonrpc_send_fn * send,
void * user_data);
extern void wf_jsonrpc_proxy_dispose(
2020-03-01 15:55:58 +00:00
struct wf_jsonrpc_proxy * proxy);
2020-03-01 12:42:46 +00:00
//------------------------------------------------------------------------------
/// \brief Invokes a method.
///
/// Creates a method an sends it using the send function.
/// Proxy keeps track of method invokation. If no response is returned within
/// timeout, an error is propagated.
///
/// \param proxy pointer to proxy instance
/// \param finished function which is called exactly once, either on success or
/// on failure.
/// \param method_name name of the method to invoke
/// \param param_info types of the param (s = string, i = integer, j = json)
/// \param ... params
//------------------------------------------------------------------------------
extern void wf_jsonrpc_proxy_invoke(
2020-03-01 15:55:58 +00:00
struct wf_jsonrpc_proxy * proxy,
wf_jsonrpc_proxy_finished_fn * finished,
void * user_data,
char const * method_name,
char const * param_info,
...
);
extern void wf_jsonrpc_proxy_notify(
2020-03-01 15:55:58 +00:00
struct wf_jsonrpc_proxy * proxy,
char const * method_name,
char const * param_info,
...
);
extern void wf_jsonrpc_proxy_onresult(
2020-03-01 15:55:58 +00:00
struct wf_jsonrpc_proxy * proxy,
json_t * message);
#ifdef __cplusplus
}
#endif
#endif