Commit 7a3343c8c885ecf1d925a095c334a6f635330995

Authored by Georg Hopp
1 parent 8786d478

Make the whole thing build again, anyway no guarantee that it works

... ... @@ -34,24 +34,24 @@
34 34 #include "asset.h"
35 35
36 36
37   -TR_CLASS(HttpResponse) {
  37 +TR_CLASS(TR_HttpResponse) {
38 38 TR_EXTENDS(HttpMessage);
39 39
40 40 unsigned int status;
41 41 char * reason;
42 42 };
43   -TR_INSTANCE_INIT(HttpResponse);
44   -TR_CLASSVARS_DECL(HttpResponse) {};
  43 +TR_INSTANCE_INIT(TR_HttpResponse);
  44 +TR_CLASSVARS_DECL(TR_HttpResponse) {};
45 45
46   -HttpResponse httpResponse304(
  46 +TR_HttpResponse httpResponse304(
47 47 const char *, size_t,
48 48 const char *, size_t,
49 49 const char *, size_t);
50   -HttpResponse httpResponse403();
51   -HttpResponse httpResponse404();
52   -HttpResponse httpResponse500();
53   -HttpResponse httpResponseJson(const char *, size_t);
54   -HttpResponse httpResponseAsset(const char *, size_t, time_t);
  50 +TR_HttpResponse httpResponse403();
  51 +TR_HttpResponse httpResponse404();
  52 +TR_HttpResponse httpResponse500();
  53 +TR_HttpResponse httpResponseJson(const char *, size_t);
  54 +TR_HttpResponse httpResponseAsset(const char *, size_t, time_t);
55 55
56 56 #endif // __HTTP_RESPONSE_H__
57 57
... ...
... ... @@ -54,7 +54,7 @@ TR_CLASS(Router) {
54 54 TR_INSTANCE_INIT(Router);
55 55 TR_CLASSVARS_DECL(Router) {};
56 56
57   -HttpResponse routerRoute(Router, HttpRequest, Session);
  57 +TR_HttpResponse routerRoute(Router, HttpRequest, Session);
58 58
59 59 #endif // __ROUTER_H__
60 60
... ...
... ... @@ -19,7 +19,7 @@ TR = ./application/.libs/libapplication.a \
19 19 ./config/.libs/libconfig.a \
20 20 ./router/.libs/librouter.a
21 21
22   -TRLIBS = -ltrbase -ltrhashing -ltrio -ltrdata -ltrutils -ltrhttpserver
  22 +TRLIBS = -ltrbase -ltrhash -ltrio -ltrdata -ltrutils -ltrhttpserver
23 23 USEDLIBS = -lrt -lssl -lcrypto -lldap -lgdbm -luuid
24 24
25 25 AM_CFLAGS += -I../include/
... ...
... ... @@ -60,7 +60,7 @@ TR_INIT_IFACE(
60 60 TR_INIT_IFACE(TR_Observer, applicationAdapterHttpUpdate);
61 61 TR_CREATE_CLASS(
62 62 ApplicationAdapterHttp,
63   - NULL,
  63 + NULL,
64 64 NULL,
65 65 TR_IF(TR_Class),
66 66 TR_IF(TR_Observer));
... ...
... ... @@ -56,13 +56,13 @@ applicationSessionCleanup(Application this, time_t now)
56 56 tmp_buf,
57 57 &(this->active_sessions[SESSION_LIVETIME - expired]),
58 58 expired * sizeof(struct sessinfo));
59   -
  59 +
60 60 TR_MEM_FREE(this->active_sessions);
61 61 this->active_sessions = tmp_buf;
62 62 }
63 63
64 64 for (i=0; i<expired; i++) {
65   - TR_treeDestroy(&(this->active_sessions[i].ip_index), NULL);
  65 + TR_treeDestroy(this->active_sessions[i].ip_index, NULL);
66 66 TR_hashCleanup(this->active_sessions[i].sessions);
67 67 }
68 68
... ...
... ... @@ -73,17 +73,17 @@ applicationSessionGet(Application this, const char * sid, uint32_t ip)
73 73 */
74 74 sess->livetime = this->session_time_ofs + SESSION_LIVETIME;
75 75 sess = (Session)TR_treeDelete(
76   - &((this->active_sessions)[index].ip_index),
  76 + (this->active_sessions)[index].ip_index,
77 77 &ip, sessionIpIndexComp);
78 78 TR_hashAdd((this->active_sessions)[0].sessions, sess);
79 79 TR_treeInsert(
80   - &((this->active_sessions)[0].ip_index),
  80 + (this->active_sessions)[0].ip_index,
81 81 sess,
82 82 sessionIpIndexComp);
83 83 break;
84 84 } else {
85 85 sess = (Session)TR_treeDelete(
86   - &((this->active_sessions)[index].ip_index),
  86 + (this->active_sessions)[index].ip_index,
87 87 &ip, sessionIpIndexComp);
88 88 if (NULL != sess) {
89 89 // we have a previous session from this ip, remove it.
... ...
... ... @@ -59,7 +59,7 @@ applicationSessionStart(Application this, uint32_t ip)
59 59
60 60 TR_hashAdd((this->active_sessions)[0].sessions, sess);
61 61 TR_treeInsert(
62   - &((this->active_sessions)[0].ip_index),
  62 + (this->active_sessions)[0].ip_index,
63 63 sess,
64 64 sessionIpIndexComp);
65 65
... ...
... ... @@ -51,7 +51,7 @@ sessionIpIndexComp(const void * a, const void * b)
51 51 void
52 52 applicationSessionStop(Application this, Session session)
53 53 {
54   - int index = SESSION_LIVETIME -
  54 + int index = SESSION_LIVETIME -
55 55 (session->livetime - this->session_time_ofs);
56 56
57 57 if (SESSION_LIVETIME > index) {
... ... @@ -59,7 +59,7 @@ applicationSessionStop(Application this, Session session)
59 59 (this->active_sessions)[index].sessions,
60 60 session->hash);
61 61 TR_treeDelete(
62   - &((this->active_sessions)[index].ip_index),
  62 + (this->active_sessions)[index].ip_index,
63 63 session, sessionIpIndexComp);
64 64 }
65 65 }
... ...
... ... @@ -88,7 +88,7 @@ httpParserParse(void * _this, TR_Stream st)
88 88 cont = 0;
89 89 break;
90 90 }
91   -
  91 +
92 92 httpParserNewMessage(this, line, line_end);
93 93 if (NULL == this->current) {
94 94 TR_cbufRelease(this->buffer);
... ... @@ -178,7 +178,7 @@ httpParserParse(void * _this, TR_Stream st)
178 178 }
179 179 }
180 180
181   - return this->queue->nmsg;
  181 + return TR_queueSize(this->queue);
