Interface nsISocketTransportType

nsISocketTransport

NOTE: Connection setup is triggered by opening an input or output stream, it does not start on its own. Completion of the connection setup is indicated by a STATUS_CONNECTED_TO notification to the event sink (if set).

NOTE: This is a free-threaded interface, meaning that the methods on this interface may be called from any thread.

Hierarchy

Properties

QoSBits: number

Socket QoS/ToS markings. Valid values are IPTOS_DSCP_AFxx or IPTOS_CLASS_CSx (or IPTOS_DSCP_EF, but currently no supported services require expedited-forwarding). Not setting this value will leave the socket with the default ToS value, which on most systems if IPTOS_CLASS_CS0 (formerly IPTOS_PREC_ROUTINE).

connectionFlags: number

connectionFlags is a bitmask that can be used to modify underlying behavior of the socket connection. See the flags below.

echConfigUsed: boolean

This attribute holds information whether echConfig has been used. The value is set after PR_Connect is called.

effectiveTRRMode: nsIRequest_TRRMode

Returns the effectiveTRRMode used for the DNS resolution.

host: string

Get the peer's host for the underlying socket connection. For Unix domain sockets, this is a pathname, or the empty string for unnamed and abstract socket addresses.

keepaliveEnabled: boolean

TCP keepalive configuration (support varies by platform). Note that the attribute as well as the setter can only accessed in the socket thread.

originAttributes: any

The origin attributes are used to create sockets. The first party domain will eventually be used to isolate OCSP cache and is only non-empty when "privacy.firstparty.isolate" is enabled. Setting this is the only way to carry origin attributes down to NSPR layers which are final consumers. It must be set before the socket transport is built.

port: number

Get the port for the underlying socket connection. For Unix domain sockets, this is zero.

recvBufferSize: number

TCP send and receive buffer sizes. A value of 0 means OS level auto-tuning is in effect.

resetIPFamilyPreference: boolean

If true, this socket transport has found out the prefered family according it's connection flags could not be used to establish connections any more. Hence, the preference should be reset.

retryDnsIfPossible: boolean

If DNS is performed externally, this flag informs the caller that it may retry connecting with a different DNS configuration (e.g. different IP family preference). The flag is set only if a network error is encounder, e.g. NS_ERROR_CONNECTION_REFUSED, NS_ERROR_RESET, etc.

securityCallbacks: nsIInterfaceRequestor

Security notification callbacks passed to the secure socket provider via nsITLSSocketControl at socket creation time.

NOTE: this attribute cannot be changed once a stream has been opened.

sendBufferSize: number
status: number

Return the current status of the socket.

tlsFlags: number

An opaque flags for non-standard behavior of the TLS system. It is unlikely this will need to be set outside of telemetry studies relating to the TLS implementation.

tlsSocketControl: nsITLSSocketControl

TLS socket control object. This attribute is only available once the socket is connected.

trrSkipReason: nsITRRSkipReason_value

Returns the TRR skip reason used for the DNS resolution.

