1 /***************************************************************************
3 * Copyright (C) Lakshya Solutions Ltd. All rights reserved. *
5 ***************************************************************************/
26 //All the members of the configuration file
27 char logFile
[MAX_FILE_PATH_LEN
];
28 char dbFile
[MAX_FILE_PATH_LEN
];
29 char tableConfigFile
[MAX_FILE_PATH_LEN
];
30 char dsConfigFile
[MAX_FILE_PATH_LEN
];// DSN Config file
31 char stderrFile
[MAX_FILE_PATH_LEN
];
32 char conflResoFile
[MAX_FILE_PATH_LEN
];
59 char dsn
[IDENTIFIER_LENGTH
];
64 int nwResponseTimeout
;
75 strcpy(logFile
, "/tmp/log/log.out");
76 strcpy(dbFile
, "/tmp/csql/db");
77 strcpy(tableConfigFile
, "/tmp/csql/csqltable.conf");
78 strcpy(dsConfigFile
,"/tmp/csql/csqlds.conf"); // DSN Config file
79 strcpy(stderrFile
, "stderr");
80 strcpy(conflResoFile
, "/tmp/csql/ConflResoFile.txt");
84 isCsqlSqlServer
= false;
91 maxSysSize
= 10485760;
92 maxDbSize
= 104857600;
107 strcpy(dsn
,"myodbc3");
115 asyncMsgMax
= 8192; //default for linux
126 int readLine(FILE *fp
, char * buffer
);
127 int storeKeyVal(char *key
, char *val
);
128 int validateValues();
131 Config() { isLoaded
= false; }
132 int readAllValues(char *filename
);
135 inline int getPageSize() { return cVal
.pageSize
; }
136 inline int getMaxProcs() { return cVal
.maxProcs
; }
137 inline long getMaxSysDbSize() { return cVal
.maxSysSize
; }
138 inline long getMaxDbSize() { return cVal
.maxDbSize
; }
139 inline int getSysDbKey() { return cVal
.sysDbKey
; }
140 inline int getUserDbKey() { return cVal
.userDbKey
; }
141 inline bool useMmap() { return cVal
.mmap
; }
142 inline char* getLogFile() { return cVal
.logFile
; }
143 inline char* getDbFile() { return cVal
.dbFile
; }
144 inline long getMapAddress() { return cVal
.mapAddr
; }
145 inline int getMutexSecs() { return cVal
.mutexSecs
; }
146 inline int getMutexUSecs() { return cVal
.mutexUSecs
; }
147 inline int getMutexRetries() { return cVal
.mutexRetries
; }
148 inline int getLockSecs() { return cVal
.lockSecs
; }
149 inline int getLockUSecs() { return cVal
.lockUSecs
; }
150 inline int getLockRetries() { return cVal
.lockRetries
; }
151 inline int getSiteID(){ return cVal
.siteID
;}
152 inline bool useCache() { return cVal
.isCache
; }
153 inline int getCacheMode() { return (int) cVal
.mode
; }
154 inline char* getDSN() { return cVal
.dsn
; }
155 inline char* getDsConfigFile() { return cVal
.dsConfigFile
; }
156 inline char* getTableConfigFile() { return cVal
.tableConfigFile
; }
157 inline char* getStderrFile() { return cVal
.stderrFile
; }
158 inline bool useDurability() { return cVal
.isDurable
; }
159 inline int getDurableMode() { return cVal
.durableMode
; }
160 inline bool useCsqlSqlServer() { return cVal
.isCsqlSqlServer
; }
161 inline int getPort() { return cVal
.port
; }
162 inline char* getConflResoFile() { return cVal
.conflResoFile
; }
163 inline long getMaxQueueLogs() { return cVal
.maxQueueLogs
; }
164 inline int getMsgKey() { return cVal
.msgKey
; }
165 inline int getAsyncMsgMax() { return cVal
.asyncMsgMax
; }
166 inline int getShmIDKey() { return cVal
.shmKeyForId
; }
167 inline int getNetworkResponseTimeout() { return cVal
.nwResponseTimeout
; }
168 inline int getNetworkConnectTimeout() { return cVal
.nwConnectTimeout
; }
169 inline bool useTwoWayCache() { return cVal
.isTwoWay
; }
170 inline int getCacheWaitSecs() { return cVal
.cacheWaitSecs
; }
171 inline int getLogLevel() { return cVal
.logLevel
; }
172 inline int getNoOfProcessors() { return cVal
.noOfProcessors
; }
178 static Config config
;
179 static Logger logger
;