transportlayerice.h (1702B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=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/. */ 6 7 // Original author: ekr@rtfm.com 8 9 // This is a wrapper around the nICEr ICE stack 10 #ifndef transportlayerice_h__ 11 #define transportlayerice_h__ 12 13 #include "m_cpp_utils.h" 14 #include "mozilla/RefPtr.h" 15 #include "nricemediastream.h" 16 #include "sigslot.h" 17 #include "transportlayer.h" 18 19 // An ICE transport layer -- corresponds to a single ICE 20 namespace mozilla { 21 22 class TransportLayerIce : public TransportLayer { 23 public: 24 TransportLayerIce(); 25 26 virtual ~TransportLayerIce(); 27 28 void SetParameters(RefPtr<NrIceMediaStream> stream, int component); 29 30 void ResetOldStream(); // called after successful ice restart 31 void RestoreOldStream(); // called after unsuccessful ice restart 32 33 // Transport layer overrides. 34 TransportResult SendPacket(MediaPacket& packet) override; 35 36 // Slots for ICE 37 void IceCandidate(NrIceMediaStream* stream, const std::string&); 38 void IceReady(NrIceMediaStream* stream); 39 void IceFailed(NrIceMediaStream* stream); 40 void IcePacketReceived(NrIceMediaStream* stream, int component, 41 const unsigned char* data, int len); 42 43 // Useful for capturing encrypted packets 44 sigslot::signal2<TransportLayer*, MediaPacket&> SignalPacketSending; 45 46 TRANSPORT_LAYER_ID("ice") 47 48 private: 49 DISALLOW_COPY_ASSIGN(TransportLayerIce); 50 void PostSetup(); 51 52 RefPtr<NrIceMediaStream> stream_; 53 int component_; 54 }; 55 56 } // namespace mozilla 57 #endif