| 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 <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" | 12 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" |
| 13 #include "third_party/webrtc/p2p/base/candidate.h" | 13 #include "third_party/webrtc/p2p/base/candidate.h" |
| 14 | 14 |
| 15 namespace remoting { | 15 namespace remoting { |
| 16 namespace protocol { | 16 namespace protocol { |
| 17 | 17 |
| 18 class ContentDescription; | 18 class ContentDescription; |
| 19 | 19 |
| 20 struct JingleMessage { | 20 struct JingleMessage { |
| 21 enum ActionType { | 21 enum ActionType { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 46 ~JingleMessage(); | 46 ~JingleMessage(); |
| 47 | 47 |
| 48 // Caller keeps ownership of |stanza|. | 48 // Caller keeps ownership of |stanza|. |
| 49 static bool IsJingleMessage(const buzz::XmlElement* stanza); | 49 static bool IsJingleMessage(const buzz::XmlElement* stanza); |
| 50 static std::string GetActionName(ActionType action); | 50 static std::string GetActionName(ActionType action); |
| 51 | 51 |
| 52 // Caller keeps ownership of |stanza|. |error| is set to debug error | 52 // Caller keeps ownership of |stanza|. |error| is set to debug error |
| 53 // message when parsing fails. | 53 // message when parsing fails. |
| 54 bool ParseXml(const buzz::XmlElement* stanza, std::string* error); | 54 bool ParseXml(const buzz::XmlElement* stanza, std::string* error); |
| 55 | 55 |
| 56 scoped_ptr<buzz::XmlElement> ToXml() const; | 56 std::unique_ptr<buzz::XmlElement> ToXml() const; |
| 57 | 57 |
| 58 std::string from; | 58 std::string from; |
| 59 std::string to; | 59 std::string to; |
| 60 ActionType action = UNKNOWN_ACTION; | 60 ActionType action = UNKNOWN_ACTION; |
| 61 std::string sid; | 61 std::string sid; |
| 62 | 62 |
| 63 std::string initiator; | 63 std::string initiator; |
| 64 | 64 |
| 65 scoped_ptr<ContentDescription> description; | 65 std::unique_ptr<ContentDescription> description; |
| 66 | 66 |
| 67 scoped_ptr<buzz::XmlElement> transport_info; | 67 std::unique_ptr<buzz::XmlElement> transport_info; |
| 68 | 68 |
| 69 // Content of session-info messages. | 69 // Content of session-info messages. |
| 70 scoped_ptr<buzz::XmlElement> info; | 70 std::unique_ptr<buzz::XmlElement> info; |
| 71 | 71 |
| 72 // Value from the <reason> tag if it is present in the | 72 // Value from the <reason> tag if it is present in the |
| 73 // message. Useful mainly for session-terminate messages, but Jingle | 73 // message. Useful mainly for session-terminate messages, but Jingle |
| 74 // spec allows it in any message. | 74 // spec allows it in any message. |
| 75 Reason reason = UNKNOWN_REASON; | 75 Reason reason = UNKNOWN_REASON; |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 struct JingleMessageReply { | 78 struct JingleMessageReply { |
| 79 enum ReplyType { | 79 enum ReplyType { |
| 80 REPLY_RESULT, | 80 REPLY_RESULT, |
| 81 REPLY_ERROR, | 81 REPLY_ERROR, |
| 82 }; | 82 }; |
| 83 enum ErrorType { | 83 enum ErrorType { |
| 84 NONE, | 84 NONE, |
| 85 BAD_REQUEST, | 85 BAD_REQUEST, |
| 86 NOT_IMPLEMENTED, | 86 NOT_IMPLEMENTED, |
| 87 INVALID_SID, | 87 INVALID_SID, |
| 88 UNEXPECTED_REQUEST, | 88 UNEXPECTED_REQUEST, |
| 89 UNSUPPORTED_INFO, | 89 UNSUPPORTED_INFO, |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 JingleMessageReply(); | 92 JingleMessageReply(); |
| 93 JingleMessageReply(ErrorType error); | 93 JingleMessageReply(ErrorType error); |
| 94 JingleMessageReply(ErrorType error, const std::string& text); | 94 JingleMessageReply(ErrorType error, const std::string& text); |
| 95 ~JingleMessageReply(); | 95 ~JingleMessageReply(); |
| 96 | 96 |
| 97 // Formats reply stanza for the specified |request_stanza|. Id and | 97 // Formats reply stanza for the specified |request_stanza|. Id and |
| 98 // recepient as well as other information needed to generate a valid | 98 // recepient as well as other information needed to generate a valid |
| 99 // reply are taken from |request_stanza|. | 99 // reply are taken from |request_stanza|. |
| 100 scoped_ptr<buzz::XmlElement> ToXml( | 100 std::unique_ptr<buzz::XmlElement> ToXml( |
| 101 const buzz::XmlElement* request_stanza) const; | 101 const buzz::XmlElement* request_stanza) const; |
| 102 | 102 |
| 103 ReplyType type; | 103 ReplyType type; |
| 104 ErrorType error_type; | 104 ErrorType error_type; |
| 105 std::string text; | 105 std::string text; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 struct IceTransportInfo { | 108 struct IceTransportInfo { |
| 109 IceTransportInfo(); | 109 IceTransportInfo(); |
| 110 ~IceTransportInfo(); | 110 ~IceTransportInfo(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 124 std::string password); | 124 std::string password); |
| 125 | 125 |
| 126 std::string channel; | 126 std::string channel; |
| 127 std::string ufrag; | 127 std::string ufrag; |
| 128 std::string password; | 128 std::string password; |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 // Caller keeps ownership of |stanza|. |error| is set to debug error | 131 // Caller keeps ownership of |stanza|. |error| is set to debug error |
| 132 // message when parsing fails. | 132 // message when parsing fails. |
| 133 bool ParseXml(const buzz::XmlElement* stanza); | 133 bool ParseXml(const buzz::XmlElement* stanza); |
| 134 scoped_ptr<buzz::XmlElement> ToXml() const; | 134 std::unique_ptr<buzz::XmlElement> ToXml() const; |
| 135 | 135 |
| 136 std::list<IceCredentials> ice_credentials; | 136 std::list<IceCredentials> ice_credentials; |
| 137 std::list<NamedCandidate> candidates; | 137 std::list<NamedCandidate> candidates; |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 } // protocol | 140 } // protocol |
| 141 } // remoting | 141 } // remoting |
| 142 | 142 |
| 143 #endif // REMOTING_PROTOCOL_JINGLE_MESSAGES_H_ | 143 #endif // REMOTING_PROTOCOL_JINGLE_MESSAGES_H_ |
| OLD | NEW |