git.ucc.asn.au
/
matches
/
MCTX3420.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of github:szmoore/MCTX3420 into intertest
[matches/MCTX3420.git]
/
server
/
fastcgi.c
diff --git
a/server/fastcgi.c
b/server/fastcgi.c
index
b58ba79
..
092eaed
100644
(file)
--- a/
server/fastcgi.c
+++ b/
server/fastcgi.c
@@
-12,8
+12,10
@@
#include "common.h"
#include "sensor.h"
#include "common.h"
#include "sensor.h"
+#include "actuator.h"
#include "control.h"
#include "options.h"
#include "control.h"
#include "options.h"
+#include "image.h"
/**The time period (in seconds) before the control key expires @ */
#define CONTROL_TIMEOUT 180
/**The time period (in seconds) before the control key expires @ */
#define CONTROL_TIMEOUT 180
@@
-237,14
+239,19
@@
bool FCGI_ParseRequest(FCGIContext *context, char *params, FCGIValue values[], s
case FCGI_BOOL_T:
*((bool*) val->value) = true;
break;
case FCGI_BOOL_T:
*((bool*) val->value) = true;
break;
- case FCGI_
LONG_T:
-
*((long*) val->value)
= strtol(value, &ptr, 10);
+ case FCGI_
INT_T: case FCGI_LONG_T: {
+
long parsed
= strtol(value, &ptr, 10);
if (!*value || *ptr) {
snprintf(buf, BUFSIZ, "Expected int for '%s' but got '%s'", key, value);
FCGI_RejectJSON(context, FCGI_EscapeJSON(buf));
return false;
}
if (!*value || *ptr) {
snprintf(buf, BUFSIZ, "Expected int for '%s' but got '%s'", key, value);
FCGI_RejectJSON(context, FCGI_EscapeJSON(buf));
return false;
}
- break;
+
+ if (FCGI_TYPE(val->flags) == FCGI_INT_T)
+ *((int*) val->value) = parsed;
+ else
+ *((long*) val->value) = parsed;
+ } break;
case FCGI_DOUBLE_T:
*((double*) val->value) = strtod(value, &ptr);
if (!*value || *ptr) {
case FCGI_DOUBLE_T:
*((double*) val->value) = strtod(value, &ptr);
if (!*value || *ptr) {
@@
-427,6
+434,17
@@
void FCGI_PrintRaw(const char *format, ...)
va_end(list);
}
va_end(list);
}
+
+/**
+ * Write binary data
+ * See fwrite
+ */
+void FCGI_WriteBinary(void * data, size_t size, size_t num_elem)
+{
+ Log(LOGDEBUG,"Writing!");
+ FCGI_fwrite(data, size, num_elem, FCGI_stdout);
+}
+
/**
* Main FCGI request loop that receives/responds to client requests.
* @param data Reserved.
/**
* Main FCGI request loop that receives/responds to client requests.
* @param data Reserved.
@@
-439,8
+457,6
@@
void * FCGI_RequestLoop (void *data)
Log(LOGDEBUG, "First request...");
while (FCGI_Accept() >= 0) {
Log(LOGDEBUG, "First request...");
while (FCGI_Accept() >= 0) {
-
-
Log(LOGDEBUG, "Got request #%d", context.response_number);
ModuleHandler module_handler = NULL;
char module[BUFSIZ], params[BUFSIZ];
Log(LOGDEBUG, "Got request #%d", context.response_number);
ModuleHandler module_handler = NULL;
char module[BUFSIZ], params[BUFSIZ];
@@
-464,6
+480,10
@@
void * FCGI_RequestLoop (void *data)
module_handler = Control_Handler;
} else if (!strcmp("sensors", module)) {
module_handler = Sensor_Handler;
module_handler = Control_Handler;
} else if (!strcmp("sensors", module)) {
module_handler = Sensor_Handler;
+ } else if (!strcmp("actuators", module)) {
+ module_handler = Actuator_Handler;
+ } else if (!strcmp("image", module)) {
+ module_handler = Image_Handler;
}
context.current_module = module;
}
context.current_module = module;
UCC
git Repository :: git.ucc.asn.au