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

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

Issue 1350523003: TransportController refactoring. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing Mac test. 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 { 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 writable_(false), 54 writable_(false),
50 receiving_(false) {} 55 receiving_(false) {}
51 virtual ~TransportChannel() {} 56 virtual ~TransportChannel() {}
52 57
53 // TODO(guoweis) - Make this pure virtual once all subclasses of 58 // TODO(guoweis) - Make this pure virtual once all subclasses of
54 // TransportChannel have this defined. 59 // TransportChannel have this defined.
55 virtual TransportChannelState GetState() const { 60 virtual TransportChannelState GetState() const {
56 return TransportChannelState::STATE_CONNECTING; 61 return TransportChannelState::STATE_CONNECTING;
57 } 62 }
58 63
59 // TODO(mallinath) - Remove this API, as it's no longer useful. 64 // TODO(mallinath) - Remove this API, as it's no longer useful.
60 // Returns the session id of this channel. 65 // Returns the session id of this channel.
61 virtual const std::string SessionId() const { return std::string(); } 66 virtual const std::string SessionId() const { return std::string(); }
62 67
63 const std::string& content_name() const { return content_name_; } 68 const std::string& transport_name() const { return transport_name_; }
64 int component() const { return component_; } 69 int component() const { return component_; }
65 70
66 // Returns the states of this channel. Each time one of these states changes, 71 // Returns the states of this channel. Each time one of these states changes,
67 // a signal is raised. These states are aggregated by the TransportManager. 72 // a signal is raised. These states are aggregated by the TransportManager.
68 bool writable() const { return writable_; } 73 bool writable() const { return writable_; }
69 bool receiving() const { return receiving_; } 74 bool receiving() const { return receiving_; }
70 sigslot::signal1<TransportChannel*> SignalWritableState; 75 sigslot::signal1<TransportChannel*> SignalWritableState;
71 // Emitted when the TransportChannel's ability to send has changed. 76 // Emitted when the TransportChannel's ability to send has changed.
72 sigslot::signal1<TransportChannel*> SignalReadyToSend; 77 sigslot::signal1<TransportChannel*> SignalReadyToSend;
73 sigslot::signal1<TransportChannel*> SignalReceivingState; 78 sigslot::signal1<TransportChannel*> SignalReceivingState;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 protected: 144 protected:
140 // TODO(honghaiz): Remove this once chromium's unit tests no longer call it. 145 // TODO(honghaiz): Remove this once chromium's unit tests no longer call it.
141 void set_readable(bool readable) { set_receiving(readable); } 146 void set_readable(bool readable) { set_receiving(readable); }
142 147
143 // Sets the writable state, signaling if necessary. 148 // Sets the writable state, signaling if necessary.
144 void set_writable(bool writable); 149 void set_writable(bool writable);
145 150
146 // Sets the receiving state, signaling if necessary. 151 // Sets the receiving state, signaling if necessary.
147 void set_receiving(bool receiving); 152 void set_receiving(bool receiving);
148 153
149
150 private: 154 private:
151 // Used mostly for debugging. 155 // Used mostly for debugging.
152 std::string content_name_; 156 std::string transport_name_;
153 int component_; 157 int component_;
154 bool writable_; 158 bool writable_;
155 bool receiving_; 159 bool receiving_;
156 160
157 RTC_DISALLOW_COPY_AND_ASSIGN(TransportChannel); 161 RTC_DISALLOW_COPY_AND_ASSIGN(TransportChannel);
158 }; 162 };
159 163
160 } // namespace cricket 164 } // namespace cricket
161 165
162 #endif // WEBRTC_P2P_BASE_TRANSPORTCHANNEL_H_ 166 #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