| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef REMOTING_PROTOCOL_JINGLE_MESSAGES_H_ | 5 #ifndef REMOTING_PROTOCOL_JINGLE_MESSAGES_H_ |
| 6 #define REMOTING_PROTOCOL_JINGLE_MESSAGES_H_ | 6 #define REMOTING_PROTOCOL_JINGLE_MESSAGES_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "remoting/protocol/errors.h" | 12 #include "remoting/protocol/errors.h" |
| 13 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" | 13 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" |
| 14 #include "third_party/webrtc/p2p/base/candidate.h" | 14 #include "third_party/webrtc/p2p/base/candidate.h" |
| 15 | 15 |
| 16 namespace remoting { | 16 namespace remoting { |
| 17 namespace protocol { | 17 namespace protocol { |
| 18 | 18 |
| 19 class ContentDescription; | 19 class ContentDescription; |
| 20 | 20 |
| 21 // Represents an address of a Chromoting endpoint and its routing channel. | 21 // Represents an address of a Chromoting endpoint and its routing channel. |
| 22 // TODO(kelvinp): Move the struct to remoting/signaling. Potentially we could | 22 // TODO(kelvinp): Move the struct to remoting/signaling. Potentially we could |
| 23 // update SignalStrategy interface to use this instead of jid for addressing. | 23 // update SignalStrategy interface to use this instead of jid for addressing. |
| 24 struct SignalingAddress { | 24 class SignalingAddress { |
| 25 public: |
| 25 enum class Channel { LCS, XMPP }; | 26 enum class Channel { LCS, XMPP }; |
| 26 | 27 |
| 27 SignalingAddress(); | 28 SignalingAddress(); |
| 28 SignalingAddress(const std::string& jid); | 29 SignalingAddress(const std::string& jid); |
| 29 SignalingAddress(const std::string& jid, | 30 SignalingAddress(const std::string& jid, |
| 30 const std::string& endpoint_id, | 31 const std::string& endpoint_id, |
| 31 Channel channel); | 32 Channel channel); |
| 32 | 33 |
| 34 const std::string& jid() const { return jid_; } |
| 35 const std::string& endpoint_id() const { return endpoint_id_; } |
| 36 Channel channel() const { return channel_; } |
| 37 const std::string& id() const { |
| 38 return (channel_ == Channel::LCS) ? endpoint_id_ : jid_; |
| 39 } |
| 40 |
| 41 bool empty() const { return jid_.empty(); } |
| 42 |
| 43 bool operator==(const SignalingAddress& other) const; |
| 44 bool operator!=(const SignalingAddress& other) const; |
| 45 |
| 46 private: |
| 33 // Represents the |to| or |from| field in an IQ stanza. | 47 // Represents the |to| or |from| field in an IQ stanza. |
| 34 std::string jid; | 48 std::string jid_; |
| 35 | 49 |
| 36 // Represents the identifier of an endpoint. In LCS, this is the LCS address | 50 // Represents the identifier of an endpoint. In LCS, this is the LCS address |
| 37 // encoded in a JID like format. In XMPP, it is empty. | 51 // encoded in a JID like format. In XMPP, it is empty. |
| 38 std::string endpoint_id; | 52 std::string endpoint_id_; |
| 39 | 53 |
| 40 Channel channel; | 54 Channel channel_; |
| 41 | |
| 42 inline const std::string& id() const { | |
| 43 return (channel == Channel::LCS) ? endpoint_id : jid; | |
| 44 } | |
| 45 | |
| 46 inline bool empty() const { return jid.empty(); } | |
| 47 | |
| 48 bool operator==(const SignalingAddress& other); | |
| 49 bool operator!=(const SignalingAddress& other); | |
| 50 }; | 55 }; |
| 51 | 56 |
| 52 struct JingleMessage { | 57 struct JingleMessage { |
| 53 enum ActionType { | 58 enum ActionType { |
| 54 UNKNOWN_ACTION, | 59 UNKNOWN_ACTION, |
| 55 SESSION_INITIATE, | 60 SESSION_INITIATE, |
| 56 SESSION_ACCEPT, | 61 SESSION_ACCEPT, |
| 57 SESSION_TERMINATE, | 62 SESSION_TERMINATE, |
| 58 SESSION_INFO, | 63 SESSION_INFO, |
| 59 TRANSPORT_INFO, | 64 TRANSPORT_INFO, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 std::unique_ptr<buzz::XmlElement> ToXml() const; | 176 std::unique_ptr<buzz::XmlElement> ToXml() const; |
| 172 | 177 |
| 173 std::list<IceCredentials> ice_credentials; | 178 std::list<IceCredentials> ice_credentials; |
| 174 std::list<NamedCandidate> candidates; | 179 std::list<NamedCandidate> candidates; |
| 175 }; | 180 }; |
| 176 | 181 |
| 177 } // protocol | 182 } // protocol |
| 178 } // remoting | 183 } // remoting |
| 179 | 184 |
| 180 #endif // REMOTING_PROTOCOL_JINGLE_MESSAGES_H_ | 185 #endif // REMOTING_PROTOCOL_JINGLE_MESSAGES_H_ |
| OLD | NEW |