-
Notifications
You must be signed in to change notification settings - Fork 19
/
neat_pm_socket.h
31 lines (25 loc) · 1 KB
/
neat_pm_socket.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef NEAT_PM_SOCKET_INCLUDE
#define NEAT_PM_SOCKET_INCLUDE
#include "neat.h"
#include "neat_internal.h"
#include <uv.h>
#include <jansson.h>
enum {
PM_ERROR_OK = 0,
PM_ERROR_SOCKET_UNAVAILABLE,
PM_ERROR_SOCKET,
PM_ERROR_INVALID_JSON,
PM_ERROR_OOM,
};
typedef void (*pm_error_callback)(struct neat_ctx *ctx, struct neat_flow *flow, int error);
typedef void (*pm_reply_callback)(struct neat_ctx *ctx, struct neat_flow *flow, json_t *json);
struct neat_pm_context {
char* output_buffer;
pm_error_callback on_pm_error;
pm_reply_callback on_pm_reply;
struct neat_ipc_context *ipc_context;
uv_timer_t* timer;
};
neat_error_code nt_json_send_once(struct neat_ctx *ctx, struct neat_flow *flow, const char *path, json_t *json, pm_reply_callback cb, pm_error_callback err_cb);
neat_error_code nt_json_send_once_no_reply(struct neat_ctx *ctx, struct neat_flow *flow, const char *path, json_t *json, pm_reply_callback cb, pm_error_callback err_cb);
#endif /* ifndef NEAT_PM_SOCKET_INCLUDE */