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 <string> | 9 #include <string> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 enum Reason { | 30 enum Reason { |
31 UNKNOWN_REASON, | 31 UNKNOWN_REASON, |
32 SUCCESS, | 32 SUCCESS, |
33 DECLINE, | 33 DECLINE, |
34 CANCEL, | 34 CANCEL, |
35 GENERAL_ERROR, | 35 GENERAL_ERROR, |
36 INCOMPATIBLE_PARAMETERS, | 36 INCOMPATIBLE_PARAMETERS, |
37 }; | 37 }; |
38 | 38 |
39 struct NamedCandidate { | |
40 NamedCandidate() = default; | |
41 NamedCandidate(const std::string& name, | |
42 const cricket::Candidate& candidate); | |
43 | |
44 std::string name; | |
45 cricket::Candidate candidate; | |
46 }; | |
47 | |
48 struct IceCredentials { | |
49 IceCredentials() = default; | |
50 IceCredentials(std::string channel, | |
51 std::string ufrag, | |
52 std::string password); | |
53 | |
54 std::string channel; | |
55 std::string ufrag; | |
56 std::string password; | |
57 }; | |
58 | 39 |
59 JingleMessage(); | 40 JingleMessage(); |
60 JingleMessage(const std::string& to_value, | 41 JingleMessage(const std::string& to_value, |
61 ActionType action_value, | 42 ActionType action_value, |
62 const std::string& sid_value); | 43 const std::string& sid_value); |
63 ~JingleMessage(); | 44 ~JingleMessage(); |
64 | 45 |
65 // Caller keeps ownership of |stanza|. | 46 // Caller keeps ownership of |stanza|. |
66 static bool IsJingleMessage(const buzz::XmlElement* stanza); | 47 static bool IsJingleMessage(const buzz::XmlElement* stanza); |
67 static std::string GetActionName(ActionType action); | 48 static std::string GetActionName(ActionType action); |
68 | 49 |
69 // Caller keeps ownership of |stanza|. |error| is set to debug error | 50 // Caller keeps ownership of |stanza|. |error| is set to debug error |
70 // message when parsing fails. | 51 // message when parsing fails. |
71 bool ParseXml(const buzz::XmlElement* stanza, std::string* error); | 52 bool ParseXml(const buzz::XmlElement* stanza, std::string* error); |
72 | 53 |
73 scoped_ptr<buzz::XmlElement> ToXml() const; | 54 scoped_ptr<buzz::XmlElement> ToXml() const; |
74 | 55 |
75 std::string from; | 56 std::string from; |
76 std::string to; | 57 std::string to; |
77 ActionType action = UNKNOWN_ACTION; | 58 ActionType action = UNKNOWN_ACTION; |
78 std::string sid; | 59 std::string sid; |
79 | 60 |
80 std::string initiator; | 61 std::string initiator; |
81 | 62 |
82 scoped_ptr<ContentDescription> description; | 63 scoped_ptr<ContentDescription> description; |
83 | 64 |
84 std::list<IceCredentials> ice_credentials; | 65 scoped_ptr<buzz::XmlElement> transport_info; |
85 std::list<NamedCandidate> candidates; | |
86 | 66 |
87 // Content of session-info messages. | 67 // Content of session-info messages. |
88 scoped_ptr<buzz::XmlElement> info; | 68 scoped_ptr<buzz::XmlElement> info; |
89 | 69 |
90 // Value from the <reason> tag if it is present in the | 70 // Value from the <reason> tag if it is present in the |
91 // message. Useful mainly for session-terminate messages, but Jingle | 71 // message. Useful mainly for session-terminate messages, but Jingle |
92 // spec allows it in any message. | 72 // spec allows it in any message. |
93 Reason reason = UNKNOWN_REASON; | 73 Reason reason = UNKNOWN_REASON; |
94 }; | 74 }; |
95 | 75 |
(...skipping 20 matching lines...) Expand all Loading... |
116 // recepient as well as other information needed to generate a valid | 96 // recepient as well as other information needed to generate a valid |
117 // reply are taken from |request_stanza|. | 97 // reply are taken from |request_stanza|. |
118 scoped_ptr<buzz::XmlElement> ToXml( | 98 scoped_ptr<buzz::XmlElement> ToXml( |
119 const buzz::XmlElement* request_stanza) const; | 99 const buzz::XmlElement* request_stanza) const; |
120 | 100 |
121 ReplyType type; | 101 ReplyType type; |
122 ErrorType error_type; | 102 ErrorType error_type; |
123 std::string text; | 103 std::string text; |
124 }; | 104 }; |
125 | 105 |
| 106 struct IceTransportInfo { |
| 107 IceTransportInfo(); |
| 108 ~IceTransportInfo(); |
| 109 struct NamedCandidate { |
| 110 NamedCandidate() = default; |
| 111 NamedCandidate(const std::string& name, |
| 112 const cricket::Candidate& candidate); |
| 113 |
| 114 std::string name; |
| 115 cricket::Candidate candidate; |
| 116 }; |
| 117 |
| 118 struct IceCredentials { |
| 119 IceCredentials() = default; |
| 120 IceCredentials(std::string channel, |
| 121 std::string ufrag, |
| 122 std::string password); |
| 123 |
| 124 std::string channel; |
| 125 std::string ufrag; |
| 126 std::string password; |
| 127 }; |
| 128 |
| 129 // Caller keeps ownership of |stanza|. |error| is set to debug error |
| 130 // message when parsing fails. |
| 131 bool ParseXml(const buzz::XmlElement* stanza); |
| 132 scoped_ptr<buzz::XmlElement> ToXml() const; |
| 133 |
| 134 std::list<IceCredentials> ice_credentials; |
| 135 std::list<NamedCandidate> candidates; |
| 136 }; |
| 137 |
126 } // protocol | 138 } // protocol |
127 } // remoting | 139 } // remoting |
128 | 140 |
129 #endif // REMOTING_PROTOCOL_JINGLE_MESSAGES_H_ | 141 #endif // REMOTING_PROTOCOL_JINGLE_MESSAGES_H_ |
OLD | NEW |