1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/network/src/UDPSocketParent.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,52 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.8 + * You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef mozilla_dom_UDPSocketParent_h__ 1.11 +#define mozilla_dom_UDPSocketParent_h__ 1.12 + 1.13 +#include "mozilla/net/PUDPSocketParent.h" 1.14 +#include "nsCOMPtr.h" 1.15 +#include "nsIUDPSocket.h" 1.16 +#include "nsIUDPSocketFilter.h" 1.17 + 1.18 +namespace mozilla { 1.19 +namespace dom { 1.20 + 1.21 +class UDPSocketParent : public mozilla::net::PUDPSocketParent 1.22 + , public nsIUDPSocketListener 1.23 +{ 1.24 +public: 1.25 + NS_DECL_THREADSAFE_ISUPPORTS 1.26 + NS_DECL_NSIUDPSOCKETLISTENER 1.27 + 1.28 + UDPSocketParent(nsIUDPSocketFilter* filter) : 1.29 + mIPCOpen(true), 1.30 + mFilter(filter) {} 1.31 + 1.32 + virtual ~UDPSocketParent(); 1.33 + 1.34 + bool Init(const nsCString& aHost, const uint16_t aPort); 1.35 + 1.36 + virtual bool RecvClose() MOZ_OVERRIDE; 1.37 + virtual bool RecvData(const InfallibleTArray<uint8_t>& aData, 1.38 + const nsCString& aRemoteAddress, 1.39 + const uint16_t& aPort) MOZ_OVERRIDE; 1.40 + virtual bool RecvDataWithAddress( const InfallibleTArray<uint8_t>& data, 1.41 + const mozilla::net::NetAddr& addr); 1.42 + virtual bool RecvRequestDelete() MOZ_OVERRIDE; 1.43 + 1.44 +private: 1.45 + virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE; 1.46 + 1.47 + bool mIPCOpen; 1.48 + nsCOMPtr<nsIUDPSocket> mSocket; 1.49 + nsCOMPtr<nsIUDPSocketFilter> mFilter; 1.50 +}; 1.51 + 1.52 +} // namespace dom 1.53 +} // namespace mozilla 1.54 + 1.55 +#endif // !defined(mozilla_dom_UDPSocketParent_h__)