OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license | |
5 * that can be found in the LICENSE file in the root of the source | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #ifndef WEBRTC_P2P_BASE_PACKETTRANSPORT_H_ | |
12 #define WEBRTC_P2P_BASE_PACKETTRANSPORT_H_ | |
13 | |
14 #include <string> | |
15 #include <vector> | |
16 | |
17 #include "webrtc/base/sigslot.h" | |
18 | |
19 namespace cricket { | |
20 struct ConnectionInfo; | |
21 typedef std::vector<ConnectionInfo> ConnectionInfos; | |
22 } | |
pthatcher1
2016/10/13 20:26:37
This shouldn't be in PacketTransport because it's
johan
2016/10/14 16:09:33
Done.
| |
23 | |
24 namespace rtc { | |
25 struct PacketOptions; | |
26 struct PacketTime; | |
27 | |
28 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.
| |
29 virtual ~PacketTransport() {} | |
30 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
| |
31 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.
| |
32 virtual bool writable() const = 0; | |
33 | |
34 sigslot::signal1<PacketTransport*> SignalWritableState; | |
35 | |
36 // Emitted when the PacketTransport's ability to send has changed. | |
37 sigslot::signal1<PacketTransport*> SignalReadyToSend; | |
38 | |
39 // Signalled each time a packet is received on this channel. | |
40 sigslot::signal5<PacketTransport*, | |
41 const char*, | |
42 size_t, | |
43 const rtc::PacketTime&, | |
44 int> | |
45 SignalReadPacket; | |
46 | |
47 // Signalled each time a packet is sent on this channel. | |
48 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.
| |
49 | |
50 // Attempts to send the given packet. The return value is < 0 on failure. | |
51 // TODO(johan): Remove the default argument once channel code is updated. | |
52 virtual int SendPacket(const char* data, | |
53 size_t len, | |
54 const rtc::PacketOptions& options, | |
55 int flags = 0) = 0; | |
56 | |
57 // Sets a socket option. Note that not all options are | |
58 // supported by all transport types. | |
59 virtual int SetOption(rtc::Socket::Option opt, int value) = 0; | |
60 | |
61 // TODO(pthatcher): Once Chrome's MockPacketTransport implments | |
62 // this, remove the default implementation. | |
63 virtual bool GetOption(rtc::Socket::Option opt, int* value) { return false; } | |
64 | |
65 // Returns the most recent error that occurred on this channel. | |
66 virtual int GetError() = 0; | |
67 | |
68 // Returns the current stats for this connection. | |
69 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.
| |
70 }; | |
71 | |
72 } // namespace rtc | |
73 | |
74 #endif // WEBRTC_P2P_BASE_PACKETTRANSPORT_H_ | |
OLD | NEW |