28880. socket transport now provides access to the underlying ip address

This commit is contained in:
valeski%netscape.com 2000-05-02 22:25:00 +00:00
parent 42cbd2bf4f
commit 2e3acb0592
2 changed files with 51 additions and 30 deletions

View File

@ -25,37 +25,43 @@
[scriptable, uuid(785CA0F0-C39E-11d3-9ED6-0010A4053FD0)]
interface nsISocketTransport : nsISupports
{
attribute boolean reuseConnection;
attribute boolean reuseConnection;
/**
* socket read/write timeout in seconds; 0 = no timeout
*/
attribute unsigned long socketTimeout;
/**
* socket connect timeout in seconds; 0 = no timeout
*/
attribute unsigned long socketConnectTimeout;
/**
* Is used to tell the channel to stop reading data after a certain point;
* needed by HTTP/1.1
*/
attribute long bytesExpected;
attribute unsigned long reuseCount;
/**
* Checks if the socket is still alive
*
* @param seconds amount of time after which the socket is always deemed to be
* dead (no further checking is done in this case); seconds = 0
* will cause it not to do the timeout checking at all
*/
boolean isAlive (in unsigned long seconds);
/**
* maximum amount of time in seconds the transport is allowed to stay alive
* while connected (0 - default; no maximum idle timeout)
*/
attribute unsigned long idleTimeout;
/**
* socket read/write timeout in seconds; 0 = no timeout
* the string representation of the underlying ip address. Caller
* is responsible for de-allocating the returned string.
*/
attribute unsigned long socketTimeout;
/**
* socket connect timeout in seconds; 0 = no timeout
*/
attribute unsigned long socketConnectTimeout;
/**
* Is used to tell the channel to stop reading data after a certain point;
* needed by HTTP/1.1
*/
attribute long bytesExpected;
attribute unsigned long reuseCount;
/**
* Checks if the socket is still alive
*
* @param seconds amount of time after which the socket is always deemed to be
* dead (no further checking is done in this case); seconds = 0
* will cause it not to do the timeout checking at all
*/
boolean isAlive (in unsigned long seconds);
/**
* maximum amount of time in seconds the transport is allowed to stay alive
* while connected (0 - default; no maximum idle timeout)
*/
attribute unsigned long idleTimeout;
[noscript] string GetIPStr(in unsigned long aStrLen);
};

View File

@ -2269,6 +2269,21 @@ nsSocketTransport::SetIdleTimeout (PRUint32 seconds)
return NS_OK;
}
NS_IMETHODIMP
nsSocketTransport::GetIPStr(PRUint32 aLen, char **_retval) {
NS_ASSERTION(aLen > 0, "caller must pass in str len");
*_retval = (char*)nsAllocator::Alloc(aLen);
if (!*_retval) return NS_ERROR_FAILURE;
PRStatus status = PR_NetAddrToString(&mNetAddress, *_retval, aLen);
if (PR_FAILURE == status) {
nsAllocator::Free(*_retval);
return NS_ERROR_FAILURE;
}
return NS_OK;
}
NS_IMETHODIMP
nsSocketTransport::GetSocketTimeout (PRUint32 * o_Seconds)
{