You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
182 lines
4.6 KiB
182 lines
4.6 KiB
15 years ago
|
/*
|
||
|
* This file is part of the KDE libraries
|
||
13 years ago
|
* Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
|
||
15 years ago
|
*
|
||
|
* This library is free software; you can redistribute it and/or
|
||
|
* modify it under the terms of the GNU Library General Public
|
||
|
* License version 2 as published by the Free Software Foundation.
|
||
|
*
|
||
|
* This library is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
* Library General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Library General Public License
|
||
|
* along with this library; see the file COPYING.LIB. If not, write to
|
||
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
* Boston, MA 02110-1301, USA.
|
||
|
**/
|
||
|
|
||
|
#ifndef CUPSDCONF_H
|
||
|
#define CUPSDCONF_H
|
||
|
|
||
15 years ago
|
#include <tqstring.h>
|
||
|
#include <tqstringlist.h>
|
||
|
#include <tqptrlist.h>
|
||
|
#include <tqtextstream.h>
|
||
|
#include <tqpair.h>
|
||
15 years ago
|
|
||
|
#include "cupsdcomment.h"
|
||
|
|
||
|
enum LogLevelType { LOGLEVEL_DEBUG2 = 0, LOGLEVEL_DEBUG, LOGLEVEL_INFO, LOGLEVEL_WARN, LOGLEVEL_ERROR, LOGLEVEL_NONE };
|
||
|
enum OrderType { ORDER_ALLOW_DENY = 0, ORDER_DENY_ALLOW };
|
||
|
enum AuthTypeType { AUTHTYPE_NONE = 0, AUTHTYPE_BASIC, AUTHTYPE_DIGEST };
|
||
|
enum AuthClassType { AUTHCLASS_ANONYMOUS = 0, AUTHCLASS_USER, AUTHCLASS_SYSTEM, AUTHCLASS_GROUP };
|
||
|
enum EncryptionType { ENCRYPT_ALWAYS = 0, ENCRYPT_NEVER, ENCRYPT_REQUIRED, ENCRYPT_IFREQUESTED };
|
||
|
enum BrowseProtocolType { BROWSE_ALL = 0, BROWSE_CUPS, BROWSE_SLP };
|
||
|
enum PrintcapFormatType { PRINTCAP_BSD = 0, PRINTCAP_SOLARIS };
|
||
|
enum HostnameLookupType { HOSTNAME_OFF = 0, HOSTNAME_ON, HOSTNAME_DOUBLE };
|
||
|
enum ClassificationType { CLASS_NONE = 0, CLASS_CLASSIFIED, CLASS_CONFIDENTIAL, CLASS_SECRET, CLASS_TOPSECRET, CLASS_UNCLASSIFIED, CLASS_OTHER };
|
||
|
enum SatisfyType { SATISFY_ALL = 0, SATISFY_ANY };
|
||
|
enum UnitType { UNIT_KB = 0, UNIT_MB, UNIT_GB, UNIT_TILE };
|
||
|
|
||
|
struct CupsLocation;
|
||
|
struct CupsResource;
|
||
|
enum ResourceType { RESOURCE_GLOBAL, RESOURCE_PRINTER, RESOURCE_CLASS, RESOURCE_ADMIN };
|
||
|
|
||
|
struct CupsdConf
|
||
|
{
|
||
|
// functions member
|
||
|
CupsdConf();
|
||
|
~CupsdConf();
|
||
|
|
||
15 years ago
|
bool loadFromFile(const TQString& filename);
|
||
|
bool saveToFile(const TQString& filename);
|
||
|
bool parseOption(const TQString& line);
|
||
|
bool parseLocation(CupsLocation *location, TQTextStream& file);
|
||
15 years ago
|
|
||
|
bool loadAvailableResources();
|
||
|
|
||
|
static CupsdConf* get();
|
||
|
static void release();
|
||
|
|
||
|
// data members
|
||
|
static CupsdConf *unique_;
|
||
|
|
||
|
// Server
|
||
14 years ago
|
TQString servername_;
|
||
|
TQString serveradmin_;
|
||
15 years ago
|
int classification_;
|
||
15 years ago
|
TQString otherclassname_;
|
||
15 years ago
|
bool classoverride_;
|
||
15 years ago
|
TQString charset_;
|
||
|
TQString language_;
|
||
|
TQString printcap_;
|
||
15 years ago
|
int printcapformat_;
|
||
|
|
||
|
// Security
|
||
15 years ago
|
TQString remoteroot_;
|
||
|
TQString systemgroup_;
|
||
|
TQString encryptcert_;
|
||
|
TQString encryptkey_;
|
||
|
TQPtrList<CupsLocation> locations_;
|
||
|
TQPtrList<CupsResource> resources_;
|
||
15 years ago
|
|
||
|
// Network
|
||
|
int hostnamelookup_;
|
||
|
bool keepalive_;
|
||
|
int keepalivetimeout_;
|
||
|
int maxclients_;
|
||
15 years ago
|
TQString maxrequestsize_;
|
||
15 years ago
|
int clienttimeout_;
|
||
15 years ago
|
TQStringList listenaddresses_;
|
||
15 years ago
|
|
||
|
// Log
|
||
15 years ago
|
TQString accesslog_;
|
||
|
TQString errorlog_;
|
||
|
TQString pagelog_;
|
||
|
TQString maxlogsize_;
|
||
15 years ago
|
int loglevel_;
|
||
|
|
||
|
// Jobs
|
||
|
bool keepjobhistory_;
|
||
|
bool keepjobfiles_;
|
||
|
bool autopurgejobs_;
|
||
|
int maxjobs_;
|
||
|
int maxjobsperprinter_;
|
||
|
int maxjobsperuser_;
|
||
|
|
||
|
// Filter
|
||
15 years ago
|
TQString user_;
|
||
|
TQString group_;
|
||
|
TQString ripcache_;
|
||
15 years ago
|
int filterlimit_;
|
||
|
|
||
|
// Directories
|
||
15 years ago
|
TQString datadir_;
|
||
|
TQString documentdir_;
|
||
|
TQStringList fontpath_;
|
||
|
TQString requestdir_;
|
||
|
TQString serverbin_;
|
||
|
TQString serverfiles_;
|
||
|
TQString tmpfiles_;
|
||
15 years ago
|
|
||
|
// Browsing
|
||
|
bool browsing_;
|
||
15 years ago
|
TQStringList browseprotocols_;
|
||
15 years ago
|
int browseport_;
|
||
|
int browseinterval_;
|
||
|
int browsetimeout_;
|
||
15 years ago
|
TQStringList browseaddresses_;
|
||
15 years ago
|
int browseorder_;
|
||
|
bool useimplicitclasses_;
|
||
|
bool hideimplicitmembers_;
|
||
|
bool useshortnames_;
|
||
|
bool useanyclasses_;
|
||
|
|
||
|
// cupsd.conf file comments
|
||
|
CupsdComment comments_;
|
||
|
|
||
|
// unrecognized options
|
||
14 years ago
|
TQValueList< TQPair<TQString,TQString> > unknown_;
|
||
15 years ago
|
};
|
||
|
|
||
|
struct CupsLocation
|
||
|
{
|
||
|
CupsLocation();
|
||
|
CupsLocation(const CupsLocation& loc);
|
||
|
|
||
15 years ago
|
bool parseOption(const TQString& line);
|
||
|
bool parseResource(const TQString& line);
|
||
15 years ago
|
|
||
|
CupsResource *resource_;
|
||
14 years ago
|
TQString resourcename_;
|
||
15 years ago
|
int authtype_;
|
||
|
int authclass_;
|
||
14 years ago
|
TQString authname_;
|
||
15 years ago
|
int encryption_;
|
||
|
int satisfy_;
|
||
|
int order_;
|
||
14 years ago
|
TQStringList addresses_;
|
||
15 years ago
|
};
|
||
|
|
||
|
struct CupsResource
|
||
|
{
|
||
|
CupsResource();
|
||
15 years ago
|
CupsResource(const TQString& path);
|
||
15 years ago
|
|
||
15 years ago
|
void setPath(const TQString& path);
|
||
15 years ago
|
|
||
|
int type_;
|
||
14 years ago
|
TQString path_;
|
||
|
TQString text_;
|
||
15 years ago
|
|
||
15 years ago
|
static TQString textToPath(const TQString& text);
|
||
|
static TQString pathToText(const TQString& path);
|
||
|
static int typeFromPath(const TQString& path);
|
||
|
static int typeFromText(const TQString& text);
|
||
|
static TQString typeToIconName(int type);
|
||
15 years ago
|
};
|
||
|
|
||
|
#endif
|