Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_UDPSocketParent_h__
8 #define mozilla_dom_UDPSocketParent_h__
10 #include "mozilla/net/PUDPSocketParent.h"
11 #include "nsCOMPtr.h"
12 #include "nsIUDPSocket.h"
13 #include "nsIUDPSocketFilter.h"
15 namespace mozilla {
16 namespace dom {
18 class UDPSocketParent : public mozilla::net::PUDPSocketParent
19 , public nsIUDPSocketListener
20 {
21 public:
22 NS_DECL_THREADSAFE_ISUPPORTS
23 NS_DECL_NSIUDPSOCKETLISTENER
25 UDPSocketParent(nsIUDPSocketFilter* filter) :
26 mIPCOpen(true),
27 mFilter(filter) {}
29 virtual ~UDPSocketParent();
31 bool Init(const nsCString& aHost, const uint16_t aPort);
33 virtual bool RecvClose() MOZ_OVERRIDE;
34 virtual bool RecvData(const InfallibleTArray<uint8_t>& aData,
35 const nsCString& aRemoteAddress,
36 const uint16_t& aPort) MOZ_OVERRIDE;
37 virtual bool RecvDataWithAddress( const InfallibleTArray<uint8_t>& data,
38 const mozilla::net::NetAddr& addr);
39 virtual bool RecvRequestDelete() MOZ_OVERRIDE;
41 private:
42 virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
44 bool mIPCOpen;
45 nsCOMPtr<nsIUDPSocket> mSocket;
46 nsCOMPtr<nsIUDPSocketFilter> mFilter;
47 };
49 } // namespace dom
50 } // namespace mozilla
52 #endif // !defined(mozilla_dom_UDPSocketParent_h__)