Added security guarantee
[iotcloud.git] / src / server / iotquery.h
1 #ifndef IOTQUERY_H
2 #define IOTQUERY_H
3 #include <iostream>
4 #include "fcgio.h"
5 #include "fcgi_stdio.h"
6 #include <dirent.h>
7
8 #define DEFAULT_SIZE 128
9 #define OFFSET_MAX 0
10 #define OFFSET_FIRST 4
11 #define OFFSET_LAST 12
12
13 class IoTQuery {
14  public:
15         IoTQuery(FCGX_Request * request);
16         ~IoTQuery();
17         void processQuery();
18         
19  private:
20         void getQuery();
21         void getDirectory();
22         void readData();
23         bool checkDirectory();
24         bool openStatusFile();
25         void updateStatusFile();
26         void decodeQuery();
27         void getSlot();
28         void putSlot();
29         
30         FCGX_Request * request;
31         char *data;
32         char *directory;
33         const char * uri;
34         const char * query;
35         const char * method;
36         const char * iotcloudroot;
37         DIR *dir;
38         long length;
39         long firstentry;
40         long lastentry;
41         long requestsequencenumber;
42         int numqueueentries;
43         int fd;
44         bool reqGetSlot;
45         bool reqPutSlot;
46 };
47 #endif