michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 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 file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_UDPSocketParent_h__ michael@0: #define mozilla_dom_UDPSocketParent_h__ michael@0: michael@0: #include "mozilla/net/PUDPSocketParent.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIUDPSocket.h" michael@0: #include "nsIUDPSocketFilter.h" michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: class UDPSocketParent : public mozilla::net::PUDPSocketParent michael@0: , public nsIUDPSocketListener michael@0: { michael@0: public: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: NS_DECL_NSIUDPSOCKETLISTENER michael@0: michael@0: UDPSocketParent(nsIUDPSocketFilter* filter) : michael@0: mIPCOpen(true), michael@0: mFilter(filter) {} michael@0: michael@0: virtual ~UDPSocketParent(); michael@0: michael@0: bool Init(const nsCString& aHost, const uint16_t aPort); michael@0: michael@0: virtual bool RecvClose() MOZ_OVERRIDE; michael@0: virtual bool RecvData(const InfallibleTArray& aData, michael@0: const nsCString& aRemoteAddress, michael@0: const uint16_t& aPort) MOZ_OVERRIDE; michael@0: virtual bool RecvDataWithAddress( const InfallibleTArray& data, michael@0: const mozilla::net::NetAddr& addr); michael@0: virtual bool RecvRequestDelete() MOZ_OVERRIDE; michael@0: michael@0: private: michael@0: virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE; michael@0: michael@0: bool mIPCOpen; michael@0: nsCOMPtr mSocket; michael@0: nsCOMPtr mFilter; michael@0: }; michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: #endif // !defined(mozilla_dom_UDPSocketParent_h__)