Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim: set ts=2 et sw=2 tw=80: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 5 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | // Original author: ekr@rtfm.com |
michael@0 | 8 | |
michael@0 | 9 | // This is a wrapper around the nICEr ICE stack |
michael@0 | 10 | #ifndef transportlayerice_h__ |
michael@0 | 11 | #define transportlayerice_h__ |
michael@0 | 12 | |
michael@0 | 13 | #include <vector> |
michael@0 | 14 | |
michael@0 | 15 | #include "sigslot.h" |
michael@0 | 16 | |
michael@0 | 17 | #include "mozilla/RefPtr.h" |
michael@0 | 18 | #include "mozilla/Scoped.h" |
michael@0 | 19 | #include "nsCOMPtr.h" |
michael@0 | 20 | #include "nsIEventTarget.h" |
michael@0 | 21 | #include "nsITimer.h" |
michael@0 | 22 | |
michael@0 | 23 | #include "m_cpp_utils.h" |
michael@0 | 24 | |
michael@0 | 25 | #include "nricemediastream.h" |
michael@0 | 26 | #include "transportflow.h" |
michael@0 | 27 | #include "transportlayer.h" |
michael@0 | 28 | |
michael@0 | 29 | // An ICE transport layer -- corresponds to a single ICE |
michael@0 | 30 | namespace mozilla { |
michael@0 | 31 | |
michael@0 | 32 | class TransportLayerIce : public TransportLayer { |
michael@0 | 33 | public: |
michael@0 | 34 | TransportLayerIce(const std::string& name, |
michael@0 | 35 | RefPtr<NrIceCtx> ctx, |
michael@0 | 36 | RefPtr<NrIceMediaStream> stream, |
michael@0 | 37 | int component); |
michael@0 | 38 | virtual ~TransportLayerIce(); |
michael@0 | 39 | |
michael@0 | 40 | // Transport layer overrides. |
michael@0 | 41 | virtual TransportResult SendPacket(const unsigned char *data, size_t len); |
michael@0 | 42 | |
michael@0 | 43 | // Slots for ICE |
michael@0 | 44 | void IceCandidate(NrIceMediaStream *stream, const std::string&); |
michael@0 | 45 | void IceReady(NrIceMediaStream *stream); |
michael@0 | 46 | void IceFailed(NrIceMediaStream *stream); |
michael@0 | 47 | void IcePacketReceived(NrIceMediaStream *stream, int component, |
michael@0 | 48 | const unsigned char *data, int len); |
michael@0 | 49 | |
michael@0 | 50 | TRANSPORT_LAYER_ID("ice") |
michael@0 | 51 | |
michael@0 | 52 | private: |
michael@0 | 53 | DISALLOW_COPY_ASSIGN(TransportLayerIce); |
michael@0 | 54 | |
michael@0 | 55 | const std::string name_; |
michael@0 | 56 | RefPtr<NrIceCtx> ctx_; |
michael@0 | 57 | RefPtr<NrIceMediaStream> stream_; |
michael@0 | 58 | int component_; |
michael@0 | 59 | }; |
michael@0 | 60 | |
michael@0 | 61 | } // close namespace |
michael@0 | 62 | #endif |