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

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

Issue 1246913005: TransportController refactoring (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Use "EXPECT_TRUE" instead of "EXPECT_EQ(true...", etc. Created 5 years, 3 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
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 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 19 matching lines...) Expand all
30 class Candidate; 30 class Candidate;
31 31
32 // Flags for SendPacket/SignalReadPacket. 32 // Flags for SendPacket/SignalReadPacket.
33 enum PacketFlags { 33 enum PacketFlags {
34 PF_NORMAL = 0x00, // A normal packet. 34 PF_NORMAL = 0x00, // A normal packet.
35 PF_SRTP_BYPASS = 0x01, // An encrypted SRTP packet; bypass any additional 35 PF_SRTP_BYPASS = 0x01, // An encrypted SRTP packet; bypass any additional
36 // crypto provided by the transport (e.g. DTLS) 36 // crypto provided by the transport (e.g. DTLS)
37 }; 37 };
38 38
39 // Used to indicate channel's connection state. 39 // Used to indicate channel's connection state.
40 enum TransportChannelState { STATE_CONNECTING, STATE_COMPLETED, STATE_FAILED }; 40 enum TransportChannelState {
41 STATE_INIT,
42 STATE_CONNECTING, // Will enter this state once a connection is created
43 STATE_COMPLETED,
44 STATE_FAILED
45 };
41 46
42 // A TransportChannel represents one logical stream of packets that are sent 47 // A TransportChannel represents one logical stream of packets that are sent
43 // between the two sides of a session. 48 // between the two sides of a session.
44 class TransportChannel : public sigslot::has_slots<> { 49 class TransportChannel : public sigslot::has_slots<> {
45 public: 50 public:
46 explicit TransportChannel(const std::string& content_name, int component) 51 explicit TransportChannel(const std::string& transport_name, int component)
47 : content_name_(content_name), 52 : transport_name_(transport_name),
48 component_(component), 53 component_(component),
49 readable_(false), writable_(false), receiving_(false) {} 54 readable_(false),
55 writable_(false),
56 receiving_(false) {}
50 virtual ~TransportChannel() {} 57 virtual ~TransportChannel() {}
51 58
52 // TODO(guoweis) - Make this pure virtual once all subclasses of 59 // TODO(guoweis) - Make this pure virtual once all subclasses of
53 // TransportChannel have this defined. 60 // TransportChannel have this defined.
54 virtual TransportChannelState GetState() const { 61 virtual TransportChannelState GetState() const {
55 return TransportChannelState::STATE_CONNECTING; 62 return TransportChannelState::STATE_CONNECTING;
56 } 63 }
57 64
58 // TODO(mallinath) - Remove this API, as it's no longer useful. 65 // TODO(mallinath) - Remove this API, as it's no longer useful.
59 // Returns the session id of this channel. 66 // Returns the session id of this channel.
60 virtual const std::string SessionId() const { return std::string(); } 67 virtual const std::string SessionId() const { return std::string(); }
61 68
62 const std::string& content_name() const { return content_name_; } 69 const std::string& transport_name() const { return transport_name_; }
63 int component() const { return component_; } 70 int component() const { return component_; }
64 71
65 // Returns the readable and states of this channel. Each time one of these 72 // Returns the readable and states of this channel. Each time one of these
66 // states changes, a signal is raised. These states are aggregated by the 73 // states changes, a signal is raised. These states are aggregated by the
67 // TransportManager. 74 // TransportManager.
68 bool readable() const { return readable_; } 75 bool readable() const { return readable_; }
69 bool writable() const { return writable_; } 76 bool writable() const { return writable_; }
70 bool receiving() const { return receiving_; } 77 bool receiving() const { return receiving_; }
71 sigslot::signal1<TransportChannel*> SignalReadableState; 78 sigslot::signal1<TransportChannel*> SignalReadableState;
72 sigslot::signal1<TransportChannel*> SignalWritableState; 79 sigslot::signal1<TransportChannel*> SignalWritableState;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 protected: 148 protected:
142 // Sets the readable state, signaling if necessary. 149 // Sets the readable state, signaling if necessary.
143 void set_readable(bool readable); 150 void set_readable(bool readable);
144 151
145 // Sets the writable state, signaling if necessary. 152 // Sets the writable state, signaling if necessary.
146 void set_writable(bool writable); 153 void set_writable(bool writable);
147 154
148 // Sets the receiving state, signaling if necessary. 155 // Sets the receiving state, signaling if necessary.
149 void set_receiving(bool receiving); 156 void set_receiving(bool receiving);
150 157
151
152 private: 158 private:
153 // Used mostly for debugging. 159 // Used mostly for debugging.
154 std::string content_name_; 160 std::string transport_name_;
155 int component_; 161 int component_;
156 bool readable_; 162 bool readable_;
157 bool writable_; 163 bool writable_;
158 bool receiving_; 164 bool receiving_;
159 165
160 DISALLOW_COPY_AND_ASSIGN(TransportChannel); 166 DISALLOW_COPY_AND_ASSIGN(TransportChannel);
161 }; 167 };
162 168
163 } // namespace cricket 169 } // namespace cricket
164 170
165 #endif // WEBRTC_P2P_BASE_TRANSPORTCHANNEL_H_ 171 #endif // WEBRTC_P2P_BASE_TRANSPORTCHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698