00001 /**************************************************************** 00002 * Vidalia is distributed under the following license: 00003 * 00004 * Copyright (C) 2006, Matt Edman, Justin Hipple 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 ****************************************************************/ 00021 00022 /** 00023 * \file torsettings.h 00024 * \version $Id: torsettings.h 1238 2006-09-25 17:50:57Z edmanm $ 00025 * \brief Settings used for starting and running Tor 00026 */ 00027 00028 #ifndef _TORSETTINGS_H 00029 #define _TORSETTINGS_H 00030 00031 #include <QHostAddress> 00032 00033 #include "vidaliasettings.h" 00034 00035 /** Manages Tor-specific settings, such as location, command-line arguments, 00036 * and control interface information. */ 00037 class TorSettings : private VidaliaSettings 00038 { 00039 public: 00040 /** Default constructor. */ 00041 TorSettings(); 00042 00043 /** Gets the name and path of Tor's executable. */ 00044 QString getExecutable(); 00045 /** Sets the name and path of Tor's executable. */ 00046 void setExecutable(QString torExecutable); 00047 00048 /** Builds and formats a list of command-line arguments. */ 00049 QString getArguments(); 00050 00051 /** Gets the torrc to use when starting Tor. */ 00052 QString getTorrc(); 00053 /** Sets the torrc to use when starting Tor. */ 00054 void setTorrc(QString torrc); 00055 00056 /** Get Tor's control interface address. */ 00057 QHostAddress getControlAddress(); 00058 /** Set Tor's control interface address. */ 00059 void setControlAddress(QHostAddress addr); 00060 00061 /** Get the control port. */ 00062 quint16 getControlPort(); 00063 /** Set the control port. */ 00064 void setControlPort(quint16 port); 00065 00066 /** Get Tor's controller authentication information. */ 00067 QByteArray getAuthToken(); 00068 /** Set Tor's controller authentication information. */ 00069 void setAuthToken(QByteArray token); 00070 00071 /** Get which user will be used to run Tor. */ 00072 QString getUser(); 00073 /** Set which user will be used to run Tor. */ 00074 void setUser(QString user); 00075 00076 /** Get which group will be used to run Tor. */ 00077 QString getGroup(); 00078 /** Set which group will be used to run Tor. */ 00079 void setGroup(QString group); 00080 00081 /** Get whether Tor is used as an NT service or not */ 00082 bool getUseService(); 00083 /** Set whether Tor is used as an NT service */ 00084 void setUseService(bool useService); 00085 00086 private: 00087 /** Formats the argument name <b>name</b> with the given value <b>value</b>. 00088 * If <b>value</b> contains a space, <b>value</b> will be wrapped in quotes. */ 00089 QString formatArgument(QString name, QString value); 00090 }; 00091 00092 #endif 00093