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 "remoting/signaling/signaling_address.h" |
13 #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" | 14 #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" |
14 #include "third_party/webrtc/p2p/base/candidate.h" | 15 #include "third_party/webrtc/p2p/base/candidate.h" |
15 | 16 |
16 namespace remoting { | 17 namespace remoting { |
17 namespace protocol { | 18 namespace protocol { |
18 | 19 |
19 class ContentDescription; | 20 class ContentDescription; |
20 | 21 |
21 // Represents an address of a Chromoting endpoint and its routing channel. | |
22 // TODO(kelvinp): Move the struct to remoting/signaling. Potentially we could | |
23 // update SignalStrategy interface to use this instead of jid for addressing. | |
24 class SignalingAddress { | |
25 public: | |
26 enum class Channel { LCS, XMPP }; | |
27 | |
28 SignalingAddress(); | |
29 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 struct JingleMessage { | 22 struct JingleMessage { |
58 enum ActionType { | 23 enum ActionType { |
59 UNKNOWN_ACTION, | 24 UNKNOWN_ACTION, |
60 SESSION_INITIATE, | 25 SESSION_INITIATE, |
61 SESSION_ACCEPT, | 26 SESSION_ACCEPT, |
62 SESSION_TERMINATE, | 27 SESSION_TERMINATE, |
63 SESSION_INFO, | 28 SESSION_INFO, |
64 TRANSPORT_INFO, | 29 TRANSPORT_INFO, |
65 }; | 30 }; |
66 | 31 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 std::unique_ptr<buzz::XmlElement> ToXml() const; | 150 std::unique_ptr<buzz::XmlElement> ToXml() const; |
186 | 151 |
187 std::list<IceCredentials> ice_credentials; | 152 std::list<IceCredentials> ice_credentials; |
188 std::list<NamedCandidate> candidates; | 153 std::list<NamedCandidate> candidates; |
189 }; | 154 }; |
190 | 155 |
191 } // protocol | 156 } // protocol |
192 } // remoting | 157 } // remoting |
193 | 158 |
194 #endif // REMOTING_PROTOCOL_JINGLE_MESSAGES_H_ | 159 #endif // REMOTING_PROTOCOL_JINGLE_MESSAGES_H_ |
OLD | NEW |