addressmapevent.h

Go to the documentation of this file.
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 addressmapevent.h
00013 ** \version $Id: bandwidthevent.h 1563 2006-12-26 06:06:04Z edmanm $
00014 ** \brief Event dispatched upon receiving a new or updated address mapping
00015 ** from Tor.
00016 */
00017 
00018 #ifndef _ADDRESSMAPEVENT_H
00019 #define _ADDRESSMAPEVENT_H
00020 
00021 #include <QEvent>
00022 #include <QString>
00023 #include <QDateTime>
00024 
00025 
00026 class AddressMapEvent : public QEvent
00027 {
00028 public:
00029   /** Constructor */
00030   AddressMapEvent(QString from, QString to, QDateTime expires)
00031   : QEvent((QEvent::Type)CustomEventType::AddressMapEvent)
00032   { _from = from; _to = to; _expires = expires; }
00033 
00034   /** Returns the source address for this address mapping. */
00035   QString from() const { return _from; }
00036   /** Returns the target address for this address mapping. */
00037   QString to() const { return _to; }
00038   /** Returns the date and time at which this mapping should expire, in local
00039    * time. */
00040   QDateTime expires() const { return _expires; }
00041   /** Returns true if this address mapping is expired. */
00042   bool isExpired() const { return (_expires > QDateTime::currentDateTime()); }
00043 
00044 private:
00045   QString _from; /**< The source address of this mapping. */
00046   QString _to;   /**< The target address of this mapping. */
00047   QDateTime _expires; /**< The time at which this mapping expires (if ever). */
00048 };
00049 
00050 #endif
00051 

Generated on Tue Jul 7 17:00:55 2009 for Vidalia by  doxygen 1.4.7