2012-05-21 15:12:37 +04:00
|
|
|
/* 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
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-05-31 10:07:26 +04:00
|
|
|
|
|
|
|
#include "nsUDPSocketProvider.h"
|
|
|
|
|
|
|
|
#include "nspr.h"
|
|
|
|
|
2014-04-27 11:06:00 +04:00
|
|
|
NS_IMPL_ISUPPORTS(nsUDPSocketProvider, nsISocketProvider)
|
2007-05-31 10:07:26 +04:00
|
|
|
|
|
|
|
nsUDPSocketProvider::~nsUDPSocketProvider()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 19:56:38 +04:00
|
|
|
nsUDPSocketProvider::NewSocket(int32_t aFamily,
|
2007-05-31 10:07:26 +04:00
|
|
|
const char *aHost,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aPort,
|
2007-05-31 10:07:26 +04:00
|
|
|
const char *aProxyHost,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aProxyPort,
|
|
|
|
uint32_t aFlags,
|
2007-05-31 10:07:26 +04:00
|
|
|
PRFileDesc * *aFileDesc,
|
|
|
|
nsISupports **aSecurityInfo)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aFileDesc);
|
|
|
|
|
|
|
|
PRFileDesc* udpFD = PR_OpenUDPSocket(aFamily);
|
|
|
|
if (!udpFD)
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
*aFileDesc = udpFD;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 19:56:38 +04:00
|
|
|
nsUDPSocketProvider::AddToSocket(int32_t aFamily,
|
2007-05-31 10:07:26 +04:00
|
|
|
const char *aHost,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aPort,
|
2007-05-31 10:07:26 +04:00
|
|
|
const char *aProxyHost,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aProxyPort,
|
|
|
|
uint32_t aFlags,
|
2007-05-31 10:07:26 +04:00
|
|
|
struct PRFileDesc * aFileDesc,
|
|
|
|
nsISupports **aSecurityInfo)
|
|
|
|
{
|
|
|
|
// does not make sense to strap a UDP socket onto an existing socket
|
|
|
|
NS_NOTREACHED("Cannot layer UDP socket on an existing socket");
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
}
|