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/. */
7 // Original author: ekr@rtfm.com
9 // This is a wrapper around the nICEr ICE stack
10 #ifndef transportlayerice_h__
11 #define transportlayerice_h__
17 #include "mozilla/RefPtr.h"
18 #include "mozilla/Scoped.h"
20 #include "nsIEventTarget.h"
23 #include "m_cpp_utils.h"
25 #include "nricemediastream.h"
26 #include "transportflow.h"
27 #include "transportlayer.h"
29 // An ICE transport layer -- corresponds to a single ICE
32 class TransportLayerIce
: public TransportLayer
{
34 explicit TransportLayerIce(const std::string
& name
);
36 virtual ~TransportLayerIce();
38 void SetParameters(RefPtr
<NrIceCtx
> ctx
,
39 RefPtr
<NrIceMediaStream
> stream
,
42 // Transport layer overrides.
43 virtual TransportResult
SendPacket(const unsigned char *data
, size_t len
);
46 void IceCandidate(NrIceMediaStream
*stream
, const std::string
&);
47 void IceReady(NrIceMediaStream
*stream
);
48 void IceFailed(NrIceMediaStream
*stream
);
49 void IcePacketReceived(NrIceMediaStream
*stream
, int component
,
50 const unsigned char *data
, int len
);
52 TRANSPORT_LAYER_ID("ice")
55 DISALLOW_COPY_ASSIGN(TransportLayerIce
);
58 const std::string name_
;
59 RefPtr
<NrIceCtx
> ctx_
;
60 RefPtr
<NrIceMediaStream
> stream_
;