forked from nicolasff/webdis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmd.h
57 lines (41 loc) · 946 Bytes
/
cmd.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef CMD_H
#define CMD_H
#include <stdlib.h>
#include <hiredis/async.h>
#include <sys/queue.h>
#include <event.h>
#include <evhttp.h>
struct evhttp_request;
struct server;
struct cmd;
typedef void (*formatting_fun)(redisAsyncContext *, void *, void *);
struct cmd {
int count;
const char **argv;
size_t *argv_len;
struct evhttp_request *rq;
struct evkeyvalq uri_params;
int started_responding;
/* HTTP data */
char *mime;
int mime_free;
char *if_none_match;
};
struct pubsub_client {
struct server *s;
struct cmd *cmd;
struct evhttp_request *rq;
};
struct cmd *
cmd_new(struct evhttp_request *rq, int count);
void
cmd_free(struct cmd *c);
int
cmd_run(struct server *s, struct evhttp_request *rq,
const char *uri, size_t uri_len,
const char *body, size_t body_len);
int
cmd_select_format(struct cmd *cmd, const char *uri, size_t uri_len, formatting_fun *f_format);
int
cmd_is_subscribe(struct cmd *cmd);
#endif