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
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.
22 * Darin Fisher <darin@netscape.com> (original author)
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 nsNetError_h__
39 #define nsNetError_h__
44 /* NETWORKING ERROR CODES */
47 /******************************************************************************
48 * General async request error codes:
50 * These error codes are commonly passed through callback methods to indicate
51 * the status of some requested async request.
53 * For example, see nsIRequestObserver::onStopRequest.
57 * The async request completed successfully.
59 #define NS_BINDING_SUCCEEDED \
63 * The async request failed for some unknown reason.
65 #define NS_BINDING_FAILED \
66 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 1)
69 * The async request failed because it was aborted by some user action.
71 #define NS_BINDING_ABORTED \
72 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
75 * The async request has been "redirected" to a different async request.
76 * (e.g., an HTTP redirect occured).
78 * This error code is used with load groups to notify the load group observer
79 * when a request in the load group is redirected to another request.
81 #define NS_BINDING_REDIRECTED \
82 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 3)
85 * The async request has been "retargeted" to a different "handler."
87 * This error code is used with load groups to notify the load group observer
88 * when a request in the load group is removed from the load group and added
89 * to a different load group.
91 #define NS_BINDING_RETARGETED \
92 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 4)
95 /******************************************************************************
96 * Miscellaneous error codes:
98 * These errors are not typically passed via onStopRequest.
102 * The URI is malformed.
104 #define NS_ERROR_MALFORMED_URI \
105 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 10)
108 * The URI scheme corresponds to an unknown protocol handler.
110 #define NS_ERROR_UNKNOWN_PROTOCOL \
111 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 18)
114 * Returned from nsIChannel::asyncOpen to indicate that OnDataAvailable will
115 * not be called because there is no content available.
117 * This is used by helper app style protocols (e.g., mailto).
119 * XXX perhaps this should be a success code.
121 #define NS_ERROR_NO_CONTENT \
122 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 17)
125 * The requested action could not be completed while the object is busy.
127 * Implementations of nsIChannel::asyncOpen will commonly return this error
128 * if the channel has already been opened (and has not yet been closed).
130 #define NS_ERROR_IN_PROGRESS \
131 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 15)
134 * Returned from nsIChannel::asyncOpen when trying to open the channel again
135 * (reopening is not supported).
137 #define NS_ERROR_ALREADY_OPENED \
138 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 73)
141 * The content encoding of the source document was incorrect, for example
142 * returning a plain HTML document advertised as Content-Encoding: gzip
144 #define NS_ERROR_INVALID_CONTENT_ENCODING \
145 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 27)
147 /******************************************************************************
148 * Connectivity error codes:
152 * The connection is already established.
153 * XXX currently unused - consider removing.
155 #define NS_ERROR_ALREADY_CONNECTED \
156 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 11)
159 * The connection does not exist.
160 * XXX currently unused - consider removing.
162 #define NS_ERROR_NOT_CONNECTED \
163 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 12)
166 * The connection attempt failed, for example, because no server was listening
167 * at specified host:port.
169 #define NS_ERROR_CONNECTION_REFUSED \
170 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 13)
173 * The connection attempt to a proxy failed.
175 #define NS_ERROR_PROXY_CONNECTION_REFUSED \
176 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 72)
179 * The connection was lost due to a timeout error.
181 #define NS_ERROR_NET_TIMEOUT \
182 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 14)
185 * The requested action could not be completed while the networking library
186 * is in the offline state.
188 #define NS_ERROR_OFFLINE \
189 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 16)
192 * The requested action was prohibited because it would have caused the
193 * networking library to establish a connection to an unsafe or otherwise
196 #define NS_ERROR_PORT_ACCESS_NOT_ALLOWED \
197 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 19)
200 * The connection was established, but no data was ever received.
202 #define NS_ERROR_NET_RESET \
203 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 20)
206 * The connection was established, but the data transfer was interrupted.
208 #define NS_ERROR_NET_INTERRUPT \
209 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 71)
211 // XXX really need to better rationalize these error codes. are consumers of
212 // necko really expected to know how to discern the meaning of these??
216 * This request is not resumable, but it was tried to resume it, or to
217 * request resume-specific data.
219 #define NS_ERROR_NOT_RESUMABLE \
220 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 25)
223 * It was attempted to resume the request, but the entity has changed in the
226 #define NS_ERROR_ENTITY_CHANGED \
227 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 32)
230 * The request failed as a result of a detected redirection loop.
232 #define NS_ERROR_REDIRECT_LOOP \
233 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 31)
236 * The request failed because the content type returned by the server was
237 * not a type expected by the channel (for nested channels such as the JAR
240 #define NS_ERROR_UNSAFE_CONTENT_TYPE \
241 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 74)
243 /******************************************************************************
244 * FTP specific error codes:
249 #define NS_ERROR_FTP_LOGIN \
250 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 21)
252 #define NS_ERROR_FTP_CWD \
253 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 22)
255 #define NS_ERROR_FTP_PASV \
256 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 23)
258 #define NS_ERROR_FTP_PWD \
259 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 24)
261 #define NS_ERROR_FTP_LIST \
262 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 28)
264 /******************************************************************************
265 * DNS specific error codes:
269 * The lookup of a hostname failed. This generally refers to the hostname
270 * from the URL being loaded.
272 #define NS_ERROR_UNKNOWN_HOST \
273 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 30)
276 * A low or medium priority DNS lookup failed because the pending
277 * queue was already full. High priorty (the default) always
280 #define NS_ERROR_DNS_LOOKUP_QUEUE_FULL \
281 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 33)
284 * The lookup of a proxy hostname failed.
286 * If a channel is configured to speak to a proxy server, then it will
287 * generate this error if the proxy hostname cannot be resolved.
289 #define NS_ERROR_UNKNOWN_PROXY_HOST \
290 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 42)
293 /******************************************************************************
294 * Socket specific error codes:
298 * The specified socket type does not exist.
300 #define NS_ERROR_UNKNOWN_SOCKET_TYPE \
301 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 51)
304 * The specified socket type could not be created.
306 #define NS_ERROR_SOCKET_CREATE_FAILED \
307 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 52)
310 /******************************************************************************
311 * Cache specific error codes:
316 #define NS_ERROR_CACHE_KEY_NOT_FOUND \
317 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 61)
319 #define NS_ERROR_CACHE_DATA_IS_STREAM \
320 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 62)
322 #define NS_ERROR_CACHE_DATA_IS_NOT_STREAM \
323 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 63)
325 #define NS_ERROR_CACHE_WAIT_FOR_VALIDATION \
326 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 64)
328 #define NS_ERROR_CACHE_ENTRY_DOOMED \
329 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 65)
331 #define NS_ERROR_CACHE_READ_ACCESS_DENIED \
332 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 66)
334 #define NS_ERROR_CACHE_WRITE_ACCESS_DENIED \
335 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 67)
337 #define NS_ERROR_CACHE_IN_USE \
338 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 68)
341 * Error passed through onStopRequest if the document could not be fetched
344 #define NS_ERROR_DOCUMENT_NOT_CACHED \
345 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 70)
348 /******************************************************************************
349 * Effective TLD Service specific error codes:
353 * The requested number of domain levels exceeds those present in the host string.
355 #define NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS \
356 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 80)
359 * The host string is an IP address.
361 #define NS_ERROR_HOST_IS_IP_ADDRESS \
362 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 81)
365 #endif // !nsNetError_h__