cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * CDDL HEADER START
cb5caa98562cf06753163f558cbcfe30b8f4673adjl *
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * The contents of this file are subject to the terms of the
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * Common Development and Distribution License (the "License").
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * You may not use this file except in compliance with the License.
cb5caa98562cf06753163f558cbcfe30b8f4673adjl *
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * or http://www.opensolaris.org/os/licensing.
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * See the License for the specific language governing permissions
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * and limitations under the License.
cb5caa98562cf06753163f558cbcfe30b8f4673adjl *
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * When distributing Covered Code, include this CDDL HEADER in each
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * If applicable, add the following below this CDDL HEADER, with the
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * fields enclosed by brackets "[]" replaced with your own identifying
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * information: Portions Copyright [yyyy] [name of copyright owner]
cb5caa98562cf06753163f558cbcfe30b8f4673adjl *
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * CDDL HEADER END
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
29836b1990ff03408750301a4ad20cfd233444b9michen * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * Use is subject to license terms.
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#ifndef _NSCD_CONFIG_H
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define _NSCD_CONFIG_H
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#pragma ident "%Z%%M% %I% %E% SMI"
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#ifdef __cplusplus
cb5caa98562cf06753163f558cbcfe30b8f4673adjlextern "C" {
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#endif
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#include <stdio.h>
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#include "nscd_common.h"
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * nscd_cfg_id_t is used to identify a config/stat
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * object. 'index' provides a way to quickly locate
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * the object in the associated configuration list.
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * 'name' can be looked up in the config info database
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * to obtain the index.
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef struct {
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int index;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl char *name;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl} nscd_cfg_id_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * forward declaration of nscd_cfg_param_desc_t
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjlstruct nscd_cfg_param_desc;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * for operations that apply to configuration data
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * in all the nsswitch databases
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_NSW_ALLDB "ALLDB"
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_NSW_ALLDB_INDEX 9999
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * configuration lists includes switch databases (eg. hosts, passwd),
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * switch sources (eg. files, ldap), config parameter descriptions
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * (defined below), and status/statistic counter descriptions (defined
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * below)
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef struct {
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int num;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_id_t **list;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl} nscd_cfg_list_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * type of configuration list
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef enum {
cb5caa98562cf06753163f558cbcfe30b8f4673adjl NSCD_CFG_LIST_NSW_DB = 0,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl NSCD_CFG_LIST_NSW_SRC = 1,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl NSCD_CFG_LIST_PARAM = 2,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl NSCD_CFG_LIST_STAT = 3
cb5caa98562cf06753163f558cbcfe30b8f4673adjl} nscd_cfg_list_type_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * A config handle identifies config or stat data,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * which if is nsswitch database specific, 'nswdb'
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * indicates the id of the database; if global,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * 'nswdb' should be null. 'desc' is the config
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * param or stat description assocaited with the
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * data.
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef struct {
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_id_t *nswdb;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl void *desc;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_list_type_t type;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl} nscd_cfg_handle_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * type of configuration/statistics data
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef enum {
cb5caa98562cf06753163f558cbcfe30b8f4673adjl NSCD_CFG_DATA_NONE = 0,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl NSCD_CFG_DATA_INTEGER = 1,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl NSCD_CFG_DATA_BOOLEAN = 2,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl NSCD_CFG_DATA_STRING = 3,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl NSCD_CFG_DATA_BITMAP = 4,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl NSCD_CFG_DATA_PERCENT = 5
cb5caa98562cf06753163f558cbcfe30b8f4673adjl} nscd_cfg_data_type_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_NUM_DATA_TYPE 5
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * data flag is attached to config/stat data passed between
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * function to specify the nature/type of action to perform
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_DFLAG_NONE 0x0000
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * data should not be freed by receiver;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * otherwise it should be freed
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_DFLAG_STATIC_DATA 0x0001
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * data is sent/received due to nscd initialization;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * otherwise due to modification of the config data
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * requested by users
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_DFLAG_INIT 0x0002
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * the entire group of data is, or should be, sent;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * otherwise only a single parameter/stat value
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_DFLAG_GROUP 0x0004
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * the data sent/received is to be verified by the
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * 'verify' function defined in the parameter
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * description
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_DFLAG_VERIFY 0x0008
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * the data sent/received is to be processed by the
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * 'notify' function defined in the parameter
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * description
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_DFLAG_NOTIFY 0x0010
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * the data sent/received is to be applied to all
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * nsswitch databases
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_DFLAG_SET_ALL_DB 0x0020
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * the entire group of data is sent/received;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * however, only those parameters selected by
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * the bitmap in the group info should be
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * processed
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_DFLAG_BIT_SELECTED 0x0040
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * param flag is defined in the parameter description.
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * It specifies what operation should be applied to, or
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * the nature of, the config parameters.
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_PFLAG_NONE 0x0000
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * At init/refresh time, send the parameter value
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * with the data of the entire group; otherwise
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * send the parameter value only
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_PFLAG_INIT_SEND_WHOLE_GROUP 0x0001
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * At user requested update time, send the parameter
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * value with the data of the entire group; otherwise
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * send the parameter value only
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_PFLAG_UPDATE_SEND_WHOLE_GROUP 0x0002
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * At init/refresh time, send the config data
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * once for each nsswitch database
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_PFLAG_INIT_SET_ALL_DB 0x0004
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * At user requested update time, send the per nsswitch
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * database (non-global) data just one time (not once
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * for each nsswitch database)
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_PFLAG_UPDATE_SEND_NON_GLOBAL_ONCE 0x0008
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * send entire group data, but use bitmap to indicate
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * the one config parameter being processed. This flag
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * can only be sepcified for a group description
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_PFLAG_SEND_BIT_SELECTED 0x0010
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * data is global, not per nsswitch database
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_PFLAG_GLOBAL 0x0020
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * data is group data, not individual parameter value
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_PFLAG_GROUP 0x0040
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * data is of variable length
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_PFLAG_VLEN_DATA 0x0080
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * data is hidden, for internal use only, get/set not allowed
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_PFLAG_HIDDEN 0x0100
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * data is linked, using the value of a different database
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_PFLAG_LINKED 0x0200
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * data is obsolete, ignored with warning, should not be displayed
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_PFLAG_OBSOLETE 0x0400
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * structure for error reporting
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef struct {
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_rc_t rc;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl char *msg;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl} nscd_cfg_error_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * typedef for flag, bitmap, and boolean
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef int nscd_cfg_flag_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef int nscd_cfg_bitmap_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * struct nscd_cfg_param_desc is used to describe each and
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * every one of the nscd config parameters so that they can
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * be processed generically by the configuration management
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * component. During init or update time, config data needs
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * to be pushed to other nscd components (frontend, switch
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * engine, cache backend, and so on) for further processing.
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * The 'verify' and 'notify' functions are the hooks provided
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * by these other components to validate and store the new
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * config data. The 'p_check' field, if specified, points
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * to a set of data used for preliminary check of a parameter
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * value (range, length, null checking etc).
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
0dfdd7f38ea07ffc9a4b245c94185c923f4bb0a3michentypedef nscd_rc_t (*nscd_cfg_func_notify_t)(void *,
0dfdd7f38ea07ffc9a4b245c94185c923f4bb0a3michen struct nscd_cfg_param_desc *,
0dfdd7f38ea07ffc9a4b245c94185c923f4bb0a3michen nscd_cfg_id_t *,
0dfdd7f38ea07ffc9a4b245c94185c923f4bb0a3michen nscd_cfg_flag_t,
0dfdd7f38ea07ffc9a4b245c94185c923f4bb0a3michen nscd_cfg_error_t **,
0dfdd7f38ea07ffc9a4b245c94185c923f4bb0a3michen void *);
0dfdd7f38ea07ffc9a4b245c94185c923f4bb0a3michentypedef nscd_rc_t (*nscd_cfg_func_verify_t)(void *,
0dfdd7f38ea07ffc9a4b245c94185c923f4bb0a3michen struct nscd_cfg_param_desc *,
0dfdd7f38ea07ffc9a4b245c94185c923f4bb0a3michen nscd_cfg_id_t *,
0dfdd7f38ea07ffc9a4b245c94185c923f4bb0a3michen nscd_cfg_flag_t,
0dfdd7f38ea07ffc9a4b245c94185c923f4bb0a3michen nscd_cfg_error_t **,
0dfdd7f38ea07ffc9a4b245c94185c923f4bb0a3michen void **);
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef struct nscd_cfg_param_desc {
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_id_t id;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_data_type_t type;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_flag_t pflag;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int p_size;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl size_t p_offset;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int p_fn;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int g_size;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl size_t g_offset;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int g_index;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl void *p_check;
0dfdd7f38ea07ffc9a4b245c94185c923f4bb0a3michen nscd_cfg_func_notify_t notify;
0dfdd7f38ea07ffc9a4b245c94185c923f4bb0a3michen nscd_cfg_func_verify_t verify;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl} nscd_cfg_param_desc_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * the _nscd_cfg_get_param_desc_list function returns
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * the list of nscd config param descriptions at
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * run time
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef struct {
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int num;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_param_desc_t **list;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl} nscd_cfg_param_desc_list_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/* this describes data of variable length */
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef struct {
cb5caa98562cf06753163f558cbcfe30b8f4673adjl void *ptr;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int len;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl} nscd_cfg_vlen_data_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * The following defines the various global and nsswitch
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * database specific data structures for all the groups of
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * configuration parameters. Before each one, there lists
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * the associated group info which contains the number of
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * parameters and the corresponding bitmap.
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef struct {
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int num_param;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_bitmap_t bitmap;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl} nscd_cfg_group_info_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_GROUP_INFO_NULL {-1, 0x0000}
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * frontend param group (Per nsswitch database)
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_GROUP_INFO_FRONTEND {1, 0x0001}
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef struct {
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_group_info_t gi;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int worker_thread_per_nsw_db;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl} nscd_cfg_frontend_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * switch engine param group (Per nsswitch database)
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_GROUP_INFO_SWITCH {7, 0x07f}
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef struct {
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_group_info_t gi;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl char *nsw_config_string;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl char *nsw_config_db;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_bool_t enable_lookup;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_bool_t enable_loopback_checking;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int max_nsw_state_per_db;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int max_nsw_state_per_thread;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int max_getent_ctx_per_db;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl} nscd_cfg_switch_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * log/debug param group (global)
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_GROUP_INFO_GLOBAL_LOG {3, 0x0007}
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef struct {
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_group_info_t gi;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl char *logfile;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int debug_level;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int debug_comp;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl} nscd_cfg_global_log_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * frontend param group (global)
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_GROUP_INFO_GLOBAL_FRONTEND {2, 0x0003}
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef struct {
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_group_info_t gi;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int common_worker_threads;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int cache_hit_threads;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl} nscd_cfg_global_frontend_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * self credential param group (global)
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
29836b1990ff03408750301a4ad20cfd233444b9michen#define NSCD_CFG_GROUP_INFO_GLOBAL_SELFCRED {2, 0x0003}
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef struct {
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_group_info_t gi;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_bool_t enable_selfcred;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int per_user_nscd_ttl;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl} nscd_cfg_global_selfcred_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * switch engine param group (global)
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_GROUP_INFO_GLOBAL_SWITCH {3, 0x0007}
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef struct {
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_group_info_t gi;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_bool_t enable_lookup_g;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_bool_t enable_loopback_checking_g;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int check_smf_state_interval_g;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl} nscd_cfg_global_switch_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * nscd_cfg_param_desc_t should always have nscd_cfg_id_t
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * as its first field. _nscd_cfg_get_desc below provides
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * an way to get to the nscd_cfg_param_desc_t from a
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * pointer to the static nscd_cfg_id_t returned by the
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * various_nscd_cfg_* functions
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define _nscd_cfg_get_desc_i(id) ((nscd_cfg_param_desc_t *)(id))
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define _nscd_cfg_get_desc(h) ((h)->desc)
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * The various param group structure should always have
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * nscd_cfg_group_info_t as its first field.
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * _nscd_cfg_get_gi below provides a generic way to
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * get to the nscd_cfg_group_info_t from a void pointer
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * to the various param group structure returned by the
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * _nscd_cfg_* functions
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define _nscd_cfg_get_gi(voidp) ((nscd_cfg_group_info_t *)(voidp))
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * It is possible in the future, we will need more bits
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * than those in nscd_cfg_flag_t and nscd_cfg_bitmap_t. To
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * make it easier to extend, the following macro should be
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * used to deal with flags and bitmaps.
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * m, m1, m2, ma: mask, n: nth bit (0 based)
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * f: flag, v: value
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_BITMAP_ZERO 0
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define _nscd_cfg_bitmap_is_set(m, n) (((m) >> n) & 1)
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define _nscd_cfg_bitmap_is_not_set(m, n) (!(((m) >> n) & 1))
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define _nscd_cfg_bitmap_is_equal(m1, m2) ((m1) == (m2))
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define _nscd_cfg_bitmap_value(m) (m)
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define _nscd_cfg_bitmap_set_nth(m, n) ((m) |= (1 << n))
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define _nscd_cfg_bitmap_set(ma, m) (*(nscd_cfg_bitmap_t *) \
cb5caa98562cf06753163f558cbcfe30b8f4673adjl (ma) = (m))
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define _nscd_cfg_bitmap_valid(m1, m2) (((m1) & ~(m2)) == 0)
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_FLAG_ZERO 0
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define _nscd_cfg_flag_is_set(f, v) ((f) & (v))
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define _nscd_cfg_flag_is_not_set(f, v) (!((f) & (v)))
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define _nscd_cfg_flag_value(f) (f)
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define _nscd_cfg_flag_set(f, v) ((f) | (v))
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define _nscd_cfg_flag_unset(f, v) ((f) & ~(v))
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * handy macros
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_NULL "NULL"
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_MAX_ERR_MSG_LEN 1024
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_STR_OR_NULL(s) ((s) == NULL ? "NULL" : (s))
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_STR_OR_GLOBAL(s) ((s) == NULL ? "GLOBAL" : (s))
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_Y_OR_N(s) (*(nscd_bool_t *)s == nscd_true ? \
cb5caa98562cf06753163f558cbcfe30b8f4673adjl "yes" : "no")
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_ERR2MSG(e) (((e) && (e)->msg) ? (e)->msg : "")
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * This macro is based on offsetof defined in stddef_iso.h,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * it gives the size of 'm' in structure 's' without needing
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * the declaration of a 's' variable (as macro sizeof does)
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_SIZEOF(s, m) (sizeof (((s *)0)->m))
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * struct nscd_cfg_stat_desc is used to describe each and every
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * one of the nscd statistics counters so that they can be
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * processed generically by the configuration management
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * component. The component does not keep a separate copy of
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * all counters, which should be maintained by other nscd
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * components. The 'get_stat' functions defined in the
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * stat description are supplied by those components and used
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * by the config management component to request and print
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * counters on behave of the users. The free_stat function
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * returned by those components will also be used to free
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * the stat data if the NSCD_CFG_DFLAG_STATIC_DATA bit is
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * not set in dflag.
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
0dfdd7f38ea07ffc9a4b245c94185c923f4bb0a3michenstruct nscd_cfg_stat_desc;
0dfdd7f38ea07ffc9a4b245c94185c923f4bb0a3michentypedef nscd_rc_t (*nscd_cfg_func_get_stat_t)(void **,
0dfdd7f38ea07ffc9a4b245c94185c923f4bb0a3michen struct nscd_cfg_stat_desc *,
0dfdd7f38ea07ffc9a4b245c94185c923f4bb0a3michen nscd_cfg_id_t *,
0dfdd7f38ea07ffc9a4b245c94185c923f4bb0a3michen nscd_cfg_flag_t *,
0dfdd7f38ea07ffc9a4b245c94185c923f4bb0a3michen void (**) (void *),
0dfdd7f38ea07ffc9a4b245c94185c923f4bb0a3michen nscd_cfg_error_t **);
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef struct nscd_cfg_stat_desc {
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_id_t id;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_data_type_t type;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_flag_t sflag;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_group_info_t gi;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int s_size;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl size_t s_offset;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int s_fn;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int g_size;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl size_t g_offset;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int g_index;
0dfdd7f38ea07ffc9a4b245c94185c923f4bb0a3michen nscd_cfg_func_get_stat_t get_stat;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl} nscd_cfg_stat_desc_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * stat flag is defined in the stat description. It
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * specifies the nature of the statistics counters.
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_SFLAG_NONE 0x0000
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * statistics counter is global, not per nsswitch database
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_SFLAG_GLOBAL 0x0001
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * description is for counter group, not individual counter
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_SFLAG_GROUP 0x0002
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * The following defines the various global and nsswitch
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * database specific data structures for all the groups of
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * statistics counters. Before each one, there lists
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * the associated group info which contains the number of
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * counters and the corresponding bitmap.
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * switch engine stat group (Per nsswitch database)
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_STAT_GROUP_INFO_SWITCH {6, 0x003f}
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef struct {
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_group_info_t gi;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int lookup_request_received;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int lookup_request_queued;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int lookup_request_in_progress;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int lookup_request_succeeded;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int lookup_request_failed;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int loopback_nsw_db_skipped;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl} nscd_cfg_stat_switch_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * log/debug stat group (global)
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_STAT_GROUP_INFO_GLOBAL_LOG {1, 0x0001}
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef struct {
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_group_info_t gi;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int entries_logged;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl} nscd_cfg_stat_global_log_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * switch engine stat group (global)
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#define NSCD_CFG_STAT_GROUP_INFO_GLOBAL_SWITCH {6, 0x003f}
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef struct {
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_group_info_t gi;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int lookup_request_received_g;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int lookup_request_queued_g;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int lookup_request_in_progress_g;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int lookup_request_succeeded_g;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int lookup_request_failed_g;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int loopback_nsw_db_skipped_g;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl} nscd_cfg_stat_global_switch_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * control structure for appending string data to a buffer
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjltypedef struct {
cb5caa98562cf06753163f558cbcfe30b8f4673adjl char *buf;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl char *next;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int size;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int used;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int left;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int real;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl} nscd_cfg_buf_t;
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl/*
cb5caa98562cf06753163f558cbcfe30b8f4673adjl * internal configuration management related functions
cb5caa98562cf06753163f558cbcfe30b8f4673adjl */
cb5caa98562cf06753163f558cbcfe30b8f4673adjlnscd_rc_t _nscd_cfg_init();
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjlnscd_rc_t
cb5caa98562cf06753163f558cbcfe30b8f4673adjl_nscd_cfg_get_param_desc_list(
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_param_desc_list_t **list);
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjlnscd_rc_t
cb5caa98562cf06753163f558cbcfe30b8f4673adjl_nscd_cfg_get_handle(
cb5caa98562cf06753163f558cbcfe30b8f4673adjl char *param_name,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl char *nswdb_name,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_handle_t **handle,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_error_t **errorp);
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjlnscd_cfg_error_t *
cb5caa98562cf06753163f558cbcfe30b8f4673adjl_nscd_cfg_make_error(
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_rc_t rc,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl char *msg);
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjlvoid
cb5caa98562cf06753163f558cbcfe30b8f4673adjl_nscd_cfg_free_handle(
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_handle_t *handle);
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjlvoid
cb5caa98562cf06753163f558cbcfe30b8f4673adjl_nscd_cfg_free_group_data(
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_handle_t *handle,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl void *data);
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjlvoid
cb5caa98562cf06753163f558cbcfe30b8f4673adjl_nscd_cfg_free_param_data(
cb5caa98562cf06753163f558cbcfe30b8f4673adjl void *data);
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjlvoid
cb5caa98562cf06753163f558cbcfe30b8f4673adjl_nscd_cfg_free_error(
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_error_t *error);
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjlnscd_rc_t
cb5caa98562cf06753163f558cbcfe30b8f4673adjl_nscd_cfg_get(
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_handle_t *handle,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl void **data,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int *data_len,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_error_t **errorp);
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjlnscd_rc_t
cb5caa98562cf06753163f558cbcfe30b8f4673adjl_nscd_cfg_set(
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_handle_t *handle,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl void *data,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_error_t **errorp);
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjlnscd_rc_t
cb5caa98562cf06753163f558cbcfe30b8f4673adjl_nscd_cfg_str_to_data(
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_param_desc_t *desc,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl char *str,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl void *data,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl void **data_p,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_error_t **errorp);
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjlnscd_rc_t
cb5caa98562cf06753163f558cbcfe30b8f4673adjl_nscd_cfg_prelim_check(
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_param_desc_t *desc,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl void *data,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_error_t **errorp);
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjlnscd_rc_t
cb5caa98562cf06753163f558cbcfe30b8f4673adjl_nscd_cfg_read_file(
cb5caa98562cf06753163f558cbcfe30b8f4673adjl char *filename,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_error_t **errorp);
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjlnscd_rc_t
cb5caa98562cf06753163f558cbcfe30b8f4673adjl_nscd_cfg_set_linked(
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_handle_t *handle,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl void *data,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_error_t **errorp);
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjlchar *
cb5caa98562cf06753163f558cbcfe30b8f4673adjl_nscd_srcs_in_db_nsw_policy(
cb5caa98562cf06753163f558cbcfe30b8f4673adjl int num_src,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl char **srcs);
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjlnscd_rc_t
cb5caa98562cf06753163f558cbcfe30b8f4673adjl_nscd_cfg_read_nsswitch_file(
cb5caa98562cf06753163f558cbcfe30b8f4673adjl char *filename,
cb5caa98562cf06753163f558cbcfe30b8f4673adjl nscd_cfg_error_t **errorp);
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#ifdef __cplusplus
cb5caa98562cf06753163f558cbcfe30b8f4673adjl}
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#endif
cb5caa98562cf06753163f558cbcfe30b8f4673adjl
cb5caa98562cf06753163f558cbcfe30b8f4673adjl#endif /* _NSCD_CONFIG_H */