server-config.c 5.9 KB
Newer Older
Linus Tolke's avatar
Linus Tolke committed
1
/*
Per Cederqvist's avatar
Per Cederqvist committed
2
 * $Id: server-config.c,v 0.22 1993/10/10 17:01:54 ceder Exp $
Linus Tolke's avatar
Linus Tolke committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 * Copyright (C) 1991  Lysator Academic Computer Association.
 *
 * This file is part of the LysKOM server.
 * 
 * LysKOM is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; either version 1, or (at your option) 
 * any later version.
 * 
 * LysKOM 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 General Public License
 * for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with LysKOM; see the file COPYING.  If not, write to
 * Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
 * or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, 
 * MA 02139, USA.
 *
 * Please mail bug reports to bug-lyskom@lysator.liu.se. 
 */
Per Cederqvist's avatar
Per Cederqvist committed
25
26
27
28
29
30
31
/*
 *  config.c
 *
 *  This is in a .c file to make it possible to change a value without having
 *  to recompile the entire server.
 */

Per Cederqvist's avatar
Per Cederqvist committed
32
static char *rcsid = "$Id: server-config.c,v 0.22 1993/10/10 17:01:54 ceder Exp $";
33
34
#include "rcs.h"
USE(rcsid);
Per Cederqvist's avatar
Per Cederqvist committed
35

Per Cederqvist's avatar
Per Cederqvist committed
36
#include <limits.h>
Per Cederqvist's avatar
Per Cederqvist committed
37

Per Cederqvist's avatar
Per Cederqvist committed
38
#include "config.h"
Per Cederqvist's avatar
Per Cederqvist committed
39

Per Cederqvist's avatar
Per Cederqvist committed
40
/* Where to save things. These are used by lyskomd and dbck. */
Per Cederqvist's avatar
Per Cederqvist committed
41

Per Cederqvist's avatar
Per Cederqvist committed
42
43
44
45
46
/*
 * DEFAULT_DBASE_DIR can be overriden by giving -Ddir to lyskomd or dbck.
 */

const char * DEFAULT_DBASE_DIR = "/usr/lyskom";
Per Cederqvist's avatar
Per Cederqvist committed
47

Per Cederqvist's avatar
Per Cederqvist committed
48
49
50
51
/*
 * Note: if you change any of the following three names you will have
 * to change the name of the real files in db-nocrypt/db/ also.
 */
Per Cederqvist's avatar
Per Cederqvist committed
52
53
54
const char *DATAFILE_NAME   = "db/lyskomd-data";
const char *BACKUPFILE_NAME = "db/lyskomd-backup";
const char *TEXTFILE_NAME   = "db/lyskomd-texts";
Per Cederqvist's avatar
Per Cederqvist committed
55

Per Cederqvist's avatar
Per Cederqvist committed
56
const char *STATISTIC_NAME  = "etc/lyskomd-log";
Per Cederqvist's avatar
Per Cederqvist committed
57
const char *PID_NAME   = "etc/pid";
Per Cederqvist's avatar
Per Cederqvist committed
58
const char *MEMUSE_NAME = "etc/memory-usage";
Per Cederqvist's avatar
Per Cederqvist committed
59
60
61

/* Communications */

62
const char * DEFAULT_CLIENT_SERVICE = "lyskom";  /* Can be number! */
Per Cederqvist's avatar
Per Cederqvist committed
63
64
65
66
67
68
69
const char * DEFAULT_MUX_SERVICE    = "lyskom-mux";     /* Can be number! */

/*
 * The following should always be true:
 * 0 <= SYNCTIMEOUT <= GARBTIMEOUT <= TIMEOUT
 * Times in milliseconds.
 */
70
71
72
73
const int TIMEOUT = 120000;	/* Timeout to select() when totally idle.
				   This shouldn't be too small, since
				   the various intervals below are
				   currently only checked this often. +++ */
Per Cederqvist's avatar
Per Cederqvist committed
74
const int GARBTIMEOUT = 100;	/* Timeout to select() when garbing texts
Per Cederqvist's avatar
Per Cederqvist committed
75
				   but not syncing. */
Per Cederqvist's avatar
Per Cederqvist committed
76
const int SYNCTIMEOUT = 0;	/* Timeout to select() when syncing. */
Per Cederqvist's avatar
Per Cederqvist committed
77
78

/* Times in minutes. */
Per Cederqvist's avatar
Per Cederqvist committed
79
80
81
82
83
const int GARB_INTERVAL = 60*24;    /* Minutes between deletion of
				       expired texts. */
