abca40a45bc3fef926d5b64eca79e63f3ccfb3fd
[nivanova/samba-autobuild/.git] / source3 / nsswitch / winbind_nss_hpux.h
1 /*
2    Unix SMB/CIFS implementation.
3  
4    Donated by HP to enable Winbindd to build on HPUX 11.x.
5    Copyright (C) Jeremy Allison 2002.
6  
7    This library is free software; you can redistribute it and/or
8    modify it under the terms of the GNU Library General Public
9    License as published by the Free Software Foundation; either
10    version 3 of the License, or (at your option) any later version.
11  
12    This library is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    Library General Public License for more details.
16  
17    You should have received a copy of the GNU Library General Public
18    License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef _WINBIND_NSS_HPUX_H
22 #define _WINBIND_NSS_HPUX_H
23
24 #include <nsswitch.h>
25
26 #define NSS_STATUS_SUCCESS     NSS_SUCCESS
27 #define NSS_STATUS_NOTFOUND    NSS_NOTFOUND
28 #define NSS_STATUS_UNAVAIL     NSS_UNAVAIL
29 #define NSS_STATUS_TRYAGAIN    NSS_TRYAGAIN
30
31 #ifdef HAVE_SYNCH_H
32 #include <synch.h>
33 #endif
34 #ifdef HAVE_PTHREAD_H
35 #include <pthread.h>
36 #endif
37  
38 typedef enum {
39         NSS_SUCCESS,
40         NSS_NOTFOUND,
41         NSS_UNAVAIL,
42         NSS_TRYAGAIN
43 } nss_status_t;
44  
45 typedef nss_status_t NSS_STATUS;
46
47 struct nss_backend;
48  
49 typedef nss_status_t (*nss_backend_op_t)(struct nss_backend *, void *args);
50  
51 struct nss_backend {
52         nss_backend_op_t *ops;
53         int n_ops;
54 };
55 typedef struct nss_backend nss_backend_t;
56 typedef int nss_dbop_t;
57
58 #include <errno.h>
59 #include <netdb.h>
60 #include <limits.h>
61  
62 #ifndef NSS_INCLUDE_UNSAFE
63 #define NSS_INCLUDE_UNSAFE      1       /* Build old, MT-unsafe interfaces, */
64 #endif  /* NSS_INCLUDE_UNSAFE */
65  
66 enum nss_netgr_argn {
67         NSS_NETGR_MACHINE,
68         NSS_NETGR_USER,
69         NSS_NETGR_DOMAIN,
70         NSS_NETGR_N
71 };
72  
73 enum nss_netgr_status {
74         NSS_NETGR_FOUND,
75         NSS_NETGR_NO,
76         NSS_NETGR_NOMEM
77 };
78  
79 typedef unsigned nss_innetgr_argc;
80 typedef char **nss_innetgr_argv;
81  
82 struct nss_innetgr_1arg {
83         nss_innetgr_argc argc;
84         nss_innetgr_argv argv;
85 };
86  
87 typedef struct {
88         void *result;        /* "result" parameter to getXbyY_r() */
89         char *buffer;        /* "buffer"     "             "      */
90         int buflen;         /* "buflen"     "             "      */
91 } nss_XbyY_buf_t;
92  
93 extern nss_XbyY_buf_t *_nss_XbyY_buf_alloc(int struct_size, int buffer_size);
94 extern void _nss_XbyY_buf_free(nss_XbyY_buf_t *);
95  
96 union nss_XbyY_key {
97         uid_t uid;
98         gid_t gid;
99         const char *name;
100         int number;
101         struct {
102                 long net;
103                 int type;
104         } netaddr;
105         struct {
106                 const char *addr;
107                 int len;
108                 int type;
109         } hostaddr;
110         struct {
111                 union {
112                         const char *name;
113                         int port;
114                 } serv;
115                 const char *proto;
116         } serv;
117         void *ether;
118 };
119  
120 typedef struct nss_XbyY_args {
121         nss_XbyY_buf_t  buf;
122         int stayopen;
123         /*
124          * Support for setXXXent(stayopen)
125          * Used only in hosts, protocols,
126          * networks, rpc, and services.
127          */
128         int (*str2ent)(const char *instr, int instr_len, void *ent, char *buffer, int buflen);
129         union nss_XbyY_key key;
130  
131         void *returnval;
132         int erange;
133         int h_errno;
134         nss_status_t status;
135 } nss_XbyY_args_t;
136  
137 #endif /* _WINBIND_NSS_HPUX_H */