hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
HttpParser.h
Go to the documentation of this file.
1 #ifndef HTTPPARSER_H
2 #define HTTPPARSER_H
3 #include <sys/types.h>
4 #include <stdlib.h>
5 #include <string.h>
6 #include <new>
7 #include <List.h>
8 
9 #define HTTP_GET 0
10 #define HTTP_POST 1
11 #define delimiter(x) ( (x) == ' ' || (x) == '\t' || (x) == '\n' || (x) == '\r')
12 
13 struct Variable
14 {
15  char *name;
16  char *value;
17 };
19 {
20  public:
21  HttpParser(const char *content, size_t contentLen);
22  ~HttpParser();
23  char* getByName(const char *var);
24  List<Variable*>* getAll(){return &vars;}
25  short getMethod(){return method;}
26  private:
27  void parseGET();
28  void parsePOST();
29  void parse(const char *pos);
30  List<Variable*> vars;
31  short method;
32  const char *content;
33  size_t contentLen;
34 };
35 #endif
36