Index: remoting/protocol/jingle_messages.h |
diff --git a/remoting/protocol/jingle_messages.h b/remoting/protocol/jingle_messages.h |
index e81d86237cca6cb624df75b76280721df78c646a..c7304cce023b80aa37a01c40976e3e1d382d8dff 100644 |
--- a/remoting/protocol/jingle_messages.h |
+++ b/remoting/protocol/jingle_messages.h |
@@ -17,6 +17,37 @@ namespace protocol { |
class ContentDescription; |
+// Represents an address of a Chromoting endpoint and its routing channel. |
+// TODO(kelvinp): Move the struct to remoting/signaling. Potentially we could |
+// update SignalStrategy interface to use this instead of jid for addressing. |
+struct SignalingAddress { |
+ enum class Channel { LCS, XMPP }; |
+ |
+ SignalingAddress(); |
+ SignalingAddress(const std::string& jid); |
+ SignalingAddress(const std::string& jid, |
+ const std::string& endpoint_id, |
+ Channel channel); |
+ |
+ // Represents the |to| or |from| field in an IQ stanza. |
+ std::string jid; |
+ |
+ // Represents the identifier of an endpoint. In LCS, this is the LCS address |
+ // encoded in a JID like format. In XMPP, it is empty. |
+ std::string endpoint_id; |
+ |
+ Channel channel; |
+ |
+ inline const std::string& id() const { |
+ return (channel == Channel::LCS) ? endpoint_id : jid; |
+ } |
+ |
+ inline bool empty() const { return jid.empty(); } |
+ |
+ bool operator==(const SignalingAddress& other); |
+ bool operator!=(const SignalingAddress& other); |
+}; |
+ |
struct JingleMessage { |
enum ActionType { |
UNKNOWN_ACTION, |
@@ -40,7 +71,7 @@ struct JingleMessage { |
JingleMessage(); |
- JingleMessage(const std::string& to_value, |
+ JingleMessage(const SignalingAddress& to, |
ActionType action_value, |
const std::string& sid_value); |
~JingleMessage(); |
@@ -55,8 +86,8 @@ struct JingleMessage { |
std::unique_ptr<buzz::XmlElement> ToXml() const; |
- std::string from; |
- std::string to; |
+ SignalingAddress from; |
+ SignalingAddress to; |
ActionType action = UNKNOWN_ACTION; |
std::string sid; |