| OLD | NEW | 
|---|
| 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  Loading... | 
| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 140  protected: | 147  protected: | 
| 141   // Sets the readable state, signaling if necessary. | 148   // Sets the readable state, signaling if necessary. | 
| 142   void set_readable(bool readable); | 149   void set_readable(bool readable); | 
| 143 | 150 | 
| 144   // Sets the writable state, signaling if necessary. | 151   // Sets the writable state, signaling if necessary. | 
| 145   void set_writable(bool writable); | 152   void set_writable(bool writable); | 
| 146 | 153 | 
| 147   // Sets the receiving state, signaling if necessary. | 154   // Sets the receiving state, signaling if necessary. | 
| 148   void set_receiving(bool receiving); | 155   void set_receiving(bool receiving); | 
| 149 | 156 | 
| 150 |  | 
| 151  private: | 157  private: | 
| 152   // Used mostly for debugging. | 158   // Used mostly for debugging. | 
| 153   std::string content_name_; | 159   std::string transport_name_; | 
| 154   int component_; | 160   int component_; | 
| 155   bool readable_; | 161   bool readable_; | 
| 156   bool writable_; | 162   bool writable_; | 
| 157   bool receiving_; | 163   bool receiving_; | 
| 158 | 164 | 
| 159   DISALLOW_COPY_AND_ASSIGN(TransportChannel); | 165   DISALLOW_COPY_AND_ASSIGN(TransportChannel); | 
| 160 }; | 166 }; | 
| 161 | 167 | 
| 162 }  // namespace cricket | 168 }  // namespace cricket | 
| 163 | 169 | 
| 164 #endif  // WEBRTC_P2P_BASE_TRANSPORTCHANNEL_H_ | 170 #endif  // WEBRTC_P2P_BASE_TRANSPORTCHANNEL_H_ | 
| OLD | NEW | 
|---|