You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
969 B
C

#ifndef CMD_H
#define CMD_H
#include <stdlib.h>
#include <hiredis/async.h>
14 years ago
#include <sys/queue.h>
#include <event.h>
14 years ago
#include <evhttp.h>
struct evhttp_request;
14 years ago
struct server;
struct cmd;
14 years ago
typedef void (*formatting_fun)(redisAsyncContext *, void *, void *);
struct cmd {
int count;
const char **argv;
size_t *argv_len;
struct evhttp_request *rq;
14 years ago
struct evkeyvalq uri_params;
14 years ago
int started_responding;
/* HTTP data */
const char *mime;
char *if_none_match;
};
14 years ago
struct pubsub_client {
struct server *s;
struct evhttp_request *rq;
};
struct reply_format {
const char *s;
size_t sz;
formatting_fun f;
const char *ct;
};
struct cmd *
cmd_new(struct evhttp_request *rq, int count);
void
cmd_free(struct cmd *c);
int
14 years ago
cmd_run(struct server *s, struct evhttp_request *rq,
14 years ago
const char *uri, size_t uri_len);
int
cmd_read_params(struct cmd *cmd, const char *uri, size_t uri_len, formatting_fun *f_format);
14 years ago
14 years ago
int
cmd_is_subscribe(struct cmd *cmd);
#endif