const int SYNC_INTERVAL = 30;  	    /* Minutes between sync. */
const int SYNC_RETRY_INTERVAL = 5;  /* 5 = Wait 5 minutes and retry after
				       an error while writing to disk. */
Per Cederqvist's avatar
Per Cederqvist committed
84
85
86
87
88
89
90
91
92
93

/* String limits */

const int CONF_NAME_LEN = 60;	/* Conference (and Person) name */
const int PWD_LEN	= 128;	/* Password. It is not guaranteed that all
				   chars are significant. */
const int WHAT_DO_LEN	=  60;	/* what_am_i_doing */
const int USERNAME_LEN	= 128;	/* Max login-id from clients */
const int TEXT_LEN      =131072;/* Max len of a text. */
const int BROADCAST_LEN = 1024;	/* Max len of a broadcast message */
94
const int REGEXP_LEN  = 1024;	/* Max len of regexp. */
Per Cederqvist's avatar
Per Cederqvist committed
95
96
97
98
99
100
101
102
103
104
105
106

/* Text_stat limits */

const int MAX_MARKS_PERSON = 2048; /* Max marks per person */
const int MAX_MARKS_TEXT   = 1024; /* Max marks per text */
const int MAX_RECIPIENTS   =  256; /* Max recipients/cc_recipients per text */
const int MAX_COMM	   =  128; /* Max number of comments to a text */
const int MAX_FOOT	   =   32; /* Max number of footnotes to a text */
const int MAX_CREA_MISC    =  512; /* Sum of recipients, cc_recipients, comm_to
				   * and footn_to must not exceed MAX_CREA_MISC
				    * when the text is created. */

107
108
109
110
111
/*
 * Size of the cache. This tells us how many clean objects of each
 * type to hold. Since all dirty items are also held in core, the
 * actual size of the cache is bigger.
 */
112

113
114
115
const int CACHE_CONFERENCES = 20;
const int CACHE_PERSONS     = 20;
const int CACHE_TEXT_STATS  = 20;
116

Per Cederqvist's avatar
Per Cederqvist committed
117
118
119
120
/*
 * Some other limits
 */

121
122
123
/*
 * MAX_NO_OF_CONNECTIONS must be small enough. Each connection takes one
 * file descriptor, and it is important that there are a few descriptors
124
 * left so that it is possible to save the data base. lyskomd might crash
125
126
 * if this number is too big and that many connectionattempts are made
 * simultaneously.
127
128
129
130
131
132
133
134
135
136
137
138
139
 *
 * The following descriptors are open by LysKOM:
 *   stdin, stdout, stderr   (stdin and stdout could probably be closed.
 *			      The log() function prints to stderr.)
 *   TEXTFILE_NAME	     (always open)
 *   DATAFILE_NAME	     (often open)
 *   STATISTIC_NAME	     (open after a SIGUSR1)
 * Thus, the max number of connections is the number of available file
 * descriptors minus six. This has not been fully tested for a long
 * while, so we subtract eight just to be on the safe side. That still
 * gives 56 simultaneous users on a sun4, and that is enough for the
 * time beeing. (If you need more connections you can ran a mux. Send
 * mail to kom@lysator.liu.se for more info.)
140
 */
Per Cederqvist's avatar
Per Cederqvist committed
141

Per Cederqvist's avatar
Per Cederqvist committed
142
#if defined(HAVE_GETDTABLESIZE) || defined(HAVE_SYSCONF)
143
144
int MAX_NO_OF_CONNECTIONS = 0;	/* Initialized by main(). */
#else
Per Cederqvist's avatar
Per Cederqvist committed
145
const int MAX_NO_OF_CONNECTIONS = (OPEN_MAX - PROTECTED_FDS);
146
#endif
147
148


Per Cederqvist's avatar
Per Cederqvist committed
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
const int MARK_AS_READ_CHUNK    = 128;	/* You can't mark more than this many
					 * texts as read in one call. */

/*
 * Max number of nested super_confs a message will be forwarded before
 * the server gives up.
 */
const int MAX_SUPER_CONF_LOOP = 17;


const int DEFAULT_NICE = 77;	/* Number of days a text normally lives. */



/* Max entries in the per-client transmit queue */
const int MAXQUEUEDSIZE = 300;

/* Max entries in the per-client transmit queue to send at any one time */
const int MAXDEQUEUELEN = 10;
Per Cederqvist's avatar
Per Cederqvist committed
168
169

/* What is whitespace? */
Per Cederqvist's avatar
Per Cederqvist committed
170
const unsigned char *WHITESPACE = (const unsigned char *)" \t\f\n\r";