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

Side by Side Diff: remoting/protocol/jingle_messages.h

Issue 8046018: Parse termination reason and propagate the error to the Session interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 11 matching lines...) Expand all
22 22
23 extern const char kJabberNamespace[]; 23 extern const char kJabberNamespace[];
24 extern const char kJingleNamespace[]; 24 extern const char kJingleNamespace[];
25 extern const char kP2PTransportNamespace[]; 25 extern const char kP2PTransportNamespace[];
26 26
27 struct JingleMessage { 27 struct JingleMessage {
28 enum ActionType { 28 enum ActionType {
29 UNKNOWN_ACTION, 29 UNKNOWN_ACTION,
30 SESSION_INITIATE, 30 SESSION_INITIATE,
31 SESSION_ACCEPT, 31 SESSION_ACCEPT,
32 SESSION_REJECT,
33 SESSION_TERMINATE, 32 SESSION_TERMINATE,
34 TRANSPORT_INFO, 33 TRANSPORT_INFO,
35 }; 34 };
36 35
36 enum Reason {
37 // Currently only termination reasons that can be sent by the host
38 // are understood. All others are converted to UNKNOWN_REASON.
39 UNKNOWN_REASON,
40 SUCCESS,
41 DECLINED,
42 INCOMPATIBLE_PARAMETERS,
43 };
44
37 JingleMessage(); 45 JingleMessage();
38 JingleMessage(const std::string& to_value, 46 JingleMessage(const std::string& to_value,
39 ActionType action_value, 47 ActionType action_value,
40 const std::string& sid_value); 48 const std::string& sid_value);
41 ~JingleMessage(); 49 ~JingleMessage();
42 50
43 // Caller keeps ownership of |stanza|. 51 // Caller keeps ownership of |stanza|.
44 static bool IsJingleMessage(const buzz::XmlElement* stanza); 52 static bool IsJingleMessage(const buzz::XmlElement* stanza);
45 53
46 // Caller keeps ownership of |stanza|. |error| is set to debug error 54 // Caller keeps ownership of |stanza|. |error| is set to debug error
47 // message when parsing fails. 55 // message when parsing fails.
48 bool ParseXml(const buzz::XmlElement* stanza, std::string* error); 56 bool ParseXml(const buzz::XmlElement* stanza, std::string* error);
49 57
50 buzz::XmlElement* ToXml(); 58 buzz::XmlElement* ToXml();
51 59
52 std::string from; 60 std::string from;
53 std::string to; 61 std::string to;
54 ActionType action; 62 ActionType action;
55 std::string sid; 63 std::string sid;
56 64
57 scoped_ptr<ContentDescription> description; 65 scoped_ptr<ContentDescription> description;
58 std::list<cricket::Candidate> candidates; 66 std::list<cricket::Candidate> candidates;
59 67
60 buzz::QName termination_reason; 68 // Value from the <reason> tag if it is present in the
69 // message. Useful mainly for session-terminate messages, but Jingle
70 // spec allows it in any message.
71 Reason reason;
61 }; 72 };
62 73
63 struct JingleMessageReply { 74 struct JingleMessageReply {
64 enum ReplyType { 75 enum ReplyType {
65 REPLY_RESULT, 76 REPLY_RESULT,
66 REPLY_ERROR, 77 REPLY_ERROR,
67 }; 78 };
68 enum ErrorType { 79 enum ErrorType {
69 NONE, 80 NONE,
70 BAD_REQUEST, 81 BAD_REQUEST,
(...skipping 14 matching lines...) Expand all
85 96
86 ReplyType type; 97 ReplyType type;
87 ErrorType error_type; 98 ErrorType error_type;
88 std::string text; 99 std::string text;
89 }; 100 };
90 101
91 } // protocol 102 } // protocol
92 } // remoting 103 } // remoting
93 104
94 #endif // REMOTING_PROTOCOL_JINGLE_MESSAGES_H_ 105 #endif // REMOTING_PROTOCOL_JINGLE_MESSAGES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698