Vidalia  0.2.17
Service.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 you
00004 **  did not receive the LICENSE file with this file, you may obtain it from the
00005 **  Vidalia source package distributed by the Vidalia Project at
00006 **  http://www.torproject.org/projects/vidalia.html. No part of Vidalia, 
00007 **  including this file, may be copied, modified, propagated, or distributed 
00008 **  except according to the terms described in the LICENSE file.
00009 */
00010 
00011 #ifndef _SERVICE_H
00012 #define _SERVICE_H
00013 
00014 #include <QString>
00015 #include <QList>
00016 #include <QMetaType>
00017 
00018 
00019 class Service
00020 {
00021 public:
00022   /** Default constructor. */
00023   Service();
00024   /** Constructor to create a new Service with initial settings */
00025   Service(QString serviceAddress, QString virtualPort,
00026    QString physicalAddressPort, QString serviceDirectory, bool enabled);
00027   /** Destructor */
00028   virtual ~Service();
00029   /** Returns the service Adress of the service */
00030   QString serviceAddress() const { return _serviceAddress; }
00031   /** Returns the listeningPort of the service */
00032   QString virtualPort() const { return _virtualPort; }
00033   /** Returns the physical Adresse and the local Port of the service */
00034   QString physicalAddressPort() const { return _physicalAddressPort; }
00035   /** Returns the service directory of the service */
00036   QString serviceDirectory() const { return _serviceDirectory; }
00037   /** Returns the deployed status of a service */
00038   bool enabled() const { return _enabled; }
00039   /** Returns the additional options of a service e.g. excludeNodes */
00040   QString additionalServiceOptions() const
00041    { return _additionalServiceOptions; }
00042   /** Sets the adress of a service */
00043   void setServiceAddress(QString serviceAddress);
00044   /** Sets the listening port of a service */
00045   void setVirtualPort(QString virtualPort);
00046   /** Sets the physical Adress and the local Port of a service */
00047   void setPhysicalAddressPort(QString physicalAddressPort);
00048   /** Sets the service directory of a service */
00049   void setServiceDirectory(QString serviceDirectory);
00050   /** Sets the deployed status a service */
00051   void setEnabled(bool enabled);
00052   /** Sets the additional options of a service e.g. excludeNodes */
00053   void setAdditionalServiceOptions(QString options);
00054   /** Writes service class data from <b>myObj</b> to the QDataStream
00055   * <b>out</b>. */
00056   friend QDataStream& operator<<(QDataStream &out, const Service &myObj);
00057   /** Reads service class data in from the QDataStream <b>in</b> and
00058   populates * the <b>myObj</b> object accordingly. */
00059   friend QDataStream& operator>>(QDataStream &in, Service &myObj);
00060   /** this method creates a string by concatenating the values of the service */
00061   QString toString();
00062 
00063 private:
00064   /** The adress of the service */
00065   QString _serviceAddress;
00066   /** The listening Port of the service */
00067   QString _virtualPort;
00068   /** The physical Adress and the local port of teh service */
00069   QString _physicalAddressPort;
00070   /** the directory of the service */
00071   QString _serviceDirectory;
00072   /** The Enabled status of the service */
00073   bool _enabled;
00074   /** Some additional service options, not configured/displayed by Vidalia */
00075   QString _additionalServiceOptions;
00076 
00077 };
00078 Q_DECLARE_METATYPE(Service);
00079 #endif /*SERIVCE_H_*/
00080