ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

winhttp_private.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2008 Hans Leidekker for CodeWeavers
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00017  */
00018 
00019 #ifndef _WINE_WINHTTP_PRIVATE_H_
00020 #define _WINE_WINHTTP_PRIVATE_H_
00021 
00022 #ifndef __WINE_CONFIG_H
00023 # error You must include config.h to use this header
00024 #endif
00025 
00026 #include "wine/list.h"
00027 #include "wine/unicode.h"
00028 
00029 #include <sys/types.h>
00030 #ifdef HAVE_SYS_SOCKET_H
00031 # include <sys/socket.h>
00032 #endif
00033 #ifdef HAVE_NETINET_IN_H
00034 # include <netinet/in.h>
00035 #endif
00036 #ifdef HAVE_NETDB_H
00037 # include <netdb.h>
00038 #endif
00039 #if defined(__MINGW32__) || defined (_MSC_VER)
00040 # include <ws2tcpip.h>
00041 #else
00042 # define closesocket close
00043 # define ioctlsocket ioctl
00044 #endif
00045 
00046 static const WCHAR getW[]    = {'G','E','T',0};
00047 static const WCHAR postW[]   = {'P','O','S','T',0};
00048 static const WCHAR slashW[]  = {'/',0};
00049 static const WCHAR http1_0[] = {'H','T','T','P','/','1','.','0',0};
00050 static const WCHAR http1_1[] = {'H','T','T','P','/','1','.','1',0};
00051 
00052 typedef struct _object_header_t object_header_t;
00053 
00054 typedef struct
00055 {
00056     void (*destroy)( object_header_t * );
00057     BOOL (*query_option)( object_header_t *, DWORD, void *, DWORD * );
00058     BOOL (*set_option)( object_header_t *, DWORD, void *, DWORD );
00059 } object_vtbl_t;
00060 
00061 struct _object_header_t
00062 {
00063     DWORD type;
00064     HINTERNET handle;
00065     const object_vtbl_t *vtbl;
00066     DWORD flags;
00067     DWORD disable_flags;
00068     DWORD logon_policy;
00069     DWORD redirect_policy;
00070     DWORD error;
00071     DWORD_PTR context;
00072     LONG refs;
00073     WINHTTP_STATUS_CALLBACK callback;
00074     DWORD notify_mask;
00075     struct list entry;
00076     struct list children;
00077 };
00078 
00079 typedef struct
00080 {
00081     struct list entry;
00082     WCHAR *name;
00083     struct list cookies;
00084 } domain_t;
00085 
00086 typedef struct
00087 {
00088     struct list entry;
00089     WCHAR *name;
00090     WCHAR *value;
00091     WCHAR *path;
00092 } cookie_t;
00093 
00094 typedef struct
00095 {
00096     object_header_t hdr;
00097     LPWSTR agent;
00098     DWORD access;
00099     int resolve_timeout;
00100     int connect_timeout;
00101     int send_timeout;
00102     int recv_timeout;
00103     LPWSTR proxy_server;
00104     LPWSTR proxy_bypass;
00105     LPWSTR proxy_username;
00106     LPWSTR proxy_password;
00107     struct list cookie_cache;
00108 } session_t;
00109 
00110 typedef struct
00111 {
00112     object_header_t hdr;
00113     session_t *session;
00114     LPWSTR hostname;    /* final destination of the request */
00115     LPWSTR servername;  /* name of the server we directly connect to */
00116     LPWSTR username;
00117     LPWSTR password;
00118     INTERNET_PORT hostport;
00119     INTERNET_PORT serverport;
00120     struct sockaddr_storage sockaddr;
00121 } connect_t;
00122 
00123 typedef struct
00124 {
00125     int socket;
00126     BOOL secure; /* SSL active on connection? */
00127     void *ssl_conn;
00128     char *peek_msg;
00129     char *peek_msg_mem;
00130     size_t peek_len;
00131     DWORD security_flags;
00132 } netconn_t;
00133 
00134 typedef struct
00135 {
00136     LPWSTR field;
00137     LPWSTR value;
00138     BOOL is_request; /* part of request headers? */
00139 } header_t;
00140 
00141 typedef struct
00142 {
00143     object_header_t hdr;
00144     connect_t *connect;
00145     LPWSTR verb;
00146     LPWSTR path;
00147     LPWSTR version;
00148     LPWSTR raw_headers;
00149     netconn_t netconn;
00150     int resolve_timeout;
00151     int connect_timeout;
00152     int send_timeout;
00153     int recv_timeout;
00154     LPWSTR status_text;
00155     DWORD content_length; /* total number of bytes to be read (per chunk) */
00156     DWORD content_read;   /* bytes read so far */
00157     header_t *headers;
00158     DWORD num_headers;
00159 } request_t;
00160 
00161 typedef struct _task_header_t task_header_t;
00162 
00163 struct _task_header_t
00164 {
00165     request_t *request;
00166     void (*proc)( task_header_t * );
00167 };
00168 
00169 typedef struct
00170 {
00171     task_header_t hdr;
00172     LPWSTR headers;
00173     DWORD headers_len;
00174     LPVOID optional;
00175     DWORD optional_len;
00176     DWORD total_len;
00177     DWORD_PTR context;
00178 } send_request_t;
00179 
00180 typedef struct
00181 {
00182     task_header_t hdr;
00183 } receive_response_t;
00184 
00185 typedef struct
00186 {
00187     task_header_t hdr;
00188     LPDWORD available;
00189 } query_data_t;
00190 
00191 typedef struct
00192 {
00193     task_header_t hdr;
00194     LPVOID buffer;
00195     DWORD to_read;
00196     LPDWORD read;
00197 } read_data_t;
00198 
00199 typedef struct
00200 {
00201     task_header_t hdr;
00202     LPCVOID buffer;
00203     DWORD to_write;
00204     LPDWORD written;
00205 } write_data_t;
00206 
00207 object_header_t *addref_object( object_header_t * ) DECLSPEC_HIDDEN;
00208 object_header_t *grab_object( HINTERNET ) DECLSPEC_HIDDEN;
00209 void release_object( object_header_t * ) DECLSPEC_HIDDEN;
00210 HINTERNET alloc_handle( object_header_t * ) DECLSPEC_HIDDEN;
00211 BOOL free_handle( HINTERNET ) DECLSPEC_HIDDEN;
00212 
00213 void set_last_error( DWORD ) DECLSPEC_HIDDEN;
00214 DWORD get_last_error( void ) DECLSPEC_HIDDEN;
00215 void send_callback( object_header_t *, DWORD, LPVOID, DWORD ) DECLSPEC_HIDDEN;
00216 void close_connection( request_t * ) DECLSPEC_HIDDEN;
00217 
00218 BOOL netconn_close( netconn_t * ) DECLSPEC_HIDDEN;
00219 BOOL netconn_connect( netconn_t *, const struct sockaddr *, unsigned int, int ) DECLSPEC_HIDDEN;
00220 BOOL netconn_connected( netconn_t * ) DECLSPEC_HIDDEN;
00221 BOOL netconn_create( netconn_t *, int, int, int ) DECLSPEC_HIDDEN;
00222 BOOL netconn_get_next_line( netconn_t *, char *, DWORD * ) DECLSPEC_HIDDEN;
00223 BOOL netconn_init( netconn_t *, BOOL ) DECLSPEC_HIDDEN;
00224 void netconn_unload( void ) DECLSPEC_HIDDEN;
00225 BOOL netconn_query_data_available( netconn_t *, DWORD * ) DECLSPEC_HIDDEN;
00226 BOOL netconn_recv( netconn_t *, void *, size_t, int, int * ) DECLSPEC_HIDDEN;
00227 BOOL netconn_resolve( WCHAR *, INTERNET_PORT, struct sockaddr *, socklen_t *, int ) DECLSPEC_HIDDEN;
00228 BOOL netconn_secure_connect( netconn_t *, WCHAR * ) DECLSPEC_HIDDEN;
00229 BOOL netconn_send( netconn_t *, const void *, size_t, int, int * ) DECLSPEC_HIDDEN;
00230 DWORD netconn_set_timeout( netconn_t *, BOOL, int ) DECLSPEC_HIDDEN;
00231 const void *netconn_get_certificate( netconn_t * ) DECLSPEC_HIDDEN;
00232 int netconn_get_cipher_strength( netconn_t * ) DECLSPEC_HIDDEN;
00233 
00234 BOOL set_cookies( request_t *, const WCHAR * ) DECLSPEC_HIDDEN;
00235 BOOL add_cookie_headers( request_t * ) DECLSPEC_HIDDEN;
00236 BOOL add_request_headers( request_t *, LPCWSTR, DWORD, DWORD ) DECLSPEC_HIDDEN;
00237 void delete_domain( domain_t * ) DECLSPEC_HIDDEN;
00238 BOOL set_server_for_hostname( connect_t *connect, LPCWSTR server, INTERNET_PORT port ) DECLSPEC_HIDDEN;
00239 
00240 static inline void *heap_alloc( SIZE_T size )
00241 {
00242     return HeapAlloc( GetProcessHeap(), 0, size );
00243 }
00244 
00245 static inline void *heap_alloc_zero( SIZE_T size )
00246 {
00247     return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size );
00248 }
00249 
00250 static inline void *heap_realloc( LPVOID mem, SIZE_T size )
00251 {
00252     return HeapReAlloc( GetProcessHeap(), 0, mem, size );
00253 }
00254 
00255 static inline void *heap_realloc_zero( LPVOID mem, SIZE_T size )
00256 {
00257     return HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, mem, size );
00258 }
00259 
00260 static inline BOOL heap_free( LPVOID mem )
00261 {
00262     return HeapFree( GetProcessHeap(), 0, mem );
00263 }
00264 
00265 static inline WCHAR *strdupW( const WCHAR *src )
00266 {
00267     WCHAR *dst;
00268 
00269     if (!src) return NULL;
00270     dst = heap_alloc( (strlenW( src ) + 1) * sizeof(WCHAR) );
00271     if (dst) strcpyW( dst, src );
00272     return dst;
00273 }
00274 
00275 static inline WCHAR *strdupAW( const char *src )
00276 {
00277     WCHAR *dst = NULL;
00278     if (src)
00279     {
00280         DWORD len = MultiByteToWideChar( CP_ACP, 0, src, -1, NULL, 0 );
00281         if ((dst = heap_alloc( len * sizeof(WCHAR) )))
00282             MultiByteToWideChar( CP_ACP, 0, src, -1, dst, len );
00283     }
00284     return dst;
00285 }
00286 
00287 static inline char *strdupWA( const WCHAR *src )
00288 {
00289     char *dst = NULL;
00290     if (src)
00291     {
00292         int len = WideCharToMultiByte( CP_ACP, 0, src, -1, NULL, 0, NULL, NULL );
00293         if ((dst = heap_alloc( len )))
00294             WideCharToMultiByte( CP_ACP, 0, src, -1, dst, len, NULL, NULL );
00295     }
00296     return dst;
00297 }
00298 
00299 #endif /* _WINE_WINHTTP_PRIVATE_H_ */

Generated on Sat May 26 2012 04:25:26 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.