taskrambler  0.1.9
Web server and task management solution.
parser.h
Go to the documentation of this file.
1 /**
2  * \file
3  * Parse requests from an input stream.
4  *
5  * \author Georg Hopp
6  *
7  * \copyright
8  * Copyright © 2012 Georg Hopp
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #ifndef __HTTP_PARSER_H__
25 #define __HTTP_PARSER_H__
26 
27 #include "class.h"
28 #include "http/message.h"
29 #include "queue.h"
30 #include "cbuf.h"
31 #include "stream.h"
32 
33 #include "commons.h"
34 
35 #define PARSER_MAX_BUF 131072
36 
37 
38 typedef enum e_HttpMessageState {
45 
46 
47 CLASS(HttpParser) {
48  Cbuf buffer;
49  Bool ourLock;
50 
51  char * incomplete;
52  size_t isize;
53 
54  Queue queue;
55  HttpMessage current;
56 
57  HttpMessageState state;
58 };
59 
60 ssize_t httpParserParse(void *, Stream);
61 void httpParserRequestVars(HttpParser);
62 void httpParserHeader(HttpParser, const char *, const char *);
63 void httpParserNewMessage(HttpParser, const char *, const char * lend);
64 size_t httpParserBody(HttpParser, const char *, size_t);
65 void httpParserRequestVars(HttpParser);
66 void httpParserPostVars(HttpParser);
67 
68 #endif // __HTTP_PARSER_H__
69 
70 // vim: set ts=4 sw=4:
HttpMessageState
Definition: parser.h:38
void httpParserRequestVars(HttpParser)
#define Bool
Definition: commons.h:26
ssize_t httpParserParse(void *, Stream)
void httpParserNewMessage(HttpParser, const char *, const char *lend)
Definition: new_message.c:28
void httpParserHeader(HttpParser, const char *, const char *)
Definition: p_header.c:37
CLASS(HttpParser)
Definition: parser.h:47
void httpParserPostVars(HttpParser)
Definition: p_post_vars.c:39
size_t httpParserBody(HttpParser, const char *, size_t)
Definition: p_body.c:34