1 /* ------------------------------------------------------------ */ 2 /* 3 HTTrack Website Copier, Offline Browser for Windows and Unix 4 Copyright (C) 1998-2017 Xavier Roche and other contributors 5 6 This program is free software: you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation, either version 3 of the License, or 9 (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program. If not, see <http://www.gnu.org/licenses/>. 18 19 Important notes: 20 21 - We hereby ask people using this source NOT to use it in purpose of grabbing 22 emails addresses, or collecting any other private information on persons. 23 This would disgrace our work, and spoil the many hours we spent on it. 24 25 Please visit our Website: http://www.httrack.com 26 */ 27 28 /* ------------------------------------------------------------ */ 29 /* File: Basic net definitions */ 30 /* Used in .c and .h files that needs hostent and so */ 31 /* Author: Xavier Roche */ 32 /* ------------------------------------------------------------ */ 33 34 #ifndef HTS_DEFBASENETH 35 #define HTS_DEFBASENETH 36 37 #ifdef _WIN32 38 39 #if HTS_INET6==0 40 #include <winsock2.h> 41 #else 42 43 #undef HTS_USESCOPEID 44 #define WIN32_LEAN_AND_MEAN 45 // KB955045 (http://support.microsoft.com/kb/955045) 46 // To execute an application using this function on earlier versions of Windows 47 // (Windows 2000, Windows NT, and Windows Me/98/95), then it is mandatary to #include Ws2tcpip.h 48 // and also Wspiapi.h. When the Wspiapi.h header file is included, the 'getaddrinfo' function is 49 // #defined to the 'WspiapiGetAddrInfo' inline function in Wspiapi.h. 50 #include <ws2tcpip.h> 51 #include <Wspiapi.h> 52 //#include <winsock2.h> 53 //#include <tpipv6.h> 54 55 #endif 56 57 #else 58 #define HTS_USESCOPEID 59 #define INVALID_SOCKET -1 60 #endif 61 62 #ifdef __cplusplus 63 extern "C" { 64 #endif 65 66 #if HTS_USEOPENSSL 67 /* 68 OpensSSL crypto routines by Eric Young (eay@cryptsoft.com) 69 Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 70 All rights reserved 71 */ 72 #ifndef HTS_OPENSSL_H_INCLUDED 73 #define HTS_OPENSSL_H_INCLUDED 74 75 /* OpenSSL definitions */ 76 #include <openssl/ssl.h> 77 #include <openssl/crypto.h> 78 #include <openssl/err.h> 79 80 /* OpenSSL structure */ 81 #include <openssl/bio.h> 82 83 /* Global SSL context */ 84 extern SSL_CTX *openssl_ctx; 85 86 #endif 87 #endif 88 89 /** RFC2616 status-codes ('statuscode' member of htsblk) **/ 90 typedef enum HTTPStatusCode { 91 HTTP_CONTINUE = 100, 92 HTTP_SWITCHING_PROTOCOLS = 101, 93 HTTP_OK = 200, 94 HTTP_CREATED = 201, 95 HTTP_ACCEPTED = 202, 96 HTTP_NON_AUTHORITATIVE_INFORMATION = 203, 97 HTTP_NO_CONTENT = 204, 98 HTTP_RESET_CONTENT = 205, 99 HTTP_PARTIAL_CONTENT = 206, 100 HTTP_MULTIPLE_CHOICES = 300, 101 HTTP_MOVED_PERMANENTLY = 301, 102 HTTP_FOUND = 302, 103 HTTP_SEE_OTHER = 303, 104 HTTP_NOT_MODIFIED = 304, 105 HTTP_USE_PROXY = 305, 106 HTTP_TEMPORARY_REDIRECT = 307, 107 HTTP_BAD_REQUEST = 400, 108 HTTP_UNAUTHORIZED = 401, 109 HTTP_PAYMENT_REQUIRED = 402, 110 HTTP_FORBIDDEN = 403, 111 HTTP_NOT_FOUND = 404, 112 HTTP_METHOD_NOT_ALLOWED = 405, 113 HTTP_NOT_ACCEPTABLE = 406, 114 HTTP_PROXY_AUTHENTICATION_REQUIRED = 407, 115 HTTP_REQUEST_TIME_OUT = 408, 116 HTTP_CONFLICT = 409, 117 HTTP_GONE = 410, 118 HTTP_LENGTH_REQUIRED = 411, 119 HTTP_PRECONDITION_FAILED = 412, 120 HTTP_REQUEST_ENTITY_TOO_LARGE = 413, 121 HTTP_REQUEST_URI_TOO_LARGE = 414, 122 HTTP_UNSUPPORTED_MEDIA_TYPE = 415, 123 HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416, 124 HTTP_EXPECTATION_FAILED = 417, 125 HTTP_INTERNAL_SERVER_ERROR = 500, 126 HTTP_NOT_IMPLEMENTED = 501, 127 HTTP_BAD_GATEWAY = 502, 128 HTTP_SERVICE_UNAVAILABLE = 503, 129 HTTP_GATEWAY_TIME_OUT = 504, 130 HTTP_HTTP_VERSION_NOT_SUPPORTED = 505 131 } HTTPStatusCode; 132 133 /** Internal HTTrack status-codes ('statuscode' member of htsblk) **/ 134 typedef enum BackStatusCode { 135 STATUSCODE_INVALID = -1, 136 STATUSCODE_TIMEOUT = -2, 137 STATUSCODE_SLOW = -3, 138 STATUSCODE_CONNERROR = -4, 139 STATUSCODE_NON_FATAL = -5, 140 STATUSCODE_SSL_HANDSHAKE = -6, 141 STATUSCODE_TOO_BIG = -7, 142 STATUSCODE_TEST_OK = -10 143 } BackStatusCode; 144 145 /** HTTrack status ('status' member of of 'lien_back') **/ 146 typedef enum HTTrackStatus { 147 STATUS_ALIVE = -103, 148 STATUS_FREE = -1, 149 STATUS_READY = 0, 150 STATUS_TRANSFER = 1, 151 STATUS_CHUNK_CR = 97, 152 STATUS_CHUNK_WAIT = 98, 153 STATUS_WAIT_HEADERS = 99, 154 STATUS_CONNECTING = 100, 155 STATUS_WAIT_DNS = 101, 156 STATUS_SSL_WAIT_HANDSHAKE = 102, 157 STATUS_FTP_TRANSFER = 1000, 158 STATUS_FTP_READY = 1001 159 } HTTrackStatus; 160 161 #ifdef __cplusplus 162 } 163 #endif 164 165 #endif 166