xref: /titanic_41/usr/src/lib/libnisdb/yptol/dit_access_utils.h (revision 2ad72058bc680e30f084e9f9ba8ceb0f77386821)
1 /*
2  * CDDL HEADER START
3  *
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.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 #ifndef _DIT_ACCESS_UTILS_H
26 #define	_DIT_ACCESS_UTILS_H
27 
28 #ifdef	__cplusplus
29 extern "C" {
30 #endif
31 
32 #ifndef ERROR
33 #define	ERROR	-1
34 #endif
35 
36 /* Keywords */
37 #define	N2LKEY			"rf_key"
38 #define	N2LIPKEY		"rf_ipkey"
39 #define	N2LSEARCHKEY		"rf_searchkey"
40 #define	N2LSEARCHIPKEY		"rf_searchipkey"
41 #define	N2LDOMAIN		"rf_domain"
42 #define	N2LCOMMENT		"rf_comment"
43 
44 /* libldap ignores usec. Hence using 1 sec timeout */
45 #define	SINGLE_ACCESS_TIMEOUT_SEC	1
46 #define	SINGLE_ACCESS_TIMEOUT_USEC	0
47 
48 extern __yp_domain_context_t	ypDomains;
49 
50 extern char			*getFullMapName(char *map, char *domain);
51 extern __nis_value_t		*stringToValue(char *dptr, int dsize);
52 extern __nis_rule_value_t	*processSplitField(__nis_table_mapping_t *sf,
53 				__nis_value_t *inVal, int *nv, int *statP);
54 extern __nis_rule_value_t	*datumToRuleValue(datum *key, datum *value,
55 				__nis_table_mapping_t *t, int *nv,
56 				char *domain, bool_t readonly, int *statP);
57 extern __nis_table_mapping_t	*mappingFromMap(char *map, char *domain,
58 				int *statP);
59 extern bool_t			singleReadFromDIT(char *map, char *domain,
60 				datum *key,
61 				datum *value, int *statP);
62 extern suc_code			singleWriteToDIT(char *map, char *domain,
63 				datum *key, datum *value, bool_t replace);
64 extern suc_code			buildNISRuleValue(__nis_table_mapping_t *t,
65 				__nis_rule_value_t *rv, char *domain);
66 extern suc_code			addSplitFieldValues(__nis_table_mapping_t *t,
67 				__nis_rule_value_t *rv, __nis_rule_value_t *trv,
68 				int numVals, char *domain);
69 extern datum			*ruleValueToDatum(__nis_table_mapping_t *t,
70 				__nis_rule_value_t *rv, int *statP);
71 extern datum 			*getKeyFromRuleValue(__nis_table_mapping_t *t,
72 				__nis_rule_value_t *rv, int *nv, int *statP,
73 				bool_t xlate_to_lcase);
74 extern const char		*getObjectClass(char *rdn);
75 extern suc_code			makeNISObject(char *domain, char *dn);
76 extern suc_code			addNISObject(char *domain, char *dn,
77 				int *ldap_rc);
78 extern suc_code			addParent(char *dn, char **attr);
79 extern bool_t			is_fatal_error(int res);
80 extern suc_code			alloc_temp_names(char *name,
81 				char **temp_entries, char **temp_ttl);
82 extern suc_code			collapseRuleValue(__nis_rule_value_t *rv);
83 
84 #ifdef	__cplusplus
85 }
86 #endif
87 
88 #endif	/* _DIT_ACCESS_UTILS_H */
89