Bug 458256. Use LoadLibraryW instead of LoadLibrary (patch by DougT). r+sr=vlad
[wine-gecko.git] / netwerk / protocol / http / src / nsAHttpConnection.h
blobf1ae1a1a45a3b8a47151f4940797bb96db7ca03e
1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
14 * The Original Code is Mozilla.
16 * The Initial Developer of the Original Code is
17 * Netscape Communications Corporation.
18 * Portions created by the Initial Developer are Copyright (C) 2002
19 * the Initial Developer. All Rights Reserved.
21 * Contributor(s):
22 * Darin Fisher <darin@netscape.com>
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #ifndef nsAHttpConnection_h__
39 #define nsAHttpConnection_h__
41 #include "nsISupports.h"
43 class nsAHttpTransaction;
44 class nsHttpRequestHead;
45 class nsHttpResponseHead;
46 class nsHttpConnectionInfo;
48 //-----------------------------------------------------------------------------
49 // Abstract base class for a HTTP connection
50 //-----------------------------------------------------------------------------
52 class nsAHttpConnection : public nsISupports
54 public:
55 //-------------------------------------------------------------------------
56 // NOTE: these methods may only be called on the socket thread.
57 //-------------------------------------------------------------------------
60 // called by a transaction when the response headers have all been read.
61 // the connection can force the transaction to reset it's response headers,
62 // and prepare for a new set of response headers, by setting |*reset=TRUE|.
64 // @return failure code to close the transaction.
66 virtual nsresult OnHeadersAvailable(nsAHttpTransaction *,
67 nsHttpRequestHead *,
68 nsHttpResponseHead *,
69 PRBool *reset) = 0;
72 // called by a transaction to resume either sending or receiving data
73 // after a transaction returned NS_BASE_STREAM_WOULD_BLOCK from its
74 // ReadSegments/WriteSegments methods.
76 virtual nsresult ResumeSend() = 0;
77 virtual nsresult ResumeRecv() = 0;
80 // called by the connection manager to close a transaction being processed
81 // by this connection.
83 // @param transaction
84 // the transaction being closed.
85 // @param reason
86 // the reason for closing the transaction. NS_BASE_STREAM_CLOSED
87 // is equivalent to NS_OK.
89 virtual void CloseTransaction(nsAHttpTransaction *transaction,
90 nsresult reason) = 0;
92 // get a reference to the connection's connection info object.
93 virtual void GetConnectionInfo(nsHttpConnectionInfo **) = 0;
95 // called by a transaction to get the security info from the socket.
96 virtual void GetSecurityInfo(nsISupports **) = 0;
98 // called by a transaction to determine whether or not the connection is
99 // persistent... important in determining the end of a response.
100 virtual PRBool IsPersistent() = 0;
102 // called to determine if a connection has been reused.
103 virtual PRBool IsReused() = 0;
105 // called by a transaction when the transaction reads more from the socket
106 // than it should have (eg. containing part of the next pipelined response).
107 virtual nsresult PushBack(const char *data, PRUint32 length) = 0;
110 #define NS_DECL_NSAHTTPCONNECTION \
111 nsresult OnHeadersAvailable(nsAHttpTransaction *, nsHttpRequestHead *, nsHttpResponseHead *, PRBool *reset); \
112 nsresult ResumeSend(); \
113 nsresult ResumeRecv(); \
114 void CloseTransaction(nsAHttpTransaction *, nsresult); \
115 void GetConnectionInfo(nsHttpConnectionInfo **); \
116 void GetSecurityInfo(nsISupports **); \
117 PRBool IsPersistent(); \
118 PRBool IsReused(); \
119 nsresult PushBack(const char *, PRUint32);
121 #endif // nsAHttpConnection_h__