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

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
« no previous file with comments | « remoting/protocol/fake_session.cc ('k') | remoting/protocol/jingle_messages.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 15 matching lines...) Expand all
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_TERMINATE, 32 SESSION_TERMINATE,
33 TRANSPORT_INFO, 33 TRANSPORT_INFO,
34 }; 34 };
35 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 DECLINE,
42 INCOMPATIBLE_PARAMETERS,
43 };
44
36 JingleMessage(); 45 JingleMessage();
37 JingleMessage(const std::string& to_value, 46 JingleMessage(const std::string& to_value,
38 ActionType action_value, 47 ActionType action_value,
39 const std::string& sid_value); 48 const std::string& sid_value);
40 ~JingleMessage(); 49 ~JingleMessage();
41 50
42 // Caller keeps ownership of |stanza|. 51 // Caller keeps ownership of |stanza|.
43 static bool IsJingleMessage(const buzz::XmlElement* stanza); 52 static bool IsJingleMessage(const buzz::XmlElement* stanza);
44 53
45 // Caller keeps ownership of |stanza|. |error| is set to debug error 54 // Caller keeps ownership of |stanza|. |error| is set to debug error
46 // message when parsing fails. 55 // message when parsing fails.
47 bool ParseXml(const buzz::XmlElement* stanza, std::string* error); 56 bool ParseXml(const buzz::XmlElement* stanza, std::string* error);
48 57
49 buzz::XmlElement* ToXml(); 58 buzz::XmlElement* ToXml();
50 59
51 std::string from; 60 std::string from;
52 std::string to; 61 std::string to;
53 ActionType action; 62 ActionType action;
54 std::string sid; 63 std::string sid;
55 64
56 scoped_ptr<ContentDescription> description; 65 scoped_ptr<ContentDescription> description;
57 std::list<cricket::Candidate> candidates; 66 std::list<cricket::Candidate> candidates;
58 67
59 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;
60 }; 72 };
61 73
62 struct JingleMessageReply { 74 struct JingleMessageReply {
63 enum ReplyType { 75 enum ReplyType {
64 REPLY_RESULT, 76 REPLY_RESULT,
65 REPLY_ERROR, 77 REPLY_ERROR,
66 }; 78 };
67 enum ErrorType { 79 enum ErrorType {
68 NONE, 80 NONE,
69 BAD_REQUEST, 81 BAD_REQUEST,
(...skipping 14 matching lines...) Expand all
84 96
85 ReplyType type; 97 ReplyType type;
86 ErrorType error_type; 98 ErrorType error_type;
87 std::string text; 99 std::string text;
88 }; 100 };
89 101
90 } // protocol 102 } // protocol
91 } // remoting 103 } // remoting
92 104
93 #endif // REMOTING_PROTOCOL_JINGLE_MESSAGES_H_ 105 #endif // REMOTING_PROTOCOL_JINGLE_MESSAGES_H_
OLDNEW
« no previous file with comments | « remoting/protocol/fake_session.cc ('k') | remoting/protocol/jingle_messages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698