Server 0.0.1
HTTP/REST server implementation

include/http/parser.h

Go to the documentation of this file.
00001 
00024 #ifndef __HTTP_PARSER_H__
00025 #define __HTTP_PARSER_H__
00026 
00027 #include "class.h"
00028 #include "http/message.h"
00029 #include "http/message/queue.h"
00030 #include "cbuf.h"
00031 #include "stream.h"
00032 
00033 #include "commons.h"
00034 
00035 #define PARSER_MAX_BUF  131072
00036 
00037 
00038 typedef enum e_HttpMessageState {
00039         HTTP_MESSAGE_GARBAGE=0,
00040         HTTP_MESSAGE_START,
00041         HTTP_MESSAGE_INTRO_DONE,
00042         HTTP_MESSAGE_HEADERS_DONE,
00043         HTTP_MESSAGE_DONE
00044 } HttpMessageState;
00045 
00046 
00047 CLASS(HttpParser) {
00048         Cbuf             buffer;
00049         Bool             ourLock;
00050 
00051         char *           incomplete;
00052         size_t           isize;
00053 
00054         HttpMessageQueue queue;
00055         HttpMessage      current;
00056 
00057         HttpMessageState state;
00058 };
00059 
00060 ssize_t httpParserParse(void *, Stream);
00061 void    httpParserRequestVars(HttpParser);
00062 void    httpParserHeader(HttpParser, const char *, const char *);
00063 void    httpParserNewMessage(HttpParser, const char *, const char * lend);
00064 size_t  httpParserBody(HttpParser, const char *, size_t);
00065 void    httpParserRequestVars(HttpParser);
00066 void    httpParserPostVars(HttpParser);
00067 
00068 #endif // __HTTP_PARSER_H__
00069 
00070 // vim: set ts=4 sw=4:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines