2008-08-15 12:41:36 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2008 Hans Leidekker for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _WINE_WINHTTP_PRIVATE_H_
|
|
|
|
#define _WINE_WINHTTP_PRIVATE_H_
|
|
|
|
|
2008-08-15 12:42:28 +00:00
|
|
|
#ifndef __WINE_CONFIG_H
|
|
|
|
# error You must include config.h to use this header
|
|
|
|
#endif
|
|
|
|
|
2008-08-15 12:41:36 +00:00
|
|
|
#include "wine/list.h"
|
2008-08-15 12:42:15 +00:00
|
|
|
#include "wine/unicode.h"
|
2008-08-15 12:41:36 +00:00
|
|
|
|
2008-08-15 12:42:28 +00:00
|
|
|
#ifdef HAVE_NETDB_H
|
|
|
|
# include <netdb.h>
|
|
|
|
#endif
|
|
|
|
|
2008-08-15 12:41:36 +00:00
|
|
|
typedef struct _object_header_t object_header_t;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
void (*destroy)( object_header_t * );
|
|
|
|
BOOL (*query_option)( object_header_t *, DWORD, void *, DWORD *, BOOL );
|
|
|
|
BOOL (*set_option)( object_header_t *, DWORD, void *, DWORD );
|
|
|
|
} object_vtbl_t;
|
|
|
|
|
|
|
|
struct _object_header_t
|
|
|
|
{
|
|
|
|
DWORD type;
|
|
|
|
HINTERNET handle;
|
|
|
|
const object_vtbl_t *vtbl;
|
|
|
|
DWORD flags;
|
|
|
|
DWORD error;
|
|
|
|
DWORD_PTR context;
|
|
|
|
LONG refs;
|
|
|
|
WINHTTP_STATUS_CALLBACK callback;
|
|
|
|
DWORD notify_mask;
|
|
|
|
struct list entry;
|
|
|
|
struct list children;
|
|
|
|
};
|
|
|
|
|
2008-08-15 12:42:15 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
object_header_t hdr;
|
|
|
|
LPWSTR agent;
|
|
|
|
DWORD access;
|
|
|
|
LPWSTR proxy_server;
|
|
|
|
LPWSTR proxy_bypass;
|
|
|
|
LPWSTR proxy_username;
|
|
|
|
LPWSTR proxy_password;
|
|
|
|
} session_t;
|
|
|
|
|
2008-08-15 12:42:28 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
object_header_t hdr;
|
|
|
|
session_t *session;
|
|
|
|
LPWSTR hostname; /* final destination of the request */
|
|
|
|
LPWSTR servername; /* name of the server we directly connect to */
|
|
|
|
LPWSTR username;
|
|
|
|
LPWSTR password;
|
|
|
|
INTERNET_PORT hostport;
|
|
|
|
INTERNET_PORT serverport;
|
|
|
|
struct sockaddr_in sockaddr;
|
|
|
|
} connect_t;
|
|
|
|
|
2008-08-15 12:42:41 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int socket;
|
|
|
|
char *peek_msg;
|
|
|
|
char *peek_msg_mem;
|
|
|
|
size_t peek_len;
|
|
|
|
} netconn_t;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
LPWSTR field;
|
|
|
|
LPWSTR value;
|
2008-08-20 09:35:39 +00:00
|
|
|
BOOL is_request; /* part of request headers? */
|
2008-08-15 12:42:41 +00:00
|
|
|
} header_t;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
object_header_t hdr;
|
|
|
|
connect_t *connect;
|
|
|
|
LPWSTR verb;
|
|
|
|
LPWSTR path;
|
|
|
|
LPWSTR version;
|
|
|
|
LPWSTR raw_headers;
|
|
|
|
netconn_t netconn;
|
|
|
|
LPWSTR status_text;
|
|
|
|
DWORD content_length; /* total number of bytes to be read (per chunk) */
|
|
|
|
DWORD content_read; /* bytes read so far */
|
|
|
|
header_t *headers;
|
|
|
|
DWORD num_headers;
|
|
|
|
} request_t;
|
|
|
|
|
2008-08-15 12:42:15 +00:00
|
|
|
object_header_t *addref_object( object_header_t * );
|
|
|
|
object_header_t *grab_object( HINTERNET );
|
|
|
|
void release_object( object_header_t * );
|
|
|
|
HINTERNET alloc_handle( object_header_t * );
|
|
|
|
BOOL free_handle( HINTERNET );
|
|
|
|
|
2008-08-20 09:35:39 +00:00
|
|
|
void set_last_error( DWORD );
|
2008-08-15 12:43:07 +00:00
|
|
|
void send_callback( object_header_t *, DWORD, LPVOID, DWORD );
|
|
|
|
|
2008-08-15 12:41:36 +00:00
|
|
|
static inline void *heap_alloc( SIZE_T size )
|
|
|
|
{
|
|
|
|
return HeapAlloc( GetProcessHeap(), 0, size );
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void *heap_alloc_zero( SIZE_T size )
|
|
|
|
{
|
|
|
|
return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size );
|
|
|
|
}
|
|
|
|
|
2008-08-20 09:35:39 +00:00
|
|
|
static inline void *heap_realloc( LPVOID mem, SIZE_T size )
|
|
|
|
{
|
|
|
|
return HeapReAlloc( GetProcessHeap(), 0, mem, size );
|
|
|
|
}
|
|
|
|
|
2008-08-15 12:41:36 +00:00
|
|
|
static inline void *heap_realloc_zero( LPVOID mem, SIZE_T size )
|
|
|
|
{
|
|
|
|
return HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, mem, size );
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline BOOL heap_free( LPVOID mem )
|
|
|
|
{
|
|
|
|
return HeapFree( GetProcessHeap(), 0, mem );
|
|
|
|
}
|
|
|
|
|
2008-08-15 12:42:15 +00:00
|
|
|
static inline WCHAR *strdupW( const WCHAR *src )
|
|
|
|
{
|
|
|
|
WCHAR *dst;
|
|
|
|
|
|
|
|
if (!src) return NULL;
|
|
|
|
dst = heap_alloc( (strlenW( src ) + 1) * sizeof(WCHAR) );
|
|
|
|
if (dst) strcpyW( dst, src );
|
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
2008-08-15 12:41:36 +00:00
|
|
|
#endif /* _WINE_WINHTTP_PRIVATE_H_ */
|