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