4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 * Copyright 2012 Milan Jurik. All rights reserved.
32 * Definitions for nscd to nscd door interfaces
40 #include <nss_dbdefs.h>
42 /* nscd v2 nscd -> nscd call numbers */
43 #define NSCD_PING (NSCD_CALLCAT_N2N|0x01)
44 #define NSCD_GETADMIN (NSCD_CALLCAT_N2N|0x02)
45 #define NSCD_SETADMIN (NSCD_CALLCAT_N2N|0x03)
46 #define NSCD_GETPUADMIN (NSCD_CALLCAT_N2N|0x04)
47 #define NSCD_SETPUADMIN (NSCD_CALLCAT_N2N|0x05)
48 #define NSCD_KILLSERVER (NSCD_CALLCAT_N2N|0x06)
50 #define NSCD_IMHERE (NSCD_CALLCAT_N2N|0x10) /* IMHERE+WHOAMI */
51 #define NSCD_FORK (NSCD_CALLCAT_N2N|0x20)
52 #define NSCD_SETUID (NSCD_CALLCAT_N2N|0x30)
53 #define NSCD_KILL (NSCD_CALLCAT_N2N|0x40)
54 #define NSCD_PULSE (NSCD_CALLCAT_N2N|0x50)
55 #define NSCD_REFRESH (NSCD_CALLCAT_N2N|0x60)
57 /* nscd v2 nscd identities */
59 #define NSCD_MAIN 0x00000001
60 #define NSCD_FORKER 0x00000002
61 #define NSCD_CHILD 0x00000004
62 #define NSCD_WHOAMI 0x0000000F
64 #define NSCD_ALLOC_DOORBUF(cn, dsz, uptr, usz) \
65 usz = (sizeof (nss_pheader_t) + (dsz)); \
67 (void) memset(uptr, 0, usz); \
68 ((nss_pheader_t *)uptr)->nsc_callnumber = (cn); \
69 ((nss_pheader_t *)uptr)->p_version = NSCD_HEADER_REV; \
70 ((nss_pheader_t *)uptr)->pbufsiz = usz; \
71 ((nss_pheader_t *)uptr)->data_off = sizeof (nss_pheader_t); \
72 ((nss_pheader_t *)uptr)->key_off = sizeof (nss_pheader_t); \
73 ((nss_pheader_t *)uptr)->dbd_off = sizeof (nss_pheader_t); \
74 ((nss_pheader_t *)uptr)->data_len = dsz;
76 #define NSCD_N2N_DOOR_DATA(type, buf) \
77 (type *)((void *)(((char *)(buf)) + sizeof (nss_pheader_t)))
79 #define NSCD_N2N_DOOR_BUF_SIZE(struct) \
80 sizeof (nss_pheader_t) + sizeof (struct)
82 #define NSCD_SET_STATUS(ph, st, errno) \
85 (ph)->p_status = st; \
90 #define NSCD_SET_HERRNO(ph, herrno) \
91 (ph)->p_herrno = herrno;
94 #define NSCD_SET_STATUS_SUCCESS(ph) \
95 (ph)->p_status = NSS_SUCCESS; \
98 #define NSCD_SET_N2N_STATUS(ph, st, errno, n2nst) \
101 (ph)->p_status = st; \
104 (ph)->nscdpriv = n2nst; \
107 #define NSCD_STATUS_IS_OK(ph) \
108 (((ph)->p_status) == NSS_SUCCESS)
110 #define NSCD_STATUS_IS_NOT_OK(ph) \
111 (((ph)->p_status) != NSS_SUCCESS)
113 #define NSCD_GET_STATUS(ph) \
114 (((nss_pheader_t *)(ph))->p_status)
116 #define NSCD_GET_ERRNO(ph) \
117 (((nss_pheader_t *)(ph))->p_errno)
119 #define NSCD_GET_HERRNO(ph) \
120 (((nss_pheader_t *)(ph))->p_herrno)
122 #define NSCD_GET_NSCD_STATUS(ph) \
123 (((nss_pheader_t *)(ph))->nscdpriv)
125 #define NSCD_CLEAR_STATUS(ph) \
126 (ph)->p_status = 0; \
130 #define NSCD_COPY_STATUS(ph, ph1) \
131 (ph)->p_status = (ph1)->p_status; \
132 (ph)->p_errno = (ph1)->p_errno; \
133 (ph)->nscdpriv = (ph1)->nscdpriv;
135 nss_status_t
_nscd_doorcall(int callnum
);
136 nss_status_t
_nscd_doorcall_data(int callnum
, void *indata
,
137 int indlen
, void *outdata
, int outdlen
,
138 nss_pheader_t
*phdr
);
140 nss_status_t
_nscd_doorcall_fd(int fd
, int callnum
, void *indata
,
141 int indlen
, void *outdata
, int outdlen
,
142 nss_pheader_t
*phdr
);
144 nss_status_t
_nscd_doorcall_sendfd(int fd
, int callnum
,
145 void *indata
, int indlen
, nss_pheader_t
*phdr
);
151 #endif /* _NSCD_DOOR_H */