00001 /* 00002 ** This file is part of Vidalia, and is subject to the license terms in the 00003 ** LICENSE file, found in the top level directory of this distribution. If 00004 ** you did not receive the LICENSE file with this file, you may obtain it 00005 ** from the Vidalia source package distributed by the Vidalia Project at 00006 ** http://www.vidalia-project.net/. No part of Vidalia, including this file, 00007 ** may be copied, modified, propagated, or distributed except according to 00008 ** the terms described in the LICENSE file. 00009 */ 00010 00011 /* 00012 ** \file generalstatusevent.h 00013 ** \version $Id: generalstatusevent.h 2780 2008-06-21 21:48:32Z edmanm $ 00014 ** \brief Base class for all general Tor status events 00015 */ 00016 00017 #ifndef _GENERALSTATUSEVENT_H 00018 #define _GENERALSTATUSEVENT_H 00019 00020 #include "statusevent.h" 00021 00022 00023 class GeneralStatusEvent : public StatusEvent 00024 { 00025 public: 00026 /**< General Tor status event types. */ 00027 enum Status { 00028 UnrecognizedStatus, 00029 ClockJumped, 00030 DangerousTorVersion, 00031 TooManyConnections, 00032 TorBug, 00033 ClockSkew, 00034 BadLibevent, 00035 DirAllUnreachable 00036 }; 00037 00038 /** Constructor */ 00039 GeneralStatusEvent(tc::Severity severity, Status status) 00040 : StatusEvent((QEvent::Type)CustomEventType::ServerStatusEvent, severity), 00041 _status(status) {} 00042 00043 /** Returns the general Tor status indicated by this event. */ 00044 Status status() const { return _status; } 00045 /** Returns a GeneralStatusEvent::Status enum value for the status value 00046 * represented by <b>str</b>. */ 00047 static Status statusFromString(const QString &str); 00048 00049 private: 00050 Status _status; /**< General Tor status value indicated by this event. */ 00051 }; 00052 00053 #endif 00054