nsISocketProvider 编辑

netwerk/socket/nsISocketProvider.idlScriptable This interface represents a socket provider. It is implemented by several types of socket classes like: UDP, SOCKS, TLS, SSL, and so on. Inherits from: nsISupports Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)

Implemented by: @mozilla.org/network/socket;2?type=foo. To create an instance, use:

var socketProvider = Components.classes["@mozilla.org/network/socket;2?type="]
                     .createInstance(Components.interfaces.nsISocketProvider);

Method overview

void addToSocket(in long aFamily, in string aHost, in long aPort, in string aProxyHost, in long aProxyPort, in unsigned long aFlags, in PRFileDescStar aFileDesc, out nsISupports aSecurityInfo); Native code only!
void newSocket(in long aFamily, in string aHost, in long aPort, in string aProxyHost, in long aProxyPort, in unsigned long aFlags, out PRFileDescStar aFileDesc, out nsISupports aSecurityInfo); Native code only!

Constants

ConstantValueDescription
PROXY_RESOLVES_HOST1 << 0This flag is set if the proxy is to perform hostname resolution instead of the client. When set, the hostname parameter passed in this interface will be used instead of the address structure passed for a later request.
ANONYMOUS_CONNECT1 << 1When setting this flag, the socket will not apply any credentials when establishing a connection. For example, an SSL connection would not send any client-certificates if this flag is set.

Methods

Native code only!

addToSocket

This function is called to allow the socket provider to layer a PRFileDesc (a file descriptor) on top of another PRFileDesc. For example, SSL via a SOCKS proxy.

Parameters are the same as newSocket() with the exception of aFileDesc, which is an input parameter instead.

void addToSocket(
  in long aFamily,
  in string aHost,
  in long aPort,
  in string aProxyHost,
  in long aProxyPort,
  in unsigned long aFlags,
  in PRFileDescStar aFileDesc,
  out nsISupports aSecurityInfo
);
Parameters
aFamily
The address family for this socket (PR_AF_INET or PR_AF_INET6).
aHost
The hostname for this connection.
aPort
The port for this connection.
aProxyHost
If non-null, the proxy hostname for this connection.
aProxyPort
The proxy port for this connection.
aFlags
Control flags that govern this connection (see Constants).
aFileDesc
The existing PRFileDesc.
aSecurityInfo
Any security info that should be associated with aFileDesc. This object typically implements nsITransportSecurityInfo.
Native code only!

newSocket

Creates a new socket.

void newSocket(
  in long aFamily,
  in string aHost,
  in long aPort,
  in string aProxyHost,
  in long aProxyPort,
  in unsigned long aFlags,
  out PRFileDescStar aFileDesc,
  out nsISupports aSecurityInfo
);
Parameters
aFamily
The address family for this socket (PR_AF_INET or PR_AF_INET6).
aHost
The hostname for this connection.
aPort
The port for this connection.
aProxyHost
If non-null, the proxy hostname for this connection.
aProxyPort
The proxy port for this connection.
aFlags
Control flags that govern this connection (see Constants)
aFileDesc
The resulting PRFileDesc.
aSecurityInfo
Any security info that should be associated with aFileDesc. This object typically implements nsITransportSecurityInfo.

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:26 次

字数:6303

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文