~jackweirdy/vidalia/680192

« back to all changes in this revision

Viewing changes to src/torcontrol/TorEvents.cpp

  • Committer: Package Import Robot
  • Author(s): Ulises Vitulli
  • Date: 2012-06-22 07:18:44 UTC
  • mfrom: (1.3.9)
  • mto: This revision was merged to the branch mainline in revision 17.
  • Revision ID: package-import@ubuntu.com-20120622071844-8fgna0qpymsflky1
Tags: upstream-0.2.19
ImportĀ upstreamĀ versionĀ 0.2.19

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
**  This file is part of Vidalia, and is subject to the license terms in the
3
 
**  LICENSE file, found in the top level directory of this distribution. If 
 
3
**  LICENSE file, found in the top level directory of this distribution. If
4
4
**  you did not receive the LICENSE file with this file, you may obtain it
5
5
**  from the Vidalia source package distributed by the Vidalia Project at
6
 
**  http://www.torproject.org/projects/vidalia.html. No part of Vidalia, 
7
 
**  including this file, may be copied, modified, propagated, or distributed 
 
6
**  http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
 
7
**  including this file, may be copied, modified, propagated, or distributed
8
8
**  except according to the terms described in the LICENSE file.
9
9
*/
10
10
 
11
 
/* 
 
11
/*
12
12
** \file TorEvents.cpp
13
13
** \brief Parses and dispatches events from Tor
14
14
*/
138
138
      case ServerStatus:
139
139
        handleStatusEvent(ServerStatus, line); break;
140
140
 
141
 
      case LogDebug: 
 
141
      case LogDebug:
142
142
      case LogInfo:
143
143
      case LogNotice:
144
144
      case LogWarn:
163
163
  if (msg.size() >= 3) {
164
164
    quint64 bytesIn = (quint64)msg.at(1).toULongLong();
165
165
    quint64 bytesOut = (quint64)msg.at(2).toULongLong();
166
 
  
 
166
 
167
167
    /* Post the event to each of the interested targets */
168
168
    emit bandwidthUpdate(bytesIn, bytesOut);
169
169
  }
194
194
}
195
195
 
196
196
/** Handle a stream status event. The format of this message is:
197
 
 *     
198
 
 *    "650" SP "STREAM" SP StreamID SP StreamStatus SP CircID SP Target SP 
 
197
 *
 
198
 *    "650" SP "STREAM" SP StreamID SP StreamStatus SP CircID SP Target SP
199
199
 *     StreamStatus =
200
200
 *                 "NEW"          / ; New request to connect
201
201
 *                 "NEWRESOLVE"   / ; New request to resolve an address
207
207
 *                 "DETACHED"       ; Detached from circuit; still retriable.
208
208
 *      Target = Address ":" Port
209
209
 *
210
 
 *  If the circuit ID is 0, then the stream is unattached.      
 
210
 *  If the circuit ID is 0, then the stream is unattached.
211
211
 */
212
212
void
213
213
TorEvents::handleStreamStatus(const ReplyLine &line)
243
243
 
244
244
/** Handles a new descriptor event. The format for event messages of this type
245
245
 * is:
246
 
 *  
 
246
 *
247
247
 *   "650" SP "NEWDESC" 1*(SP ServerID)
248
248
 */
249
249
void
294
294
  tc::Severity severity;
295
295
  QHash<QString,QString> args;
296
296
  QString msg = line.getMessage();
297
 
  
 
297
 
298
298
  severity = tc::severityFromString(msg.section(' ', 1, 1));
299
299
  status   = msg.section(' ', 2, 2);
300
300
  args     = string_parse_keyvals(msg.section(' ', 3));