Reactos
at master 162 lines 5.4 kB view raw
1/* 2 * Copyright 2011 Jacek Caban 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#pragma once 20 21typedef struct nsWineURI nsWineURI; 22 23/* Keep sync with request_method_strings in nsio.c */ 24typedef enum { 25 METHOD_GET, 26 METHOD_PUT, 27 METHOD_POST 28} REQUEST_METHOD; 29 30typedef enum { 31 BOM_NONE, 32 BOM_UTF8, 33 BOM_UTF16 34} binding_bom_t; 35 36typedef struct { 37 nsIHttpChannel nsIHttpChannel_iface; 38 nsIUploadChannel nsIUploadChannel_iface; 39 nsIHttpChannelInternal nsIHttpChannelInternal_iface; 40 41 LONG ref; 42 43 nsWineURI *uri; 44 nsIInputStream *post_data_stream; 45 BOOL post_data_contains_headers; 46 nsILoadGroup *load_group; 47 nsIInterfaceRequestor *notif_callback; 48 nsISupports *owner; 49 nsILoadInfo *load_info; 50 nsLoadFlags load_flags; 51 nsIURI *original_uri; 52 nsIURI *referrer; 53 char *content_type; 54 char *charset; 55 UINT32 response_status; 56 char *response_status_text; 57 REQUEST_METHOD request_method; 58 struct list response_headers; 59 struct list request_headers; 60} nsChannel; 61 62typedef struct { 63 nsIInputStream *post_stream; 64 WCHAR *headers; 65 HGLOBAL post_data; 66 ULONG post_data_len; 67} request_data_t; 68 69typedef struct BSCallbackVtbl BSCallbackVtbl; 70 71struct BSCallback { 72 IBindStatusCallback IBindStatusCallback_iface; 73 IServiceProvider IServiceProvider_iface; 74 IHttpNegotiate2 IHttpNegotiate2_iface; 75 IInternetBindInfo IInternetBindInfo_iface; 76 77 const BSCallbackVtbl *vtbl; 78 79 LONG ref; 80 81 request_data_t request_data; 82 ULONG readed; 83 DWORD bindf; 84 BOOL bindinfo_ready; 85 binding_bom_t bom; 86 87 IMoniker *mon; 88 IBinding *binding; 89 90 HTMLInnerWindow *window; 91 92 struct list entry; 93}; 94 95typedef struct nsProtocolStream nsProtocolStream; 96 97struct nsChannelBSC { 98 BSCallback bsc; 99 100 nsChannel *nschannel; 101 nsIStreamListener *nslistener; 102 nsISupports *nscontext; 103 BOOL is_js; 104 BOOL is_doc_channel; 105 BOOL response_processed; 106 107 nsProtocolStream *nsstream; 108}; 109 110struct BSCallbackVtbl { 111 void (*destroy)(BSCallback*); 112 HRESULT (*init_bindinfo)(BSCallback*); 113 HRESULT (*start_binding)(BSCallback*); 114 HRESULT (*stop_binding)(BSCallback*,HRESULT); 115 HRESULT (*read_data)(BSCallback*,IStream*); 116 HRESULT (*on_progress)(BSCallback*,ULONG,LPCWSTR); 117 HRESULT (*on_response)(BSCallback*,DWORD,LPCWSTR); 118 HRESULT (*beginning_transaction)(BSCallback*,WCHAR**); 119}; 120 121typedef struct { 122 struct list entry; 123 WCHAR *header; 124 WCHAR *data; 125} http_header_t; 126 127#define BINDING_NAVIGATED 0x0001 128#define BINDING_REPLACE 0x0002 129#define BINDING_FROMHIST 0x0004 130#define BINDING_REFRESH 0x0008 131#define BINDING_SUBMIT 0x0010 132#define BINDING_NOFRAG 0x0020 133 134HRESULT set_http_header(struct list*,const WCHAR*,int,const WCHAR*,int) DECLSPEC_HIDDEN; 135HRESULT create_redirect_nschannel(const WCHAR*,nsChannel*,nsChannel**) DECLSPEC_HIDDEN; 136 137nsresult on_start_uri_open(NSContainer*,nsIURI*,cpp_bool*) DECLSPEC_HIDDEN; 138HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsChannel*,DWORD,BOOL*) DECLSPEC_HIDDEN; 139HRESULT create_doc_uri(HTMLOuterWindow*,IUri*,nsWineURI**) DECLSPEC_HIDDEN; 140HRESULT load_nsuri(HTMLOuterWindow*,nsWineURI*,nsIInputStream*,nsChannelBSC*,DWORD) DECLSPEC_HIDDEN; 141HRESULT set_moniker(HTMLOuterWindow*,IMoniker*,IUri*,IBindCtx*,nsChannelBSC*,BOOL) DECLSPEC_HIDDEN; 142void prepare_for_binding(HTMLDocument*,IMoniker*,DWORD) DECLSPEC_HIDDEN; 143HRESULT super_navigate(HTMLOuterWindow*,IUri*,DWORD,const WCHAR*,BYTE*,DWORD) DECLSPEC_HIDDEN; 144HRESULT load_uri(HTMLOuterWindow*,IUri*,DWORD) DECLSPEC_HIDDEN; 145HRESULT navigate_new_window(HTMLOuterWindow*,IUri*,const WCHAR*,request_data_t*,IHTMLWindow2**) DECLSPEC_HIDDEN; 146HRESULT navigate_url(HTMLOuterWindow*,const WCHAR*,IUri*,DWORD) DECLSPEC_HIDDEN; 147HRESULT submit_form(HTMLOuterWindow*,const WCHAR*,IUri*,nsIInputStream*) DECLSPEC_HIDDEN; 148 149void init_bscallback(BSCallback*,const BSCallbackVtbl*,IMoniker*,DWORD) DECLSPEC_HIDDEN; 150HRESULT create_channelbsc(IMoniker*,const WCHAR*,BYTE*,DWORD,BOOL,nsChannelBSC**) DECLSPEC_HIDDEN; 151HRESULT channelbsc_load_stream(HTMLInnerWindow*,IMoniker*,IStream*) DECLSPEC_HIDDEN; 152void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*) DECLSPEC_HIDDEN; 153IUri *nsuri_get_uri(nsWineURI*) DECLSPEC_HIDDEN; 154 155HRESULT read_stream(BSCallback*,IStream*,void*,DWORD,DWORD*) DECLSPEC_HIDDEN; 156 157HRESULT create_relative_uri(HTMLOuterWindow*,const WCHAR*,IUri**) DECLSPEC_HIDDEN; 158HRESULT create_uri(const WCHAR*,DWORD,IUri**) DECLSPEC_HIDDEN; 159IUri *get_uri_nofrag(IUri*) DECLSPEC_HIDDEN; 160 161void set_current_mon(HTMLOuterWindow*,IMoniker*,DWORD) DECLSPEC_HIDDEN; 162void set_current_uri(HTMLOuterWindow*,IUri*) DECLSPEC_HIDDEN;