xref: /titanic_41/usr/src/cmd/nscd/nscd_cfgdef.h (revision a970c705050f9e90c4b6d7982a9b3211719353fb)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 #ifndef	_NSCD_CFGDEF_H
26 #define	_NSCD_CFGDEF_H
27 
28 #ifdef	__cplusplus
29 extern "C" {
30 #endif
31 
32 #include <stddef.h>
33 #include <limits.h>
34 #include <nss_dbdefs.h>
35 #include "nscd_config.h"
36 #include "nscd_log.h"
37 #include "cache.h"
38 
39 /*
40  * structure used for preliminary checking of an integer
41  * configuration value
42  */
43 typedef	struct {
44 	int	min;
45 	int	max;
46 } nscd_cfg_int_check_t;
47 
48 /*
49  * structure used for preliminary checking of a bitmap
50  * configuration value
51  */
52 typedef	struct {
53 	nscd_cfg_bitmap_t	valid_bits;
54 } nscd_cfg_bitmap_check_t;
55 
56 /*
57  * structure used for preliminary checking of a string
58  * configuration value
59  */
60 typedef	struct {
61 	nscd_bool_t	must_not_null;
62 	int		maxlen;
63 } nscd_cfg_str_check_t;
64 
65 /*
66  * Per nsswitch database config data
67  */
68 typedef struct {
69 	nscd_cfg_frontend_t	fe;
70 	nscd_cfg_switch_t	sw;
71 	nscd_cfg_cache_t	cache;
72 } nscd_cfg_nsw_db_data_t;
73 
74 /*
75  * Per nsswitch database statistics data
76  */
77 typedef struct {
78 	nscd_cfg_stat_switch_t		sw;
79 	nscd_cfg_stat_cache_t		cache;
80 } nscd_cfg_stat_nsw_db_data_t;
81 
82 /*
83  * global statistics data
84  */
85 typedef struct {
86 	nscd_cfg_stat_global_log_t	log;
87 	nscd_cfg_stat_global_switch_t	sw;
88 	nscd_cfg_stat_cache_t		cache;
89 } nscd_cfg_stat_global_data_t;
90 
91 /*
92  * global config data
93  */
94 typedef struct {
95 	nscd_cfg_global_log_t		log;
96 	nscd_cfg_global_frontend_t	fe;
97 	nscd_cfg_global_selfcred_t	sc;
98 	nscd_cfg_global_switch_t	sw;
99 	nscd_cfg_global_cache_t		cache;
100 } nscd_cfg_global_data_t;
101 
102 /*
103  * structure for handling the switch database specific group
104  * or parameter default
105  */
106 typedef struct nscd_cfg_nsw_spc_default {
107 	char	*db;
108 	int	group_off;
109 	int	param_off;
110 	void	*data;		/* pointer or link to data */
111 	int	data_len;
112 } nscd_cfg_nsw_spc_default_t;
113 
114 /*
115  * name service switch source (repository) table
116  */
117 nscd_cfg_id_t _nscd_cfg_nsw_src[] = {
118 	{	0,	"files"			},
119 	{	1,	"ldap"			},
120 	{	2,	"nis"			},
121 	{	3,	"mdns"			},
122 	{	4,	"dns"			},
123 	{	5,	"compat"		},
124 	{	6,	"user"			},
125 	{	7,	"ad"			},
126 	{	-1,	NULL			}
127 };
128 
129 /*
130  * name service related smf service table
131  * (the order of the services should match the order of the source
132  *  listed above, 0: files, 1: ldap, 2: nis, 3: mdns.
133  *  dns is not needed)
134  */
135 nscd_cfg_id_t _nscd_cfg_smf_services[] = {
136 	{	0,	"svc:/system/name-service-cache:default"},
137 	{	1,	"svc:/network/ldap/client:default"	},
138 	{	2,	"svc:/network/nis/client:default"	},
139 	{	3,	"svc:/network/dns/multicast:default"	},
140 	{	-1,	NULL					}
141 };
142 
143 /*
144  * default version for supported sources/backends
145  */
146 void	*_nscd_be_version = NULL;
147 
148 /*
149  * name service database table
150  */
151 nscd_cfg_id_t _nscd_cfg_nsw_db[] = {
152 	{	0,	NSS_DBNAM_PASSWD	},
153 	{	1,	NSS_DBNAM_GROUP		},
154 	{	2,	NSS_DBNAM_HOSTS		},
155 	{	3,	NSS_DBNAM_IPNODES	},
156 	{	4,	NSS_DBNAM_EXECATTR	},
157 	{	5,	NSS_DBNAM_PROFATTR	},
158 	{	6,	NSS_DBNAM_USERATTR	},
159 	{	7,	NSS_DBNAM_NETWORKS	},
160 	{	8,	NSS_DBNAM_PROTOCOLS	},
161 	{	9,	NSS_DBNAM_RPC		},
162 	{	10,	NSS_DBNAM_ETHERS	},
163 	{	11,	NSS_DBNAM_NETMASKS	},
164 	{	12,	NSS_DBNAM_BOOTPARAMS	},
165 	{	13,	NSS_DBNAM_PUBLICKEY	},
166 	{	14,	NSS_DBNAM_NETGROUP	},
167 	{	15,	NSS_DBNAM_SERVICES	},
168 	{	16,	NSS_DBNAM_PRINTERS	},
169 	{	17,	NSS_DBNAM_AUTHATTR	},
170 	{	18,	NSS_DBNAM_PROJECT	},
171 	{	19,	NSS_DBNAM_SHADOW	},
172 	{	20,	NSS_DBNAM_AUDITUSER	},
173 	{	21,	NSS_DBNAM_TSOL_TP	},
174 	{	22,	NSS_DBNAM_TSOL_RH	},
175 	/* pseudo-databases for the compat backend */
176 	{	23,	NSS_DBNAM_PASSWD_COMPAT },
177 	{	24,	NSS_DBNAM_GROUP_COMPAT  },
178 #define	NSS_DBNAM_COMPAT_NUM_DB	5
179 	/*
180 	 * pseudo-databases that use the switch policy that is
181 	 * configured for NSS_DBNAM_PASSWD_COMPAT
182 	 */
183 	{	25,	NSS_DBNAM_PASSWD	},
184 	{	26,	NSS_DBNAM_SHADOW	},
185 	{	27,	NSS_DBNAM_AUDITUSER	},
186 	{	28,	NSS_DBNAM_USERATTR	},
187 	/*
188 	 * pseudo-database that uses the switch policy that is
189 	 * configured for NSS_DBNAM_GROUP_COMPAT
190 	 */
191 	{	29,	NSS_DBNAM_GROUP		},
192 	{	-1,	NULL			}
193 };
194 
195 /*
196  * A special way to indicate all switch databases
197  */
198 static	nscd_cfg_id_t _nscd_cfg_nsw_alldb = {
199 		NSCD_CFG_NSW_ALLDB_INDEX,
200 		NSCD_CFG_NSW_ALLDB
201 };
202 
203 /*
204  * data for preliminary checking of the log configuration
205  */
206 static nscd_cfg_str_check_t	NSCD_CFG_LOGFILE_PCHECK =
207 				{nscd_false, PATH_MAX};
208 static nscd_cfg_bitmap_check_t	NSCD_CFG_LOGCOMP_PCHECK =
209 				{NSCD_LOG_ALL};
210 static nscd_cfg_bitmap_check_t	NSCD_CFG_LOGLEVEL_PCHECK =
211 				{NSCD_LOG_LEVEL_ALL};
212 
213 /* data for preliminary checking of the switch configuration */
214 static nscd_cfg_str_check_t	NSCD_CFG_NSWCFGSTR_PCHECK =
215 				{nscd_true, 128};
216 
217 /*
218  * macros for defining the static param table
219  */
220 #define	NSCD_CFG_PGROUP_DESC(pn, type, pflag, gf, g_in_t, pcheck_p,\
221 		nfunc_name, vfunc_name) \
222 	{ \
223 		{-1, pn}, type, (NSCD_CFG_PFLAG_GROUP | pflag), \
224 		0, 0, 0,\
225 		NSCD_SIZEOF(g_in_t, gf), offsetof(g_in_t, gf), -1, \
226 		pcheck_p, nfunc_name, vfunc_name \
227 	}
228 
229 #define	NSCD_CFG_PARAM_DESC(pn, type, pflag, pf, p_in_t, \
230 		gf, g_in_t, pcheck_p, nfunc_name, vfunc_name) \
231 	{ \
232 		{-1, pn}, type, pflag, \
233 		NSCD_SIZEOF(p_in_t, pf), offsetof(p_in_t, pf), -1, \
234 		NSCD_SIZEOF(g_in_t, gf), offsetof(g_in_t, gf), -1, \
235 		pcheck_p, nfunc_name, vfunc_name \
236 	}
237 
238 #define	NSCD_CFG_PGROUP_DESC_NULL \
239 	{ \
240 		{-1, NULL}, -1, NSCD_CFG_PFLAG_GROUP, \
241 		0, 0, 0, \
242 		0, 0, 0, \
243 		NULL, NULL, NULL \
244 	}
245 
246 /* nscd internal cfg_*_notify() cfg_*_verify() and cfg_*_get_stat()  */
247 extern	nscd_rc_t	_nscd_cfg_log_notify();
248 extern	nscd_rc_t	_nscd_cfg_log_verify();
249 extern	nscd_rc_t	_nscd_cfg_frontend_notify();
250 extern	nscd_rc_t	_nscd_cfg_frontend_verify();
251 extern	nscd_rc_t	_nscd_cfg_selfcred_notify();
252 extern	nscd_rc_t	_nscd_cfg_selfcred_verify();
253 extern	nscd_rc_t	_nscd_cfg_switch_notify();
254 extern	nscd_rc_t	_nscd_cfg_switch_verify();
255 extern	nscd_rc_t	_nscd_cfg_cache_notify();
256 extern	nscd_rc_t	_nscd_cfg_cache_verify();
257 extern	nscd_rc_t	_nscd_cfg_log_get_stat();
258 extern	nscd_rc_t	_nscd_cfg_switch_get_stat();
259 extern	nscd_rc_t	_nscd_cfg_cache_get_stat();
260 
261 /*
262  * the following macros are used to indicate a parameter's
263  * notify/verify/get_stat functions are the same as those
264  * of the group
265  */
266 #define	NSCD_CFG_FUNC_NOTIFY_AS_GROUP	((nscd_cfg_func_notify_t)-1)
267 #define	NSCD_CFG_FUNC_VERIFY_AS_GROUP	((nscd_cfg_func_verify_t)-1)
268 #define	NSCD_CFG_FUNC_GET_STAT_AS_GROUP	((nscd_cfg_func_get_stat_t)-1)
269 
270 /*
271  * the static config parameter description table
272  */
273 static	nscd_cfg_param_desc_t	_nscd_cfg_param_desc[] = {
274 
275 	NSCD_CFG_PGROUP_DESC(
276 		"param-group-global-log",
277 		NSCD_CFG_DATA_NONE,
278 		NSCD_CFG_PFLAG_INIT_SEND_WHOLE_GROUP |
279 		NSCD_CFG_PFLAG_GLOBAL,
280 		log,
281 		nscd_cfg_global_data_t,
282 		NULL,
283 		_nscd_cfg_log_notify,
284 		_nscd_cfg_log_verify),
285 
286 	NSCD_CFG_PARAM_DESC(
287 		"logfile",
288 		NSCD_CFG_DATA_STRING,
289 		NSCD_CFG_PFLAG_GLOBAL |
290 		NSCD_CFG_PFLAG_VLEN_DATA,
291 		logfile,
292 		nscd_cfg_global_log_t,
293 		log,
294 		nscd_cfg_global_data_t,
295 		&NSCD_CFG_LOGFILE_PCHECK,
296 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
297 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
298 
299 	NSCD_CFG_PARAM_DESC(
300 		"debug-level",
301 		NSCD_CFG_DATA_BITMAP,
302 		NSCD_CFG_PFLAG_GLOBAL,
303 		debug_level,
304 		nscd_cfg_global_log_t,
305 		log,
306 		nscd_cfg_global_data_t,
307 		&NSCD_CFG_LOGLEVEL_PCHECK,
308 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
309 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
310 
311 	NSCD_CFG_PARAM_DESC(
312 		"debug-components",
313 		NSCD_CFG_DATA_BITMAP,
314 		NSCD_CFG_PFLAG_GLOBAL,
315 		debug_comp,
316 		nscd_cfg_global_log_t,
317 		log,
318 		nscd_cfg_global_data_t,
319 		&NSCD_CFG_LOGCOMP_PCHECK,
320 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
321 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
322 
323 	NSCD_CFG_PGROUP_DESC(
324 		"param-group-global-frontend",
325 		NSCD_CFG_DATA_NONE,
326 		NSCD_CFG_PFLAG_INIT_SEND_WHOLE_GROUP |
327 		NSCD_CFG_PFLAG_GLOBAL,
328 		fe,
329 		nscd_cfg_global_data_t,
330 		NULL,
331 		_nscd_cfg_frontend_notify,
332 		_nscd_cfg_frontend_verify),
333 
334 	NSCD_CFG_PARAM_DESC(
335 		"common-worker-threads",
336 		NSCD_CFG_DATA_INTEGER,
337 		NSCD_CFG_PFLAG_SEND_BIT_SELECTED |
338 		NSCD_CFG_PFLAG_GLOBAL,
339 		common_worker_threads,
340 		nscd_cfg_global_frontend_t,
341 		fe,
342 		nscd_cfg_global_data_t,
343 		NULL,
344 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
345 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
346 
347 	NSCD_CFG_PARAM_DESC(
348 		"cache-hit-threads",
349 		NSCD_CFG_DATA_INTEGER,
350 		NSCD_CFG_PFLAG_SEND_BIT_SELECTED |
351 		NSCD_CFG_PFLAG_GLOBAL,
352 		cache_hit_threads,
353 		nscd_cfg_global_frontend_t,
354 		fe,
355 		nscd_cfg_global_data_t,
356 		NULL,
357 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
358 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
359 
360 	NSCD_CFG_PGROUP_DESC(
361 		"param-group-global-selfcred",
362 		NSCD_CFG_DATA_NONE,
363 		NSCD_CFG_PFLAG_INIT_SEND_WHOLE_GROUP |
364 		NSCD_CFG_PFLAG_GLOBAL,
365 		sc,
366 		nscd_cfg_global_data_t,
367 		NULL,
368 		_nscd_cfg_selfcred_notify,
369 		_nscd_cfg_selfcred_verify),
370 
371 	NSCD_CFG_PARAM_DESC(
372 		"enable-selfcred",
373 		NSCD_CFG_DATA_BOOLEAN,
374 		NSCD_CFG_PFLAG_GLOBAL,
375 		enable_selfcred,
376 		nscd_cfg_global_selfcred_t,
377 		sc,
378 		nscd_cfg_global_data_t,
379 		NULL,
380 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
381 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
382 
383 	NSCD_CFG_PARAM_DESC(
384 		"per-user-nscd-ttl",
385 		NSCD_CFG_DATA_INTEGER,
386 		NSCD_CFG_PFLAG_GLOBAL,
387 		per_user_nscd_ttl,
388 		nscd_cfg_global_selfcred_t,
389 		sc,
390 		nscd_cfg_global_data_t,
391 		NULL,
392 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
393 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
394 
395 	NSCD_CFG_PGROUP_DESC(
396 		"param-group-global-switch",
397 		NSCD_CFG_DATA_NONE,
398 		NSCD_CFG_PFLAG_INIT_SEND_WHOLE_GROUP |
399 		NSCD_CFG_PFLAG_GLOBAL,
400 		sw,
401 		nscd_cfg_global_data_t,
402 		NULL,
403 		_nscd_cfg_switch_notify,
404 		_nscd_cfg_switch_verify),
405 
406 	NSCD_CFG_PARAM_DESC(
407 		"global-enable-lookup",
408 		NSCD_CFG_DATA_BOOLEAN,
409 		NSCD_CFG_PFLAG_GLOBAL,
410 		enable_lookup_g,
411 		nscd_cfg_global_switch_t,
412 		sw,
413 		nscd_cfg_global_data_t,
414 		NULL,
415 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
416 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
417 
418 	NSCD_CFG_PARAM_DESC(
419 		"global-enable-loopback-checking",
420 		NSCD_CFG_DATA_BOOLEAN,
421 		NSCD_CFG_PFLAG_GLOBAL,
422 		enable_loopback_checking_g,
423 		nscd_cfg_global_switch_t,
424 		sw,
425 		nscd_cfg_global_data_t,
426 		NULL,
427 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
428 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
429 
430 	NSCD_CFG_PARAM_DESC(
431 		"global-check-smf-state-interval",
432 		NSCD_CFG_DATA_INTEGER,
433 		NSCD_CFG_PFLAG_GLOBAL,
434 		check_smf_state_interval_g,
435 		nscd_cfg_global_switch_t,
436 		sw,
437 		nscd_cfg_global_data_t,
438 		NULL,
439 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
440 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
441 
442 	NSCD_CFG_PGROUP_DESC(
443 		"param-group-global-cache",
444 		NSCD_CFG_DATA_NONE,
445 		NSCD_CFG_PFLAG_INIT_SEND_WHOLE_GROUP |
446 		NSCD_CFG_PFLAG_INIT_SET_ALL_DB |
447 		NSCD_CFG_PFLAG_GLOBAL,
448 		cache,
449 		nscd_cfg_global_data_t,
450 		NULL,
451 		_nscd_cfg_cache_notify,
452 		_nscd_cfg_cache_verify),
453 
454 	NSCD_CFG_PARAM_DESC(
455 		"global-enable-cache",
456 		NSCD_CFG_DATA_BOOLEAN,
457 		NSCD_CFG_PFLAG_GLOBAL,
458 		enable,
459 		nscd_cfg_global_cache_t,
460 		cache,
461 		nscd_cfg_global_data_t,
462 		NULL,
463 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
464 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
465 
466 	/* non-global config param from this point on */
467 
468 	NSCD_CFG_PGROUP_DESC(
469 		"param-group-frontend",
470 		NSCD_CFG_DATA_NONE,
471 		NSCD_CFG_PFLAG_INIT_SEND_WHOLE_GROUP,
472 		fe,
473 		nscd_cfg_nsw_db_data_t,
474 		NULL,
475 		_nscd_cfg_frontend_notify,
476 		_nscd_cfg_frontend_verify),
477 
478 	NSCD_CFG_PARAM_DESC(
479 		"worker-thread-per-nsw-db",
480 		NSCD_CFG_DATA_INTEGER,
481 		NSCD_CFG_PFLAG_NONE,
482 		worker_thread_per_nsw_db,
483 		nscd_cfg_frontend_t,
484 		fe,
485 		nscd_cfg_nsw_db_data_t,
486 		NULL,
487 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
488 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
489 
490 	NSCD_CFG_PGROUP_DESC(
491 		"param-group-switch",
492 		NSCD_CFG_DATA_NONE,
493 		NSCD_CFG_PFLAG_INIT_SEND_WHOLE_GROUP |
494 		NSCD_CFG_PFLAG_NONE,
495 		sw,
496 		nscd_cfg_nsw_db_data_t,
497 		NULL,
498 		_nscd_cfg_switch_notify,
499 		_nscd_cfg_switch_verify),
500 
501 	NSCD_CFG_PARAM_DESC(
502 		"nsw-config-string",
503 		NSCD_CFG_DATA_STRING,
504 		NSCD_CFG_PFLAG_VLEN_DATA |
505 		NSCD_CFG_PFLAG_LINKED,
506 		nsw_config_string,
507 		nscd_cfg_switch_t,
508 		sw,
509 		nscd_cfg_nsw_db_data_t,
510 		&NSCD_CFG_NSWCFGSTR_PCHECK,
511 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
512 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
513 
514 	NSCD_CFG_PARAM_DESC(
515 		"nsw-config-database",
516 		NSCD_CFG_DATA_STRING,
517 		NSCD_CFG_PFLAG_VLEN_DATA |
518 		NSCD_CFG_PFLAG_HIDDEN,
519 		nsw_config_db,
520 		nscd_cfg_switch_t,
521 		sw,
522 		nscd_cfg_nsw_db_data_t,
523 		&NSCD_CFG_NSWCFGSTR_PCHECK,
524 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
525 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
526 
527 	NSCD_CFG_PARAM_DESC(
528 		"enable-lookup",
529 		NSCD_CFG_DATA_BOOLEAN,
530 		NSCD_CFG_PFLAG_NONE,
531 		enable_lookup,
532 		nscd_cfg_switch_t,
533 		sw,
534 		nscd_cfg_nsw_db_data_t,
535 		NULL,
536 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
537 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
538 
539 	NSCD_CFG_PARAM_DESC(
540 		"enable-loopback-checking",
541 		NSCD_CFG_DATA_BOOLEAN,
542 		NSCD_CFG_PFLAG_NONE,
543 		enable_loopback_checking,
544 		nscd_cfg_switch_t,
545 		sw,
546 		nscd_cfg_nsw_db_data_t,
547 		NULL,
548 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
549 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
550 
551 	NSCD_CFG_PARAM_DESC(
552 		"max-nsw-state-per-db",
553 		NSCD_CFG_DATA_INTEGER,
554 		NSCD_CFG_PFLAG_NONE,
555 		max_nsw_state_per_db,
556 		nscd_cfg_switch_t,
557 		sw,
558 		nscd_cfg_nsw_db_data_t,
559 		NULL,
560 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
561 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
562 
563 	NSCD_CFG_PARAM_DESC(
564 		"max-nsw-state-per-thread",
565 		NSCD_CFG_DATA_INTEGER,
566 		NSCD_CFG_PFLAG_NONE,
567 		max_nsw_state_per_thread,
568 		nscd_cfg_switch_t,
569 		sw,
570 		nscd_cfg_nsw_db_data_t,
571 		NULL,
572 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
573 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
574 
575 	NSCD_CFG_PARAM_DESC(
576 		"max-getent-ctx-per-db",
577 		NSCD_CFG_DATA_INTEGER,
578 		NSCD_CFG_PFLAG_NONE,
579 		max_getent_ctx_per_db,
580 		nscd_cfg_switch_t,
581 		sw,
582 		nscd_cfg_nsw_db_data_t,
583 		NULL,
584 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
585 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
586 
587 	NSCD_CFG_PGROUP_DESC(
588 		"param-group-cache",
589 		NSCD_CFG_DATA_NONE,
590 		NSCD_CFG_PFLAG_INIT_SEND_WHOLE_GROUP,
591 		cache,
592 		nscd_cfg_nsw_db_data_t,
593 		NULL,
594 		_nscd_cfg_cache_notify,
595 		_nscd_cfg_cache_verify),
596 
597 	NSCD_CFG_PARAM_DESC(
598 		"enable-cache",
599 		NSCD_CFG_DATA_BOOLEAN,
600 		NSCD_CFG_PFLAG_NONE,
601 		enable,
602 		nscd_cfg_cache_t,
603 		cache,
604 		nscd_cfg_nsw_db_data_t,
605 		NULL,
606 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
607 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
608 
609 	NSCD_CFG_PARAM_DESC(
610 		"enable-per-user-cache",
611 		NSCD_CFG_DATA_BOOLEAN,
612 		NSCD_CFG_PFLAG_NONE,
613 		per_user,
614 		nscd_cfg_cache_t,
615 		cache,
616 		nscd_cfg_nsw_db_data_t,
617 		NULL,
618 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
619 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
620 
621 	NSCD_CFG_PARAM_DESC(
622 		"avoid-nameservice",
623 		NSCD_CFG_DATA_BOOLEAN,
624 		NSCD_CFG_PFLAG_NONE,
625 		avoid_ns,
626 		nscd_cfg_cache_t,
627 		cache,
628 		nscd_cfg_nsw_db_data_t,
629 		NULL,
630 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
631 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
632 
633 	NSCD_CFG_PARAM_DESC(
634 		"check-files",
635 		NSCD_CFG_DATA_BOOLEAN,
636 		NSCD_CFG_PFLAG_NONE,
637 		check_files,
638 		nscd_cfg_cache_t,
639 		cache,
640 		nscd_cfg_nsw_db_data_t,
641 		NULL,
642 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
643 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
644 
645 	NSCD_CFG_PARAM_DESC(
646 		"check-file-interval",
647 		NSCD_CFG_DATA_INTEGER,
648 		NSCD_CFG_PFLAG_NONE,
649 		check_interval,
650 		nscd_cfg_cache_t,
651 		cache,
652 		nscd_cfg_nsw_db_data_t,
653 		NULL,
654 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
655 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
656 
657 	NSCD_CFG_PARAM_DESC(
658 		"positive-time-to-live",
659 		NSCD_CFG_DATA_INTEGER,
660 		NSCD_CFG_PFLAG_NONE,
661 		pos_ttl,
662 		nscd_cfg_cache_t,
663 		cache,
664 		nscd_cfg_nsw_db_data_t,
665 		NULL,
666 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
667 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
668 
669 	NSCD_CFG_PARAM_DESC(
670 		"negative-time-to-live",
671 		NSCD_CFG_DATA_INTEGER,
672 		NSCD_CFG_PFLAG_NONE,
673 		neg_ttl,
674 		nscd_cfg_cache_t,
675 		cache,
676 		nscd_cfg_nsw_db_data_t,
677 		NULL,
678 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
679 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
680 
681 	NSCD_CFG_PARAM_DESC(
682 		"keep-hot-count",
683 		NSCD_CFG_DATA_INTEGER,
684 		NSCD_CFG_PFLAG_NONE,
685 		keephot,
686 		nscd_cfg_cache_t,
687 		cache,
688 		nscd_cfg_nsw_db_data_t,
689 		NULL,
690 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
691 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
692 
693 	NSCD_CFG_PARAM_DESC(
694 		"hint-size",
695 		NSCD_CFG_DATA_INTEGER,
696 		NSCD_CFG_PFLAG_NONE,
697 		hint_size,
698 		nscd_cfg_cache_t,
699 		cache,
700 		nscd_cfg_nsw_db_data_t,
701 		NULL,
702 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
703 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
704 
705 	NSCD_CFG_PARAM_DESC(
706 		"maximum-entries-allowed",
707 		NSCD_CFG_DATA_INTEGER,
708 		NSCD_CFG_PFLAG_NONE,
709 		maxentries,
710 		nscd_cfg_cache_t,
711 		cache,
712 		nscd_cfg_nsw_db_data_t,
713 		NULL,
714 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
715 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
716 
717 	NSCD_CFG_PARAM_DESC(
718 		"suggested-size",
719 		NSCD_CFG_DATA_INTEGER,
720 		NSCD_CFG_PFLAG_OBSOLETE,
721 		suggestedsize,
722 		nscd_cfg_cache_t,
723 		cache,
724 		nscd_cfg_nsw_db_data_t,
725 		NULL,
726 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
727 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
728 
729 	NSCD_CFG_PARAM_DESC(
730 		"old-data-ok",
731 		NSCD_CFG_DATA_BOOLEAN,
732 		NSCD_CFG_PFLAG_OBSOLETE,
733 		old_data_ok,
734 		nscd_cfg_cache_t,
735 		cache,
736 		nscd_cfg_nsw_db_data_t,
737 		NULL,
738 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
739 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
740 
741 	NSCD_CFG_PGROUP_DESC_NULL
742 };
743 
744 /*
745  * defaults for the global configuration
746  */
747 static nscd_cfg_global_data_t nscd_cfg_global_default = {
748 
749 	/*
750 	 * nscd_cfg_global_log_t
751 	 */
752 	{
753 
754 	NSCD_CFG_GROUP_INFO_GLOBAL_LOG,
755 	NULL,
756 	NSCD_LOG_LEVEL_NONE,	/* debug_level */
757 	NSCD_LOG_CACHE,		/* debug_comp */
758 
759 	},
760 
761 	/*
762 	 * nscd_cfg_global_frontend_t
763 	 */
764 	{
765 
766 	NSCD_CFG_GROUP_INFO_GLOBAL_FRONTEND,
767 	100,			/* common_worker_threads */
768 	100,			/* cache_hit_threads */
769 
770 	},
771 
772 	/*
773 	 * nscd_cfg_global_selfcred_t
774 	 */
775 	{
776 
777 	NSCD_CFG_GROUP_INFO_GLOBAL_SELFCRED,
778 	nscd_true,		/* enable_selfcred */
779 	120,			/* per_user_nscd_ttl: 120 seconds */
780 
781 	},
782 
783 	/*
784 	 * nscd_cfg_global_switch_t
785 	 */
786 	{
787 
788 	NSCD_CFG_GROUP_INFO_GLOBAL_SWITCH,
789 	nscd_true,		/* enable_lookup_g */
790 	nscd_false,		/* enable_loopback_checking_g */
791 	120,			/* check_smf_state_interval_g */
792 
793 	},
794 
795 	/*
796 	 * nscd_cfg_global_cache_t
797 	 */
798 	NSCD_CFG_GLOBAL_CACHE_DEFAULTS
799 };
800 
801 /*
802  * defaults for the per switch database configuration
803  */
804 static nscd_cfg_nsw_db_data_t nscd_cfg_nsw_db_data_default = {
805 
806 	/*
807 	 * nscd_cfg_frontend_t
808 	 */
809 	{
810 
811 	NSCD_CFG_GROUP_INFO_FRONTEND,
812 	50, 			/* worker_thread_per_nsw_db */
813 
814 	},
815 
816 	/*
817 	 * nscd_cfg_switch_t
818 	 */
819 	{
820 
821 	NSCD_CFG_GROUP_INFO_SWITCH,
822 	"nis files",		/* nsw_config_string */
823 	NULL,			/* nsw_config_db */
824 	nscd_true,		/* enable_lookup */
825 	nscd_false,		/* enable_loopback_checking */
826 	288,			/* max_nsw_state_per_db */
827 	32,			/* max_nsw_state_per_thread */
828 	256,			/* max_getent_ctx_per_db */
829 
830 	},
831 
832 	/*
833 	 * nscd_cfg_cache_t
834 	 */
835 	NSCD_CFG_CACHE_DEFAULTS
836 };
837 
838 /*
839  * macros for defining the database specific defaults
840  */
841 #define	NSCD_CFG_DB_DEFAULT_PARAM(db, gf, pf, gt, defaddr, deflen) \
842 	{ \
843 		db, offsetof(nscd_cfg_nsw_db_data_t, gf), \
844 		offsetof(gt, pf), defaddr, deflen \
845 	}
846 
847 #define	NSCD_CFG_DB_DEFAULT_GROUP(db, gf, defaddr, deflen) \
848 	{ \
849 		db, offsetof(nscd_cfg_nsw_db_data_t, gf), \
850 		0, defaddr, deflen \
851 	}
852 
853 #define	NSCD_CFG_DB_DEFAULT_NULL \
854 	{ \
855 		NULL, 0, 0, NULL, 0 \
856 	}
857 
858 /*
859  * shadow, and user_attr use the same switch policy
860  * as that of passwd. exec_attr use that of prof_attr.
861  */
862 static char *nscd_cfg_shadow_cfg_db	= NSS_DBNAM_PASSWD;
863 static char *nscd_cfg_userattr_cfg_db	= NSS_DBNAM_PASSWD;
864 static char *nscd_cfg_execattr_cfg_db	= NSS_DBNAM_PROFATTR;
865 
866 /*
867  * default switch policy for pseudo-databases passwd_compat and
868  * and group_compa is "nis"
869  */
870 static char *nscd_cfg_def_passwd_compat	= NSS_DEFCONF_PASSWD_COMPAT;
871 static char *nscd_cfg_def_group_compat	= NSS_DEFCONF_GROUP_COMPAT;
872 
873 static nscd_cfg_nsw_spc_default_t nscd_cfg_passwd_cfg_link =
874 	NSCD_CFG_DB_DEFAULT_PARAM(
875 		NSS_DBNAM_PASSWD,
876 		sw,
877 		nsw_config_string,
878 		nscd_cfg_switch_t,
879 		NULL,
880 		NSCD_SIZEOF(nscd_cfg_switch_t, nsw_config_string));
881 
882 static nscd_cfg_nsw_spc_default_t nscd_cfg_profattr_cfg_link =
883 	NSCD_CFG_DB_DEFAULT_PARAM(
884 		NSS_DBNAM_PROFATTR,
885 		sw,
886 		nsw_config_string,
887 		nscd_cfg_switch_t,
888 		NULL,
889 		NSCD_SIZEOF(nscd_cfg_switch_t, nsw_config_string));
890 
891 
892 /*
893  * switch database specific defaults
894  */
895 nscd_cfg_nsw_spc_default_t	_nscd_cfg_nsw_spc_default[] = {
896 
897 	NSCD_CFG_DB_DEFAULT_PARAM(
898 	NSS_DBNAM_SHADOW,
899 		sw,
900 		nsw_config_db,
901 		nscd_cfg_switch_t,
902 		&nscd_cfg_shadow_cfg_db,
903 		sizeof (nscd_cfg_shadow_cfg_db)),
904 
905 	NSCD_CFG_DB_DEFAULT_PARAM(
906 		NSS_DBNAM_USERATTR,
907 		sw,
908 		nsw_config_db,
909 		nscd_cfg_switch_t,
910 		&nscd_cfg_userattr_cfg_db,
911 		sizeof (nscd_cfg_userattr_cfg_db)),
912 
913 	NSCD_CFG_DB_DEFAULT_PARAM(
914 		NSS_DBNAM_EXECATTR,
915 		sw,
916 		nsw_config_db,
917 		nscd_cfg_switch_t,
918 		&nscd_cfg_execattr_cfg_db,
919 		sizeof (nscd_cfg_execattr_cfg_db)),
920 
921 	NSCD_CFG_DB_DEFAULT_PARAM(
922 		NSS_DBNAM_PASSWD_COMPAT,
923 		sw,
924 		nsw_config_string,
925 		nscd_cfg_switch_t,
926 		&nscd_cfg_def_passwd_compat,
927 		sizeof (nscd_cfg_def_passwd_compat)),
928 
929 	NSCD_CFG_DB_DEFAULT_PARAM(
930 		NSS_DBNAM_GROUP_COMPAT,
931 		sw,
932 		nsw_config_string,
933 		nscd_cfg_switch_t,
934 		&nscd_cfg_def_group_compat,
935 		sizeof (nscd_cfg_def_group_compat)),
936 
937 	NSCD_CFG_DB_DEFAULT_NULL
938 };
939 
940 /*
941  * switch database specific defaults that are linked to
942  * those of other databases
943  */
944 nscd_cfg_nsw_spc_default_t	_nscd_cfg_nsw_link_default[] = {
945 
946 	NSCD_CFG_DB_DEFAULT_PARAM(
947 		NSS_DBNAM_SHADOW,
948 		sw,
949 		nsw_config_string,
950 		nscd_cfg_switch_t,
951 		&nscd_cfg_passwd_cfg_link,
952 		0),
953 
954 	NSCD_CFG_DB_DEFAULT_PARAM(
955 		NSS_DBNAM_USERATTR,
956 		sw,
957 		nsw_config_string,
958 		nscd_cfg_switch_t,
959 		&nscd_cfg_passwd_cfg_link,
960 		0),
961 
962 	NSCD_CFG_DB_DEFAULT_PARAM(
963 		NSS_DBNAM_AUDITUSER,
964 		sw,
965 		nsw_config_string,
966 		nscd_cfg_switch_t,
967 		&nscd_cfg_passwd_cfg_link,
968 		0),
969 
970 	NSCD_CFG_DB_DEFAULT_PARAM(
971 		NSS_DBNAM_EXECATTR,
972 		sw,
973 		nsw_config_string,
974 		nscd_cfg_switch_t,
975 		&nscd_cfg_profattr_cfg_link,
976 		0),
977 
978 	NSCD_CFG_DB_DEFAULT_NULL
979 };
980 
981 /*
982  * macros for defining the static stats table
983  */
984 #define	NSCD_CFG_SGROUP_DESC(sn, type, sflag, gi, \
985 		gf, g_in_t, gsfunc_name) \
986 	{ \
987 		{-1, sn}, type, NSCD_CFG_SFLAG_GROUP | sflag, gi, \
988 		0, 0, 0,\
989 		NSCD_SIZEOF(g_in_t, gf), offsetof(g_in_t, gf), -1, \
990 		gsfunc_name \
991 	}
992 
993 #define	NSCD_CFG_STAT_DESC(sn, type, sflag, sf, s_in_t, \
994 		gf, g_in_t, gsfunc_name) \
995 	{ \
996 		{-1, sn}, type, sflag, NSCD_CFG_GROUP_INFO_NULL, \
997 		NSCD_SIZEOF(s_in_t, sf), offsetof(s_in_t, sf), -1, \
998 		NSCD_SIZEOF(g_in_t, gf), offsetof(g_in_t, gf), -1, \
999 		gsfunc_name \
1000 	}
1001 
1002 #define	NSCD_CFG_SGROUP_DESC_NULL \
1003 	{ \
1004 		{-1, NULL}, -1, NSCD_CFG_SFLAG_GROUP, NULL, \
1005 		0, 0, 0, \
1006 		0, 0, 0, \
1007 		NULL \
1008 	}
1009 
1010 /*
1011  * the static statistics description table
1012  */
1013 static	nscd_cfg_stat_desc_t	_nscd_cfg_stat_desc[] = {
1014 
1015 	NSCD_CFG_SGROUP_DESC(
1016 		"stat-group-global-log",
1017 		NSCD_CFG_DATA_NONE,
1018 		NSCD_CFG_SFLAG_GLOBAL,
1019 		NSCD_CFG_STAT_GROUP_INFO_GLOBAL_LOG,
1020 		log,
1021 		nscd_cfg_stat_global_data_t,
1022 		_nscd_cfg_log_get_stat),
1023 
1024 	NSCD_CFG_STAT_DESC(
1025 		"entries-logged",
1026 		NSCD_CFG_DATA_INTEGER,
1027 		NSCD_CFG_SFLAG_GLOBAL,
1028 		entries_logged,
1029 		nscd_cfg_stat_global_log_t,
1030 		log,
1031 		nscd_cfg_stat_global_data_t,
1032 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1033 
1034 	NSCD_CFG_SGROUP_DESC(
1035 		"stat-group-global-switch",
1036 		NSCD_CFG_DATA_NONE,
1037 		NSCD_CFG_SFLAG_GLOBAL,
1038 		NSCD_CFG_STAT_GROUP_INFO_GLOBAL_SWITCH,
1039 		sw,
1040 		nscd_cfg_stat_global_data_t,
1041 		_nscd_cfg_switch_get_stat),
1042 
1043 	NSCD_CFG_STAT_DESC(
1044 		"global-lookup-request-received",
1045 		NSCD_CFG_DATA_INTEGER,
1046 		NSCD_CFG_SFLAG_GLOBAL,
1047 		lookup_request_received_g,
1048 		nscd_cfg_stat_global_switch_t,
1049 		sw,
1050 		nscd_cfg_stat_global_data_t,
1051 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1052 
1053 	NSCD_CFG_STAT_DESC(
1054 		"global-lookup-request-queued",
1055 		NSCD_CFG_DATA_INTEGER,
1056 		NSCD_CFG_SFLAG_GLOBAL,
1057 		lookup_request_queued_g,
1058 		nscd_cfg_stat_global_switch_t,
1059 		sw,
1060 		nscd_cfg_stat_global_data_t,
1061 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1062 
1063 	NSCD_CFG_STAT_DESC(
1064 		"global-lookup-request-in-progress",
1065 		NSCD_CFG_DATA_INTEGER,
1066 		NSCD_CFG_SFLAG_GLOBAL,
1067 		lookup_request_in_progress_g,
1068 		nscd_cfg_stat_global_switch_t,
1069 		sw,
1070 		nscd_cfg_stat_global_data_t,
1071 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1072 
1073 	NSCD_CFG_STAT_DESC(
1074 		"global-lookup-request-succeeded",
1075 		NSCD_CFG_DATA_INTEGER,
1076 		NSCD_CFG_SFLAG_GLOBAL,
1077 		lookup_request_succeeded_g,
1078 		nscd_cfg_stat_global_switch_t,
1079 		sw,
1080 		nscd_cfg_stat_global_data_t,
1081 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1082 
1083 	NSCD_CFG_STAT_DESC(
1084 		"global-lookup-request-failed",
1085 		NSCD_CFG_DATA_INTEGER,
1086 		NSCD_CFG_SFLAG_GLOBAL,
1087 		lookup_request_failed_g,
1088 		nscd_cfg_stat_global_switch_t,
1089 		sw,
1090 		nscd_cfg_stat_global_data_t,
1091 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1092 
1093 	NSCD_CFG_STAT_DESC(
1094 		"global-loopback-nsw-db-skipped",
1095 		NSCD_CFG_DATA_INTEGER,
1096 		NSCD_CFG_SFLAG_GLOBAL,
1097 		loopback_nsw_db_skipped_g,
1098 		nscd_cfg_stat_global_switch_t,
1099 		sw,
1100 		nscd_cfg_stat_global_data_t,
1101 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1102 
1103 	NSCD_CFG_SGROUP_DESC(
1104 		"stat-group-global-cache",
1105 		NSCD_CFG_DATA_NONE,
1106 		NSCD_CFG_SFLAG_GLOBAL,
1107 		NSCD_CFG_STAT_GROUP_INFO_CACHE,
1108 		cache,
1109 		nscd_cfg_stat_global_data_t,
1110 		_nscd_cfg_cache_get_stat),
1111 
1112 	NSCD_CFG_STAT_DESC(
1113 		"global-cache-hits-on-positive",
1114 		NSCD_CFG_DATA_INTEGER,
1115 		NSCD_CFG_SFLAG_GLOBAL,
1116 		pos_hits,
1117 		nscd_cfg_stat_cache_t,
1118 		cache,
1119 		nscd_cfg_stat_global_data_t,
1120 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1121 
1122 	NSCD_CFG_STAT_DESC(
1123 		"global-cache-hits-on-negative",
1124 		NSCD_CFG_DATA_INTEGER,
1125 		NSCD_CFG_SFLAG_GLOBAL,
1126 		neg_hits,
1127 		nscd_cfg_stat_cache_t,
1128 		cache,
1129 		nscd_cfg_stat_global_data_t,
1130 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1131 
1132 	NSCD_CFG_STAT_DESC(
1133 		"global-cache-misses-on-positive",
1134 		NSCD_CFG_DATA_INTEGER,
1135 		NSCD_CFG_SFLAG_GLOBAL,
1136 		pos_misses,
1137 		nscd_cfg_stat_cache_t,
1138 		cache,
1139 		nscd_cfg_stat_global_data_t,
1140 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1141 
1142 	NSCD_CFG_STAT_DESC(
1143 		"global-cache-misses-on-negative",
1144 		NSCD_CFG_DATA_INTEGER,
1145 		NSCD_CFG_SFLAG_GLOBAL,
1146 		neg_misses,
1147 		nscd_cfg_stat_cache_t,
1148 		cache,
1149 		nscd_cfg_stat_global_data_t,
1150 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1151 
1152 	NSCD_CFG_STAT_DESC(
1153 		"global-cache-queries-queued",
1154 		NSCD_CFG_DATA_INTEGER,
1155 		NSCD_CFG_SFLAG_GLOBAL,
1156 		wait_count,
1157 		nscd_cfg_stat_cache_t,
1158 		cache,
1159 		nscd_cfg_stat_global_data_t,
1160 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1161 
1162 	NSCD_CFG_STAT_DESC(
1163 		"global-total-cache-entries",
1164 		NSCD_CFG_DATA_INTEGER,
1165 		NSCD_CFG_SFLAG_GLOBAL,
1166 		entries,
1167 		nscd_cfg_stat_cache_t,
1168 		cache,
1169 		nscd_cfg_stat_global_data_t,
1170 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1171 
1172 	NSCD_CFG_STAT_DESC(
1173 		"global-complete-cache-invalidations",
1174 		NSCD_CFG_DATA_INTEGER,
1175 		NSCD_CFG_SFLAG_GLOBAL,
1176 		invalidate_count,
1177 		nscd_cfg_stat_cache_t,
1178 		cache,
1179 		nscd_cfg_stat_global_data_t,
1180 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1181 
1182 	NSCD_CFG_STAT_DESC(
1183 		"global-cache-queries-dropped",
1184 		NSCD_CFG_DATA_INTEGER,
1185 		NSCD_CFG_SFLAG_GLOBAL,
1186 		drop_count,
1187 		nscd_cfg_stat_cache_t,
1188 		cache,
1189 		nscd_cfg_stat_global_data_t,
1190 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1191 
1192 	NSCD_CFG_STAT_DESC(
1193 		"global-cache-hit-rate",
1194 		NSCD_CFG_DATA_PERCENT,
1195 		NSCD_CFG_SFLAG_GLOBAL,
1196 		hitrate,
1197 		nscd_cfg_stat_cache_t,
1198 		cache,
1199 		nscd_cfg_stat_global_data_t,
1200 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1201 
1202 	/* non-global stat from this point on */
1203 
1204 	NSCD_CFG_SGROUP_DESC(
1205 		"stat-group-switch",
1206 		NSCD_CFG_DATA_NONE,
1207 		NSCD_CFG_SFLAG_GROUP,
1208 		NSCD_CFG_STAT_GROUP_INFO_SWITCH,
1209 		cache,
1210 		nscd_cfg_stat_nsw_db_data_t,
1211 		_nscd_cfg_switch_get_stat),
1212 
1213 	NSCD_CFG_STAT_DESC(
1214 		"lookup-request-received",
1215 		NSCD_CFG_DATA_INTEGER,
1216 		NSCD_CFG_SFLAG_NONE,
1217 		lookup_request_received,
1218 		nscd_cfg_stat_switch_t,
1219 		sw,
1220 		nscd_cfg_stat_nsw_db_data_t,
1221 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1222 
1223 	NSCD_CFG_STAT_DESC(
1224 		"lookup-request-queued",
1225 		NSCD_CFG_DATA_INTEGER,
1226 		NSCD_CFG_SFLAG_NONE,
1227 		lookup_request_queued,
1228 		nscd_cfg_stat_switch_t,
1229 		sw,
1230 		nscd_cfg_stat_nsw_db_data_t,
1231 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1232 
1233 	NSCD_CFG_STAT_DESC(
1234 		"lookup-request-in-progress",
1235 		NSCD_CFG_DATA_INTEGER,
1236 		NSCD_CFG_SFLAG_NONE,
1237 		lookup_request_in_progress,
1238 		nscd_cfg_stat_switch_t,
1239 		sw,
1240 		nscd_cfg_stat_nsw_db_data_t,
1241 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1242 
1243 	NSCD_CFG_STAT_DESC(
1244 		"lookup-request-succeeded",
1245 		NSCD_CFG_DATA_INTEGER,
1246 		NSCD_CFG_SFLAG_NONE,
1247 		lookup_request_succeeded,
1248 		nscd_cfg_stat_switch_t,
1249 		sw,
1250 		nscd_cfg_stat_nsw_db_data_t,
1251 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1252 
1253 	NSCD_CFG_STAT_DESC(
1254 		"lookup-request-failed",
1255 		NSCD_CFG_DATA_INTEGER,
1256 		NSCD_CFG_SFLAG_NONE,
1257 		lookup_request_failed,
1258 		nscd_cfg_stat_switch_t,
1259 		sw,
1260 		nscd_cfg_stat_nsw_db_data_t,
1261 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1262 
1263 	NSCD_CFG_STAT_DESC(
1264 		"loopback-nsw-db-skipped",
1265 		NSCD_CFG_DATA_INTEGER,
1266 		NSCD_CFG_SFLAG_NONE,
1267 		loopback_nsw_db_skipped,
1268 		nscd_cfg_stat_switch_t,
1269 		sw,
1270 		nscd_cfg_stat_nsw_db_data_t,
1271 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1272 
1273 	NSCD_CFG_SGROUP_DESC(
1274 		"stat-group-cache",
1275 		NSCD_CFG_DATA_NONE,
1276 		NSCD_CFG_SFLAG_GROUP,
1277 		NSCD_CFG_STAT_GROUP_INFO_CACHE,
1278 		cache,
1279 		nscd_cfg_stat_nsw_db_data_t,
1280 		_nscd_cfg_cache_get_stat),
1281 
1282 	NSCD_CFG_STAT_DESC(
1283 		"cache-hits-on-positive",
1284 		NSCD_CFG_DATA_INTEGER,
1285 		NSCD_CFG_SFLAG_NONE,
1286 		pos_hits,
1287 		nscd_cfg_stat_cache_t,
1288 		cache,
1289 		nscd_cfg_stat_nsw_db_data_t,
1290 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1291 
1292 	NSCD_CFG_STAT_DESC(
1293 		"cache-hits-on-negative",
1294 		NSCD_CFG_DATA_INTEGER,
1295 		NSCD_CFG_SFLAG_NONE,
1296 		neg_hits,
1297 		nscd_cfg_stat_cache_t,
1298 		cache,
1299 		nscd_cfg_stat_nsw_db_data_t,
1300 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1301 
1302 	NSCD_CFG_STAT_DESC(
1303 		"cache-misses-on-positive",
1304 		NSCD_CFG_DATA_INTEGER,
1305 		NSCD_CFG_SFLAG_NONE,
1306 		pos_misses,
1307 		nscd_cfg_stat_cache_t,
1308 		cache,
1309 		nscd_cfg_stat_nsw_db_data_t,
1310 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1311 
1312 	NSCD_CFG_STAT_DESC(
1313 		"cache-misses-on-negative",
1314 		NSCD_CFG_DATA_INTEGER,
1315 		NSCD_CFG_SFLAG_NONE,
1316 		neg_misses,
1317 		nscd_cfg_stat_cache_t,
1318 		cache,
1319 		nscd_cfg_stat_nsw_db_data_t,
1320 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1321 
1322 	NSCD_CFG_STAT_DESC(
1323 		"cache-queries-queued",
1324 		NSCD_CFG_DATA_INTEGER,
1325 		NSCD_CFG_SFLAG_NONE,
1326 		wait_count,
1327 		nscd_cfg_stat_cache_t,
1328 		cache,
1329 		nscd_cfg_stat_nsw_db_data_t,
1330 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1331 
1332 	NSCD_CFG_STAT_DESC(
1333 		"total-cache-entries",
1334 		NSCD_CFG_DATA_INTEGER,
1335 		NSCD_CFG_SFLAG_NONE,
1336 		entries,
1337 		nscd_cfg_stat_cache_t,
1338 		cache,
1339 		nscd_cfg_stat_nsw_db_data_t,
1340 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1341 
1342 	NSCD_CFG_STAT_DESC(
1343 		"complete-cache-invalidations",
1344 		NSCD_CFG_DATA_INTEGER,
1345 		NSCD_CFG_SFLAG_NONE,
1346 		invalidate_count,
1347 		nscd_cfg_stat_cache_t,
1348 		cache,
1349 		nscd_cfg_stat_nsw_db_data_t,
1350 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1351 
1352 	NSCD_CFG_STAT_DESC(
1353 		"cache-hit-rate",
1354 		NSCD_CFG_DATA_PERCENT,
1355 		NSCD_CFG_SFLAG_NONE,
1356 		hitrate,
1357 		nscd_cfg_stat_cache_t,
1358 		cache,
1359 		nscd_cfg_stat_nsw_db_data_t,
1360 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1361 
1362 	NSCD_CFG_STAT_DESC(
1363 		"cache-queries-dropped",
1364 		NSCD_CFG_DATA_PERCENT,
1365 		NSCD_CFG_SFLAG_NONE,
1366 		drop_count,
1367 		nscd_cfg_stat_cache_t,
1368 		cache,
1369 		nscd_cfg_stat_nsw_db_data_t,
1370 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1371 
1372 
1373 	NSCD_CFG_SGROUP_DESC_NULL
1374 };
1375 
1376 /* number of entries in the static tables */
1377 
1378 int _nscd_cfg_num_nsw_src =
1379 	(sizeof (_nscd_cfg_nsw_src) /
1380 		sizeof (_nscd_cfg_nsw_src[0]) - 1);
1381 
1382 int _nscd_cfg_num_smf_services =
1383 	(sizeof (_nscd_cfg_smf_services) /
1384 		sizeof (_nscd_cfg_smf_services[0]) - 1);
1385 
1386 /* number of supported nsw databases (including pseudo ones) */
1387 int _nscd_cfg_num_nsw_db_all =
1388 	(sizeof (_nscd_cfg_nsw_db) /
1389 		sizeof (_nscd_cfg_nsw_db[0]) - 1);
1390 
1391 /* number of supported nsw databases (not including pseudo ones) */
1392 int _nscd_cfg_num_nsw_db =
1393 	(sizeof (_nscd_cfg_nsw_db) /
1394 		sizeof (_nscd_cfg_nsw_db[0]) - 1) -
1395 		NSS_DBNAM_COMPAT_NUM_DB;
1396 
1397 static int _nscd_cfg_num_param =
1398 	(sizeof (_nscd_cfg_param_desc) /
1399 		sizeof (_nscd_cfg_param_desc[0]) - 1);
1400 
1401 static int _nscd_cfg_num_stat =
1402 	(sizeof (_nscd_cfg_stat_desc) /
1403 		sizeof (_nscd_cfg_stat_desc[0]) - 1);
1404 
1405 int _nscd_cfg_num_nsw_default =
1406 	(sizeof (_nscd_cfg_nsw_spc_default) /
1407 		sizeof (_nscd_cfg_nsw_spc_default[0]) - 1);
1408 
1409 int _nscd_cfg_num_link_default =
1410 	(sizeof (_nscd_cfg_nsw_link_default) /
1411 		sizeof (_nscd_cfg_nsw_link_default[0]) - 1);
1412 
1413 #ifdef	__cplusplus
1414 }
1415 #endif
1416 
1417 #endif	/* _NSCD_CFGDEF_H */
1418