Bumping manifests a=b2g-bump
[gecko.git] / dom / network / UDPSocketParent.h
blob465e731449b945fd7779313d9b627a0978e0c931
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"
14 #include "mozilla/net/OfflineObserver.h"
15 #include "mozilla/dom/PermissionMessageUtils.h"
17 namespace mozilla {
18 namespace dom {
20 class UDPSocketParent : public mozilla::net::PUDPSocketParent
21 , public nsIUDPSocketListener
22 , public mozilla::net::DisconnectableParent
24 public:
25 NS_DECL_THREADSAFE_ISUPPORTS
26 NS_DECL_NSIUDPSOCKETLISTENER
28 UDPSocketParent();
30 bool Init(const IPC::Principal& aPrincipal, const nsACString& aFilter);
32 virtual bool RecvBind(const UDPAddressInfo& aAddressInfo,
33 const bool& aAddressReuse, const bool& aLoopback) MOZ_OVERRIDE;
35 virtual bool RecvOutgoingData(const UDPData& aData, const UDPSocketAddr& aAddr) MOZ_OVERRIDE;
37 virtual bool RecvClose() MOZ_OVERRIDE;
39 virtual bool RecvRequestDelete() MOZ_OVERRIDE;
40 virtual bool RecvJoinMulticast(const nsCString& aMulticastAddress,
41 const nsCString& aInterface) MOZ_OVERRIDE;
42 virtual bool RecvLeaveMulticast(const nsCString& aMulticastAddress,
43 const nsCString& aInterface) MOZ_OVERRIDE;
44 virtual nsresult OfflineNotification(nsISupports *) MOZ_OVERRIDE;
45 virtual uint32_t GetAppId() MOZ_OVERRIDE;
47 private:
48 virtual ~UDPSocketParent();
50 virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
51 void Send(const InfallibleTArray<uint8_t>& aData, const UDPSocketAddr& aAddr);
52 void Send(const InputStreamParams& aStream, const UDPSocketAddr& aAddr);
53 nsresult BindInternal(const nsCString& aHost, const uint16_t& aPort,
54 const bool& aAddressReuse, const bool& aLoopback);
56 void FireInternalError(uint32_t aLineNo);
58 bool mIPCOpen;
59 nsCOMPtr<nsIUDPSocket> mSocket;
60 nsCOMPtr<nsIUDPSocketFilter> mFilter;
61 nsRefPtr<mozilla::net::OfflineObserver> mObserver;
62 nsCOMPtr<nsIPrincipal> mPrincipal;
65 } // namespace dom
66 } // namespace mozilla
68 #endif // !defined(mozilla_dom_UDPSocketParent_h__)