xref: /onnv-gate/usr/src/lib/libidmap/common/idmap_impl.h (revision 12914:e95332bf1454)
14520Snw141292 /*
24520Snw141292  * CDDL HEADER START
34520Snw141292  *
44520Snw141292  * The contents of this file are subject to the terms of the
54520Snw141292  * Common Development and Distribution License (the "License").
64520Snw141292  * You may not use this file except in compliance with the License.
74520Snw141292  *
84520Snw141292  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
94520Snw141292  * or http://www.opensolaris.org/os/licensing.
104520Snw141292  * See the License for the specific language governing permissions
114520Snw141292  * and limitations under the License.
124520Snw141292  *
134520Snw141292  * When distributing Covered Code, include this CDDL HEADER in each
144520Snw141292  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
154520Snw141292  * If applicable, add the following below this CDDL HEADER, with the
164520Snw141292  * fields enclosed by brackets "[]" replaced with your own identifying
174520Snw141292  * information: Portions Copyright [yyyy] [name of copyright owner]
184520Snw141292  *
194520Snw141292  * CDDL HEADER END
204520Snw141292  */
214520Snw141292 /*
2212065SKeyur.Desai@Sun.COM  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
234520Snw141292  */
244520Snw141292 
254520Snw141292 /*
264520Snw141292  * Private Header for Identity Mapping
274520Snw141292  */
284520Snw141292 
294520Snw141292 #ifndef _IDMAP_IMPL_H
304520Snw141292 #define	_IDMAP_IMPL_H
314520Snw141292 
324520Snw141292 
336616Sdm199847 #include <rpc/xdr.h>
346616Sdm199847 #include <libscf.h>
356616Sdm199847 #include <resolv.h>
366616Sdm199847 
379565SJordan.Brown@Sun.COM #include <rpcsvc/idmap_prot.h>
384520Snw141292 #include "idmap_priv.h"
398671SJulian.Pullen@Sun.COM 
406616Sdm199847 
414520Snw141292 
424520Snw141292 #ifdef __cplusplus
434520Snw141292 extern "C" {
444520Snw141292 #endif
454520Snw141292 
464520Snw141292 struct idmap_udt_handle {
474520Snw141292 	idmap_update_batch	batch;
484520Snw141292 	uint64_t		next;
495064Sdm199847 	int64_t			error_index;
505064Sdm199847 	idmap_stat		commit_stat;
515064Sdm199847 	idmap_namerule		error_rule;
525064Sdm199847 	idmap_namerule		conflict_rule;
534520Snw141292 };
544520Snw141292 
554644Sbaban #define	_IDMAP_RESET_UDT_HANDLE(uh) \
564644Sbaban 	(void) xdr_free(xdr_idmap_update_batch, (caddr_t)&uh->batch);\
575064Sdm199847 	uh->next = 0;\
585064Sdm199847 	uh->error_index = -1;\
595064Sdm199847 	(void) xdr_free(xdr_idmap_namerule, (caddr_t)&uh->error_rule);\
605064Sdm199847 	(void) xdr_free(xdr_idmap_namerule, (caddr_t)&uh->conflict_rule);
614644Sbaban 
624520Snw141292 typedef struct idmap_get_res {
634520Snw141292 	idmap_id_type	idtype;
644520Snw141292 	uid_t		*uid;
654520Snw141292 	gid_t		*gid;
664520Snw141292 	int		*is_user;
674520Snw141292 	char		**sidprefix;
684520Snw141292 	idmap_rid_t	*rid;
694520Snw141292 	idmap_stat	*stat;
706386Sjp151216 	idmap_info	*info;
717369SJulian.Pullen@Sun.COM 	int		cache_res;
724520Snw141292 } idmap_get_res_t;
734520Snw141292 
744520Snw141292 struct idmap_get_handle {
754520Snw141292 	idmap_mapping_batch	batch;
764520Snw141292 	idmap_get_res_t		*retlist;
774520Snw141292 	uint64_t		next;
784520Snw141292 };
794520Snw141292 
804644Sbaban #define	_IDMAP_RESET_GET_HANDLE(gh) \
814644Sbaban 	(void) xdr_free(xdr_idmap_mapping_batch, (caddr_t)&gh->batch);\
824644Sbaban 	if (gh->retlist) \
834644Sbaban 		free(gh->retlist);\
844644Sbaban 	gh->retlist = NULL;\
854644Sbaban 	gh->next = 0;
864644Sbaban 
874520Snw141292 struct idmap_iter {
884520Snw141292 	int			type;
894520Snw141292 	uint64_t		limit;
904520Snw141292 	void			*arg;
914520Snw141292 	idmap_retcode		retcode;
924520Snw141292 	uint64_t		lastrowid;
934520Snw141292 	uint64_t		next;
944520Snw141292 	void			*retlist;
954520Snw141292 };
964520Snw141292 
974520Snw141292 typedef struct stat_table {
984520Snw141292 	idmap_retcode	retcode;
994520Snw141292 	const char	*msg;
1004520Snw141292 	int		errnum;
1014520Snw141292 } stat_table_t;
1024520Snw141292 
1034520Snw141292 typedef idmap_retcode	_idmap_stat;
1044520Snw141292 
105*12914SJoyce.McIntosh@Sun.COM extern idmap_stat	_idmap_clnt_call(const rpcproc_t,
106*12914SJoyce.McIntosh@Sun.COM 				const xdrproc_t, const caddr_t,
107*12914SJoyce.McIntosh@Sun.COM 				const xdrproc_t, caddr_t out,
108*12914SJoyce.McIntosh@Sun.COM 				const struct timeval);
109*12914SJoyce.McIntosh@Sun.COM 
1104644Sbaban extern idmap_retcode	_udt_extend_batch(idmap_udt_handle_t *);
1114520Snw141292 extern idmap_retcode	_get_ids_extend_batch(idmap_get_handle_t *);
1124520Snw141292 extern idmap_stat	_iter_get_next_list(int, idmap_iter_t *, void *,
1134520Snw141292 				uchar_t **, size_t, xdrproc_t, xdrproc_t);
1144520Snw141292 
11512065SKeyur.Desai@Sun.COM extern idmap_logger_t logger;
1166616Sdm199847 
1174520Snw141292 #ifdef __cplusplus
1184520Snw141292 }
1194520Snw141292 #endif
1204520Snw141292 
1214520Snw141292 #endif /* _IDMAP_IMPL_H */
122