OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 class PacketTransportInterface : public sigslot::has_slots<> { | 29 class PacketTransportInterface : public sigslot::has_slots<> { |
30 public: | 30 public: |
31 virtual ~PacketTransportInterface() {} | 31 virtual ~PacketTransportInterface() {} |
32 | 32 |
33 // Identify the object for logging and debug purpose. | 33 // Identify the object for logging and debug purpose. |
34 virtual const std::string debug_name() const = 0; | 34 virtual const std::string debug_name() const = 0; |
35 | 35 |
36 // The transport has been established. | 36 // The transport has been established. |
37 virtual bool writable() const = 0; | 37 virtual bool writable() const = 0; |
38 | 38 |
| 39 // The transport has received a packet in the last X milliseconds, here X is |
| 40 // configured by each implementation. |
| 41 virtual bool receiving() const = 0; |
| 42 |
39 // Attempts to send the given packet. | 43 // Attempts to send the given packet. |
40 // The return value is < 0 on failure. The return value in failure case is not | 44 // The return value is < 0 on failure. The return value in failure case is not |
41 // descriptive. Depending on failure cause and implementation details | 45 // descriptive. Depending on failure cause and implementation details |
42 // GetError() returns an descriptive errno.h error value. | 46 // GetError() returns an descriptive errno.h error value. |
43 // This mimics posix socket send() or sendto() behavior. | 47 // This mimics posix socket send() or sendto() behavior. |
44 // TODO(johan): Reliable, meaningful, consistent error codes for all | 48 // TODO(johan): Reliable, meaningful, consistent error codes for all |
45 // implementations would be nice. | 49 // implementations would be nice. |
46 // TODO(johan): Remove the default argument once channel code is updated. | 50 // TODO(johan): Remove the default argument once channel code is updated. |
47 virtual int SendPacket(const char* data, | 51 virtual int SendPacket(const char* data, |
48 size_t len, | 52 size_t len, |
(...skipping 14 matching lines...) Expand all Loading... |
63 // Emitted when the writable state, represented by |writable()|, changes. | 67 // Emitted when the writable state, represented by |writable()|, changes. |
64 sigslot::signal1<PacketTransportInterface*> SignalWritableState; | 68 sigslot::signal1<PacketTransportInterface*> SignalWritableState; |
65 | 69 |
66 // Emitted when the PacketTransportInterface is ready to send packets. "Ready | 70 // Emitted when the PacketTransportInterface is ready to send packets. "Ready |
67 // to send" is more sensitive than the writable state; a transport may be | 71 // to send" is more sensitive than the writable state; a transport may be |
68 // writable, but temporarily not able to send packets. For example, the | 72 // writable, but temporarily not able to send packets. For example, the |
69 // underlying transport's socket buffer may be full, as indicated by | 73 // underlying transport's socket buffer may be full, as indicated by |
70 // SendPacket's return code and/or GetError. | 74 // SendPacket's return code and/or GetError. |
71 sigslot::signal1<PacketTransportInterface*> SignalReadyToSend; | 75 sigslot::signal1<PacketTransportInterface*> SignalReadyToSend; |
72 | 76 |
| 77 // Emitted when receiving state changes to true. |
| 78 sigslot::signal1<PacketTransportInterface*> SignalReceivingState; |
| 79 |
73 // Signalled each time a packet is received on this channel. | 80 // Signalled each time a packet is received on this channel. |
74 sigslot::signal5<PacketTransportInterface*, | 81 sigslot::signal5<PacketTransportInterface*, |
75 const char*, | 82 const char*, |
76 size_t, | 83 size_t, |
77 const rtc::PacketTime&, | 84 const rtc::PacketTime&, |
78 int> | 85 int> |
79 SignalReadPacket; | 86 SignalReadPacket; |
80 | 87 |
81 // Signalled each time a packet is sent on this channel. | 88 // Signalled each time a packet is sent on this channel. |
82 sigslot::signal2<PacketTransportInterface*, const rtc::SentPacket&> | 89 sigslot::signal2<PacketTransportInterface*, const rtc::SentPacket&> |
83 SignalSentPacket; | 90 SignalSentPacket; |
84 }; | 91 }; |
85 | 92 |
86 } // namespace rtc | 93 } // namespace rtc |
87 | 94 |
88 #endif // WEBRTC_P2P_BASE_PACKETTRANSPORTINTERFACE_H_ | 95 #endif // WEBRTC_P2P_BASE_PACKETTRANSPORTINTERFACE_H_ |
OLD | NEW |