OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/libjingle/xmpp/xmpplogintask.h" | 11 #include "webrtc/libjingle/xmpp/xmpplogintask.h" |
12 | 12 |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "webrtc/libjingle/xmllite/xmlelement.h" | 16 #include "webrtc/libjingle/xmllite/xmlelement.h" |
17 #include "webrtc/libjingle/xmpp/constants.h" | 17 #include "webrtc/libjingle/xmpp/constants.h" |
18 #include "webrtc/libjingle/xmpp/jid.h" | 18 #include "webrtc/libjingle/xmpp/jid.h" |
19 #include "webrtc/libjingle/xmpp/saslmechanism.h" | 19 #include "webrtc/libjingle/xmpp/saslmechanism.h" |
20 #include "webrtc/libjingle/xmpp/xmppengineimpl.h" | 20 #include "webrtc/libjingle/xmpp/xmppengineimpl.h" |
21 #include "webrtc/base/base64.h" | 21 #include "webrtc/base/base64.h" |
22 #include "webrtc/base/common.h" | 22 #include "webrtc/base/common.h" |
23 | 23 |
24 using rtc::ConstantLabel; | 24 using rtc::ConstantLabel; |
25 | 25 |
26 namespace buzz { | 26 namespace buzz { |
27 | 27 |
28 #ifdef _DEBUG | 28 #if !defined(NDEBUG) |
29 const ConstantLabel XmppLoginTask::LOGINTASK_STATES[] = { | 29 const ConstantLabel XmppLoginTask::LOGINTASK_STATES[] = { |
30 KLABEL(LOGINSTATE_INIT), | 30 KLABEL(LOGINSTATE_INIT), |
31 KLABEL(LOGINSTATE_STREAMSTART_SENT), | 31 KLABEL(LOGINSTATE_STREAMSTART_SENT), |
32 KLABEL(LOGINSTATE_STARTED_XMPP), | 32 KLABEL(LOGINSTATE_STARTED_XMPP), |
33 KLABEL(LOGINSTATE_TLS_INIT), | 33 KLABEL(LOGINSTATE_TLS_INIT), |
34 KLABEL(LOGINSTATE_AUTH_INIT), | 34 KLABEL(LOGINSTATE_AUTH_INIT), |
35 KLABEL(LOGINSTATE_BIND_INIT), | 35 KLABEL(LOGINSTATE_BIND_INIT), |
36 KLABEL(LOGINSTATE_TLS_REQUESTED), | 36 KLABEL(LOGINSTATE_TLS_REQUESTED), |
37 KLABEL(LOGINSTATE_SASL_RUNNING), | 37 KLABEL(LOGINSTATE_SASL_RUNNING), |
38 KLABEL(LOGINSTATE_BIND_REQUESTED), | 38 KLABEL(LOGINSTATE_BIND_REQUESTED), |
39 KLABEL(LOGINSTATE_SESSION_REQUESTED), | 39 KLABEL(LOGINSTATE_SESSION_REQUESTED), |
40 KLABEL(LOGINSTATE_DONE), | 40 KLABEL(LOGINSTATE_DONE), |
41 LASTLABEL | 41 LASTLABEL |
42 }; | 42 }; |
43 #endif // _DEBUG | 43 #endif |
44 XmppLoginTask::XmppLoginTask(XmppEngineImpl * pctx) : | 44 XmppLoginTask::XmppLoginTask(XmppEngineImpl * pctx) : |
45 pctx_(pctx), | 45 pctx_(pctx), |
46 authNeeded_(true), | 46 authNeeded_(true), |
47 allowNonGoogleLogin_(true), | 47 allowNonGoogleLogin_(true), |
48 state_(LOGINSTATE_INIT), | 48 state_(LOGINSTATE_INIT), |
49 pelStanza_(NULL), | 49 pelStanza_(NULL), |
50 isStart_(false), | 50 isStart_(false), |
51 iqId_(STR_EMPTY), | 51 iqId_(STR_EMPTY), |
52 pelFeatures_(), | 52 pelFeatures_(), |
53 fullJid_(STR_EMPTY), | 53 fullJid_(STR_EMPTY), |
(...skipping 23 matching lines...) Expand all Loading... |
77 return result; | 77 return result; |
78 } | 78 } |
79 | 79 |
80 bool | 80 bool |
81 XmppLoginTask::Advance() { | 81 XmppLoginTask::Advance() { |
82 | 82 |
83 for (;;) { | 83 for (;;) { |
84 | 84 |
85 const XmlElement * element = NULL; | 85 const XmlElement * element = NULL; |
86 | 86 |
87 #if _DEBUG | 87 #if !defined(NDEBUG) |
88 LOG(LS_VERBOSE) << "XmppLoginTask::Advance - " | 88 LOG(LS_VERBOSE) << "XmppLoginTask::Advance - " |
89 << rtc::ErrorName(state_, LOGINTASK_STATES); | 89 << rtc::ErrorName(state_, LOGINTASK_STATES); |
90 #endif // _DEBUG | 90 #endif |
91 | 91 |
92 switch (state_) { | 92 switch (state_) { |
93 | 93 |
94 case LOGINSTATE_INIT: { | 94 case LOGINSTATE_INIT: { |
95 pctx_->RaiseReset(); | 95 pctx_->RaiseReset(); |
96 pelFeatures_.reset(NULL); | 96 pelFeatures_.reset(NULL); |
97 | 97 |
98 // The proper domain to verify against is the real underlying | 98 // The proper domain to verify against is the real underlying |
99 // domain - i.e., the domain that owns the JID. Our XmppEngineImpl | 99 // domain - i.e., the domain that owns the JID. Our XmppEngineImpl |
100 // also allows matching against a proxy domain instead, if it is told | 100 // also allows matching against a proxy domain instead, if it is told |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 void | 371 void |
372 XmppLoginTask::FlushQueuedStanzas() { | 372 XmppLoginTask::FlushQueuedStanzas() { |
373 for (size_t i = 0; i < pvecQueuedStanzas_->size(); i += 1) { | 373 for (size_t i = 0; i < pvecQueuedStanzas_->size(); i += 1) { |
374 pctx_->InternalSendStanza((*pvecQueuedStanzas_)[i]); | 374 pctx_->InternalSendStanza((*pvecQueuedStanzas_)[i]); |
375 delete (*pvecQueuedStanzas_)[i]; | 375 delete (*pvecQueuedStanzas_)[i]; |
376 } | 376 } |
377 pvecQueuedStanzas_->clear(); | 377 pvecQueuedStanzas_->clear(); |
378 } | 378 } |
379 | 379 |
380 } | 380 } |
OLD | NEW |