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

Side by Side Diff: remoting/signaling/signaling_address.h

Issue 2805173005: Move SignalingAddress to remoting/signaling (Closed)
Patch Set: fix compilation on windows Created 3 years, 8 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 | « remoting/signaling/BUILD.gn ('k') | remoting/signaling/signaling_address.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef REMOTING_SIGNALING_SIGNALING_ADDRESS_H_
6 #define REMOTING_SIGNALING_SIGNALING_ADDRESS_H_
7
8 #include <string>
9
10 namespace buzz {
11 class XmlElement;
12 } // namespace buzz
13
14 namespace remoting {
15
16 // Represents an address of a Chromoting endpoint and its routing channel.
17 class SignalingAddress {
18 public:
19 enum class Channel { LCS, XMPP };
20 enum Direction { TO, FROM };
21
22 static SignalingAddress Parse(const buzz::XmlElement* iq,
23 Direction direction,
24 std::string* error);
25
26 void SetInMessage(buzz::XmlElement* message, Direction direction) const;
27
28 SignalingAddress();
29 explicit SignalingAddress(const std::string& jid);
30 SignalingAddress(const std::string& jid,
31 const std::string& endpoint_id,
32 Channel channel);
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:
47 // Represents the |to| or |from| field in an IQ stanza.
48 std::string jid_;
49
50 // Represents the identifier of an endpoint. In LCS, this is the LCS address
51 // encoded in a JID like format. In XMPP, it is empty.
52 std::string endpoint_id_;
53
54 Channel channel_;
55 };
56
57 } // namespace remoting
58
59 #endif // REMOTING_SIGNALING_SIGNALING_ADDRESS_H_
OLDNEW
« no previous file with comments | « remoting/signaling/BUILD.gn ('k') | remoting/signaling/signaling_address.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698