Source code
Revision control
Copy as Markdown
Other Tools
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
#include "nsISupports.idl"
interface nsINetAddr;
[scriptable, builtinclass, uuid(8ef68853-dbea-4113-9dce-273b45d431c5)]
interface nsIMockNetworkLayerController : nsISupports
{
nsINetAddr createScriptableNetAddr(in AUTF8String aIP, in uint16_t aPort);
/**
* Adds an override for this specific NetAddr.
*/
void addNetAddrOverride(in nsINetAddr aFrom, in nsINetAddr aTo);
/**
* Clears all the NetAddr overrides that were previously set.
*/
void clearNetAddrOverrides();
/**
* This method causes TCP connect() to fail with PR_CONNECT_REFUSED_ERROR
* for the given network address.
*/
void blockTCPConnect(in nsINetAddr aAddr);
/**
* Removes all entries from the TCP connect blocklist.
*/
void clearBlockedTCPConnect();
/**
* This method causes TCP connect() to hang indefinitely (returns
* PR_IN_PROGRESS_ERROR without actually connecting) for the given address.
*/
void pauseTCPConnect(in nsINetAddr aAddr);
/**
* Removes all entries from the TCP connect pause list.
*/
void clearPausedTCPConnect();
/**
* This method prevents any UDP traffic to and from the given network address.
*/
void blockUDPAddrIO(in nsINetAddr aAddr);
/**
* Removes all entries from the UDP blocklist.
*/
void clearBlockedUDPAddr();
/**
* This method causes UDP sendto() to fail immediately with
* PR_CONNECT_REFUSED_ERROR for the given network address.
*/
void failUDPAddrIO(in nsINetAddr aAddr);
/**
* Removes all entries from the UDP fail list.
*/
void clearFailedUDPAddr();
};