Update.
[glibc/history.git] / nscd / nscd.h
blob48355426199e24768dce65c716408e5406befded
1 /* Copyright (c) 1998 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1998.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
20 #ifndef _NSCD_H
21 #define _NSCD_H 1
23 #include <grp.h>
24 #include <pwd.h>
26 /* Version number of the daemon interface */
27 #define NSCD_VERSION 1
29 /* How many threads do we spawn maximal ? */
30 #define MAX_NUM_CONNECTIONS 16
32 /* Services provided */
33 typedef enum
35 GETPWBYNAME,
36 GETPWBYUID,
37 GETGRBYNAME,
38 GETGRBYGID,
39 GETHOSTBYNAME,
40 GETHOSTBYADDR,
41 SHUTDOWN, /* Shut the server down */
42 GETSTAT /* Get the server statistic */
43 } request_type;
45 /* Header common to all requests */
46 typedef struct
48 /* Version number of the daemon interface */
49 int version;
50 /* Service requested */
51 request_type type;
52 /* key len */
53 ssize_t key_len;
54 } request_header;
56 typedef struct
58 int version;
59 int found;
60 ssize_t pw_name_len;
61 ssize_t pw_passwd_len;
62 uid_t pw_uid;
63 gid_t pw_gid;
64 ssize_t pw_gecos_len;
65 ssize_t pw_dir_len;
66 ssize_t pw_shell_len;
67 } pw_response_header;
69 typedef struct
71 int version;
72 int found;
73 ssize_t gr_name_len;
74 ssize_t gr_passwd_len;
75 gid_t gr_gid;
76 ssize_t gr_mem_len;
77 } gr_response_header;
79 typedef struct
81 int debug_level;
82 int pw_enabled;
83 unsigned long pw_poshit;
84 unsigned long pw_posmiss;
85 unsigned long pw_neghit;
86 unsigned long pw_negmiss;
87 unsigned long pw_size;
88 unsigned long pw_posttl;
89 unsigned long pw_negttl;
90 int gr_enabled;
91 unsigned long gr_poshit;
92 unsigned long gr_posmiss;
93 unsigned long gr_neghit;
94 unsigned long gr_negmiss;
95 unsigned long gr_size;
96 unsigned long gr_posttl;
97 unsigned long gr_negttl;
98 } stat_response_header;
100 #define _PATH_NSCDPID "/var/run/nscd.pid"
101 #define _PATH_NSCDSOCKET "/var/run/.nscd_socket"
102 #define _PATH_NSCDCONF "/etc/nscd.conf"
104 typedef struct
106 char *key;
107 int conn;
108 } param_t;
110 extern int do_shutdown; /* 1 if we should quit the programm. */
111 extern int disabled_passwd;
112 extern int disabled_group;
114 extern int nscd_parse_file __P ((const char *fname));
115 extern int set_logfile __P ((const char *logfile));
116 extern void set_pos_pwd_ttl __P ((unsigned long));
117 extern void set_neg_pwd_ttl __P ((unsigned long));
118 extern void set_pos_grp_ttl __P ((unsigned long));
119 extern void set_neg_grp_ttl __P ((unsigned long));
120 extern void set_pwd_modulo __P ((unsigned long));
121 extern void set_grp_modulo __P ((unsigned long));
123 extern void init_sockets __P ((void));
124 extern void close_socket __P ((int conn));
125 extern void close_sockets __P ((void));
126 extern void get_request __P ((int *conn, request_header *req, char **key));
127 extern void pw_send_answer __P ((int conn, struct passwd *pwd));
128 extern void pw_send_disabled __P ((int conn));
129 extern void gr_send_answer __P ((int conn, struct group *grp));
130 extern void gr_send_disabled __P ((int conn));
132 extern int cache_pwdinit __P ((void));
133 extern void *cache_getpwnam __P ((void *param));
134 extern void *cache_getpwuid __P ((void *param));
135 extern void *cache_pw_disabled __P ((void *param));
137 extern int cache_grpinit __P ((void));
138 extern void *cache_getgrnam __P ((void *param));
139 extern void *cache_getgrgid __P ((void *param));
140 extern void *cache_gr_disabled __P ((void *param));
142 extern int __nscd_open_socket __P ((void));
144 extern void get_pw_stat __P ((stat_response_header *resp));
145 extern void get_gr_stat __P ((stat_response_header *resp));
146 extern void print_stat __P ((void));
147 extern void stat_send __P ((int conn, stat_response_header *resp));
149 #endif