torrent-stats/httpd.h

45 lines
895 B
C
Raw Permalink Normal View History

2007-06-18 15:44:05 +02:00
#ifndef _HTTPD_H_
#define _HTTPD_H_
#include <netinet/in.h>
#include "event.h"
#include "list.h"
struct httpd_con {
struct sockaddr_in addr;
struct event_fd *event;
int fd;
char *req_data;
unsigned int req_size;
char **req_headers;
unsigned int req_header_cnt;
char **req_args;
unsigned int req_arg_cnt;
};
struct httpd_callback {
struct list_head list;
char *name;
int wildcard;
int (* callback)(struct httpd_con *con, void *privdata);
void *privdata;
};
int httpd_send_header(struct httpd_con *con, char *code, char *type);
int httpd_send_error(struct httpd_con *con, char *code, char *msg);
struct httpd_callback * httpd_add_cb(const char *name, int flags, int (* cb)(struct httpd_con *con, void *privdata), void *privdata);
int httpd_remove_cb(struct httpd_callback *cb);
int httpd_accept_handler(int fd, void *privdata);
2009-05-03 14:20:03 +02:00
int httpd_free(void);
2007-06-18 15:44:05 +02:00
#endif // _HTTP_H_