| 1 |
pippijn |
1.1 |
/* |
| 2 |
|
|
* Copyright © 2005 Atheme Development Group |
| 3 |
pippijn |
1.2 |
* Rights to this code are as documented in doc/pod/license.pod. |
| 4 |
pippijn |
1.1 |
* |
| 5 |
|
|
* Generic HTTP server |
| 6 |
|
|
* |
| 7 |
pippijn |
1.2 |
* $Id: httpd.h,v 1.1 2007-07-19 08:24:55 pippijn Exp $ |
| 8 |
pippijn |
1.1 |
*/ |
| 9 |
|
|
|
| 10 |
|
|
#ifndef HTTPD_H |
| 11 |
|
|
#define HTTPD_H |
| 12 |
|
|
|
| 13 |
|
|
#include <map> |
| 14 |
|
|
|
| 15 |
pippijn |
1.2 |
#include "util.h" |
| 16 |
pippijn |
1.1 |
|
| 17 |
|
|
struct path_handler_t |
| 18 |
|
|
{ |
| 19 |
|
|
char *path; |
| 20 |
|
|
void (*handler) (connection_t *, void *); |
| 21 |
|
|
}; |
| 22 |
|
|
|
| 23 |
|
|
typedef std::vector <path_handler_t *> pathvec; |
| 24 |
|
|
|
| 25 |
|
|
struct httpddata |
| 26 |
|
|
{ |
| 27 |
|
|
char method[64]; |
| 28 |
|
|
char filename[256]; |
| 29 |
|
|
char *requestbuf; |
| 30 |
|
|
char *replybuf; |
| 31 |
|
|
int length; |
| 32 |
|
|
int lengthdone; |
| 33 |
|
|
bool connection_close; |
| 34 |
|
|
bool correct_content_type; |
| 35 |
|
|
bool expect_100_continue; |
| 36 |
|
|
bool sent_reply; |
| 37 |
|
|
}; |
| 38 |
|
|
|
| 39 |
|
|
struct pathhandler_eq |
| 40 |
|
|
{ |
| 41 |
|
|
pathhandler_eq (char const *path) : path (path) { } |
| 42 |
|
|
|
| 43 |
|
|
bool operator () (path_handler_t *other) |
| 44 |
|
|
{ |
| 45 |
|
|
return !strcmp (other->path, path); |
| 46 |
|
|
} |
| 47 |
|
|
|
| 48 |
|
|
private: |
| 49 |
|
|
path_handler_t *ph; |
| 50 |
|
|
char const *path; |
| 51 |
|
|
}; |
| 52 |
|
|
|
| 53 |
|
|
#endif |