| 1 |
/** |
| 2 |
* account.h: Data structures for account information. |
| 3 |
* |
| 4 |
* Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team |
| 5 |
* Rights to this code are as documented in COPYING. |
| 6 |
* |
| 7 |
* |
| 8 |
* Portions of this file were derived from sources bearing the following license: |
| 9 |
* Copyright © 2005 Atheme Development Group |
| 10 |
* Rights to this code are as documented in doc/pod/license.pod. |
| 11 |
* |
| 12 |
* Generic HTTP server |
| 13 |
* |
| 14 |
* $Id: httpd.h,v 1.4 2007-09-16 18:54:44 pippijn Exp $ |
| 15 |
*/ |
| 16 |
|
| 17 |
#ifndef HTTPD_H |
| 18 |
#define HTTPD_H |
| 19 |
|
| 20 |
#include <map> |
| 21 |
|
| 22 |
#include <util/containers.h> |
| 23 |
|
| 24 |
struct path_handler_t |
| 25 |
{ |
| 26 |
char *path; |
| 27 |
void (*handler) (connection_t *, void *); |
| 28 |
}; |
| 29 |
|
| 30 |
typedef std::vector <path_handler_t> pathvec; |
| 31 |
|
| 32 |
struct httpddata |
| 33 |
{ |
| 34 |
char method[64]; |
| 35 |
char filename[256]; |
| 36 |
char *replybuf; |
| 37 |
char *requestbuf; |
| 38 |
int length; |
| 39 |
int lengthdone; |
| 40 |
bool connection_close; |
| 41 |
bool correct_content_type; |
| 42 |
bool expect_100_continue; |
| 43 |
bool sent_reply; |
| 44 |
|
| 45 |
httpddata () |
| 46 |
: replybuf (0), |
| 47 |
requestbuf (0), |
| 48 |
length (0), |
| 49 |
lengthdone (0), |
| 50 |
connection_close (false), |
| 51 |
correct_content_type (false), |
| 52 |
expect_100_continue (false), |
| 53 |
sent_reply (false) |
| 54 |
{ |
| 55 |
method[0] = 0; |
| 56 |
filename[0] = 0; |
| 57 |
} |
| 58 |
|
| 59 |
void clear (void); |
| 60 |
}; |
| 61 |
|
| 62 |
struct pathhandler_eq |
| 63 |
{ |
| 64 |
pathhandler_eq (char const * const otherpath) |
| 65 |
: path (otherpath) |
| 66 |
{ |
| 67 |
} |
| 68 |
|
| 69 |
bool operator () (path_handler_t const &other) |
| 70 |
{ |
| 71 |
return !strcmp (other.path, path); |
| 72 |
} |
| 73 |
|
| 74 |
private: |
| 75 |
char const * const path; |
| 76 |
}; |
| 77 |
|
| 78 |
#endif |