| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/Main/lib/CFtp.h $ |
| 21 | * $Revision: 1.3 $ |
| 22 | * $Date: 2004/02/09 04:14:51 $ |
| 23 | * $Author: kevinb $ |
| 24 | * |
| 25 | * FTP Client class (get only) |
| 26 | * |
| 27 | * $Log: CFtp.h,v $ |
| 28 | * Revision 1.3 2004/02/09 04:14:51 kevinb |
| 29 | * Added newlines to all headers to reduce number of warnings printed |
| 30 | * |
| 31 | * Made some small changes to get everything compiling. |
| 32 | * |
| 33 | * All Ready to merge the 1.5 tree. |
| 34 | * |
| 35 | * Revision 1.2 2000/06/03 14:30:33 icculus |
| 36 | * 1.4 code merge and pthread->SDL thread conversion. |
| 37 | * |
| 38 | * Revision 1.1.1.1 2000/04/18 00:00:38 icculus |
| 39 | * initial checkin |
| 40 | * |
| 41 | * |
| 42 | * 4 8/21/99 6:48a Jeff |
| 43 | * Linux port |
| 44 | * |
| 45 | * 3 7/31/98 11:40a Kevin |
| 46 | * |
| 47 | * 2 6/01/98 10:10a Kevin |
| 48 | * Added DLL connection interface and auto update DLL |
| 49 | * |
| 50 | * 1 5/27/98 9:54a Kevin |
| 51 | * |
| 52 | * 1 5/25/98 5:31p Kevin |
| 53 | * Initial version |
| 54 | * |
| 55 | * $NoKeywords: $ |
| 56 | */ |
| 57 | #ifndef _CFTP_HEADER_ |
| 58 | #define _CFTP_HEADER_cxx . . $ `netcon/includes/CFtp.h:58:9`! |
| 59 | |
| 60 | #include <cstdint> |
| 61 | |
| 62 | #define FTP_STATE_INTERNAL_ERRORcxx . . $ `netcon/includes/CFtp.h:62:9`! 0 |
| 63 | #define FTP_STATE_SOCKET_ERRORcxx . . $ `netcon/includes/CFtp.h:63:9`! 1 |
| 64 | #define FTP_STATE_URL_PARSING_ERRORcxx . . $ `netcon/includes/CFtp.h:64:9`! 2 |
| 65 | #define FTP_STATE_CONNECTINGcxx . . $ `netcon/includes/CFtp.h:65:9`! 3 |
| 66 | #define FTP_STATE_HOST_NOT_FOUNDcxx . . $ `netcon/includes/CFtp.h:66:9`! 4 |
| 67 | #define FTP_STATE_CANT_CONNECTcxx . . $ `netcon/includes/CFtp.h:67:9`! 5 |
| 68 | #define FTP_STATE_LOGGING_INcxx . . $ `netcon/includes/CFtp.h:68:9`! 6 |
| 69 | #define FTP_STATE_LOGIN_ERRORcxx . . $ `netcon/includes/CFtp.h:69:9`! 7 |
| 70 | #define FTP_STATE_LOGGED_INcxx . . $ `netcon/includes/CFtp.h:70:9`! 8 |
| 71 | #define FTP_STATE_DIRECTORY_INVALIDcxx . . $ `netcon/includes/CFtp.h:71:9`! 9 |
| 72 | #define FTP_STATE_FILE_NOT_FOUNDcxx . . $ `netcon/includes/CFtp.h:72:9`! 10 |
| 73 | #define FTP_STATE_RECEIVINGcxx . . $ `netcon/includes/CFtp.h:73:9`! 11 |
| 74 | #define FTP_STATE_FILE_RECEIVEDcxx . . $ `netcon/includes/CFtp.h:74:9`! 12 |
| 75 | #define FTP_STATE_UNKNOWN_ERRORcxx . . $ `netcon/includes/CFtp.h:75:9`! 13 |
| 76 | #define FTP_STATE_RECV_FAILEDcxx . . $ `netcon/includes/CFtp.h:76:9`! 14 |
| 77 | #define FTP_STATE_CANT_WRITE_FILEcxx . . $ `netcon/includes/CFtp.h:77:9`! 15 |
| 78 | #define FTP_STATE_STARTUPcxx . . $ `netcon/includes/CFtp.h:78:9`! 16 |
| 79 | |
| 80 | #if WIN32 |
| 81 | typedef UINT_PTR SOCKET; |
| 82 | #endif |
| 83 | |
| 84 | #if defined(POSIXcxx . . $ `<built-in>:478:9`!) |
| 85 | extern int FTPObjThreadcxx . . $ FTPObjThread(dedf1e9b1c614a07).(void *obj); |
| 86 | #else |
| 87 | extern void FTPObjThread(void *obj); |
| 88 | #endif |
| 89 | |
| 90 | class CFtpGetcxx . . $ CFtpGet# { |
| 91 | |
| 92 | public: |
| 93 | CFtpGetcxx . . $ CFtpGet#CFtpGet(c66867f4cf358f2d).(char *URL, char *localfile, char *Username = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, char *Password = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 94 | ~cxx . . $ CFtpGet#`~CFtpGet`(49f6e7a06ebc5aa8).CFtpGetcxx . . $ CFtpGet#(); |
| 95 | int GetStatuscxx . . $ CFtpGet#GetStatus(b126dc7c1de90089).(); |
| 96 | uint32_tcxx . . $ uint32_t# GetBytesIncxx . . $ CFtpGet#GetBytesIn(db52760e79bf9054).(); |
| 97 | uint32_tcxx . . $ uint32_t# GetTotalBytescxx . . $ CFtpGet#GetTotalBytes(db52760e79bf9054).(); |
| 98 | void AbortGetcxx . . $ CFtpGet#AbortGet(49f6e7a06ebc5aa8).(); |
| 99 | |
| 100 | void WorkerThreadcxx . . $ CFtpGet#WorkerThread(49f6e7a06ebc5aa8).(); |
| 101 | |
| 102 | protected: |
| 103 | int ConnectControlSocketcxx . . $ CFtpGet#ConnectControlSocket(b126dc7c1de90089).(); |
| 104 | int LoginHostcxx . . $ CFtpGet#LoginHost(b126dc7c1de90089).(); |
| 105 | uint32_tcxx . . $ uint32_t# SendFTPCommandcxx . . $ CFtpGet#SendFTPCommand(33ab057182e9f89d).(char *command); |
| 106 | uint32_tcxx . . $ uint32_t# ReadFTPServerReplycxx . . $ CFtpGet#ReadFTPServerReply(db52760e79bf9054).(); |
| 107 | uint32_tcxx . . $ uint32_t# GetFilecxx . . $ CFtpGet#GetFile(db52760e79bf9054).(); |
| 108 | uint32_tcxx . . $ uint32_t# IssuePortcxx . . $ CFtpGet#IssuePort(db52760e79bf9054).(); |
| 109 | uint32_tcxx . . $ uint32_t# ReadDataChannelcxx . . $ CFtpGet#ReadDataChannel(db52760e79bf9054).(); |
| 110 | void FlushControlChannelcxx . . $ CFtpGet#FlushControlChannel(49f6e7a06ebc5aa8).(); |
| 111 | |
| 112 | uint32_tcxx . . $ uint32_t# m_iBytesIncxx . . $ CFtpGet#m_iBytesIn.; |
| 113 | uint32_tcxx . . $ uint32_t# m_iBytesTotalcxx . . $ CFtpGet#m_iBytesTotal.; |
| 114 | uint32_tcxx . . $ uint32_t# m_Statecxx . . $ CFtpGet#m_State.; |
| 115 | |
| 116 | bool m_Abortingcxx . . $ CFtpGet#m_Aborting.; |
| 117 | bool m_Abortedcxx . . $ CFtpGet#m_Aborted.; |
| 118 | |
| 119 | char m_szUserNamecxx . . $ CFtpGet#m_szUserName.[100]; |
| 120 | char m_szPasswordcxx . . $ CFtpGet#m_szPassword.[100]; |
| 121 | char m_szHostcxx . . $ CFtpGet#m_szHost.[200]; |
| 122 | char m_szDircxx . . $ CFtpGet#m_szDir.[200]; |
| 123 | char m_szFilenamecxx . . $ CFtpGet#m_szFilename.[100]; |
| 124 | |
| 125 | char recv_buffercxx . . $ CFtpGet#recv_buffer.[1000]; |
| 126 | |
| 127 | SOCKETcxx . . $ `lib/networking.h:217:9`! m_ListenSockcxx . . $ CFtpGet#m_ListenSock.; |
| 128 | SOCKETcxx . . $ `lib/networking.h:217:9`! m_DataSockcxx . . $ CFtpGet#m_DataSock.; |
| 129 | SOCKETcxx . . $ `lib/networking.h:217:9`! m_ControlSockcxx . . $ CFtpGet#m_ControlSock.; |
| 130 | |
| 131 | FILEcxx . . $ FILE# *LOCALFILEcxx . . $ CFtpGet#LOCALFILE.; |
| 132 | }; |
| 133 | |
| 134 | #endif |