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