Merge branch 'test-ip_mreq_source-android-only' into 'master'
[glib.git] / gio / win32 / winhttp.h
blob2f0041a67f2cd9de122b27dab18559234087f5e9
1 /*
2 * Copyright (C) 2007 Francois Gouget
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library; if not, see <http://www.gnu.org/licenses/>.
18 #ifndef __WINE_WINHTTP_H
19 #define __WINE_WINHTTP_H
21 #define WINHTTPAPI
22 #define BOOLAPI WINHTTPAPI BOOL WINAPI
25 typedef LPVOID HINTERNET;
26 typedef HINTERNET *LPHINTERNET;
28 #define INTERNET_DEFAULT_PORT 0
29 #define INTERNET_DEFAULT_HTTP_PORT 80
30 #define INTERNET_DEFAULT_HTTPS_PORT 443
31 typedef WORD INTERNET_PORT;
32 typedef INTERNET_PORT *LPINTERNET_PORT;
34 #define INTERNET_SCHEME_HTTP 1
35 #define INTERNET_SCHEME_HTTPS 2
36 typedef int INTERNET_SCHEME, *LPINTERNET_SCHEME;
38 /* flags for WinHttpOpen */
39 #define WINHTTP_FLAG_ASYNC 0x10000000
41 /* flags for WinHttpOpenRequest */
42 #define WINHTTP_FLAG_ESCAPE_PERCENT 0x00000004
43 #define WINHTTP_FLAG_NULL_CODEPAGE 0x00000008
44 #define WINHTTP_FLAG_ESCAPE_DISABLE 0x00000040
45 #define WINHTTP_FLAG_ESCAPE_DISABLE_QUERY 0x00000080
46 #define WINHTTP_FLAG_BYPASS_PROXY_CACHE 0x00000100
47 #define WINHTTP_FLAG_REFRESH WINHTTP_FLAG_BYPASS_PROXY_CACHE
48 #define WINHTTP_FLAG_SECURE 0x00800000
50 #define WINHTTP_ACCESS_TYPE_DEFAULT_PROXY 0
51 #define WINHTTP_ACCESS_TYPE_NO_PROXY 1
52 #define WINHTTP_ACCESS_TYPE_NAMED_PROXY 3
54 #define WINHTTP_NO_PROXY_NAME NULL
55 #define WINHTTP_NO_PROXY_BYPASS NULL
57 #define WINHTTP_NO_REFERER NULL
58 #define WINHTTP_DEFAULT_ACCEPT_TYPES NULL
60 #define WINHTTP_ERROR_BASE 12000
62 /* The original WINE winhttp.h didn't contain symbolic names for the
63 * error codes. However, the values of most of them are publicly
64 * documented at
65 * http://msdn.microsoft.com/en-us/library/aa383770(VS.85).aspx so
66 * we can add them here.
68 #define ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR 12178
69 #define ERROR_WINHTTP_BAD_AUTO_PROXY_SCRIPT 12166
70 #define ERROR_WINHTTP_CANNOT_CALL_AFTER_OPEN 12103
71 #define ERROR_WINHTTP_CANNOT_CALL_AFTER_SEND 12102
72 #define ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN 12100
73 #define ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND 12101
74 #define ERROR_WINHTTP_CANNOT_CONNECT 12029
75 #define ERROR_WINHTTP_CHUNKED_ENCODING_HEADER_SIZE_OVERFLOW 12183
76 #define ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED 12044
77 #define ERROR_WINHTTP_CONNECTION_ERROR 12030
78 #define ERROR_WINHTTP_HEADER_ALREADY_EXISTS 12155
79 #define ERROR_WINHTTP_HEADER_COUNT_EXCEEDED 12181
80 #define ERROR_WINHTTP_HEADER_NOT_FOUND 12150
81 #define ERROR_WINHTTP_HEADER_SIZE_OVERFLOW 12182
82 #define ERROR_WINHTTP_INCORRECT_HANDLE_STATE 12019
83 #define ERROR_WINHTTP_INCORRECT_HANDLE_TYPE 12018
84 #define ERROR_WINHTTP_INTERNAL_ERROR 12004
85 #define ERROR_WINHTTP_INVALID_OPTION 12009
86 #define ERROR_WINHTTP_INVALID_QUERY_REQUEST 12154
87 #define ERROR_WINHTTP_INVALID_SERVER_RESPONSE 12152
88 #define ERROR_WINHTTP_INVALID_URL 12005
89 #define ERROR_WINHTTP_LOGIN_FAILURE 12015
90 #define ERROR_WINHTTP_NAME_NOT_RESOLVED 12007
91 #define ERROR_WINHTTP_NOT_INITIALIZED 12172
92 #define ERROR_WINHTTP_OPERATION_CANCELLED 12017
93 #define ERROR_WINHTTP_OPTION_NOT_SETTABLE 12011
94 #define ERROR_WINHTTP_OUT_OF_HANDLES 12001
95 #define ERROR_WINHTTP_REDIRECT_FAILED 12156
96 #define ERROR_WINHTTP_RESEND_REQUEST 12032
97 #define ERROR_WINHTTP_RESPONSE_DRAIN_OVERFLOW 12184
98 #define ERROR_WINHTTP_SECURE_CERT_CN_INVALID 12038
99 #define ERROR_WINHTTP_SECURE_CERT_DATE_INVALID 12037
100 #define ERROR_WINHTTP_SECURE_CERT_REV_FAILED 12057
101 #define ERROR_WINHTTP_SECURE_CERT_REVOKED 12170
102 #define ERROR_WINHTTP_SECURE_CERT_WRONG_USAGE 12179
103 #define ERROR_WINHTTP_SECURE_CHANNEL_ERROR 12157
104 #define ERROR_WINHTTP_SECURE_FAILURE 12175
105 #define ERROR_WINHTTP_SECURE_INVALID_CA 12045
106 #define ERROR_WINHTTP_SECURE_INVALID_CERT 12169
107 #define ERROR_WINHTTP_SHUTDOWN 12012
108 #define ERROR_WINHTTP_TIMEOUT 12002
109 #define ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT 12167
110 #define ERROR_WINHTTP_UNRECOGNIZED_SCHEME 12006
111 /* End of added error codes */
113 #define ERROR_WINHTTP_AUTODETECTION_FAILED (WINHTTP_ERROR_BASE + 180)
115 typedef struct
117 DWORD dwStructSize;
118 LPWSTR lpszScheme;
119 DWORD dwSchemeLength;
120 INTERNET_SCHEME nScheme;
121 LPWSTR lpszHostName;
122 DWORD dwHostNameLength;
123 INTERNET_PORT nPort;
124 LPWSTR lpszUserName;
125 DWORD dwUserNameLength;
126 LPWSTR lpszPassword;
127 DWORD dwPasswordLength;
128 LPWSTR lpszUrlPath;
129 DWORD dwUrlPathLength;
130 LPWSTR lpszExtraInfo;
131 DWORD dwExtraInfoLength;
132 } URL_COMPONENTS, *LPURL_COMPONENTS;
133 typedef URL_COMPONENTS URL_COMPONENTSW;
134 typedef LPURL_COMPONENTS LPURL_COMPONENTSW;
136 typedef struct
138 DWORD_PTR dwResult;
139 DWORD dwError;
140 } WINHTTP_ASYNC_RESULT, *LPWINHTTP_ASYNC_RESULT;
142 typedef struct
144 FILETIME ftExpiry;
145 FILETIME ftStart;
146 LPWSTR lpszSubjectInfo;
147 LPWSTR lpszIssuerInfo;
148 LPWSTR lpszProtocolName;
149 LPWSTR lpszSignatureAlgName;
150 LPWSTR lpszEncryptionAlgName;
151 DWORD dwKeySize;
152 } WINHTTP_CERTIFICATE_INFO;
154 typedef struct
156 DWORD dwAccessType;
157 LPCWSTR lpszProxy;
158 LPCWSTR lpszProxyBypass;
159 } WINHTTP_PROXY_INFO, *LPWINHTTP_PROXY_INFO;
160 typedef WINHTTP_PROXY_INFO WINHTTP_PROXY_INFOW;
161 typedef LPWINHTTP_PROXY_INFO LPWINHTTP_PROXY_INFOW;
163 typedef struct
165 BOOL fAutoDetect;
166 LPWSTR lpszAutoConfigUrl;
167 LPWSTR lpszProxy;
168 LPWSTR lpszProxyBypass;
169 } WINHTTP_CURRENT_USER_IE_PROXY_CONFIG;
171 typedef VOID (CALLBACK *WINHTTP_STATUS_CALLBACK)(HINTERNET,DWORD_PTR,DWORD,LPVOID,DWORD);
173 typedef struct
175 DWORD dwFlags;
176 DWORD dwAutoDetectFlags;
177 LPCWSTR lpszAutoConfigUrl;
178 LPVOID lpvReserved;
179 DWORD dwReserved;
180 BOOL fAutoLogonIfChallenged;
181 } WINHTTP_AUTOPROXY_OPTIONS;
183 typedef struct
185 DWORD dwMajorVersion;
186 DWORD dwMinorVersion;
187 } HTTP_VERSION_INFO, *LPHTTP_VERSION_INFO;
190 #ifdef __cplusplus
191 extern "C" {
192 #endif
194 BOOL WINAPI WinHttpAddRequestHeaders(HINTERNET,LPCWSTR,DWORD,DWORD);
195 BOOL WINAPI WinHttpDetectAutoProxyConfigUrl(DWORD,LPWSTR*);
196 BOOL WINAPI WinHttpCheckPlatform(void);
197 BOOL WINAPI WinHttpCloseHandle(HINTERNET);
198 HINTERNET WINAPI WinHttpConnect(HINTERNET,LPCWSTR,INTERNET_PORT,DWORD);
199 BOOL WINAPI WinHttpCrackUrl(LPCWSTR,DWORD,DWORD,LPURL_COMPONENTS);
200 BOOL WINAPI WinHttpCreateUrl(LPURL_COMPONENTS,DWORD,LPWSTR,LPDWORD);
201 BOOL WINAPI WinHttpGetDefaultProxyConfiguration(WINHTTP_PROXY_INFO*);
202 BOOL WINAPI WinHttpGetIEProxyConfigForCurrentUser(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG* config);
203 BOOL WINAPI WinHttpGetProxyForUrl(HINTERNET,LPCWSTR,WINHTTP_AUTOPROXY_OPTIONS*,WINHTTP_PROXY_INFO*);
204 HINTERNET WINAPI WinHttpOpen(LPCWSTR,DWORD,LPCWSTR,LPCWSTR,DWORD);
206 /* The sixth parameter to WinHttpOpenRequest was wrong in the original
207 * WINE header. It should be LPCWSTR*, not LPCWSTR, as it points to an
208 * array of wide strings.
210 HINTERNET WINAPI WinHttpOpenRequest(HINTERNET,LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR*,DWORD);
211 BOOL WINAPI WinHttpQueryAuthParams(HINTERNET,DWORD,LPVOID*);
212 BOOL WINAPI WinHttpQueryAuthSchemes(HINTERNET,LPDWORD,LPDWORD,LPDWORD);
213 BOOL WINAPI WinHttpQueryDataAvailable(HINTERNET,LPDWORD);
214 BOOL WINAPI WinHttpQueryHeaders(HINTERNET,DWORD,LPCWSTR,LPVOID,LPDWORD,LPDWORD);
215 BOOL WINAPI WinHttpReadData(HINTERNET,LPVOID,DWORD,LPDWORD);
216 BOOL WINAPI WinHttpReceiveResponse(HINTERNET,LPVOID);
217 BOOL WINAPI WinHttpSendRequest(HINTERNET,LPCWSTR,DWORD,LPVOID,DWORD,DWORD,DWORD_PTR);
218 BOOL WINAPI WinHttpSetDefaultProxyConfiguration(WINHTTP_PROXY_INFO*);
219 BOOL WINAPI WinHttpSetCredentials(HINTERNET,DWORD,DWORD,LPCWSTR,LPCWSTR,LPVOID);
220 BOOL WINAPI WinHttpSetOption(HINTERNET,DWORD,LPVOID,DWORD);
221 WINHTTP_STATUS_CALLBACK WINAPI WinHttpSetStatusCallback(HINTERNET,WINHTTP_STATUS_CALLBACK,DWORD,DWORD_PTR);
222 BOOL WINAPI WinHttpSetTimeouts(HINTERNET,int,int,int,int);
223 BOOL WINAPI WinHttpTimeFromSystemTime(CONST SYSTEMTIME *,LPWSTR);
224 BOOL WINAPI WinHttpTimeToSystemTime(LPCWSTR,SYSTEMTIME*);
225 BOOL WINAPI WinHttpWriteData(HINTERNET,LPCVOID,DWORD,LPDWORD);
227 /* Additional definitions, from the public domain <wininet.h> in mingw */
228 #define ICU_ESCAPE 0x80000000
229 #define ICU_DECODE 0x10000000
231 /* A few constants I couldn't find publicly documented, so I looked up
232 * their value from the Windows SDK <winhttp.h>. Presumably this falls
233 * under fair use.
235 #define WINHTTP_QUERY_CONTENT_LENGTH 5
236 #define WINHTTP_QUERY_CONTENT_TYPE 1
237 #define WINHTTP_QUERY_LAST_MODIFIED 11
238 #define WINHTTP_QUERY_STATUS_CODE 19
239 #define WINHTTP_QUERY_STATUS_TEXT 20
241 #define WINHTTP_QUERY_FLAG_SYSTEMTIME 0x40000000
243 #ifdef __cplusplus
245 #endif
247 #endif /* __WINE_WINHTTP_H */