michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsUDPSocketProvider.h" michael@0: michael@0: #include "nspr.h" michael@0: michael@0: NS_IMPL_ISUPPORTS(nsUDPSocketProvider, nsISocketProvider) michael@0: michael@0: nsUDPSocketProvider::~nsUDPSocketProvider() michael@0: { michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: nsUDPSocketProvider::NewSocket(int32_t aFamily, michael@0: const char *aHost, michael@0: int32_t aPort, michael@0: nsIProxyInfo *aProxy, michael@0: uint32_t aFlags, michael@0: PRFileDesc * *aFileDesc, michael@0: nsISupports **aSecurityInfo) michael@0: { michael@0: NS_ENSURE_ARG_POINTER(aFileDesc); michael@0: michael@0: PRFileDesc* udpFD = PR_OpenUDPSocket(aFamily); michael@0: if (!udpFD) michael@0: return NS_ERROR_FAILURE; michael@0: michael@0: *aFileDesc = udpFD; michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: nsUDPSocketProvider::AddToSocket(int32_t aFamily, michael@0: const char *aHost, michael@0: int32_t aPort, michael@0: nsIProxyInfo *aProxy, michael@0: uint32_t aFlags, michael@0: struct PRFileDesc * aFileDesc, michael@0: nsISupports **aSecurityInfo) michael@0: { michael@0: // does not make sense to strap a UDP socket onto an existing socket michael@0: NS_NOTREACHED("Cannot layer UDP socket on an existing socket"); michael@0: return NS_ERROR_UNEXPECTED; michael@0: }