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

Unified Diff: remoting/protocol/jingle_messages.h

Issue 2577333003: Update SignalingAddress to normalize all JIDs. (Closed)
Patch Set: . Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/protocol/jingle_messages.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/jingle_messages.h
diff --git a/remoting/protocol/jingle_messages.h b/remoting/protocol/jingle_messages.h
index ef33b4a1675eb43db09d3945129ef0f7d3bc5a80..73c148f5040ef4f2bea561bc18dea4b2da8e5d1d 100644
--- a/remoting/protocol/jingle_messages.h
+++ b/remoting/protocol/jingle_messages.h
@@ -21,7 +21,8 @@ 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 {
+class SignalingAddress {
+ public:
enum class Channel { LCS, XMPP };
SignalingAddress();
@@ -30,23 +31,27 @@ struct SignalingAddress {
const std::string& endpoint_id,
Channel channel);
- // Represents the |to| or |from| field in an IQ stanza.
- std::string jid;
+ const std::string& jid() const { return jid_; }
+ const std::string& endpoint_id() const { return endpoint_id_; }
+ Channel channel() const { return channel_; }
+ const std::string& id() const {
+ return (channel_ == Channel::LCS) ? endpoint_id_ : 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;
+ bool empty() const { return jid_.empty(); }
- Channel channel;
+ bool operator==(const SignalingAddress& other) const;
+ bool operator!=(const SignalingAddress& other) const;
- inline const std::string& id() const {
- return (channel == Channel::LCS) ? endpoint_id : jid;
- }
+ private:
+ // Represents the |to| or |from| field in an IQ stanza.
+ std::string jid_;
- inline bool empty() const { return jid.empty(); }
+ // 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_;
- bool operator==(const SignalingAddress& other);
- bool operator!=(const SignalingAddress& other);
+ Channel channel_;
};
struct JingleMessage {
« no previous file with comments | « no previous file | remoting/protocol/jingle_messages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698