Bug 460926 A11y hierachy is broken on Ubuntu 8.10 (GNOME 2.24), r=Evan.Yan sr=roc
[wine-gecko.git] / netwerk / base / public / nsIIOService.idl
blob5154a3a859620b9f6ef9afc40d154c176bbe6db2
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
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 #include "nsISupports.idl"
40 interface nsIProtocolHandler;
41 interface nsIChannel;
42 interface nsIURI;
43 interface nsIFile;
45 /**
46 * nsIIOService provides a set of network utility functions. This interface
47 * duplicates many of the nsIProtocolHandler methods in a protocol handler
48 * independent way (e.g., NewURI inspects the scheme in order to delegate
49 * creation of the new URI to the appropriate protocol handler). nsIIOService
50 * also provides a set of URL parsing utility functions. These are provided
51 * as a convenience to the programmer and in some cases to improve performance
52 * by eliminating intermediate data structures and interfaces.
54 * @status FROZEN
56 [scriptable, uuid(bddeda3f-9020-4d12-8c70-984ee9f7935e)]
57 interface nsIIOService : nsISupports
59 /**
60 * Returns a protocol handler for a given URI scheme.
62 * @param aScheme the URI scheme
63 * @return reference to corresponding nsIProtocolHandler
65 nsIProtocolHandler getProtocolHandler(in string aScheme);
67 /**
68 * Returns the protocol flags for a given scheme.
70 * @param aScheme the URI scheme
71 * @return value of corresponding nsIProtocolHandler::protocolFlags
73 unsigned long getProtocolFlags(in string aScheme);
75 /**
76 * This method constructs a new URI by determining the scheme of the
77 * URI spec, and then delegating the construction of the URI to the
78 * protocol handler for that scheme. QueryInterface can be used on
79 * the resulting URI object to obtain a more specific type of URI.
81 * @see nsIProtocolHandler::newURI
83 nsIURI newURI(in AUTF8String aSpec,
84 in string aOriginCharset,
85 in nsIURI aBaseURI);
87 /**
88 * This method constructs a new URI from a nsIFile.
90 * @param aFile specifies the file path
91 * @return reference to a new nsIURI object
93 nsIURI newFileURI(in nsIFile aFile);
95 /**
96 * Creates a channel for a given URI.
98 * @param aURI nsIURI from which to make a channel
99 * @return reference to the new nsIChannel object
101 nsIChannel newChannelFromURI(in nsIURI aURI);
104 * Equivalent to newChannelFromURI(newURI(...))
106 nsIChannel newChannel(in AUTF8String aSpec,
107 in string aOriginCharset,
108 in nsIURI aBaseURI);
111 * Returns true if networking is in "offline" mode. When in offline mode,
112 * attempts to access the network will fail (although this does not
113 * necessarily correlate with whether there is actually a network
114 * available -- that's hard to detect without causing the dialer to
115 * come up).
117 * Changing this fires observer notifications ... see below.
119 attribute boolean offline;
122 * Checks if a port number is banned. This involves consulting a list of
123 * unsafe ports, corresponding to network services that may be easily
124 * exploitable. If the given port is considered unsafe, then the protocol
125 * handler (corresponding to aScheme) will be asked whether it wishes to
126 * override the IO service's decision to block the port. This gives the
127 * protocol handler ultimate control over its own security policy while
128 * ensuring reasonable, default protection.
130 * @see nsIProtocolHandler::allowPort
132 boolean allowPort(in long aPort, in string aScheme);
135 * Utility to extract the scheme from a URL string, consistently and
136 * according to spec (see RFC 2396).
138 * NOTE: Most URL parsing is done via nsIURI, and in fact the scheme
139 * can also be extracted from a URL string via nsIURI. This method
140 * is provided purely as an optimization.
142 * @param aSpec the URL string to parse
143 * @return URL scheme
145 * @throws NS_ERROR_MALFORMED_URI if URL string is not of the right form.
147 ACString extractScheme(in AUTF8String urlString);
150 %{C++
152 * We send notifications through nsIObserverService with topic
153 * NS_IOSERVICE_GOING_OFFLINE_TOPIC and data NS_IOSERVICE_OFFLINE
154 * when 'offline' has changed from false to true, and we are about
155 * to shut down network services such as DNS. When those
156 * services have been shut down, we send a notification with
157 * topic NS_IOSERVICE_OFFLINE_STATUS_TOPIC and data
158 * NS_IOSERVICE_OFFLINE.
160 * When 'offline' changes from true to false, then after
161 * network services have been restarted, we send a notification
162 * with topic NS_IOSERVICE_OFFLINE_STATUS_TOPIC and data
163 * NS_IOSERVICE_ONLINE.
165 #define NS_IOSERVICE_GOING_OFFLINE_TOPIC "network:offline-about-to-go-offline"
166 #define NS_IOSERVICE_OFFLINE_STATUS_TOPIC "network:offline-status-changed"
167 #define NS_IOSERVICE_OFFLINE "offline"
168 #define NS_IOSERVICE_ONLINE "online"