Bumping manifests a=b2g-bump
[gecko.git] / dom / network / UDPSocketChild.h
blobd154e304f7eca1baaeccf39bae0b12ee9465d6e8
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_dom_UDPSocketChild_h__
6 #define mozilla_dom_UDPSocketChild_h__
8 #include "mozilla/net/PUDPSocketChild.h"
9 #include "nsIUDPSocketChild.h"
10 #include "nsCycleCollectionParticipant.h"
11 #include "nsCOMPtr.h"
13 #define UDPSOCKETCHILD_CID \
14 {0xb47e5a0f, 0xd384, 0x48ef, { 0x88, 0x85, 0x42, 0x59, 0x79, 0x3d, 0x9c, 0xf0 }}
16 namespace mozilla {
17 namespace dom {
19 class UDPSocketChildBase : public nsIUDPSocketChild {
20 public:
21 NS_DECL_ISUPPORTS
23 void AddIPDLReference();
24 void ReleaseIPDLReference();
26 protected:
27 UDPSocketChildBase();
28 virtual ~UDPSocketChildBase();
29 nsCOMPtr<nsIUDPSocketInternal> mSocket;
30 bool mIPCOpen;
33 class UDPSocketChild : public mozilla::net::PUDPSocketChild
34 , public UDPSocketChildBase
36 public:
37 NS_DECL_NSIUDPSOCKETCHILD
38 NS_IMETHOD_(MozExternalRefCountType) Release() MOZ_OVERRIDE;
40 UDPSocketChild();
41 virtual ~UDPSocketChild();
43 virtual bool RecvCallbackOpened(const UDPAddressInfo& aAddressInfo) MOZ_OVERRIDE;
44 virtual bool RecvCallbackClosed() MOZ_OVERRIDE;
45 virtual bool RecvCallbackReceivedData(const UDPAddressInfo& aAddressInfo,
46 const InfallibleTArray<uint8_t>& aData) MOZ_OVERRIDE;
47 virtual bool RecvCallbackError(const nsCString& aMessage,
48 const nsCString& aFilename,
49 const uint32_t& aLineNumber) MOZ_OVERRIDE;
51 private:
52 nsresult SendDataInternal(const UDPSocketAddr& aAddr,
53 const uint8_t* aData,
54 const uint32_t aByteLength);
56 uint16_t mLocalPort;
57 nsCString mLocalAddress;
58 nsCString mFilterName;
61 } // namespace dom
62 } // namespace mozilla
64 #endif // !defined(mozilla_dom_UDPSocketChild_h__)