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