1 /*
2  * COPYRIGHT:   See COPYING in the top level directory
3  * PROJECT:     ReactOS HTTP Daemon
4  * FILE:        include/http.h
5  */
6 #ifndef __HTTP_H
7 #define __HTTP_H
8 
9 #include <windows.h>
10 
11 // Generel HTTP related constants
12 #define NUMMETHODS 7
13 #define NUMGENERELS 7
14 #define NUMREQUESTS 17
15 #define NUMENTITIES 12
16 
17 // HTTP method constants
18 #define hmOPTIONS	0
19 #define hmGET		1
20 #define hmHEAD		2
21 #define hmPOST		3
22 #define hmPUT		4
23 #define hmDELETE	5
24 #define hmTRACE		6
25 
26 class CHttpParser {
27 public:
28     CHAR sBuffer[2048];
29     UINT nHead;
30     UINT nTail;
31     CHAR sUri[255];
32     CHAR sVersion[15];
33     CHAR sHeader[63];
34     CHAR sMethod[63];
35     UINT nMethodNo;
36     BOOL bUnknownMethod;
37     BOOL bBadRequest;
38     CHttpParser();
39     ~CHttpParser();
40     BOOL Complete();
41     BOOL Parse();
42 private:
43     BOOL ReadChar(LPSTR lpsStr);
44     BOOL PeekChar(LPSTR lpsStr);
45     BOOL ReadString(LPSTR lpsStr, UINT nLength);
46     BOOL ReadSpecial(LPSTR lpStr, UINT nLength);
47     VOID Skip(CHAR sStr);
48     BOOL Expect(CHAR sStr);
49     BOOL ExpectCRLF();
50     BOOL RequestLine();
51     BOOL GenerelHeader();
52     BOOL RequestHeader();
53     BOOL EntityHeader();
54     BOOL MessageBody();
55 };
56 
57 #endif /* __HTTP_H */
58