c6951277356c2100d254572474a20513259cd2b3
[kai/samba.git] / source3 / nsswitch / hp_nss_dbdefs.h
1 #ifndef _HP_NSS_DBDEFS_H
2 #define _HP_NSS_DBDEFS_H
3
4 /*
5    Unix SMB/Netbios implementation.
6    Version 2.2
7  
8    Donated by HP to enable Winbindd to build on HPUX 11.x.
9    Copyright (C) Jeremy Allison 2002.
10  
11    This library is free software; you can redistribute it and/or
12    modify it under the terms of the GNU Library General Public
13    License as published by the Free Software Foundation; either
14    version 2 of the License, or (at your option) any later version.
15  
16    This library is distributed in the hope that it will be useful,
17    but WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19    Library General Public License for more details.
20  
21    You should have received a copy of the GNU Library General Public
22    License along with this library; if not, write to the
23    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24    Boston, MA  02111-1307, USA.
25 */
26
27 #include <errno.h>
28 #include <netdb.h>
29 #include <limits.h>
30  
31 #ifndef NSS_INCLUDE_UNSAFE
32 #define NSS_INCLUDE_UNSAFE      1       /* Build old, MT-unsafe interfaces, */
33 #endif  /* NSS_INCLUDE_UNSAFE */
34  
35 enum nss_netgr_argn {
36         NSS_NETGR_MACHINE,
37         NSS_NETGR_USER,
38         NSS_NETGR_DOMAIN,
39         NSS_NETGR_N
40 };
41  
42 enum nss_netgr_status {
43         NSS_NETGR_FOUND,
44         NSS_NETGR_NO,
45         NSS_NETGR_NOMEM
46 };
47  
48 typedef unsigned nss_innetgr_argc;
49 typedef char **nss_innetgr_argv;
50  
51 struct nss_innetgr_1arg {
52         nss_innetgr_argc argc;
53         nss_innetgr_argv argv;
54 };
55  
56 typedef struct {
57         void *result;        /* "result" parameter to getXbyY_r() */
58         char *buffer;        /* "buffer"     "             "      */
59         int buflen;         /* "buflen"     "             "      */
60 } nss_XbyY_buf_t;
61  
62 extern nss_XbyY_buf_t *_nss_XbyY_buf_alloc(int struct_size, int buffer_size);
63 extern void _nss_XbyY_buf_free(nss_XbyY_buf_t *);
64  
65 union nss_XbyY_key {
66         uid_t uid;
67         gid_t gid;
68         const char *name;
69         int number;
70         struct {
71                 long net;
72                 int type;
73         } netaddr;
74         struct {
75                 const char *addr;
76                 int len;
77                 int type;
78         } hostaddr;
79         struct {
80                 union {
81                         const char *name;
82                         int port;
83                 } serv;
84                 const char *proto;
85         } serv;
86         void *ether;
87 };
88  
89 typedef struct nss_XbyY_args {
90         nss_XbyY_buf_t  buf;
91         int stayopen;
92         /*
93          * Support for setXXXent(stayopen)
94          * Used only in hosts, protocols,
95          * networks, rpc, and services.
96          */
97         int (*str2ent)(const char *instr, int instr_len, void *ent, char *buffer, int buflen);
98         union nss_XbyY_key key;
99  
100         void *returnval;
101         int erange;
102         int h_errno;
103         nss_status_t status;
104 } nss_XbyY_args_t;
105  
106 #endif /* _NSS_DBDEFS_H */