Public Member Functions | Public Attributes

nsIIOService Interface Reference

nsIIOService provides a set of network utility functions. More...

import "nsIIOService.idl";

Inheritance diagram for nsIIOService:

List of all members.

Public Member Functions

nsIProtocolHandler getProtocolHandler (in string aScheme)
 Returns a protocol handler for a given URI scheme.
unsigned long getProtocolFlags (in string aScheme)
 Returns the protocol flags for a given scheme.
nsIURI newURI (in AUTF8String aSpec, in string aOriginCharset, in nsIURI aBaseURI)
 This method constructs a new URI by determining the scheme of the URI spec, and then delegating the construction of the URI to the protocol handler for that scheme.
nsIURI newFileURI (in nsIFile aFile)
 This method constructs a new URI from a nsIFile.
nsIChannel newChannelFromURI (in nsIURI aURI)
 Creates a channel for a given URI.
nsIChannel newChannel (in AUTF8String aSpec, in string aOriginCharset, in nsIURI aBaseURI)
 Equivalent to newChannelFromURI(newURI(...)).
boolean allowPort (in long aPort, in string aScheme)
 Checks if a port number is banned.
ACString extractScheme (in AUTF8String urlString)
 Utility to extract the scheme from a URL string, consistently and according to spec (see RFC 2396).

Public Attributes

attribute boolean offline
 Returns true if networking is in "offline" mode.

Detailed Description

nsIIOService provides a set of network utility functions.

This interface duplicates many of the nsIProtocolHandler methods in a protocol handler independent way (e.g., NewURI inspects the scheme in order to delegate creation of the new URI to the appropriate protocol handler). nsIIOService also provides a set of URL parsing utility functions. These are provided as a convenience to the programmer and in some cases to improve performance by eliminating intermediate data structures and interfaces.

Status:
FROZEN

Member Function Documentation

boolean nsIIOService::allowPort ( in long  aPort,
in string  aScheme 
)

Checks if a port number is banned.

This involves consulting a list of unsafe ports, corresponding to network services that may be easily exploitable. If the given port is considered unsafe, then the protocol handler (corresponding to aScheme) will be asked whether it wishes to override the IO service's decision to block the port. This gives the protocol handler ultimate control over its own security policy while ensuring reasonable, default protection.

See also:
nsIProtocolHandler::allowPort
ACString nsIIOService::extractScheme ( in AUTF8String  urlString  ) 

Utility to extract the scheme from a URL string, consistently and according to spec (see RFC 2396).

NOTE: Most URL parsing is done via nsIURI, and in fact the scheme can also be extracted from a URL string via nsIURI. This method is provided purely as an optimization.

Parameters:
aSpec the URL string to parse
Returns:
URL scheme
Exceptions:
NS_ERROR_MALFORMED_URI if URL string is not of the right form.
unsigned long nsIIOService::getProtocolFlags ( in string  aScheme  ) 

Returns the protocol flags for a given scheme.

Parameters:
aScheme the URI scheme
Returns:
value of corresponding nsIProtocolHandler::protocolFlags
nsIProtocolHandler nsIIOService::getProtocolHandler ( in string  aScheme  ) 

Returns a protocol handler for a given URI scheme.

Parameters:
aScheme the URI scheme
Returns:
reference to corresponding nsIProtocolHandler
nsIChannel nsIIOService::newChannel ( in AUTF8String  aSpec,
in string  aOriginCharset,
in nsIURI  aBaseURI 
)

Equivalent to newChannelFromURI(newURI(...)).

nsIChannel nsIIOService::newChannelFromURI ( in nsIURI  aURI  ) 

Creates a channel for a given URI.

Parameters:
aURI nsIURI from which to make a channel
Returns:
reference to the new nsIChannel object
nsIURI nsIIOService::newFileURI ( in nsIFile  aFile  ) 

This method constructs a new URI from a nsIFile.

Parameters:
aFile specifies the file path
Returns:
reference to a new nsIURI object

Note: in the future, for perf reasons we should allow callers to specify whether this is a file or directory by splitting this into newDirURI() and newActualFileURI().

nsIURI nsIIOService::newURI ( in AUTF8String  aSpec,
in string  aOriginCharset,
in nsIURI  aBaseURI 
)

This method constructs a new URI by determining the scheme of the URI spec, and then delegating the construction of the URI to the protocol handler for that scheme.

QueryInterface can be used on the resulting URI object to obtain a more specific type of URI.

See also:
nsIProtocolHandler::newURI

Member Data Documentation

Returns true if networking is in "offline" mode.

When in offline mode, attempts to access the network will fail (although this does not necessarily correlate with whether there is actually a network available -- that's hard to detect without causing the dialer to come up).

Changing this fires observer notifications ... see below.


The documentation for this interface was generated from the following file: