diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/network/UDPSocketChild.h | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/network/UDPSocketChild.h')
-rw-r--r-- | dom/network/UDPSocketChild.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/dom/network/UDPSocketChild.h b/dom/network/UDPSocketChild.h new file mode 100644 index 000000000..5794b7d46 --- /dev/null +++ b/dom/network/UDPSocketChild.h @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef mozilla_dom_UDPSocketChild_h__ +#define mozilla_dom_UDPSocketChild_h__ + +#include "mozilla/net/PUDPSocketChild.h" +#include "nsIUDPSocketChild.h" +#include "nsCycleCollectionParticipant.h" +#include "nsCOMPtr.h" + +#define UDPSOCKETCHILD_CID \ + {0xb47e5a0f, 0xd384, 0x48ef, { 0x88, 0x85, 0x42, 0x59, 0x79, 0x3d, 0x9c, 0xf0 }} + +namespace mozilla { +namespace dom { + +class UDPSocketChildBase : public nsIUDPSocketChild { +public: + NS_DECL_ISUPPORTS + + void AddIPDLReference(); + void ReleaseIPDLReference(); + +protected: + UDPSocketChildBase(); + virtual ~UDPSocketChildBase(); + nsCOMPtr<nsIUDPSocketInternal> mSocket; + bool mIPCOpen; +}; + +class UDPSocketChild : public mozilla::net::PUDPSocketChild + , public UDPSocketChildBase +{ +public: + NS_DECL_NSIUDPSOCKETCHILD + NS_IMETHOD_(MozExternalRefCountType) Release() override; + + UDPSocketChild(); + virtual ~UDPSocketChild(); + + nsresult CreatePBackgroundSpinUntilDone(); + + virtual bool RecvCallbackOpened(const UDPAddressInfo& aAddressInfo) override; + virtual bool RecvCallbackConnected(const UDPAddressInfo& aAddressInfo) override; + virtual bool RecvCallbackClosed() override; + virtual bool RecvCallbackReceivedData(const UDPAddressInfo& aAddressInfo, + InfallibleTArray<uint8_t>&& aData) override; + virtual bool RecvCallbackError(const nsCString& aMessage, + const nsCString& aFilename, + const uint32_t& aLineNumber) override; + +private: + nsresult SendDataInternal(const UDPSocketAddr& aAddr, + const uint8_t* aData, + const uint32_t aByteLength); + + mozilla::ipc::PBackgroundChild* mBackgroundManager; + uint16_t mLocalPort; + nsCString mLocalAddress; + nsCString mFilterName; +}; + +} // namespace dom +} // namespace mozilla + +#endif // !defined(mozilla_dom_UDPSocketChild_h__) |