Chromium Code Reviews| Index: webrtc/p2p/base/packettransport.h |
| diff --git a/webrtc/p2p/base/packettransport.h b/webrtc/p2p/base/packettransport.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..23c710351afef4a6709c2541483d7f4cf64e0277 |
| --- /dev/null |
| +++ b/webrtc/p2p/base/packettransport.h |
| @@ -0,0 +1,74 @@ |
| +/* |
| + * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
| + * |
| + * Use of this source code is governed by a BSD-style license |
| + * that can be found in the LICENSE file in the root of the source |
| + * tree. An additional intellectual property rights grant can be found |
| + * in the file PATENTS. All contributing project authors may |
| + * be found in the AUTHORS file in the root of the source tree. |
| + */ |
| + |
| +#ifndef WEBRTC_P2P_BASE_PACKETTRANSPORT_H_ |
| +#define WEBRTC_P2P_BASE_PACKETTRANSPORT_H_ |
| + |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "webrtc/base/sigslot.h" |
| + |
| +namespace cricket { |
| +struct ConnectionInfo; |
| +typedef std::vector<ConnectionInfo> ConnectionInfos; |
| +} |
|
pthatcher1
2016/10/13 20:26:37
This shouldn't be in PacketTransport because it's
johan
2016/10/14 16:09:33
Done.
|
| + |
| +namespace rtc { |
| +struct PacketOptions; |
| +struct PacketTime; |
| + |
| +struct PacketTransport : public sigslot::has_slots<> { |
|
pthatcher1
2016/10/13 20:26:37
Can you change the name to PacketTransportInterfac
johan
2016/10/14 16:09:33
Done.
|
| + virtual ~PacketTransport() {} |
| + virtual const std::string& transport_name() const = 0; |
|
pthatcher1
2016/10/13 20:26:37
I'm not sure this is needed in PacketTransport. I
johan
2016/10/14 16:09:33
Probably not. Removing it for now. It is used in c
|
| + virtual int component() const = 0; |
|
pthatcher1
2016/10/13 20:26:37
This shouldn't be in PacketTransport because it's
johan
2016/10/14 16:09:33
Acknowledged.
|
| + virtual bool writable() const = 0; |
| + |
| + sigslot::signal1<PacketTransport*> SignalWritableState; |
| + |
| + // Emitted when the PacketTransport's ability to send has changed. |
| + sigslot::signal1<PacketTransport*> SignalReadyToSend; |
| + |
| + // Signalled each time a packet is received on this channel. |
| + sigslot::signal5<PacketTransport*, |
| + const char*, |
| + size_t, |
| + const rtc::PacketTime&, |
| + int> |
| + SignalReadPacket; |
| + |
| + // Signalled each time a packet is sent on this channel. |
| + sigslot::signal2<PacketTransport*, const rtc::SentPacket&> SignalSentPacket; |
|
pthatcher1
2016/10/13 20:26:37
Can you put all the signals after all the methods?
johan
2016/10/14 16:09:33
Done.
|
| + |
| + // Attempts to send the given packet. The return value is < 0 on failure. |
| + // TODO(johan): Remove the default argument once channel code is updated. |
| + virtual int SendPacket(const char* data, |
| + size_t len, |
| + const rtc::PacketOptions& options, |
| + int flags = 0) = 0; |
| + |
| + // Sets a socket option. Note that not all options are |
| + // supported by all transport types. |
| + virtual int SetOption(rtc::Socket::Option opt, int value) = 0; |
| + |
| + // TODO(pthatcher): Once Chrome's MockPacketTransport implments |
| + // this, remove the default implementation. |
| + virtual bool GetOption(rtc::Socket::Option opt, int* value) { return false; } |
| + |
| + // Returns the most recent error that occurred on this channel. |
| + virtual int GetError() = 0; |
| + |
| + // Returns the current stats for this connection. |
| + virtual bool GetStats(cricket::ConnectionInfos* infos) = 0; |
|
pthatcher1
2016/10/13 20:26:37
This shouldn't be in PacketTransport because it's
johan
2016/10/14 16:09:33
Done.
|
| +}; |
| + |
| +} // namespace rtc |
| + |
| +#endif // WEBRTC_P2P_BASE_PACKETTRANSPORT_H_ |