1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20: #ifndef _NSSWITCH_H
21: #define _NSSWITCH_H 1
22:
23:
24:
25: #include <arpa/nameser.h>
26: #include <netinet/in.h>
27: #include <nss.h>
28: #include <resolv.h>
29: #include <search.h>
30: #include <dlfcn.h>
31:
32:
33: typedef enum
34: {
35: NSS_ACTION_CONTINUE,
36: NSS_ACTION_RETURN
37: } lookup_actions;
38:
39:
40: typedef struct service_library
41: {
42:
43: const char *name;
44:
45: void *lib_handle;
46:
47: struct service_library *next;
48: } service_library;
49:
50:
51:
52:
53:
54: typedef struct
55: {
56: const char *fct_name;
57: void *fct_ptr;
58: } known_function;
59:
60:
61: typedef struct service_user
62: {
63:
64: struct service_user *next;
65:
66: lookup_actions actions[5];
67:
68: service_library *library;
69:
70: void *known;
71:
72: char name[0];
73: } service_user;
74:
75:
76: #define nss_next_action(ni, status) ((ni)->actions[2 + status])
77:
78:
79: typedef struct name_database_entry
80: {
81:
82: struct name_database_entry *next;
83:
84: service_user *service;
85:
86: char name[0];
87: } name_database_entry;
88:
89:
90: typedef struct name_database
91: {
92:
93: name_database_entry *entry;
94:
95: service_library *library;
96: } name_database;
97:
98:
99:
100:
101:
102:
103:
104:
105: extern int __nss_database_lookup (const char *database,
106: const char *alternative_name,
107: const char *defconfig, service_user **ni);
108: libc_hidden_proto (__nss_database_lookup)
109:
110:
111:
112:
113: extern int __nss_lookup (service_user **ni, const char *fct_name, void **fctp);
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128: extern int __nss_next (service_user **ni, const char *fct_name, void **fctp,
129: int status, int all_values);
130: libc_hidden_proto (__nss_next)
131:
132:
133:
134: extern void *__nss_lookup_function (service_user *ni, const char *fct_name);
135: libc_hidden_proto (__nss_lookup_function)
136:
137:
138:
139: extern void __nss_disable_nscd (void);
140:
141:
142: typedef int (*db_lookup_function) (service_user **, const char *, void **)
143: internal_function;
144: typedef enum nss_status (*setent_function) (int);
145: typedef enum nss_status (*endent_function) (void);
146: typedef enum nss_status (*getent_function) (void *, char *, size_t,
147: int *, int *);
148: typedef int (*getent_r_function) (void *, char *, size_t,
149: void **result, int *);
150:
151: extern void __nss_setent (const char *func_name,
152: db_lookup_function lookup_fct,
153: service_user **nip, service_user **startp,
154: service_user **last_nip, int stayon,
155: int *stayon_tmp, int res);
156: extern void __nss_endent (const char *func_name,
157: db_lookup_function lookup_fct,
158: service_user **nip, service_user **startp,
159: service_user **last_nip, int res);
160: extern int __nss_getent_r (const char *getent_func_name,
161: const char *setent_func_name,
162: db_lookup_function lookup_fct,
163: service_user **nip, service_user **startp,
164: service_user **last_nip, int *stayon_tmp,
165: int res,
166: void *resbuf, char *buffer, size_t buflen,
167: void **result, int *h_errnop);
168: extern void *__nss_getent (getent_r_function func,
169: void **resbuf, char **buffer, size_t buflen,
170: size_t *buffer_size, int *h_errnop);
171: struct hostent;
172: extern int __nss_hostname_digits_dots (const char *name,
173: struct hostent *resbuf, char **buffer,
174: size_t *buffer_size, size_t buflen,
175: struct hostent **result,
176: enum nss_status *status, int af,
177: int *h_errnop);
178: libc_hidden_proto (__nss_hostname_digits_dots)
179:
180: #endif