FS2_Open
Open source remastering of the Freespace 2 engine
chttpget.h
Go to the documentation of this file.
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 the
6  * source.
7  *
8 */
9 
10 
11 
12 #ifndef _CHTTPGET_HEADER_
13 #define _CHTTPGET_HEADER_
14 
15 #define HTTP_STATE_INTERNAL_ERROR 0
16 #define HTTP_STATE_SOCKET_ERROR 1
17 #define HTTP_STATE_URL_PARSING_ERROR 2
18 #define HTTP_STATE_CONNECTING 3
19 #define HTTP_STATE_HOST_NOT_FOUND 4
20 #define HTTP_STATE_CANT_CONNECT 5
21 #define HTTP_STATE_CONNECTED 6
22 #define HTTP_STATE_FILE_NOT_FOUND 10
23 #define HTTP_STATE_RECEIVING 11
24 #define HTTP_STATE_FILE_RECEIVED 12
25 #define HTTP_STATE_UNKNOWN_ERROR 13
26 #define HTTP_STATE_RECV_FAILED 14
27 #define HTTP_STATE_CANT_WRITE_FILE 15
28 #define HTTP_STATE_STARTUP 16
29 
30 #define MAX_URL_LEN 300
31 
32 class ChttpGet
33 {
34 public:
35  ChttpGet(char *URL,char *localfile);
36  ChttpGet(char *URL,char *localfile,char *proxyip,unsigned short proxyport);
37  ~ChttpGet();
38  void GetFile(char *URL,char *localfile);
39  int GetStatus();
40  uint GetBytesIn();
42  void AbortGet();
43  void WorkerThread();
44  bool m_Aborted;
45 
46 protected:
47  int ConnectSocket();
48  char *GetHTTPLine();
54  char *m_ProxyIP;
57 
58  char m_szUserName[100];
59  char m_szPassword[100];
60  char m_szHost[200];
61  char m_szDir[200];
62  char m_szFilename[100];
63 
64  bool m_Aborting;
65 
66 
68 
69  FILE *LOCALFILE;
70  char recv_buffer[1000];
71 
72 #ifdef SCP_UNIX
73  SDL_Thread *thread_id;
74 #endif
75 };
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 #endif
char m_szUserName[100]
Definition: chttpget.h:58
SOCKET m_DataSock
Definition: chttpget.h:67
char m_szPassword[100]
Definition: chttpget.h:59
char m_szHost[200]
Definition: chttpget.h:60
char * GetHTTPLine()
Definition: chttpget.cpp:462
uint m_iBytesTotal
Definition: chttpget.h:51
FILE * LOCALFILE
Definition: chttpget.h:69
void WorkerThread()
Definition: chttpget.cpp:224
ushort m_ProxyPort
Definition: chttpget.h:56
int ConnectSocket()
Definition: chttpget.cpp:317
unsigned int uint
Definition: pstypes.h:64
char m_szDir[200]
Definition: chttpget.h:61
bool m_Aborting
Definition: chttpget.h:64
void AbortGet()
Definition: chttpget.cpp:70
int GetStatus()
Definition: chttpget.cpp:208
#define SOCKET
Definition: config.h:122
uint GetTotalBytes()
Definition: chttpget.cpp:218
char * m_ProxyIP
Definition: chttpget.h:54
void GetFile(char *URL, char *localfile)
Definition: chttpget.cpp:99
uint m_iBytesIn
Definition: chttpget.h:50
char m_URL[MAX_URL_LEN]
Definition: chttpget.h:55
char recv_buffer[1000]
Definition: chttpget.h:70
#define MAX_URL_LEN
Definition: chttpget.h:30
uint ReadDataChannel()
Definition: chttpget.cpp:534
char m_szFilename[100]
Definition: chttpget.h:62
unsigned short ushort
Definition: pstypes.h:63
bool m_ProxyEnabled
Definition: chttpget.h:53
ChttpGet(char *URL, char *localfile)
Definition: chttpget.cpp:92
bool m_Aborted
Definition: chttpget.h:44
uint GetBytesIn()
Definition: chttpget.cpp:213
uint m_State
Definition: chttpget.h:52