]> icculus.org git repositories - taylor/freespace2.git/blob - include/chttpget.h
Initial revision
[taylor/freespace2.git] / include / chttpget.h
1 /*
2 * $Logfile: /Freespace2/code/Inetfile/Chttpget.h $
3 * $Revision$
4 * $Date$
5 * $Author$
6 *
7 * HTTP Client class (get only)
8 *
9 * $Log$
10 * Revision 1.1  2002/05/03 03:28:12  root
11 * Initial revision
12 *
13  * 
14  * 3     8/22/99 1:19p Dave
15  * Fixed up http proxy code. Cleaned up scoring code. Reverse the order in
16  * which d3d cards are detected.
17  * 
18  * 5     8/20/99 3:01p Kevin
19  * Added support for Proxies (I hope!)
20  * 
21  * 4     7/31/98 12:19p Nate
22  * Fixed http abort problem.
23  * 
24  * 3     7/31/98 11:57a Kevin
25  * Added new functions for getting state
26  * 
27  * 2     6/01/98 10:10a Kevin
28  * Added DLL connection interface and auto update DLL
29  * 
30  * 1     5/27/98 9:54a Kevin
31  * 
32  * 1     5/25/98 5:31p Kevin
33  * Initial version
34 *
35 * $NoKeywords: $
36 */
37 #ifndef _CHTTPGET_HEADER_
38 #define _CHTTPGET_HEADER_
39
40 #define HTTP_STATE_INTERNAL_ERROR               0
41 #define HTTP_STATE_SOCKET_ERROR                 1
42 #define HTTP_STATE_URL_PARSING_ERROR    2
43 #define HTTP_STATE_CONNECTING                           3
44 #define HTTP_STATE_HOST_NOT_FOUND               4
45 #define HTTP_STATE_CANT_CONNECT                 5
46 #define HTTP_STATE_CONNECTED                            6
47 #define HTTP_STATE_FILE_NOT_FOUND               10
48 #define HTTP_STATE_RECEIVING                            11
49 #define HTTP_STATE_FILE_RECEIVED                        12
50 #define HTTP_STATE_UNKNOWN_ERROR                        13
51 #define HTTP_STATE_RECV_FAILED                  14
52 #define HTTP_STATE_CANT_WRITE_FILE              15
53 #define HTTP_STATE_STARTUP                                      16
54
55 #define MAX_URL_LEN     300
56
57 class ChttpGet
58 {
59 public:
60         ChttpGet(char *URL,char *localfile);
61         ChttpGet(char *URL,char *localfile,char *proxyip,unsigned short proxyport);
62         ~ChttpGet();
63         void GetFile(char *URL,char *localfile);
64         int GetStatus();
65         unsigned int GetBytesIn();
66         unsigned int GetTotalBytes();
67         void AbortGet();
68         void WorkerThread();
69         bool m_Aborted;
70
71 protected:
72         int ConnectSocket();
73         char *GetHTTPLine();
74         unsigned int ReadDataChannel();
75         unsigned int m_iBytesIn;
76         unsigned int m_iBytesTotal;
77         unsigned int m_State;
78         bool m_ProxyEnabled;
79         char *m_ProxyIP;
80         char m_URL[MAX_URL_LEN];
81         unsigned short m_ProxyPort;
82
83         char m_szUserName[100];
84         char m_szPassword[100];
85         char m_szHost[200];
86         char m_szDir[200];
87         char m_szFilename[100];
88         
89         bool m_Aborting;
90
91
92         SOCKET m_DataSock;
93         
94         FILE *LOCALFILE;
95         char recv_buffer[1000];
96
97 };
98
99
100
101
102
103
104
105
106
107
108 #endif
109