| 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/Chttpget.h $ |
| 21 | * $Revision: 1.2 $ |
| 22 | * $Date: 2004/02/09 04:14:51 $ |
| 23 | * $Author: kevinb $ |
| 24 | * |
| 25 | * HTTP Client class (get only) |
| 26 | * |
| 27 | * $Log: Chttpget.h,v $ |
| 28 | * Revision 1.2 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.1.1.1 2000/04/18 00:00:38 icculus |
| 36 | * initial checkin |
| 37 | * |
| 38 | * |
| 39 | * 7 8/21/99 9:14p Kevin |
| 40 | * Added support for redirection |
| 41 | * |
| 42 | * 6 8/21/99 6:48a Jeff |
| 43 | * Linux port |
| 44 | * |
| 45 | * 5 8/20/99 3:01p Kevin |
| 46 | * Added support for Proxies (I hope!) |
| 47 | * |
| 48 | * 4 7/31/98 12:19p Nate |
| 49 | * Fixed http abort problem. |
| 50 | * |
| 51 | * 3 7/31/98 11:57a Kevin |
| 52 | * Added new functions for getting state |
| 53 | * |
| 54 | * 2 6/01/98 10:10a Kevin |
| 55 | * Added DLL connection interface and auto update DLL |
| 56 | * |
| 57 | * 1 5/27/98 9:54a Kevin |
| 58 | * |
| 59 | * 1 5/25/98 5:31p Kevin |
| 60 | * Initial version |
| 61 | * |
| 62 | * $NoKeywords: $ |
| 63 | */ |
| 64 | #ifndef _CHTTPGET_HEADER_ |
| 65 | #define _CHTTPGET_HEADER_cxx . . $ `netcon/includes/Chttpget.h:65:9`! |
| 66 | |
| 67 | #include <cstdint> |
| 68 | #include "networking.h"cxx . . $ `<file>/lib/networking.h`/ |
| 69 | |
| 70 | #define HTTP_STATE_INTERNAL_ERRORcxx . . $ `netcon/includes/Chttpget.h:70:9`! 0 |
| 71 | #define HTTP_STATE_SOCKET_ERRORcxx . . $ `netcon/includes/Chttpget.h:71:9`! 1 |
| 72 | #define HTTP_STATE_URL_PARSING_ERRORcxx . . $ `netcon/includes/Chttpget.h:72:9`! 2 |
| 73 | #define HTTP_STATE_CONNECTINGcxx . . $ `netcon/includes/Chttpget.h:73:9`! 3 |
| 74 | #define HTTP_STATE_HOST_NOT_FOUNDcxx . . $ `netcon/includes/Chttpget.h:74:9`! 4 |
| 75 | #define HTTP_STATE_CANT_CONNECTcxx . . $ `netcon/includes/Chttpget.h:75:9`! 5 |
| 76 | #define HTTP_STATE_CONNECTEDcxx . . $ `netcon/includes/Chttpget.h:76:9`! 6 |
| 77 | #define HTTP_STATE_FILE_NOT_FOUNDcxx . . $ `netcon/includes/Chttpget.h:77:9`! 10 |
| 78 | #define HTTP_STATE_RECEIVINGcxx . . $ `netcon/includes/Chttpget.h:78:9`! 11 |
| 79 | #define HTTP_STATE_FILE_RECEIVEDcxx . . $ `netcon/includes/Chttpget.h:79:9`! 12 |
| 80 | #define HTTP_STATE_UNKNOWN_ERRORcxx . . $ `netcon/includes/Chttpget.h:80:9`! 13 |
| 81 | #define HTTP_STATE_RECV_FAILEDcxx . . $ `netcon/includes/Chttpget.h:81:9`! 14 |
| 82 | #define HTTP_STATE_CANT_WRITE_FILEcxx . . $ `netcon/includes/Chttpget.h:82:9`! 15 |
| 83 | #define HTTP_STATE_STARTUPcxx . . $ `netcon/includes/Chttpget.h:83:9`! 16 |
| 84 | |
| 85 | #define MAX_URL_LENcxx . . $ `netcon/includes/Chttpget.h:85:9`! 300 |
| 86 | |
| 87 | class ChttpGetcxx . . $ ChttpGet# { |
| 88 | public: |
| 89 | ChttpGetcxx . . $ ChttpGet#ChttpGet(d0489a02ea06dfc6).(char *URL, char *localfile); |
| 90 | ChttpGetcxx . . $ ChttpGet#ChttpGet(1905cbfd26227f9c).(char *URL, char *localfile, char *proxyip, uint16_tcxx . . $ uint16_t# proxyport); |
| 91 | void PrepSocketcxx . . $ ChttpGet#PrepSocket(fda57c8427c60377).(char *URL); |
| 92 | ~cxx . . $ ChttpGet#`~ChttpGet`(ced63f7c635d850d).ChttpGetcxx . . $ ChttpGet#(); |
| 93 | void GetFilecxx . . $ ChttpGet#GetFile(d0489a02ea06dfc6).(char *URL, char *localfile); |
| 94 | int GetStatuscxx . . $ ChttpGet#GetStatus(b126dc7c1de90089).(); |
| 95 | uint32_tcxx . . $ uint32_t# GetBytesIncxx . . $ ChttpGet#GetBytesIn(db52760e79bf9054).(); |
| 96 | uint32_tcxx . . $ uint32_t# GetTotalBytescxx . . $ ChttpGet#GetTotalBytes(db52760e79bf9054).(); |
| 97 | void AbortGetcxx . . $ ChttpGet#AbortGet(49f6e7a06ebc5aa8).(); |
| 98 | void WorkerThreadcxx . . $ ChttpGet#WorkerThread(49f6e7a06ebc5aa8).(); |
| 99 | bool m_Abortedcxx . . $ ChttpGet#m_Aborted.; |
| 100 | |
| 101 | protected: |
| 102 | int ConnectSocketcxx . . $ ChttpGet#ConnectSocket(b126dc7c1de90089).(); |
| 103 | char *GetHTTPLinecxx . . $ ChttpGet#GetHTTPLine(41208ce6ca65dd58).(); |
| 104 | uint32_tcxx . . $ uint32_t# ReadDataChannelcxx . . $ ChttpGet#ReadDataChannel(db52760e79bf9054).(); |
| 105 | uint32_tcxx . . $ uint32_t# m_iBytesIncxx . . $ ChttpGet#m_iBytesIn.; |
| 106 | uint32_tcxx . . $ uint32_t# m_iBytesTotalcxx . . $ ChttpGet#m_iBytesTotal.; |
| 107 | uint32_tcxx . . $ uint32_t# m_Statecxx . . $ ChttpGet#m_State.; |
| 108 | bool m_ProxyEnabledcxx . . $ ChttpGet#m_ProxyEnabled.; |
| 109 | char *m_ProxyIPcxx . . $ ChttpGet#m_ProxyIP.; |
| 110 | char m_URLcxx . . $ ChttpGet#m_URL.[MAX_URL_LENcxx . . $ `netcon/includes/Chttpget.h:85:9`!]; |
| 111 | uint16_tcxx . . $ uint16_t# m_ProxyPortcxx . . $ ChttpGet#m_ProxyPort.; |
| 112 | |
| 113 | char m_szUserNamecxx . . $ ChttpGet#m_szUserName.[100]; |
| 114 | char m_szPasswordcxx . . $ ChttpGet#m_szPassword.[100]; |
| 115 | char m_szHostcxx . . $ ChttpGet#m_szHost.[200]; |
| 116 | char m_szDircxx . . $ ChttpGet#m_szDir.[200]; |
| 117 | char m_szFilenamecxx . . $ ChttpGet#m_szFilename.[100]; |
| 118 | |
| 119 | bool m_Abortingcxx . . $ ChttpGet#m_Aborting.; |
| 120 | |
| 121 | SOCKETcxx . . $ `lib/networking.h:217:9`! m_DataSockcxx . . $ ChttpGet#m_DataSock.; |
| 122 | |
| 123 | FILEcxx . . $ FILE# *LOCALFILEcxx . . $ ChttpGet#LOCALFILE.; |
| 124 | char recv_buffercxx . . $ ChttpGet#recv_buffer.[1000]; |
| 125 | }; |
| 126 | |
| 127 | #endif |