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

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

Issue 1358413003: Revert of TransportController refactoring. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 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
« no previous file with comments | « webrtc/p2p/base/transport_unittest.cc ('k') | webrtc/p2p/base/transportchannel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 { 40 enum TransportChannelState { STATE_CONNECTING, STATE_COMPLETED, STATE_FAILED };
41 STATE_INIT,
42 STATE_CONNECTING, // Will enter this state once a connection is created
43 STATE_COMPLETED,
44 STATE_FAILED
45 };
46 41
47 // A TransportChannel represents one logical stream of packets that are sent 42 // A TransportChannel represents one logical stream of packets that are sent
48 // between the two sides of a session. 43 // between the two sides of a session.
49 class TransportChannel : public sigslot::has_slots<> { 44 class TransportChannel : public sigslot::has_slots<> {
50 public: 45 public:
51 explicit TransportChannel(const std::string& transport_name, int component) 46 explicit TransportChannel(const std::string& content_name, int component)
52 : transport_name_(transport_name), 47 : content_name_(content_name),
53 component_(component), 48 component_(component),
54 writable_(false), 49 writable_(false),
55 receiving_(false) {} 50 receiving_(false) {}
56 virtual ~TransportChannel() {} 51 virtual ~TransportChannel() {}
57 52
58 // TODO(guoweis) - Make this pure virtual once all subclasses of 53 // TODO(guoweis) - Make this pure virtual once all subclasses of
59 // TransportChannel have this defined. 54 // TransportChannel have this defined.
60 virtual TransportChannelState GetState() const { 55 virtual TransportChannelState GetState() const {
61 return TransportChannelState::STATE_CONNECTING; 56 return TransportChannelState::STATE_CONNECTING;
62 } 57 }
63 58
64 // TODO(mallinath) - Remove this API, as it's no longer useful. 59 // TODO(mallinath) - Remove this API, as it's no longer useful.
65 // Returns the session id of this channel. 60 // Returns the session id of this channel.
66 virtual const std::string SessionId() const { return std::string(); } 61 virtual const std::string SessionId() const { return std::string(); }
67 62
68 const std::string& transport_name() const { return transport_name_; } 63 const std::string& content_name() const { return content_name_; }
69 int component() const { return component_; } 64 int component() const { return component_; }
70 65
71 // Returns the states of this channel. Each time one of these states changes, 66 // Returns the states of this channel. Each time one of these states changes,
72 // a signal is raised. These states are aggregated by the TransportManager. 67 // a signal is raised. These states are aggregated by the TransportManager.
73 bool writable() const { return writable_; } 68 bool writable() const { return writable_; }
74 bool receiving() const { return receiving_; } 69 bool receiving() const { return receiving_; }
75 sigslot::signal1<TransportChannel*> SignalWritableState; 70 sigslot::signal1<TransportChannel*> SignalWritableState;
76 // Emitted when the TransportChannel's ability to send has changed. 71 // Emitted when the TransportChannel's ability to send has changed.
77 sigslot::signal1<TransportChannel*> SignalReadyToSend; 72 sigslot::signal1<TransportChannel*> SignalReadyToSend;
78 sigslot::signal1<TransportChannel*> SignalReceivingState; 73 sigslot::signal1<TransportChannel*> SignalReceivingState;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 protected: 139 protected:
145 // TODO(honghaiz): Remove this once chromium's unit tests no longer call it. 140 // TODO(honghaiz): Remove this once chromium's unit tests no longer call it.
146 void set_readable(bool readable) { set_receiving(readable); } 141 void set_readable(bool readable) { set_receiving(readable); }
147 142
148 // Sets the writable state, signaling if necessary. 143 // Sets the writable state, signaling if necessary.
149 void set_writable(bool writable); 144 void set_writable(bool writable);
150 145
151 // Sets the receiving state, signaling if necessary. 146 // Sets the receiving state, signaling if necessary.
152 void set_receiving(bool receiving); 147 void set_receiving(bool receiving);
153 148
149
154 private: 150 private:
155 // Used mostly for debugging. 151 // Used mostly for debugging.
156 std::string transport_name_; 152 std::string content_name_;
157 int component_; 153 int component_;
158 bool writable_; 154 bool writable_;
159 bool receiving_; 155 bool receiving_;
160 156
161 RTC_DISALLOW_COPY_AND_ASSIGN(TransportChannel); 157 RTC_DISALLOW_COPY_AND_ASSIGN(TransportChannel);
162 }; 158 };
163 159
164 } // namespace cricket 160 } // namespace cricket
165 161
166 #endif // WEBRTC_P2P_BASE_TRANSPORTCHANNEL_H_ 162 #endif // WEBRTC_P2P_BASE_TRANSPORTCHANNEL_H_
OLDNEW
« no previous file with comments | « webrtc/p2p/base/transport_unittest.cc ('k') | webrtc/p2p/base/transportchannel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698