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