/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#ifndef _NSCD_H
#define _NSCD_H
/*
* This is a private header file. Applications should not directly include
* this file.
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <thread.h>
#include <synch.h>
#include <nss_dbdefs.h>
#include "getxby_door.h"
#include "nscd_common.h"
#include "nscd_config.h"
/*
* OR'D in by server to call self for updates
*/
/*
* debug levels
*/
#define DBG_OFF 0
/*
* Max size name we allow to be passed to avoid
* buffer overflow problems
*/
/*
* cached entry status
*/
/*
* Cache eviction start and stop levels
*/
/*
* other internal constants
*/
/*
* Macros used for logging purposes
*/
/*
* Macros used by compare routines
*/
/*
* nsc_lookup action
*/
typedef enum {
_NSC_NSLOOKUP = 0,
} nsc_action_t;
/*
* What each entry in the nameserver cache looks like.
*/
typedef struct nsc_entry_stat {
typedef struct nsc_entry {
} nsc_entry_t;
typedef struct nsc_keephot {
void *ptr;
/*
* Structure to handle waiting for pending name service requests
*/
typedef struct waiter {
} waiter_t;
/*
* Macros used by hash table
*
* _NSC_HTSIZE_PRIMES are prime numbers that are used as hash table
* sizes when hash table type is nsc_ht_prime. For hash tables of
* type nsc_ht_power2, the size is automatically calculated.
* Number of primes listed below is _NSC_HTSIZE_NUM_SLOTS + 1.
* Each number (except the first) is a prime closest to a
* power of 2 in increasing order. Ex: 509 is the closest prime to
* 512 (2**9), 1021 is closest to 1024 (2**10), and so on.
* The first prime is chosen as 211 for historical reasons.
*/
16381, 32771, 65537, 131071, 262147
/*
* cache backend param group (global)
*/
typedef struct nscd_cfg_global_cache {
#define NSCD_CFG_GLOBAL_CACHE_DEFAULTS \
/*
* cache backend param group (per database)
*/
typedef struct nscd_cfg_cache {
#define NSCD_CFG_CACHE_DEFAULTS \
{ \
0, nscd_false \
}
/*
* cache backend stat group (per database)
*/
typedef struct nscd_cfg_stat_cache {
typedef struct nsc_db {
/*
* Data
*/
int callnumber;
int dbop;
char *name;
int htsize;
enum hash_type {
nsc_ht_default = 0,
} hash_type;
enum db_type {
nsc_key_ces = 0,
} db_type;
/*
* Methods
*/
int (*compar)(const void *, const void *);
/*
* Config
*/
} nsc_db_t;
typedef struct nsc_ctx {
} nsc_ctx_t;
typedef struct nsc_lookup_args {
void *buffer;
/* Context initialization */
extern void passwd_init_ctx(nsc_ctx_t *);
extern void group_init_ctx(nsc_ctx_t *);
extern void host_init_ctx(nsc_ctx_t *);
extern void ipnode_init_ctx(nsc_ctx_t *);
extern void exec_init_ctx(nsc_ctx_t *);
extern void prof_init_ctx(nsc_ctx_t *);
extern void user_init_ctx(nsc_ctx_t *);
extern void ether_init_ctx(nsc_ctx_t *);
extern void rpc_init_ctx(nsc_ctx_t *);
extern void proto_init_ctx(nsc_ctx_t *);
extern void net_init_ctx(nsc_ctx_t *);
extern void bootp_init_ctx(nsc_ctx_t *);
extern void auth_init_ctx(nsc_ctx_t *);
extern void serv_init_ctx(nsc_ctx_t *);
extern void netmask_init_ctx(nsc_ctx_t *);
extern void printer_init_ctx(nsc_ctx_t *);
extern void project_init_ctx(nsc_ctx_t *);
extern void tnrhtp_init_ctx(nsc_ctx_t *);
extern void tnrhdb_init_ctx(nsc_ctx_t *);
/* Functions used to throttle threads */
/* Cache creation and initialization */
extern nscd_rc_t init_cache();
int (*compar) (const void *, const void *),
enum hash_type, int);
/* Cache backend lookup */
extern void nsc_lookup(nsc_lookup_args_t *, int);
/* Cache backend info */
#ifdef NSCD_DEBUG
extern int nsc_dump(char *, int);
#endif /* NSCD_DEBUG */
/* Cache invalidate */
/* Keep hot functions */
extern nsc_keephot_t *maken(int);
/* hash related routines */
extern uint_t cis_gethash(const char *, int);
extern uint_t ces_gethash(const char *, int);
extern uint_t db_gethash(const void *, int, int);
extern void leave(int n);
extern int get_cache_idx(char *);
#ifdef __cplusplus
}
#endif
#endif /* _NSCD_H */