]> icculus.org git repositories - taylor/freespace2.git/blob - include/cftp.h
rendering functions mostly done; more complete shader setup
[taylor/freespace2.git] / include / cftp.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/CFtp.h $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * FTP 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  * 2     4/20/99 6:39p Dave
26  * Almost done with artillery targeting. Added support for downloading
27  * images on the PXO screen.
28  * 
29  * 1     4/20/99 4:37p Dave
30  * 
31  * Initial version
32  *
33  * $NoKeywords: $
34  */
35 #ifndef _CFTP_HEADER_
36 #define _CFTP_HEADER_
37
38 #define FTP_STATE_INTERNAL_ERROR                0
39 #define FTP_STATE_SOCKET_ERROR          1
40 #define FTP_STATE_URL_PARSING_ERROR     2
41 #define FTP_STATE_CONNECTING                    3
42 #define FTP_STATE_HOST_NOT_FOUND                4
43 #define FTP_STATE_CANT_CONNECT          5
44 #define FTP_STATE_LOGGING_IN                    6
45 #define FTP_STATE_LOGIN_ERROR                   7
46 #define FTP_STATE_LOGGED_IN                     8
47 #define FTP_STATE_DIRECTORY_INVALID     9
48 #define FTP_STATE_FILE_NOT_FOUND                10
49 #define FTP_STATE_RECEIVING                     11
50 #define FTP_STATE_FILE_RECEIVED         12
51 #define FTP_STATE_UNKNOWN_ERROR         13
52 #define FTP_STATE_RECV_FAILED                   14
53 #define FTP_STATE_CANT_WRITE_FILE       15
54 #define FTP_STATE_STARTUP                               16
55
56
57 extern int FTPObjThread( void * obj );
58
59 class CFtpGet
60 {
61
62 public:
63         CFtpGet(char *URL,char *localfile,char *Username = NULL,char *Password = NULL);
64         ~CFtpGet();
65         int GetStatus();
66         unsigned int GetBytesIn();
67         unsigned int GetTotalBytes();
68         void AbortGet();
69
70         void WorkerThread();
71
72 protected:
73         
74         int ConnectControlSocket();
75         int LoginHost();        
76         unsigned int SendFTPCommand(char *command);
77         unsigned int ReadFTPServerReply();
78         unsigned int GetFile();
79         unsigned int IssuePort();
80         unsigned int ReadDataChannel();
81         void FlushControlChannel();
82
83         unsigned int m_iBytesIn;
84         unsigned int m_iBytesTotal;
85         unsigned int m_State;
86
87         bool m_Aborting;
88         bool m_Aborted;
89
90         char m_szUserName[100];
91         char m_szPassword[100];
92         char m_szHost[200];
93         char m_szDir[200];
94         char m_szFilename[100];
95         
96         char recv_buffer[1000];
97
98         SOCKET m_ListenSock;
99         SOCKET m_DataSock;
100         SOCKET m_ControlSock;
101
102         FILE *LOCALFILE;
103 };
104
105
106
107 #endif
108