tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

WebrtcTCPSocketParent.h (1789B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set sw=2 ts=8 et tw=80 ft=cpp : */
      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/. */
      6 
      7 #ifndef mozilla_net_WebrtcTCPSocketParent_h
      8 #define mozilla_net_WebrtcTCPSocketParent_h
      9 
     10 #include "WebrtcTCPSocketCallback.h"
     11 #include "mozilla/net/PWebrtcTCPSocketParent.h"
     12 
     13 class nsIAuthPromptProvider;
     14 
     15 namespace mozilla::net {
     16 
     17 class WebrtcTCPSocket;
     18 
     19 class WebrtcTCPSocketParent : public PWebrtcTCPSocketParent,
     20                              public WebrtcTCPSocketCallback {
     21 public:
     22  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebrtcTCPSocketParent, override)
     23 
     24  mozilla::ipc::IPCResult RecvAsyncOpen(
     25      const nsACString& aHost, const int& aPort,
     26      const nsACString& aLocalAddress, const int& aLocalPort,
     27      const bool& aUseTls,
     28      const Maybe<WebrtcProxyConfig>& aProxyConfig) override;
     29 
     30  mozilla::ipc::IPCResult RecvWrite(nsTArray<uint8_t>&& aWriteData) override;
     31 
     32  mozilla::ipc::IPCResult RecvClose() override;
     33 
     34  void ActorDestroy(ActorDestroyReason aWhy) override;
     35 
     36  explicit WebrtcTCPSocketParent(const Maybe<dom::TabId>& aTabId);
     37 
     38  // WebrtcTCPSocketCallback
     39  void OnClose(nsresult aReason) override;
     40  void OnConnected(const nsACString& aProxyType) override;
     41  void OnRead(nsTArray<uint8_t>&& bytes) override;
     42 
     43  void AddIPDLReference() { AddRef(); }
     44  void ReleaseIPDLReference() { Release(); }
     45 
     46 protected:
     47  virtual ~WebrtcTCPSocketParent();
     48 
     49 private:
     50  void CleanupChannel();
     51 
     52  // Indicates that IPC is open.
     53  RefPtr<WebrtcTCPSocket> mChannel;
     54 };
     55 
     56 }  // namespace mozilla::net
     57 
     58 #endif  // mozilla_net_WebrtcTCPSocketParent_h