| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2017 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 |
| 11 #ifndef WEBRTC_P2P_BASE_PACKETTRANSPORTINTERNAL_H_ | 11 #ifndef WEBRTC_P2P_BASE_PACKETTRANSPORTINTERNAL_H_ |
| 12 #define WEBRTC_P2P_BASE_PACKETTRANSPORTINTERNAL_H_ | 12 #define WEBRTC_P2P_BASE_PACKETTRANSPORTINTERNAL_H_ |
| (...skipping 10 matching lines...) Expand all Loading... |
| 23 class TransportChannel; | 23 class TransportChannel; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace rtc { | 26 namespace rtc { |
| 27 struct PacketOptions; | 27 struct PacketOptions; |
| 28 struct PacketTime; | 28 struct PacketTime; |
| 29 struct SentPacket; | 29 struct SentPacket; |
| 30 | 30 |
| 31 class PacketTransportInternal : public sigslot::has_slots<> { | 31 class PacketTransportInternal : public sigslot::has_slots<> { |
| 32 public: | 32 public: |
| 33 virtual ~PacketTransportInternal() {} | |
| 34 | |
| 35 // Identify the object for logging and debug purpose. | 33 // Identify the object for logging and debug purpose. |
| 36 virtual std::string debug_name() const = 0; | 34 virtual std::string debug_name() const = 0; |
| 37 | 35 |
| 38 // The transport has been established. | 36 // The transport has been established. |
| 39 virtual bool writable() const = 0; | 37 virtual bool writable() const = 0; |
| 40 | 38 |
| 41 // The transport has received a packet in the last X milliseconds, here X is | 39 // The transport has received a packet in the last X milliseconds, here X is |
| 42 // configured by each implementation. | 40 // configured by each implementation. |
| 43 virtual bool receiving() const = 0; | 41 virtual bool receiving() const = 0; |
| 44 | 42 |
| 45 // Attempts to send the given packet. | 43 // Attempts to send the given packet. |
| 46 // 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 |
| 47 // descriptive. Depending on failure cause and implementation details | 45 // descriptive. Depending on failure cause and implementation details |
| 48 // GetError() returns an descriptive errno.h error value. | 46 // GetError() returns an descriptive errno.h error value. |
| 49 // This mimics posix socket send() or sendto() behavior. | 47 // This mimics posix socket send() or sendto() behavior. |
| 50 // TODO(johan): Reliable, meaningful, consistent error codes for all | 48 // TODO(johan): Reliable, meaningful, consistent error codes for all |
| 51 // implementations would be nice. | 49 // implementations would be nice. |
| 52 // TODO(johan): Remove the default argument once channel code is updated. | 50 // TODO(johan): Remove the default argument once channel code is updated. |
| 53 virtual int SendPacket(const char* data, | 51 virtual int SendPacket(const char* data, |
| 54 size_t len, | 52 size_t len, |
| 55 const rtc::PacketOptions& options, | 53 const rtc::PacketOptions& options, |
| 56 int flags = 0) = 0; | 54 int flags = 0) = 0; |
| 57 | 55 |
| 58 // Sets a socket option. Note that not all options are | 56 // Sets a socket option. Note that not all options are |
| 59 // supported by all transport types. | 57 // supported by all transport types. |
| 60 virtual int SetOption(rtc::Socket::Option opt, int value) = 0; | 58 virtual int SetOption(rtc::Socket::Option opt, int value) = 0; |
| 61 | 59 |
| 62 // TODO(pthatcher): Once Chrome's MockPacketTransportInternal implements | 60 // TODO(pthatcher): Once Chrome's MockPacketTransportInterface implements |
| 63 // this, remove the default implementation. | 61 // this, remove the default implementation. |
| 64 virtual bool GetOption(rtc::Socket::Option opt, int* value) { return false; } | 62 virtual bool GetOption(rtc::Socket::Option opt, int* value) { return false; } |
| 65 | 63 |
| 66 // Returns the most recent error that occurred on this channel. | 64 // Returns the most recent error that occurred on this channel. |
| 67 virtual int GetError() = 0; | 65 virtual int GetError() = 0; |
| 68 | 66 |
| 69 // Emitted when the writable state, represented by |writable()|, changes. | 67 // Emitted when the writable state, represented by |writable()|, changes. |
| 70 sigslot::signal1<PacketTransportInternal*> SignalWritableState; | 68 sigslot::signal1<PacketTransportInternal*> SignalWritableState; |
| 71 | 69 |
| 72 // Emitted when the PacketTransportInternal is ready to send packets. "Ready | 70 // Emitted when the PacketTransportInternal is ready to send packets. "Ready |
| (...skipping 15 matching lines...) Expand all Loading... |
| 88 SignalReadPacket; | 86 SignalReadPacket; |
| 89 | 87 |
| 90 // Signalled each time a packet is sent on this channel. | 88 // Signalled each time a packet is sent on this channel. |
| 91 sigslot::signal2<PacketTransportInternal*, const rtc::SentPacket&> | 89 sigslot::signal2<PacketTransportInternal*, const rtc::SentPacket&> |
| 92 SignalSentPacket; | 90 SignalSentPacket; |
| 93 }; | 91 }; |
| 94 | 92 |
| 95 } // namespace rtc | 93 } // namespace rtc |
| 96 | 94 |
| 97 #endif // WEBRTC_P2P_BASE_PACKETTRANSPORTINTERNAL_H_ | 95 #endif // WEBRTC_P2P_BASE_PACKETTRANSPORTINTERNAL_H_ |
| OLD | NEW |