2002-11-03 17:26:12 +01:00
|
|
|
/*
|
2003-09-26 16:13:15 +02:00
|
|
|
* The contents of this file are subject to the Initial
|
|
|
|
* Developer's Public License Version 1.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
|
|
|
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
|
2002-11-03 17:26:12 +01:00
|
|
|
*
|
2003-09-26 16:13:15 +02:00
|
|
|
* Software distributed under the License is distributed AS IS,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing rights
|
|
|
|
* and limitations under the License.
|
2002-11-03 17:26:12 +01:00
|
|
|
*
|
2003-09-26 16:13:15 +02:00
|
|
|
* The Original Code was created by Dmitry Yemanov
|
|
|
|
* for the Firebird Open Source RDBMS project.
|
2002-11-03 17:26:12 +01:00
|
|
|
*
|
2003-09-26 16:13:15 +02:00
|
|
|
* Copyright (c) 2002 Dmitry Yemanov <dimitr@users.sf.net>
|
|
|
|
* and all contributors signed below.
|
2002-11-03 17:26:12 +01:00
|
|
|
*
|
2003-09-26 16:13:15 +02:00
|
|
|
* All Rights Reserved.
|
|
|
|
* Contributor(s): ______________________________________.
|
2002-11-03 17:26:12 +01:00
|
|
|
*/
|
|
|
|
|
2004-03-18 06:56:06 +01:00
|
|
|
#ifndef COMMON_CONFIG_H
|
|
|
|
#define COMMON_CONFIG_H
|
2002-11-03 17:26:12 +01:00
|
|
|
|
2004-12-17 06:41:47 +01:00
|
|
|
#include "../common/classes/fb_string.h"
|
2004-03-14 14:14:58 +01:00
|
|
|
#include "../jrd/os/path_utils.h"
|
2002-11-03 17:26:12 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
Since the original (isc.cpp) code wasn't able to provide powerful and
|
|
|
|
easy-to-use abilities to work with complex configurations, a decision
|
|
|
|
has been made to create a completely new one.
|
|
|
|
|
|
|
|
This class is a public interface for our generic configuration manager
|
|
|
|
and allows to access all configuration values by its getXXX() member
|
|
|
|
functions. Each of these functions corresponds to one and only one key
|
|
|
|
and has one input argument - default value, which is used when the
|
|
|
|
requested key is missing or the configuration file is not found. Supported
|
2002-11-30 16:08:09 +01:00
|
|
|
value datatypes are "const char*", "int" and "bool". Usual default values for
|
2002-11-03 17:26:12 +01:00
|
|
|
these datatypes are empty string, zero and false respectively. There are
|
|
|
|
two types of member functions - scalar and vector. The former ones return
|
|
|
|
single value of the given type. The latter ones return vector which
|
|
|
|
contains an ordered array of values.
|
|
|
|
|
|
|
|
There's one exception - getRootDirectory() member function, which returns
|
|
|
|
root pathname of the current installation. This value isn't stored in the
|
2002-11-30 16:08:09 +01:00
|
|
|
configuration file, but is managed by the code itself. But there's a way
|
|
|
|
to override this value via the configuration file as well.
|
2002-11-03 17:26:12 +01:00
|
|
|
|
|
|
|
To add new configuration item, you have to take the following steps:
|
|
|
|
|
2002-11-30 16:08:09 +01:00
|
|
|
1. Add key description to ConfigImpl::entries[] array (config.cpp)
|
|
|
|
2. Add logical key to Config::ConfigKey enumeration (config.h)
|
2002-11-03 17:26:12 +01:00
|
|
|
(note: both physical and logical keys MUST have the same ordinal
|
|
|
|
position within appropriate structures)
|
|
|
|
3. Add member function to Config class (config.h) and implement it
|
|
|
|
in config.cpp module.
|
|
|
|
**/
|
|
|
|
|
2004-11-09 13:59:37 +01:00
|
|
|
extern const char* GCPolicyCooperative;
|
|
|
|
extern const char* GCPolicyBackground;
|
|
|
|
extern const char* GCPolicyCombined;
|
|
|
|
extern const char* GCPolicyDefault;
|
|
|
|
|
2006-12-17 15:02:23 +01:00
|
|
|
extern const char* AmNative;
|
|
|
|
extern const char* AmTrusted;
|
|
|
|
extern const char* AmMixed;
|
|
|
|
|
|
|
|
enum AmCache {AM_UNKNOWN, AM_DISABLED, AM_ENABLED};
|
|
|
|
|
2002-11-03 17:26:12 +01:00
|
|
|
class Config
|
|
|
|
{
|
2002-11-30 16:08:09 +01:00
|
|
|
enum ConfigKey
|
|
|
|
{
|
|
|
|
KEY_ROOT_DIRECTORY, // 0
|
2006-05-31 10:53:00 +02:00
|
|
|
KEY_TEMP_BLOCK_SIZE, // 1
|
|
|
|
KEY_TEMP_CACHE_LIMIT, // 2
|
2002-11-30 16:08:09 +01:00
|
|
|
KEY_REMOTE_FILE_OPEN_ABILITY, // 3
|
|
|
|
KEY_GUARDIAN_OPTION, // 4
|
2002-12-03 14:37:06 +01:00
|
|
|
KEY_CPU_AFFINITY_MASK, // 5
|
2002-12-06 13:34:43 +01:00
|
|
|
KEY_OLD_PARAMETER_ORDERING, // 6
|
|
|
|
KEY_TCP_REMOTE_BUFFER_SIZE, // 7
|
2002-12-06 22:12:59 +01:00
|
|
|
KEY_TCP_NO_NAGLE, // 8
|
2005-01-16 13:35:27 +01:00
|
|
|
KEY_DEFAULT_DB_CACHE_PAGES, // 9
|
|
|
|
KEY_CONNECTION_TIMEOUT, // 10
|
|
|
|
KEY_DUMMY_PACKET_INTERVAL, // 11
|
|
|
|
KEY_LOCK_MEM_SIZE, // 12
|
|
|
|
KEY_LOCK_SEM_COUNT, // 13
|
|
|
|
KEY_LOCK_SIGNAL, // 14
|
|
|
|
KEY_LOCK_GRANT_ORDER, // 15
|
|
|
|
KEY_LOCK_HASH_SLOTS, // 16
|
|
|
|
KEY_LOCK_ACQUIRE_SPINS, // 17
|
|
|
|
KEY_EVENT_MEM_SIZE, // 18
|
|
|
|
KEY_DEADLOCK_TIMEOUT, // 19
|
|
|
|
KEY_SOLARIS_STALL_VALUE, // 20
|
|
|
|
KEY_TRACE_MEMORY_POOLS, // 21
|
|
|
|
KEY_PRIORITY_SWITCH_DELAY, // 22
|
|
|
|
KEY_USE_PRIORITY_SCHEDULER, // 23
|
|
|
|
KEY_PRIORITY_BOOST, // 24
|
|
|
|
KEY_REMOTE_SERVICE_NAME, // 25
|
|
|
|
KEY_REMOTE_SERVICE_PORT, // 26
|
|
|
|
KEY_REMOTE_PIPE_NAME, // 27
|
|
|
|
KEY_IPC_NAME, // 28
|
|
|
|
KEY_MAX_UNFLUSHED_WRITES, // 29
|
|
|
|
KEY_MAX_UNFLUSHED_WRITE_TIME, // 30
|
|
|
|
KEY_PROCESS_PRIORITY_LEVEL, // 31
|
|
|
|
KEY_CREATE_INTERNAL_WINDOW, // 32
|
|
|
|
KEY_COMPLETE_BOOLEAN_EVALUATION, // 33
|
|
|
|
KEY_REMOTE_AUX_PORT, // 34
|
|
|
|
KEY_REMOTE_BIND_ADDRESS, // 35
|
|
|
|
KEY_EXTERNAL_FILE_ACCESS, // 36
|
|
|
|
KEY_DATABASE_ACCESS, // 37
|
|
|
|
KEY_UDF_ACCESS, // 38
|
|
|
|
KEY_TEMP_DIRECTORIES, // 39
|
|
|
|
KEY_BUGCHECK_ABORT, // 40
|
|
|
|
KEY_TRACE_DSQL, // 41
|
|
|
|
KEY_LEGACY_HASH, // 42
|
2005-12-21 11:10:37 +01:00
|
|
|
KEY_GC_POLICY, // 43
|
2006-12-10 13:31:15 +01:00
|
|
|
KEY_REDIRECTION, // 44
|
|
|
|
KEY_OLD_COLUMN_NAMING, // 45
|
|
|
|
KEY_AUTH_METHOD // 46
|
2002-11-30 16:08:09 +01:00
|
|
|
};
|
2002-11-03 17:26:12 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2007-04-05 14:47:20 +02:00
|
|
|
/*
|
|
|
|
Interface to support command line root specification.
|
|
|
|
*
|
|
|
|
This ugly solution was required to make it possible to specify root
|
|
|
|
in command line to load firebird.conf from that root, though in other
|
|
|
|
cases firebird.conf may be also used to specify root.
|
|
|
|
*/
|
|
|
|
static void setRootDirectoryFromCommandLine(const Firebird::PathName& newRoot);
|
|
|
|
static const Firebird::PathName* getCommandLineRootDirectory();
|
|
|
|
|
2005-05-28 00:45:31 +02:00
|
|
|
/*
|
|
|
|
Installation directory
|
|
|
|
*/
|
|
|
|
static const char* getInstallDirectory();
|
|
|
|
|
2002-11-03 17:26:12 +01:00
|
|
|
/*
|
|
|
|
Root directory of current installation
|
|
|
|
*/
|
2002-11-30 16:08:09 +01:00
|
|
|
static const char* getRootDirectory();
|
2002-11-03 17:26:12 +01:00
|
|
|
|
|
|
|
/*
|
2006-05-31 10:53:00 +02:00
|
|
|
Allocation chunk for the temporary spaces
|
2002-11-03 17:26:12 +01:00
|
|
|
*/
|
2006-05-31 10:53:00 +02:00
|
|
|
static int getTempBlockSize();
|
2002-11-03 17:26:12 +01:00
|
|
|
|
|
|
|
/*
|
2006-05-31 10:53:00 +02:00
|
|
|
Caching limit for the temporary data
|
2002-11-03 17:26:12 +01:00
|
|
|
*/
|
2006-05-31 10:53:00 +02:00
|
|
|
static int getTempCacheLimit();
|
2002-11-03 17:26:12 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Whether remote (NFS) files can be opened
|
|
|
|
*/
|
2002-11-30 16:08:09 +01:00
|
|
|
static bool getRemoteFileOpenAbility();
|
2002-11-03 17:26:12 +01:00
|
|
|
|
|
|
|
/*
|
2002-11-30 16:08:09 +01:00
|
|
|
Startup option for the guardian
|
2002-11-03 17:26:12 +01:00
|
|
|
*/
|
2002-11-30 16:08:09 +01:00
|
|
|
static int getGuardianOption();
|
2002-11-10 14:41:20 +01:00
|
|
|
|
|
|
|
/*
|
2002-11-30 16:08:09 +01:00
|
|
|
CPU affinity mask
|
2002-11-10 14:41:20 +01:00
|
|
|
*/
|
2002-11-30 16:08:09 +01:00
|
|
|
static int getCpuAffinityMask();
|
2002-12-03 14:37:06 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Old parameter ordering for backward compatibility with FB1/IB6.X
|
|
|
|
*/
|
|
|
|
static bool getOldParameterOrdering();
|
2002-12-06 13:34:43 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
XDR buffer size
|
|
|
|
*/
|
|
|
|
static int getTcpRemoteBufferSize();
|
|
|
|
|
|
|
|
/*
|
|
|
|
Disable Nagle algorithm
|
|
|
|
*/
|
|
|
|
static bool getTcpNoNagle();
|
2002-12-06 22:12:59 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Default database cache size
|
|
|
|
*/
|
|
|
|
static int getDefaultDbCachePages();
|
|
|
|
|
|
|
|
/*
|
|
|
|
Connection timeout
|
|
|
|
*/
|
|
|
|
static int getConnectionTimeout();
|
|
|
|
|
|
|
|
/*
|
|
|
|
Dummy packet interval
|
|
|
|
*/
|
|
|
|
static int getDummyPacketInterval();
|
2002-12-07 14:27:12 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Lock manager memory size
|
|
|
|
*/
|
|
|
|
static int getLockMemSize();
|
|
|
|
|
|
|
|
/*
|
|
|
|
Lock manager semaphore count
|
|
|
|
*/
|
|
|
|
static int getLockSemCount();
|
|
|
|
|
|
|
|
/*
|
|
|
|
Lock manager signal number
|
|
|
|
*/
|
|
|
|
static int getLockSignal();
|
|
|
|
|
|
|
|
/*
|
|
|
|
Lock manager grant order
|
|
|
|
*/
|
|
|
|
static bool getLockGrantOrder();
|
|
|
|
|
|
|
|
/*
|
|
|
|
Lock manager hash slots
|
|
|
|
*/
|
|
|
|
static int getLockHashSlots();
|
|
|
|
|
|
|
|
/*
|
|
|
|
Lock manager acquire spins
|
|
|
|
*/
|
2003-06-19 20:13:26 +02:00
|
|
|
static int getLockAcquireSpins();
|
2002-12-07 14:27:12 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Event manager memory size
|
|
|
|
*/
|
|
|
|
static int getEventMemSize();
|
|
|
|
|
|
|
|
/*
|
|
|
|
Deadlock timeout
|
|
|
|
*/
|
|
|
|
static int getDeadlockTimeout();
|
|
|
|
|
|
|
|
/*
|
|
|
|
Solaris stall value
|
|
|
|
*/
|
|
|
|
static int getSolarisStallValue();
|
2002-12-07 14:49:37 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Trace memory pools
|
|
|
|
*/
|
|
|
|
static bool getTraceMemoryPools();
|
2003-01-12 16:33:00 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Priority switch delay
|
|
|
|
*/
|
|
|
|
static int getPrioritySwitchDelay();
|
|
|
|
|
2004-09-02 11:00:48 +02:00
|
|
|
/*
|
|
|
|
Use priority scheduler
|
|
|
|
*/
|
|
|
|
static bool getUsePriorityScheduler();
|
|
|
|
|
2003-01-12 16:33:00 +01:00
|
|
|
/*
|
|
|
|
Priority boost
|
|
|
|
*/
|
|
|
|
static int getPriorityBoost();
|
2003-01-15 15:10:07 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Service name for remote protocols
|
|
|
|
*/
|
|
|
|
static const char *getRemoteServiceName();
|
|
|
|
|
|
|
|
/*
|
|
|
|
Service port for INET
|
|
|
|
*/
|
2004-01-13 14:38:36 +01:00
|
|
|
static unsigned short getRemoteServicePort();
|
2003-01-15 15:10:07 +01:00
|
|
|
|
|
|
|
/*
|
2003-02-02 16:20:02 +01:00
|
|
|
Pipe name for WNET
|
2003-01-15 15:10:07 +01:00
|
|
|
*/
|
2003-02-02 16:20:02 +01:00
|
|
|
static const char *getRemotePipeName();
|
2003-01-15 15:10:07 +01:00
|
|
|
|
|
|
|
/*
|
2003-02-02 16:20:02 +01:00
|
|
|
Name for IPC-related objects
|
2003-01-15 15:10:07 +01:00
|
|
|
*/
|
2003-02-02 16:20:02 +01:00
|
|
|
static const char *getIpcName();
|
2003-02-05 15:32:21 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Unflushed writes number
|
|
|
|
*/
|
|
|
|
static int getMaxUnflushedWrites();
|
|
|
|
|
|
|
|
/*
|
|
|
|
Unflushed write time
|
|
|
|
*/
|
|
|
|
static int getMaxUnflushedWriteTime();
|
2003-02-16 19:58:56 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Process priority level
|
|
|
|
*/
|
|
|
|
static int getProcessPriorityLevel();
|
|
|
|
|
|
|
|
/*
|
|
|
|
Create window for IPC stuff
|
|
|
|
*/
|
|
|
|
static bool getCreateInternalWindow();
|
2003-02-21 10:17:03 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Complete boolean evaluation
|
|
|
|
*/
|
|
|
|
static bool getCompleteBooleanEvaluation();
|
2003-03-11 15:57:08 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Port for event processing
|
|
|
|
*/
|
|
|
|
static int getRemoteAuxPort();
|
|
|
|
|
|
|
|
/*
|
|
|
|
Server binding NIC address
|
|
|
|
*/
|
|
|
|
static const char *getRemoteBindAddress();
|
2003-03-15 21:02:39 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Directory list for external tables
|
|
|
|
*/
|
2003-04-06 17:01:30 +02:00
|
|
|
static const char *getExternalFileAccess();
|
2003-03-31 19:41:18 +02:00
|
|
|
|
|
|
|
/*
|
2003-05-01 13:35:15 +02:00
|
|
|
Directory list for databases
|
2003-03-31 19:41:18 +02:00
|
|
|
*/
|
2003-04-06 17:01:30 +02:00
|
|
|
static const char *getDatabaseAccess();
|
2003-05-01 13:35:15 +02:00
|
|
|
|
2003-04-12 18:34:26 +02:00
|
|
|
/*
|
2003-05-01 13:35:15 +02:00
|
|
|
Directory list for UDF libraries
|
2003-04-12 18:34:26 +02:00
|
|
|
*/
|
|
|
|
static const char *getUdfAccess();
|
2003-05-01 13:35:15 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
Temporary directories list
|
|
|
|
*/
|
|
|
|
static const char *getTempDirectories();
|
2003-09-28 23:36:05 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
DSQL trace bitmask
|
|
|
|
*/
|
|
|
|
static int getTraceDSQL();
|
2004-04-06 09:25:45 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
Abort on BUGCHECK and structured exceptions
|
|
|
|
*/
|
|
|
|
static bool getBugcheckAbort();
|
2004-11-07 15:12:15 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Let use of des hash to verify passwords
|
|
|
|
*/
|
|
|
|
static bool getLegacyHash();
|
2004-11-09 13:59:37 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
GC policy
|
|
|
|
*/
|
|
|
|
static const char *getGCPolicy();
|
2005-12-21 11:10:37 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Redirection
|
|
|
|
*/
|
|
|
|
static bool getRedirection();
|
2006-01-17 05:40:31 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Use old column naming rules (does not conform to SQL standard)
|
|
|
|
*/
|
|
|
|
static bool getOldColumnNaming();
|
|
|
|
|
2006-12-10 13:31:15 +01:00
|
|
|
/*
|
2006-12-17 15:02:23 +01:00
|
|
|
Use native, trusted or mixed authentication
|
2006-12-10 13:31:15 +01:00
|
|
|
*/
|
2006-12-17 15:02:23 +01:00
|
|
|
static const char *getAuthMethod();
|
2006-12-10 13:31:15 +01:00
|
|
|
|
2002-11-03 17:26:12 +01:00
|
|
|
};
|
|
|
|
|
2004-03-14 14:14:58 +01:00
|
|
|
namespace Firebird {
|
|
|
|
|
|
|
|
// Add appropriate file prefix.
|
|
|
|
inline void Prefix(PathName& result, const PathName& file)
|
|
|
|
{
|
|
|
|
PathUtils::concatPath(result, Config::getRootDirectory(), file);
|
|
|
|
}
|
|
|
|
|
|
|
|
} //namespace Firebird
|
|
|
|
|
2004-03-18 06:56:06 +01:00
|
|
|
#endif // COMMON_CONFIG_H
|