| 27 */ |
27 */ |
| 28 |
28 |
| 29 #include "vserver.h" |
29 #include "vserver.h" |
| 30 |
30 |
| 31 #include <cx/hash_map.h> |
31 #include <cx/hash_map.h> |
| |
32 #include <cx/array_list.h> |
| 32 |
33 |
| 33 VirtualServer* vs_new(pool_handle_t *pool) { |
34 VirtualServer* vs_new(pool_handle_t *pool) { |
| 34 VirtualServer *vs = pool_malloc(pool, sizeof(VirtualServer)); |
35 VirtualServer *vs = pool_malloc(pool, sizeof(VirtualServer)); |
| 35 ZERO(vs, sizeof(VirtualServer)); |
36 ZERO(vs, sizeof(VirtualServer)); |
| 36 vs->pool = pool; |
37 vs->pool = pool; |
| 50 |
51 |
| 51 |
52 |
| 52 return 0; |
53 return 0; |
| 53 } |
54 } |
| 54 |
55 |
| |
56 int vs_add_location(VirtualServer *vs, WSLocation *location) { |
| |
57 void **begin = (void**)&vs->locations_begin; |
| |
58 void **end = (void**)&vs->locations_end; |
| |
59 cx_linked_list_add(begin, end, offsetof(WSLocation, prev), offsetof(WSLocation, next), location); |
| |
60 return 0; |
| |
61 } |
| 55 |
62 |
| 56 // public API |
63 // public API |
| 57 |
64 |
| 58 char* vs_translate_uri(const VirtualServer *vs, const char *uri) { |
65 char* vs_translate_uri(const VirtualServer *vs, const char *uri) { |
| 59 // TODO: implement |
66 // TODO: implement |