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