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 <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
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
00058
static CupsdConf *unique_;
00059
00060
00061
QString servername_;
00062
QString serveradmin_;
00063
QString user_;
00064
QString group_;
00065
QString remroot_;
00066
00067
00068
QString accesslog_;
00069
QString errorlog_;
00070
QString pagelog_;
00071
int loglevel_;
00072
int maxlogsize_;
00073
00074
00075
QString datadir_;
00076
QString requestroot_;
00077
QString serverbin_;
00078
QString serverroot_;
00079
QString tempdir_;
00080
QString fontpath_;
00081
00082
00083
QString documentroot_;
00084
QString defaultcharset_;
00085
QString defaultlanguage_;
00086
00087
00088
int preservejobhistory_;
00089
int preservejobfiles_;
00090
int autopurgejobs_;
00091
int maxjobs_;
00092
int filterlimit_;
00093
QString classification_;
00094
int classifyoverride_;
00095
00096
00097
QString printcap_;
00098
QString ripcache_;
00099
00100
00101
QValueList<int> port_;
00102
int hostnamelookups_;
00103
int keepalive_;
00104
int keepalivetimeout_;
00105
int maxclients_;
00106
int maxrequestsize_;
00107
int timeout_;
00108
00109
00110
int browsing_;
00111
int browseprotocols_;
00112
int browseshortnames_;
00113
int implicitclasses_;
00114
int hideimplicitmembers_;
00115
int implicitanyclasses_;
00116
00117
00118
QStringList browseaddress_;
00119
int browseport_;
00120
QStringList browserelay_;
00121
QStringList browsepoll_;
00122
00123
00124
QStringList browseallow_;
00125
QStringList browsedeny_;
00126
int browseorder_;
00127
00128
00129
int browseinterval_;
00130
int browsetimeout_;
00131
00132
00133
QString systemgroup_;
00134
QPtrList<CupsLocation> locations_;
00135
QPtrList<CupsResource> resources_;
00136
00137
00138
QString servercertificate_;
00139
QString serverkey_;
00140
00141
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