-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.h
39 lines (30 loc) · 1.16 KB
/
client.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
32
33
34
35
36
37
38
39
// Copyright 2017 by Peter Ohler, All Rights Reserved
#ifndef __OPOC_CLIENT_H__
#define __OPOC_CLIENT_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdio.h>
#include "val.h"
typedef struct _opoClient *opoClient;
typedef uint64_t opoRef;
typedef void (*opoQueryCallback)(opoRef ref, opoMsg response, void *ctx);
typedef void (*opoStatusCallback)(opoClient client, bool connected, opoErrCode code, const char *msg);
typedef struct _opoClientOptions {
double timeout;
int pending_max;
opoStatusCallback status_callback;
opoQueryCallback query_callback;
void *query_ctx;
} *opoClientOptions;
extern opoClient opo_client_connect(opoErr err, const char *host, int port, opoClientOptions options);
extern void opo_client_close(opoClient client);
extern opoRef opo_client_query(opoErr err, opoClient client, opoVal query, opoQueryCallback cb, void *ctx);
extern int opo_client_process(opoClient client, int max, double wait);
extern int opo_client_pending_count(opoClient client);
extern int opo_client_ready_count(opoClient client);
#ifdef __cplusplus
}
#endif
#endif /* __OPOC_CLIENT_H__ */