KDEPrint
cupsdconf.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef CUPSDCONF_H
00021 #define CUPSDCONF_H
00022
00023 #include <QtCore/QString>
00024 #include <QtCore/QStringList>
00025 #include <QtCore/QTextStream>
00026 #include <QtCore/QPair>
00027 #include <QtCore/QList>
00028
00029 #include "cupsdcomment.h"
00030
00031 enum LogLevelType { LOGLEVEL_DEBUG2 = 0, LOGLEVEL_DEBUG, LOGLEVEL_INFO, LOGLEVEL_WARN, LOGLEVEL_ERROR, LOGLEVEL_NONE };
00032 enum OrderType { ORDER_ALLOW_DENY = 0, ORDER_DENY_ALLOW };
00033 enum AuthTypeType { AUTHTYPE_NONE = 0, AUTHTYPE_BASIC, AUTHTYPE_DIGEST };
00034 enum AuthClassType { AUTHCLASS_ANONYMOUS = 0, AUTHCLASS_USER, AUTHCLASS_SYSTEM, AUTHCLASS_GROUP };
00035 enum EncryptionType { ENCRYPT_ALWAYS = 0, ENCRYPT_NEVER, ENCRYPT_REQUIRED, ENCRYPT_IFREQUESTED };
00036 enum BrowseProtocolType { BROWSE_ALL = 0, BROWSE_CUPS, BROWSE_SLP };
00037 enum PrintcapFormatType { PRINTCAP_BSD = 0, PRINTCAP_SOLARIS };
00038 enum HostnameLookupType { HOSTNAME_OFF = 0, HOSTNAME_ON, HOSTNAME_DOUBLE };
00039 enum ClassificationType { CLASS_NONE = 0, CLASS_CLASSIFIED, CLASS_CONFIDENTIAL, CLASS_SECRET, CLASS_TOPSECRET, CLASS_UNCLASSIFIED, CLASS_OTHER };
00040 enum SatisfyType { SATISFY_ALL = 0, SATISFY_ANY };
00041 enum UnitType { UNIT_KB = 0, UNIT_MB, UNIT_GB, UNIT_TILE };
00042
00043 struct CupsLocation;
00044 struct CupsResource;
00045 enum ResourceType { RESOURCE_GLOBAL, RESOURCE_PRINTER, RESOURCE_CLASS, RESOURCE_ADMIN };
00046
00047 #ifdef __GNUC__
00048 #warning rename struct or remove from global namespace
00049 #endif
00050 struct CupsdConf {
00051
00052 CupsdConf();
00053 ~CupsdConf();
00054
00055 bool loadFromFile(const QString& filename);
00056 bool saveToFile(const QString& filename);
00057 bool parseOption(const QString& line);
00058 bool parseLocation(CupsLocation *location, QTextStream& file);
00059
00060 bool loadAvailableResources();
00061
00062 static CupsdConf* get();
00063 static void release();
00064
00065
00066 static CupsdConf *unique_;
00067
00068
00069 QString servername_;
00070 QString serveradmin_;
00071 int classification_;
00072 QString otherclassname_;
00073 bool classoverride_;
00074 QString charset_;
00075 QString language_;
00076 QString printcap_;
00077 int printcapformat_;
00078
00079
00080 QString remoteroot_;
00081 QString systemgroup_;
00082 QString encryptcert_;
00083 QString encryptkey_;
00084 QList<CupsLocation*> locations_;
00085 QList<CupsResource*> resources_;
00086
00087
00088 int hostnamelookup_;
00089 bool keepalive_;
00090 int keepalivetimeout_;
00091 int maxclients_;
00092 QString maxrequestsize_;
00093 int clienttimeout_;
00094 QStringList listenaddresses_;
00095
00096
00097 QString accesslog_;
00098 QString errorlog_;
00099 QString pagelog_;
00100 QString maxlogsize_;
00101 int loglevel_;
00102
00103
00104 bool keepjobhistory_;
00105 bool keepjobfiles_;
00106 bool autopurgejobs_;
00107 int maxjobs_;
00108 int maxjobsperprinter_;
00109 int maxjobsperuser_;
00110
00111
00112 QString user_;
00113 QString group_;
00114 QString ripcache_;
00115 int filterlimit_;
00116
00117
00118 QString datadir_;
00119 QString documentdir_;
00120 QStringList fontpath_;
00121 QString requestdir_;
00122 QString serverbin_;
00123 QString serverfiles_;
00124 QString tmpfiles_;
00125
00126
00127 bool browsing_;
00128 QStringList browseprotocols_;
00129 int browseport_;
00130 int browseinterval_;
00131 int browsetimeout_;
00132 QStringList browseaddresses_;
00133 int browseorder_;
00134 bool useimplicitclasses_;
00135 bool hideimplicitmembers_;
00136 bool useshortnames_;
00137 bool useanyclasses_;
00138
00139
00140 CupsdComment comments_;
00141
00142
00143 QList< QPair<QString, QString> > unknown_;
00144 };
00145
00146 #ifdef __GNUC__
00147 #warning rename struct or remove from global namespace
00148 #endif
00149 struct CupsLocation {
00150 CupsLocation();
00151 CupsLocation(const CupsLocation& loc);
00152
00153 bool parseOption(const QString& line);
00154 bool parseResource(const QString& line);
00155
00156 CupsResource *resource_;
00157 QString resourcename_;
00158 int authtype_;
00159 int authclass_;
00160 QString authname_;
00161 int encryption_;
00162 int satisfy_;
00163 int order_;
00164 QStringList addresses_;
00165 };
00166
00167 #ifdef __GNUC__
00168 #warning rename struct or remove from global namespace
00169 #endif
00170 struct CupsResource {
00171 CupsResource();
00172 CupsResource(const QString& path);
00173
00174 void setPath(const QString& path);
00175
00176 int type_;
00177 QString path_;
00178 QString text_;
00179
00180 static QString textToPath(const QString& text);
00181 static QString pathToText(const QString& path);
00182 static int typeFromPath(const QString& path);
00183 static int typeFromText(const QString& text);
00184 static QString typeToIconName(int type);
00185 };
00186
00187 #endif