182 182 }
183 183
184 184 // vim: set ts=4 sw=4:
... ...
... ... @@ -35,10 +35,10 @@ static
35 35 int
36 36 httpResponseCtor(void * _this, va_list * params)
37 37 {
38   - HttpResponse this = _this;
  38 + TR_HttpResponse this = _this;
39 39 char * reason;
40 40
41   - TR_PARENTCALL(TR_Response, _this, TR_Class, ctor, params);
  41 + TR_PARENTCALL(TR_HttpResponse, _this, TR_Class, ctor, params);
42 42
43 43 this->status = va_arg(* params, unsigned int);
44 44 reason = va_arg(* params, char *);
... ... @@ -53,18 +53,18 @@ static
53 53 void
54 54 httpResponseDtor(void * _this)
55 55 {
56   - HttpResponse this = _this;
  56 + TR_HttpResponse this = _this;
57 57
58 58 TR_MEM_FREE(this->reason);
59 59
60   - TR_PARENTCALL(TR_Response, _this, TR_Class, dtor);
  60 + TR_PARENTCALL(TR_HttpResponse, _this, TR_Class, dtor);
61 61 }
62 62
63 63 static
64 64 size_t
65 65 sizeGet(void * _this)
66 66 {
67   - HttpResponse this = _this;
  67 + TR_HttpResponse this = _this;
68 68 size_t size = 0;
69 69
70 70 size += strlen(((HttpMessage)this)->version) + 1;
... ... @@ -78,7 +78,7 @@ static
78 78 char *
79 79 toString(void * _this, char * string)
80 80 {
81   - HttpResponse this = _this;
  81 + TR_HttpResponse this = _this;
82 82
83 83 strcpy(string, ((HttpMessage)this)->version);
84 84 string += strlen(string);
... ... @@ -99,7 +99,7 @@ toString(void * _this, char * string)
99 99 TR_INIT_IFACE(TR_Class, httpResponseCtor, httpResponseDtor, NULL);
100 100 TR_INIT_IFACE(HttpIntro, sizeGet, toString);
101 101 TR_CREATE_CLASS(
102   - HttpResponse,
  102 + TR_HttpResponse,
103 103 HttpMessage,
104 104 NULL,
105 105 TR_IF(TR_Class),
... ...
... ... @@ -28,16 +28,16 @@
28 28 #include "http/message.h"
29 29 #include "http/header.h"
30 30
31   -HttpResponse
  31 +TR_HttpResponse
32 32 httpResponse304(
33 33 const char * mime, size_t nmime,
34 34 const char * etag, size_t netag,
35 35 const char * mtime, size_t nmtime)
36 36 {
37   - HttpResponse response;
  37 + TR_HttpResponse response;
38 38 HttpMessage message;
39 39
40   - response = TR_new(HttpResponse, "HTTP/1.1", 304, "Not Modified");
  40 + response = TR_new(TR_HttpResponse, "HTTP/1.1", 304, "Not Modified");
41 41 message = (HttpMessage)response;
42 42
43 43 message->nbody = 0;
... ...
... ... @@ -31,13 +31,13 @@
31 31 #include "http/header.h"
32 32
33 33
34   -HttpResponse
  34 +TR_HttpResponse
35 35 httpResponse403()
36 36 {
37   - HttpResponse response;
  37 + TR_HttpResponse response;
38 38 HttpMessage message;
39 39
40   - response = TR_new(HttpResponse, "HTTP/1.1", 403, "Forbidden");
  40 + response = TR_new(TR_HttpResponse, "HTTP/1.1", 403, "Forbidden");
41 41 message = (HttpMessage)response;
42 42
43 43 message->nbody = 0;
... ...
... ... @@ -40,13 +40,13 @@
40 40 "</html>"
41 41
42 42
43   -HttpResponse
  43 +TR_HttpResponse
44 44 httpResponse404()
45 45 {
46   - HttpResponse response;
  46 + TR_HttpResponse response;
47 47 HttpMessage message;
48 48
49   - response = TR_new(HttpResponse, "HTTP/1.1", 404, "Not Found");
  49 + response = TR_new(TR_HttpResponse, "HTTP/1.1", 404, "Not Found");
50 50 message = (HttpMessage)response;
51 51
52 52 TR_hashAdd(message->header,
... ...
... ... @@ -40,13 +40,13 @@
40 40 "</html>"
41 41
42 42
43   -HttpResponse
  43 +TR_HttpResponse
44 44 httpResponse500()
45 45 {
46   - HttpResponse response;
  46 + TR_HttpResponse response;
47 47 HttpMessage message;
48 48
49   - response = TR_new(HttpResponse, "HTTP/1.1", 500, "Internal Server Error");
  49 + response = TR_new(TR_HttpResponse, "HTTP/1.1", 500, "Internal Server Error");
50 50 message = (HttpMessage)response;
51 51
52 52 TR_hashAdd(message->header,
... ...
... ... @@ -52,10 +52,10 @@
52 52 #include "asset.h"
53 53
54 54
55   -HttpResponse
  55 +TR_HttpResponse
56 56 httpResponseAsset(const char * fname, size_t nfname, time_t exptime)
57 57 {
58   - HttpResponse response;
  58 + TR_HttpResponse response;
59 59 HttpMessage message;
60 60 Asset asset = assetPoolGet(fname, nfname);
61 61 char expires[200];
... ... @@ -65,7 +65,7 @@ httpResponseAsset(const char * fname, size_t nfname, time_t exptime)
65 65 return NULL;
66 66 }
67 67
68   - response = TR_new(HttpResponse, "HTTP/1.1", 200, "OK");
  68 + response = TR_new(TR_HttpResponse, "HTTP/1.1", 200, "OK");
69 69 message = (HttpMessage)response;
70 70
71 71 message->asset = asset;
... ...
... ... @@ -33,13 +33,13 @@
33 33 #include "http/header.h"
34 34 #include "session.h"
35 35
36   -HttpResponse
  36 +TR_HttpResponse
37 37 httpResponseJson(const char * body, size_t nbody)
38 38 {
39   - HttpResponse response;
  39 + TR_HttpResponse response;
40 40 HttpMessage message;
41 41
42   - response = TR_new(HttpResponse, "HTTP/1.1", 200, "OK");
  42 + response = TR_new(TR_HttpResponse, "HTTP/1.1", 200, "OK");
43 43 message = (HttpMessage)response;
44 44
45 45 TR_hashAdd(message->header,
... ...
... ... @@ -49,7 +49,7 @@ httpWorkerAddCommonHeader(HttpWorker this)
49 49 TR_hashAdd(this->current_response->header,
50 50 TR_new(HttpHeader, CSTRA("Server"), CSTRA(PACKAGE_STRING)));
51 51
52   - switch(((HttpResponse)this->current_response)->status) {
  52 + switch(((TR_HttpResponse)this->current_response)->status) {
53 53 case 304:
54 54 break;
55 55
... ...
... ... @@ -129,7 +129,7 @@ httpWorkerProcess(HttpWorker this, TR_Stream st)
129 129 }
130 130 }
131 131
132   - return this->writer->queue->nmsg;
  132 + return TR_queueSize(this->writer->queue);
133 133 }
134 134
135 135 // vim: set ts=4 sw=4:
... ...
... ... @@ -145,8 +145,8 @@ httpWriterWrite(void * _this, TR_Stream st)
145 145 }
146 146
147 147 return NULL == this->current ?
148   - this->queue->nmsg :
149   - this->queue->nmsg + 1;
  148 + TR_queueSize(this->queue) :
  149 + TR_queueSize(this->queue) + 1;
150 150 }
151 151
152 152 // vim: set ts=4 sw=4:
... ...
... ... @@ -48,7 +48,7 @@
48 48 #define COMMAND_LEN 128
49 49
50 50
51   -HttpResponse
  51 +TR_HttpResponse
52 52 routerRoute(
53 53 Router this,
54 54 HttpRequest request,
... ... @@ -62,14 +62,14 @@ routerRoute(
62 62 char * command;
63 63 size_t ncommand;
64 64 char * response_data;
65   - HttpResponse response;
  65 + TR_HttpResponse response;
66 66
67 67 if ('/' != request->uri[0]) {
68 68 /*
69 69 * we only support absolute paths within our
70 70 * application
71 71 */
72   - return NULL;
  72 + return (void *)NULL;
73 73 }
74 74
75 75 command = &(request->uri[1]);
... ... @@ -121,7 +121,7 @@ routerRoute(
121 121
122 122 default:
123 123 /* other methods are not subject of REST */
124   - return NULL;
  124 + return (void *)NULL;
125 125 }
126 126
127 127 /*
... ... @@ -243,7 +243,7 @@ routerRoute(
243 243 */
244 244 }
245 245
246   - return NULL;
  246 + return (void *)NULL;
247 247 }
248 248
249 249 /*
... ...
... ... @@ -128,7 +128,7 @@ httpGetMessage(
128 128 const char * part3, size_t len3)
129 129 {
130 130 if (isHttpVersion(part1, len1)) {
131   - return TR_new(HttpResponse,
  131 + return TR_new(TR_HttpResponse,
132 132 part1, len1,
133 133 strtoul(part2, NULL, 10),
134 134 part3, len3);
... ...
Please register or login to post a comment