Methods

  • Increases the reference count for this interface. The associated instance will not be deleted unless the reference count is returned to zero.

    Returns

    The resulting reference count.

    Returns number

  • Parameters

    • aIID: object
    • Optional aInstancePtr: object

    Returns any

  • A run time mechanism for interface discovery.

    Returns

    NS_OK if the interface is supported by the associated instance, NS_NOINTERFACE if it is not.

    aInstancePtr must not be null.

    Parameters

    • aIID: object

      [in] A requested interface IID

    • aInstancePtr: object

      [out] A pointer to an interface pointer to receive the result.

    Returns void

  • Decreases the reference count for this interface. Generally, if the reference count returns to zero, the associated instance is deleted.

    Returns

    The resulting reference count.

    Returns number

  • Returns OriginAttributes

  • Parameters

    • aOriginAttrs: const_OriginAttributesRef

    Returns void

  • Bind to a specific local address.

    Parameters

    • aLocalAddr: NetAddrPtr

    Returns void

  • Close the transport and any open streams.

    Parameters

    • aReason: number

      the reason for closing the stream.

    Returns void

  • Returns the IP address of the socket connection peer. This attribute is defined only once a connection has been established.

    Returns NetAddr

  • Returns a scriptable version of getPeerAddr. This attribute is defined only once a connection has been established.

    Returns nsINetAddr

  • Returns a scriptable version of getSelfAddr. This attribute is defined only once a connection has been established.

    Returns nsINetAddr

  • Returns the IP address of the initiating end. This attribute is defined only once a connection has been established.

    Returns NetAddr

  • Socket timeouts in seconds. To specify no timeout, pass UINT32_MAX as aValue to setTimeout. The implementation may truncate timeout values to a smaller range of values (e.g., 0 to 0xFFFF).

    Parameters

    • aType: number

    Returns number

  • Test if this socket transport is (still) connected.

    Returns boolean

  • Open an input stream on this transport.

    Flags have the following meaning:

    OPEN_BLOCKING If specified, then the resulting stream will have blocking stream semantics. This means that if the stream has no data and is not closed, then reading from it will block the calling thread until at least one byte is available or until the stream is closed. If this flag is NOT specified, then the stream has non-blocking stream semantics. This means that if the stream has no data and is not closed, then reading from it returns NS_BASE_STREAM_WOULD_BLOCK. In addition, in non-blocking mode, the stream is guaranteed to support nsIAsyncInputStream. This interface allows the consumer of the stream to be notified when the stream can again be read.

    OPEN_UNBUFFERED If specified, the resulting stream may not support ReadSegments. ReadSegments is only gauranteed to be implemented when this flag is NOT specified.

    Parameters

    • aFlags: number

      optional transport specific flags.

    • aSegmentSize: number

      if OPEN_UNBUFFERED is not set, then this parameter specifies the size of each buffer segment (pass 0 to use default value).

    • aSegmentCount: number

      if OPEN_UNBUFFERED is not set, then this parameter specifies the maximum number of buffer segments (pass 0 to use default value).

    Returns nsIInputStream

  • Open an output stream on this transport.

    Flags have the following meaning:

    OPEN_BLOCKING If specified, then the resulting stream will have blocking stream semantics. This means that if the stream is full and is not closed, then writing to it will block the calling thread until ALL of the data can be written or until the stream is closed. If this flag is NOT specified, then the stream has non-blocking stream semantics. This means that if the stream is full and is not closed, then writing to it returns NS_BASE_STREAM_WOULD_BLOCK. In addition, in non- blocking mode, the stream is guaranteed to support nsIAsyncOutputStream. This interface allows the consumer of the stream to be notified when the stream can again accept more data.

    OPEN_UNBUFFERED If specified, the resulting stream may not support WriteSegments and WriteFrom. WriteSegments and WriteFrom are only guaranteed to be implemented when this flag is NOT specified.

    Parameters

    • aFlags: number

      optional transport specific flags.

    • aSegmentSize: number

      if OPEN_UNBUFFERED is not set, then this parameter specifies the size of each buffer segment (pass 0 to use default value).

    • aSegmentCount: number

      if OPEN_UNBUFFERED is not set, then this parameter specifies the maximum number of buffer segments (pass 0 to use default value).

    Returns nsIOutputStream

  • IP address resolved using TRR.

    Returns bool

  • Called to set the echConfig to the securityInfo object.

    Parameters

    • echConfig: string

    Returns void

  • Set the transport event sink.

    Parameters

    • aSink: nsITransportEventSink

      receives transport layer notifications

    • aEventTarget: nsIEventTarget

      indicates the event target to which the notifications should be delivered. if NULL, then the notifications may occur on any thread.

    Returns void

  • Indicate whether this socket is created from a private window. If yes, this socket will be closed when the last private window is closed.

    Parameters

    • isPrivate: boolean

    Returns void

  • Parameters

    • keepaliveIdleTime: number
    • keepaliveRetryInterval: number

    Returns void

  • Sets the SO_LINGER option with the specified values for the l_onoff and l_linger parameters. This applies PR_SockOpt_Linger before PR_Close and can be used with a timeout of zero to send an RST packet when closing.

    Parameters

    • aPolarity: boolean
    • aTimeout: number

    Returns void

  • True to set addr and port reuse socket options.

    Parameters

    • reuseAddrPort: bool

    Returns void

  • Parameters

    • aType: number
    • aValue: number

    Returns void

Generated using TypeDoc