ReactOS 0.4.16-dev-2491-g3dc6630
winhttp_private.h
Go to the documentation of this file.
1/*
2 * Copyright 2008 Hans Leidekker for CodeWeavers
3 *
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.
8 *
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.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19#ifndef _WINE_WINHTTP_PRIVATE_H_
20#define _WINE_WINHTTP_PRIVATE_H_
21
22#include <wine/heap.h>
23
24#include "ole2.h"
25#include "sspi.h"
26#include "wincrypt.h"
27
28#ifdef __REACTOS__
29#include <string.h>
30#include <winnls.h>
31#endif
32
33#include "wine/list.h"
34
35#define WINHTTP_HANDLE_TYPE_SOCKET 4
36
37struct object_header;
39{
41 void (*destroy)( struct object_header * );
42 BOOL (*query_option)( struct object_header *, DWORD, void *, DWORD * );
43 BOOL (*set_option)( struct object_header *, DWORD, void *, DWORD );
44};
45
47{
50 const struct object_vtbl *vtbl;
61 struct list entry;
64};
65
67{
68 struct list entry;
74};
75
76struct session
77{
97};
98
99struct connect
100{
103 WCHAR *hostname; /* final destination of the request */
104 WCHAR *servername; /* name of the server we directly connect to */
111};
112
114{
115 struct list entry;
119 BOOL secure; /* SSL active on connection? */
120 struct hostdata *host;
126 size_t extra_len;
127 char *peek_msg;
129 size_t peek_len;
131};
132
133struct header
134{
137 BOOL is_request; /* part of request headers? */
138};
139
141{
147
149{
158
159struct authinfo
160{
165 ULONG attr;
167 char *data;
168 unsigned int data_len;
169 BOOL finished; /* finished authenticating */
170};
171
172struct queue
173{
174 SRWLOCK lock;
177};
178
180{
182};
183
185{
195};
196
197struct request
198{
206 void *optional;
221 DWORD redirect_count; /* total number of redirects during this request */
223 DWORD content_length; /* total number of bytes to be read */
224 DWORD content_read; /* bytes read so far */
225 BOOL read_chunked; /* are we reading in chunked mode? */
226 BOOL read_chunked_eof; /* end of stream in chunked mode */
227 BOOL read_chunked_size; /* chunk size remaining */
228 DWORD read_pos; /* current read position in read_buf */
229 DWORD read_size; /* valid data size in read_buf */
230 char read_buf[8192]; /* buffer for already read but not returned data */
237 struct queue queue;
238#ifdef __REACTOS__
239 HANDLE task_thread;
240#endif
241 struct
242 {
251};
252
254{
258};
259
260/* rfc6455 */
262{
275};
276
278{
282};
283
284struct socket
285{
289 unsigned int send_buffer_size;
291 struct queue send_q;
292 struct queue recv_q;
295 char mask[4];
296 unsigned int mask_index;
300 char reason[123];
309 SRWLOCK send_lock;
314};
315
316typedef void (*TASK_CALLBACK)( void *ctx, BOOL abort );
317
319{
320 struct list entry;
323 volatile LONG refs;
325};
326
328{
331 void *info;
333 union
334 {
337 };
338};
339
341{
345 void *optional;
349};
350
352{
354};
355
357{
360};
361
363{
365 void *buffer;
368};
369
371{
373 const void *buffer;
376};
377
379{
382 const void *buf;
386};
387
389{
391 void *buf;
393};
394
396{
399 char reason[123];
404};
405
406struct object_header *addref_object( struct object_header * );
408void release_object( struct object_header * );
411
413void close_connection( struct request * );
414void init_queue( struct queue *queue );
415void stop_queue( struct queue * );
416
417void netconn_addref( struct netconn * );
418void netconn_release( struct netconn * );
419DWORD netconn_create( struct hostdata *, const struct sockaddr_storage *, int, struct netconn ** );
420void netconn_unload( void );
422DWORD netconn_recv( struct netconn *, void *, size_t, int, int * );
425DWORD netconn_send( struct netconn *, const void *, size_t, int *, WSAOVERLAPPED * );
427void netconn_cancel_io( struct netconn *conn );
428DWORD netconn_set_timeout( struct netconn *, BOOL, int );
429BOOL netconn_is_alive( struct netconn * );
430const void *netconn_get_certificate( struct netconn * );
432
433BOOL set_cookies( struct request *, const WCHAR * );
435DWORD add_request_headers( struct request *, const WCHAR *, DWORD, DWORD );
436void destroy_cookies( struct session * );
438void destroy_authinfo( struct authinfo * );
439
440void release_host( struct hostdata * );
441DWORD process_header( struct request *, const WCHAR *, const WCHAR *, DWORD, BOOL );
442
443extern HRESULT WinHttpRequest_create( void ** );
444void release_typelib( void );
445
446static inline WCHAR *strdupAW( const char *src )
447{
448 WCHAR *dst = NULL;
449 if (src)
450 {
451 int len = MultiByteToWideChar( CP_ACP, 0, src, -1, NULL, 0 );
452 if ((dst = malloc( len * sizeof(WCHAR) )))
453 MultiByteToWideChar( CP_ACP, 0, src, -1, dst, len );
454 }
455 return dst;
456}
457
458static inline char *strdupWA( const WCHAR *src )
459{
460 char *dst = NULL;
461 if (src)
462 {
463 int len = WideCharToMultiByte( CP_ACP, 0, src, -1, NULL, 0, NULL, NULL );
464 if ((dst = malloc( len )))
466 }
467 return dst;
468}
469
471
472#define MIN_WEBSOCKET_SEND_BUFFER_SIZE 16
473
474#endif /* _WINE_WINHTTP_PRIVATE_H_ */
Definition: list.h:37
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum src
Definition: glext.h:6340
GLenum GLint GLuint mask
Definition: glext.h:6028
GLenum GLenum dst
Definition: glext.h:6340
GLenum GLsizei len
Definition: glext.h:6722
#define abort()
Definition: i386-dis.c:34
static void close_connection(void)
Definition: http.c:5576
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
enum auth_scheme scheme
char * data
CredHandle cred
CtxtHandle ctx
TimeStamp exp
unsigned int data_len
ULONG max_token
WCHAR * hostname
struct session * session
WCHAR * password
WCHAR * servername
INTERNET_PORT hostport
WCHAR * username
INTERNET_PORT serverport
struct object_header hdr
WCHAR * field
BOOL is_request
WCHAR * value
INTERNET_PORT port
struct list connections
struct list entry
WCHAR * hostname
SecPkgContext_StreamSizes ssl_sizes
char * peek_msg
char * ssl_write_buf
struct hostdata * host
struct list entry
char * extra_buf
char * peek_msg_mem
char * ssl_read_buf
CtxtHandle ssl_ctx
ULONGLONG keep_until
HANDLE port
size_t extra_len
size_t peek_len
volatile LONG pending_receives
WINHTTP_STATUS_CALLBACK callback
volatile LONG pending_sends
DWORD_PTR context
HINTERNET handle
const struct object_vtbl * vtbl
struct list entry
BOOL(* set_option)(struct object_header *, DWORD, void *, DWORD)
void(* destroy)(struct object_header *)
void(* handle_closing)(struct object_header *)
BOOL(* query_option)(struct object_header *, DWORD, void *, DWORD *)
DWORD * available
struct task_header task_hdr
BOOL callback_running
SRWLOCK lock
struct list queued_tasks
struct task_header task_hdr
DWORD * read
struct task_header task_hdr
Definition: tftpd.h:86
unsigned int websocket_set_send_buffer_size
HANDLE task_cancel
DWORD content_read
DWORD read_reply_status
DWORD read_size
HANDLE task_wait
struct request::@633 creds[TARGET_MAX][SCHEME_MAX]
DWORD optional_len
const CERT_CONTEXT * server_cert
DWORD max_redirects
WCHAR * version
const CERT_CONTEXT * client_cert
int send_timeout
struct header * headers
struct object_header hdr
WCHAR * verb
DWORD security_flags
DWORD redirect_count
enum request_flags flags
struct authinfo * authinfo
DWORD num_headers
CredHandle cred_handle
WCHAR * path
WCHAR * password
WCHAR * status_text
int read_reply_len
unsigned int websocket_receive_buffer_size
void * optional
int receive_timeout
BOOL check_revocation
WCHAR * username
int connect_timeout
int resolve_timeout
WCHAR * raw_headers
struct connect * connect
DWORD read_pos
char read_buf[8192]
unsigned int websocket_send_buffer_size
BOOL read_chunked
int receive_response_timeout
BOOL read_chunked_size
BOOL cred_handle_initialized
struct netconn * netconn
DWORD content_length
struct authinfo * proxy_authinfo
enum request_response_state state
BOOL read_chunked_eof
WINHTTP_ASYNC_RESULT result
struct task_header task_hdr
struct task_header task_hdr
DWORD_PTR context
int resolve_timeout
WCHAR * proxy_password
DWORD passport_flags
WCHAR * proxy_bypass
int receive_response_timeout
CRITICAL_SECTION cs
int receive_timeout
DWORD access
HANDLE unload_event
unsigned int websocket_receive_buffer_size
DWORD secure_protocols
WCHAR * agent
WCHAR * proxy_server
struct object_header hdr
int send_timeout
WCHAR * proxy_username
int connect_timeout
unsigned int websocket_send_buffer_size
struct list cookie_cache
struct task_header task_hdr
const void * buf
WINHTTP_WEB_SOCKET_BUFFER_TYPE type
struct task_header task_hdr
WSAOVERLAPPED ovr
WSAOVERLAPPED ovr
struct task_header task_hdr
SRWLOCK send_lock
enum fragment_type sending_fragment_type
unsigned int send_frame_buffer_size
DWORD read_size
struct object_header hdr
enum socket_opcode opcode
enum socket_state state
USHORT status
DWORD close_frame_receive_err
struct queue send_q
enum fragment_type receiving_fragment_type
unsigned int send_remaining_size
struct queue recv_q
volatile LONG pending_noncontrol_send
char * send_frame_buffer
struct netconn * netconn
unsigned int mask_index
unsigned int bytes_in_read_buffer
char reason[123]
unsigned int client_buffer_offset
BOOL last_receive_final
unsigned int bytes_in_send_frame_buffer
unsigned int send_buffer_size
BOOL close_frame_received
char * read_buffer
DWORD reason_len
int keepalive_interval
struct object_header * obj
volatile LONG refs
TASK_CALLBACK callback
volatile LONG completion_sent
struct list entry
const void * buffer
struct task_header task_hdr
DWORD * written
uint32_t DWORD_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
WORD INTERNET_PORT
Definition: winhttp.h:43
VOID(CALLBACK * WINHTTP_STATUS_CALLBACK)(_In_ HINTERNET, _In_ DWORD_PTR, _In_ DWORD, _In_ LPVOID, _In_ DWORD)
Definition: winhttp.h:592
enum _WINHTTP_WEB_SOCKET_BUFFER_TYPE WINHTTP_WEB_SOCKET_BUFFER_TYPE
request_response_state
@ REQUEST_RESPONSE_STATE_READ_RESPONSE_QUEUED_REQUEST_SENT
@ REQUEST_RESPONSE_STATE_SENDING_REQUEST
@ REQUEST_RESPONSE_STATE_READ_RESPONSE_QUEUED
@ REQUEST_RESPONSE_STATE_RESPONSE_RECEIVED
@ REQUEST_RESPONSE_RECURSIVE_REQUEST
@ REQUEST_RESPONSE_STATE_NONE
@ REQUEST_RESPONSE_STATE_REQUEST_SENT
@ REQUEST_RESPONSE_STATE_REPLY_RECEIVED
@ REQUEST_RESPONSE_STATE_READ_RESPONSE_QUEUED_REPLY_RECEIVED
void init_queue(struct queue *queue)
Definition: request.c:137
void release_host(struct hostdata *)
Definition: request.c:1449
void netconn_cancel_io(struct netconn *conn)
Definition: net.c:674
DWORD add_cookie_headers(struct request *)
Definition: cookie.c:322
fragment_type
@ SOCKET_FRAGMENT_UTF8
@ SOCKET_FRAGMENT_NONE
@ SOCKET_FRAGMENT_BINARY
DWORD process_header(struct request *, const WCHAR *, const WCHAR *, DWORD, BOOL)
Definition: request.c:424
BOOL set_cookies(struct request *, const WCHAR *)
Definition: cookie.c:263
static char * strdupWA(const WCHAR *src)
void destroy_authinfo(struct authinfo *)
Definition: request.c:1097
int netconn_get_cipher_strength(struct netconn *)
Definition: net.c:860
void stop_queue(struct queue *)
Definition: request.c:144
BOOL free_handle(HINTERNET)
Definition: handle.c:123
DWORD netconn_send(struct netconn *, const void *, size_t, int *, WSAOVERLAPPED *)
Definition: net.c:479
socket_opcode
@ SOCKET_OPCODE_TEXT
@ SOCKET_OPCODE_PING
@ SOCKET_OPCODE_PONG
@ SOCKET_OPCODE_CONTINUE
@ SOCKET_OPCODE_BINARY
@ SOCKET_OPCODE_INVALID
@ SOCKET_OPCODE_RESERVED4
@ SOCKET_OPCODE_RESERVED3
@ SOCKET_OPCODE_CLOSE
@ SOCKET_OPCODE_RESERVED6
@ SOCKET_OPCODE_RESERVED7
@ SOCKET_OPCODE_RESERVED5
socket_state
@ SOCKET_STATE_SHUTDOWN
@ SOCKET_STATE_CLOSED
@ SOCKET_STATE_OPEN
struct object_header * addref_object(struct object_header *)
Definition: handle.c:48
void release_object(struct object_header *)
Definition: handle.c:71
auth_target
@ TARGET_MAX
@ TARGET_INVALID
@ TARGET_SERVER
@ TARGET_PROXY
void netconn_addref(struct netconn *)
Definition: net.c:290
DWORD netconn_secure_connect(struct netconn *, WCHAR *, DWORD, CredHandle *, BOOL)
Definition: net.c:315
void netconn_unload(void)
Definition: net.c:182
BOOL netconn_is_alive(struct netconn *)
Definition: net.c:698
static WCHAR * strdupAW(const char *src)
DWORD add_request_headers(struct request *, const WCHAR *, DWORD, DWORD)
Definition: request.c:485
request_flags
@ REQUEST_FLAG_WEBSOCKET_UPGRADE
HRESULT WinHttpRequest_create(void **)
Definition: request.c:6155
auth_scheme
@ SCHEME_BASIC
@ SCHEME_PASSPORT
@ SCHEME_DIGEST
@ SCHEME_INVALID
@ SCHEME_NTLM
@ SCHEME_NEGOTIATE
@ SCHEME_MAX
void release_typelib(void)
Definition: apps.c:159
void netconn_release(struct netconn *)
Definition: net.c:295
DWORD netconn_recv(struct netconn *, void *, size_t, int, int *)
Definition: net.c:618
void(* TASK_CALLBACK)(void *ctx, BOOL abort)
struct object_header * grab_object(HINTERNET)
Definition: handle.c:55
BOOL set_server_for_hostname(struct connect *, const WCHAR *, INTERNET_PORT)
Definition: session.c:532
DWORD netconn_resolve(WCHAR *, INTERNET_PORT, struct sockaddr_storage *, int)
Definition: net.c:819
ULONG netconn_query_data_available(struct netconn *)
Definition: net.c:681
BOOL netconn_wait_overlapped_result(struct netconn *conn, WSAOVERLAPPED *ovr, DWORD *len)
Definition: net.c:54
void destroy_cookies(struct session *)
Definition: cookie.c:120
DWORD netconn_create(struct hostdata *, const struct sockaddr_storage *, int, struct netconn **)
Definition: net.c:212
HINSTANCE winhttp_instance
Definition: main.c:33
const void * netconn_get_certificate(struct netconn *)
Definition: net.c:850
HINTERNET alloc_handle(struct object_header *)
Definition: handle.c:86
DWORD netconn_set_timeout(struct netconn *, BOOL, int)
Definition: net.c:686
__wchar_t WCHAR
Definition: xmlstorage.h:180