Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1796)

Side by Side Diff: webrtc/p2p/base/packettransportinterface.h

Issue 2416023002: Introduce rtc::PacketTransportInterface and let cricket::TransportChannel inherit. (Closed)
Patch Set: Rebase. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_PACKETTRANSPORTINTERFACE_H_
12 #define WEBRTC_P2P_BASE_PACKETTRANSPORTINTERFACE_H_
13
14 #include <string>
15 #include <vector>
16
17 #include "webrtc/base/sigslot.h"
18
19 namespace rtc {
20 struct PacketOptions;
21 struct PacketTime;
22
23 struct PacketTransportInterface : public sigslot::has_slots<> {
Taylor Brandstetter 2016/10/17 23:24:51 Any reason to use struct? As a matter of style, we
johan 2016/10/18 09:17:09 "struct" usually helps to let people consider twic
24 virtual ~PacketTransportInterface() {}
25 virtual const std::string debug_name() const = 0;
Taylor Brandstetter 2016/10/17 23:24:51 nit: Could be just "name()", with a comment explai
johan 2016/10/18 09:17:08 Ack on adding a comment. Please discuss with Peter
26 virtual bool writable() const = 0;
Taylor Brandstetter 2016/10/17 23:24:51 Should have a comment explaining what "writable" m
johan 2016/10/18 09:17:09 Acknowledged.
27
28 // Attempts to send the given packet. The return value is < 0 on failure.
29 // TODO(johan): Remove the default argument once channel code is updated.
Taylor Brandstetter 2016/10/17 23:24:50 Could the comments document where the return codes
johan 2016/10/18 09:17:09 Documenting current behaviour. You won't like it :
30 virtual int SendPacket(const char* data,
31 size_t len,
32 const rtc::PacketOptions& options,
33 int flags = 0) = 0;
34
35 // Sets a socket option. Note that not all options are
36 // supported by all transport types.
37 virtual int SetOption(rtc::Socket::Option opt, int value) = 0;
38
39 // TODO(pthatcher): Once Chrome's MockPacketTransportInterface implments
40 // this, remove the default implementation.
41 virtual bool GetOption(rtc::Socket::Option opt, int* value) { return false; }
42
43 // Returns the most recent error that occurred on this channel.
44 virtual int GetError() = 0;
45
46 sigslot::signal1<PacketTransportInterface*> SignalWritableState;
Taylor Brandstetter 2016/10/17 23:24:51 Would be nice to have a comment here too ("Emitted
johan 2016/10/18 09:17:09 Done.
47
48 // Emitted when the PacketTransportInterface's ability to send has changed.
Taylor Brandstetter 2016/10/17 23:24:51 Again, not your fault that this comment was vague/
johan 2016/10/18 09:17:08 Done.
49 sigslot::signal1<PacketTransportInterface*> SignalReadyToSend;
50
51 // Signalled each time a packet is received on this channel.
52 sigslot::signal5<PacketTransportInterface*,
53 const char*,
54 size_t,
55 const rtc::PacketTime&,
56 int>
57 SignalReadPacket;
58
59 // Signalled each time a packet is sent on this channel.
60 sigslot::signal2<PacketTransportInterface*, const rtc::SentPacket&>
61 SignalSentPacket;
62 };
63
64 } // namespace rtc
65
66 #endif // WEBRTC_P2P_BASE_PACKETTRANSPORTINTERFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698