2020-02-28 22:17:41 +00:00
|
|
|
#ifndef JSONRPC_REQUEST_H
|
|
|
|
#define JSONRPC_REQUEST_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>
|
2020-02-29 01:32:03 +00:00
|
|
|
#include <jsonrpc/api.h>
|
2020-02-28 22:17:41 +00:00
|
|
|
#include "jsonrpc/send_fn.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct jsonrpc_request;
|
|
|
|
|
2020-02-29 01:32:03 +00:00
|
|
|
extern JSONRPC_API bool jsonrpc_is_request(
|
2020-02-28 22:17:41 +00:00
|
|
|
json_t * message);
|
|
|
|
|
2020-02-29 01:32:03 +00:00
|
|
|
extern JSONRPC_API struct jsonrpc_request * jsonrpc_request_create(
|
2020-02-28 22:17:41 +00:00
|
|
|
int id,
|
|
|
|
jsonrpc_send_fn * send,
|
|
|
|
void * user_data);
|
|
|
|
|
2020-02-29 01:32:03 +00:00
|
|
|
extern JSONRPC_API void jsonrpc_request_dispose(
|
2020-02-28 22:17:41 +00:00
|
|
|
struct jsonrpc_request * request);
|
|
|
|
|
2020-02-29 01:32:03 +00:00
|
|
|
extern JSONRPC_API void * jsonrpc_request_get_userdata(
|
2020-02-28 22:17:41 +00:00
|
|
|
struct jsonrpc_request * request);
|
|
|
|
|
2020-02-29 01:32:03 +00:00
|
|
|
extern JSONRPC_API void jsonrpc_respond(
|
2020-02-28 22:17:41 +00:00
|
|
|
struct jsonrpc_request * request,
|
|
|
|
json_t * result);
|
|
|
|
|
2020-02-29 01:32:03 +00:00
|
|
|
extern JSONRPC_API void jsonrpc_respond_error(
|
2020-02-28 22:17:41 +00:00
|
|
|
struct jsonrpc_request * request,
|
2020-02-29 01:32:03 +00:00
|
|
|
int code,
|
|
|
|
char const * message);
|
2020-02-28 22:17:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|