#ifndef LCB_HTTP_H
#define LCB_HTTP_H
#include <libcouchbase/couchbase.h>
#include "simplestring.h"
#include "sllist.h"
struct lcb_settings_st;
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
LCBHT_S_HTSTATUS = 1 << 0,
LCBHT_S_HEADER = 1 << 1,
LCBHT_S_BODY = 1 << 2,
LCBHT_S_DONE = 1 << 3,
LCBHT_S_ERROR = 1 << 4
} lcbht_RESPSTATE;
typedef struct {
sllist_node slnode;
const char *key;
const char *value;
lcb_string buf_;
} lcbht_MIMEHDR;
typedef struct {
unsigned short status;
lcbht_RESPSTATE state;
sllist_root headers;
lcb_string body;
} lcbht_RESPONSE;
typedef struct lcbht_PARSER *lcbht_pPARSER;
lcbht_pPARSER
lcbht_new(struct lcb_settings_st *settings);
void
lcbht_free(lcbht_pPARSER);
void
lcbht_reset(lcbht_pPARSER);
lcbht_RESPSTATE
lcbht_parse(lcbht_pPARSER parser, const void *data, unsigned ndata);
lcbht_RESPSTATE
lcbht_parse_ex(lcbht_pPARSER parser, const void *data, unsigned ndata,
unsigned *nused, unsigned *nbody, const char **pbody);
lcbht_RESPONSE *
lcbht_get_response(lcbht_pPARSER parser);
int
lcbht_can_keepalive(lcbht_pPARSER parser);
void
lcbht_clear_response(lcbht_RESPONSE *resp);
const char *
lcbht_get_resphdr(const lcbht_RESPONSE *response, const char *key);
char **
lcbht_make_resphdrlist(lcbht_RESPONSE *response);
#ifdef __cplusplus
}
#endif
#endif