tdeprint
cupsdconf.h
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 <tqstring.h>
00024 #include <tqstringlist.h>
00025 #include <tqptrlist.h>
00026 #include <tqtextstream.h>
00027 #include <tqpair.h>
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 struct CupsdConf
00048 {
00049
00050 CupsdConf();
00051 ~CupsdConf();
00052
00053 bool loadFromFile(const TQString& filename);
00054 bool saveToFile(const TQString& filename);
00055 bool parseOption(const TQString& line);
00056 bool parseLocation(CupsLocation *location, TQTextStream& file);
00057
00058 bool loadAvailableResources();
00059
00060 static CupsdConf* get();
00061 static void release();
00062
00063
00064 static CupsdConf *unique_;
00065
00066
00067 TQString servername_;
00068 TQString serveradmin_;
00069 int classification_;
00070 TQString otherclassname_;
00071 bool classoverride_;
00072 TQString charset_;
00073 TQString language_;
00074 TQString printcap_;
00075 int printcapformat_;
00076
00077
00078 TQString remoteroot_;
00079 TQString systemgroup_;
00080 TQString encryptcert_;
00081 TQString encryptkey_;
00082 TQPtrList<CupsLocation> locations_;
00083 TQPtrList<CupsResource> resources_;
00084
00085
00086 int hostnamelookup_;
00087 bool keepalive_;
00088 int keepalivetimeout_;
00089 int maxclients_;
00090 TQString maxrequestsize_;
00091 int clienttimeout_;
00092 TQStringList listenaddresses_;
00093
00094
00095 TQString accesslog_;
00096 TQString errorlog_;
00097 TQString pagelog_;
00098 TQString maxlogsize_;
00099 int loglevel_;
00100
00101
00102 bool keepjobhistory_;
00103 bool keepjobfiles_;
00104 bool autopurgejobs_;
00105 int maxjobs_;
00106 int maxjobsperprinter_;
00107 int maxjobsperuser_;
00108
00109
00110 TQString user_;
00111 TQString group_;
00112 TQString ripcache_;
00113 int filterlimit_;
00114
00115
00116 TQString datadir_;
00117 TQString documentdir_;
00118 TQStringList fontpath_;
00119 TQString requestdir_;
00120 TQString serverbin_;
00121 TQString serverfiles_;
00122 TQString tmpfiles_;
00123
00124
00125 bool browsing_;
00126 TQStringList browseprotocols_;
00127 int browseport_;
00128 int browseinterval_;
00129 int browsetimeout_;
00130 TQStringList browseaddresses_;
00131 int browseorder_;
00132 bool useimplicitclasses_;
00133 bool hideimplicitmembers_;
00134 bool useshortnames_;
00135 bool useanyclasses_;
00136
00137
00138 CupsdComment comments_;
00139
00140
00141 TQValueList< TQPair<TQString,TQString> > unknown_;
00142 };
00143
00144 struct CupsLocation
00145 {
00146 CupsLocation();
00147 CupsLocation(const CupsLocation& loc);
00148
00149 bool parseOption(const TQString& line);
00150 bool parseResource(const TQString& line);
00151
00152 CupsResource *resource_;
00153 TQString resourcename_;
00154 int authtype_;
00155 int authclass_;
00156 TQString authname_;
00157 int encryption_;
00158 int satisfy_;
00159 int order_;
00160 TQStringList addresses_;
00161 };
00162
00163 struct CupsResource
00164 {
00165 CupsResource();
00166 CupsResource(const TQString& path);
00167
00168 void setPath(const TQString& path);
00169
00170 int type_;
00171 TQString path_;
00172 TQString text_;
00173
00174 static TQString textToPath(const TQString& text);
00175 static TQString pathToText(const TQString& path);
00176 static int typeFromPath(const TQString& path);
00177 static int typeFromText(const TQString& text);
00178 static TQString typeToIconName(int type);
00179 };
00180
00181 #endif