|
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 <vector> |
|
14 |
|
15 #include "sigslot.h" |
|
16 |
|
17 #include "mozilla/RefPtr.h" |
|
18 #include "mozilla/Scoped.h" |
|
19 #include "nsCOMPtr.h" |
|
20 #include "nsIEventTarget.h" |
|
21 #include "nsITimer.h" |
|
22 |
|
23 #include "m_cpp_utils.h" |
|
24 |
|
25 #include "nricemediastream.h" |
|
26 #include "transportflow.h" |
|
27 #include "transportlayer.h" |
|
28 |
|
29 // An ICE transport layer -- corresponds to a single ICE |
|
30 namespace mozilla { |
|
31 |
|
32 class TransportLayerIce : public TransportLayer { |
|
33 public: |
|
34 TransportLayerIce(const std::string& name, |
|
35 RefPtr<NrIceCtx> ctx, |
|
36 RefPtr<NrIceMediaStream> stream, |
|
37 int component); |
|
38 virtual ~TransportLayerIce(); |
|
39 |
|
40 // Transport layer overrides. |
|
41 virtual TransportResult SendPacket(const unsigned char *data, size_t len); |
|
42 |
|
43 // Slots for ICE |
|
44 void IceCandidate(NrIceMediaStream *stream, const std::string&); |
|
45 void IceReady(NrIceMediaStream *stream); |
|
46 void IceFailed(NrIceMediaStream *stream); |
|
47 void IcePacketReceived(NrIceMediaStream *stream, int component, |
|
48 const unsigned char *data, int len); |
|
49 |
|
50 TRANSPORT_LAYER_ID("ice") |
|
51 |
|
52 private: |
|
53 DISALLOW_COPY_ASSIGN(TransportLayerIce); |
|
54 |
|
55 const std::string name_; |
|
56 RefPtr<NrIceCtx> ctx_; |
|
57 RefPtr<NrIceMediaStream> stream_; |
|
58 int component_; |
|
59 }; |
|
60 |
|
61 } // close namespace |
|
62 #endif |