Put back the changes that Simo reverted and fix a speling mistak.
[tprouty/samba.git] / source / 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 2 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, write to the
19    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20    Boston, MA  02111-1307, USA.
21 */
22
23 #ifndef _WINBIND_NSS_HPUX_H
24 #define _WINBIND_NSS_HPUX_H
25
26 #include <nsswitch.h>
27
28 #ifndef _HAVE_TYPEDEF_NSS_STATUS
29 #define _HAVE_TYPEDEF_NSS_STATUS
30 typedef nss_status_t NSS_STATUS;
31
32 #define NSS_STATUS_SUCCESS     NSS_SUCCESS
33 #define NSS_STATUS_NOTFOUND    NSS_NOTFOUND
34 #define NSS_STATUS_UNAVAIL     NSS_UNAVAIL
35 #define NSS_STATUS_TRYAGAIN    NSS_TRYAGAIN
36
37 #ifdef HAVE_SYNCH_H
38 #include <synch.h>
39 #endif
40 #ifdef HAVE_PTHREAD_H
41 #include <pthread.h>
42 #endif
43  
44 typedef enum {
45         NSS_SUCCESS,
46         NSS_NOTFOUND,
47         NSS_UNAVAIL,
48         NSS_TRYAGAIN
49 } nss_status_t;
50  
51 struct nss_backend;
52  
53 typedef nss_status_t (*nss_backend_op_t)(struct nss_backend *, void *args);
54  
55 struct nss_backend {
56         nss_backend_op_t *ops;
57         int n_ops;
58 };
59 typedef struct nss_backend nss_backend_t;
60 typedef int nss_dbop_t;
61
62 #include <errno.h>
63 #include <netdb.h>
64 #include <limits.h>
65  
66 #ifndef NSS_INCLUDE_UNSAFE
67 #define NSS_INCLUDE_UNSAFE      1       /* Build old, MT-unsafe interfaces, */
68 #endif  /* NSS_INCLUDE_UNSAFE */
69  
70 enum nss_netgr_argn {
71         NSS_NETGR_MACHINE,
72         NSS_NETGR_USER,
73         NSS_NETGR_DOMAIN,
74         NSS_NETGR_N
75 };
76  
77 enum nss_netgr_status {
78         NSS_NETGR_FOUND,
79         NSS_NETGR_NO,
80         NSS_NETGR_NOMEM
81 };
82  
83 typedef unsigned nss_innetgr_argc;
84 typedef char **nss_innetgr_argv;
85  
86 struct nss_innetgr_1arg {
87         nss_innetgr_argc argc;
88         nss_innetgr_argv argv;
89 };
90  
91 typedef struct {
92         void *result;        /* "result" parameter to getXbyY_r() */
93         char *buffer;        /* "buffer"     "             "      */
94         int buflen;         /* "buflen"     "             "      */
95 } nss_XbyY_buf_t;
96  
97 extern nss_XbyY_buf_t *_nss_XbyY_buf_alloc(int struct_size, int buffer_size);
98 extern void _nss_XbyY_buf_free(nss_XbyY_buf_t *);
99  
100 union nss_XbyY_key {
101         uid_t uid;
102         gid_t gid;
103         const char *name;
104         int number;
105         struct {
106                 long net;
107                 int type;
108         } netaddr;
109         struct {
110                 const char *addr;
111                 int len;
112                 int type;
113         } hostaddr;
114         struct {
115                 union {
116                         const char *name;
117                         int port;
118                 } serv;
119                 const char *proto;
120         } serv;
121         void *ether;
122 };
123  
124 typedef struct nss_XbyY_args {
125         nss_XbyY_buf_t  buf;
126         int stayopen;
127         /*
128          * Support for setXXXent(stayopen)
129          * Used only in hosts, protocols,
130          * networks, rpc, and services.
131          */
132         int (*str2ent)(const char *instr, int instr_len, void *ent, char *buffer, int buflen);
133         union nss_XbyY_key key;
134  
135         void *returnval;
136         int erange;
137         int h_errno;
138         nss_status_t status;
139 } nss_XbyY_args_t;
140  
141 #endif /* _WINBIND_NSS_HPUX_H */