kdeprint Library API Documentation

cupsdconf.h

00001 /*
00002  *  This file is part of the KDE libraries
00003  *  Copyright (c) 2001 Michael Goffioul <kdeprint@swing.be>
00004  *
00005  *  This library is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU Library General Public
00007  *  License version 2 as published by the Free Software Foundation.
00008  *
00009  *  This library is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  *  Library General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU Library General Public License
00015  *  along with this library; see the file COPYING.LIB.  If not, write to
00016  *  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017  *  Boston, MA 02111-1307, USA.
00018  **/
00019 
00020 #ifndef CUPSDCONF_H
00021 #define CUPSDCONF_H
00022 
00023 #include <qstring.h>
00024 #include <qstringlist.h>
00025 #include <qptrlist.h>
00026 #include <qtextstream.h>
00027 
00028 #include "cupsdcomment.h"
00029 
00030 enum LogLevelType { LOGLEVEL_DEBUG2 = 0, LOGLEVEL_DEBUG, LOGLEVEL_INFO, LOGLEVEL_WARN, LOGLEVEL_ERROR, LOGLEVEL_NONE };
00031 enum OrderType { ORDER_ALLOW_DENY = 0, ORDER_DENY_ALLOW };
00032 enum AuthTypeType { AUTHTYPE_NONE = 0, AUTHTYPE_BASIC, AUTHTYPE_DIGEST };
00033 enum AuthClassType { AUTHCLASS_ANONYMOUS = 0, AUTHCLASS_USER, AUTHCLASS_SYSTEM, AUTHCLASS_GROUP };
00034 enum EncryptionType { ENCRYPT_ALWAYS = 0, ENCRYPT_NEVER, ENCRYPT_REQUIRED, ENCRYPT_IFREQUESTED };
00035 enum BrowseProtocolType { BROWSE_ALL = 0, BROWSE_CUPS, BROWSE_SLP };
00036 
00037 struct CupsLocation;
00038 struct CupsResource;
00039 enum ResourceType { RESOURCE_GLOBAL, RESOURCE_PRINTER, RESOURCE_CLASS, RESOURCE_ADMIN };
00040 
00041 struct CupsdConf
00042 {
00043 // functions member
00044     CupsdConf();
00045     ~CupsdConf();
00046 
00047     bool loadFromFile(const QString& filename);
00048     bool saveToFile(const QString& filename);
00049     bool parseOption(const QString& line);
00050     bool parseLocation(CupsLocation *location, QTextStream& file);
00051 
00052     bool loadAvailableResources();
00053 
00054     static CupsdConf* get();
00055     static void release();
00056 
00057 // data members
00058     static CupsdConf    *unique_;
00059 
00060     // Server/Identity
00061     QString servername_;
00062     QString serveradmin_;
00063     QString user_;
00064     QString group_;
00065     QString remroot_;
00066 
00067     // Server/Log
00068     QString accesslog_;
00069     QString errorlog_;
00070     QString pagelog_;
00071     int loglevel_;
00072     int maxlogsize_;
00073 
00074     // Server/Directories
00075     QString datadir_;
00076     QString requestroot_;
00077     QString serverbin_;
00078     QString serverroot_;
00079     QString tempdir_;
00080     QString fontpath_;
00081 
00082     // Server/HTTP
00083     QString documentroot_;
00084     QString defaultcharset_;
00085     QString defaultlanguage_;
00086 
00087     // Server/Jobs
00088     int preservejobhistory_;
00089     int preservejobfiles_;
00090     int autopurgejobs_;
00091     int maxjobs_;
00092     int filterlimit_;
00093     QString classification_;
00094     int classifyoverride_;
00095 
00096     // Server/Misc
00097     QString printcap_;
00098     QString ripcache_;
00099 
00100     // Network
00101     QValueList<int> port_;
00102     int hostnamelookups_;
00103     int keepalive_;
00104     int keepalivetimeout_;
00105     int maxclients_;
00106     int maxrequestsize_;
00107     int timeout_;
00108 
00109     // Browsing/General
00110     int browsing_;
00111     int browseprotocols_;
00112     int browseshortnames_;
00113     int implicitclasses_;
00114     int hideimplicitmembers_;
00115     int implicitanyclasses_;
00116 
00117     // Browsing/Connection
00118     QStringList browseaddress_;
00119     int browseport_;
00120     QStringList browserelay_;
00121     QStringList browsepoll_;
00122 
00123     // Browsing/Masks
00124     QStringList browseallow_;
00125     QStringList browsedeny_;
00126     int browseorder_;
00127 
00128     // Browsing/Timeouts
00129     int browseinterval_;
00130     int browsetimeout_;
00131 
00132     // Security
00133     QString systemgroup_;
00134     QPtrList<CupsLocation>  locations_;
00135     QPtrList<CupsResource>  resources_;
00136 
00137         // Encryption
00138         QString servercertificate_;
00139         QString serverkey_;
00140 
00141     // cupsd.conf file comments
00142     CupsdComment    comments_;
00143 };
00144 
00145 struct CupsLocation
00146 {
00147     CupsLocation();
00148     CupsLocation(const CupsLocation& loc);
00149 
00150     bool parseOption(const QString& line);
00151     bool parseResource(const QString& line);
00152 
00153     CupsResource    *resource_;
00154     QString resourcename_;
00155     int authtype_;
00156     int authclass_;
00157     QString authgroupname_;
00158     int order_;
00159     QStringList allow_;
00160     QStringList deny_;
00161         int encryption_;
00162 };
00163 
00164 struct CupsResource
00165 {
00166     CupsResource();
00167     CupsResource(const QString& path);
00168 
00169     void setPath(const QString& path);
00170 
00171     int type_;
00172     QString path_;
00173     QString text_;
00174 
00175     static QString textToPath(const QString& text);
00176     static QString pathToText(const QString& path);
00177     static int typeFromPath(const QString& path);
00178     static int typeFromText(const QString& text);
00179     static QString typeToIconName(int type);
00180 };
00181 
00182 #endif
KDE Logo
This file is part of the documentation for kdeprint Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Sep 30 05:20:48 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2003