1 /* rwm.h - dn rewrite/attribute mapping header file */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 1999-2005 The OpenLDAP Foundation.
6 * Portions Copyright 1999-2003 Howard Chu.
7 * Portions Copyright 2000-2003 Pierangelo Masarati.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted only as authorized by the OpenLDAP
14 * A copy of this license is available in the file LICENSE in the
15 * top-level directory of the distribution or, alternatively, at
16 * <http://www.OpenLDAP.org/license.html>.
19 * This work was initially developed by the Howard Chu for inclusion
20 * in OpenLDAP Software and subsequently enhanced by Pierangelo
27 /* String rewrite library */
30 #endif /* ENABLE_REWRITE */
34 /* define to enable referral DN massage by default */
35 #undef RWM_REFERRAL_REWRITE
46 #define RWMMAP_F_NONE 0x00
47 #define RWMMAP_F_IS_OC 0x01
48 #define RWMMAP_F_FREE_SRC 0x10
49 #define RWMMAP_F_FREE_DST 0x20
52 AttributeDescription *m_s_ad;
55 #define m_src_ad m_src_ref.m_s_ad
56 #define m_src_oc m_src_ref.m_s_oc
59 AttributeDescription *m_d_ad;
62 #define m_dst_ad m_dst_ref.m_d_ad
63 #define m_dst_oc m_dst_ref.m_d_oc
71 struct rewrite_info *rwm_rw;
72 #else /* !ENABLE_REWRITE */
73 /* some time the suffix massaging without librewrite
75 BerVarray rwm_suffix_massage;
76 #endif /* !ENABLE_REWRITE */
79 * Attribute/objectClass mapping
81 struct ldapmap rwm_oc;
82 struct ldapmap rwm_at;
85 /* Whatever context ldap_back_dn_massage needs... */
86 typedef struct dncookie {
87 struct ldaprwmap *rwmap;
93 #else /* !ENABLE_REWRITE */
96 #endif /* !ENABLE_REWRITE */
99 int rwm_dn_massage( dncookie *dc, struct berval *in, struct berval *dn );
100 int rwm_dn_massage_pretty( dncookie *dc, struct berval *in, struct berval *pdn );
101 int rwm_dn_massage_normalize( dncookie *dc, struct berval *in, struct berval *ndn );
102 int rwm_dn_massage_pretty_normalize( dncookie *dc, struct berval *in, struct berval *pdn, struct berval *ndn );
104 /* attributeType/objectClass mapping */
105 int rwm_mapping_cmp (const void *, const void *);
106 int rwm_mapping_dup (void *, void *);
108 int rwm_map_init ( struct ldapmap *lm, struct ldapmapping ** );
109 void rwm_map ( struct ldapmap *map, struct berval *s, struct berval *m,
111 int rwm_mapping ( struct ldapmap *map, struct berval *s,
112 struct ldapmapping **m, int remap );
117 struct ldapmap *at_map,
118 struct ldapmap *oc_map,
123 struct ldapmap *at_map,
126 char ***mapped_attrs );
130 struct ldapmap *at_map,
131 struct ldapmap *oc_map,
136 extern void rwm_mapping_free ( void *mapping );
138 extern int rwm_map_config(
139 struct ldapmap *oc_map,
140 struct ldapmap *at_map,
147 rwm_filter_map_rewrite(
150 struct berval *fstr );
152 /* suffix massaging by means of librewrite */
153 #ifdef ENABLE_REWRITE
154 extern int rwm_suffix_massage_config( struct rewrite_info *info,
155 struct berval *pvnc, struct berval *nvnc,
156 struct berval *prnc, struct berval *nrnc);
157 #endif /* ENABLE_REWRITE */
158 extern int rwm_dnattr_rewrite(
163 BerVarray *pa_nvals );
164 extern int rwm_referral_rewrite(
169 BerVarray *pa_nvals );
170 extern int rwm_dnattr_result_rewrite( dncookie *dc, BerVarray a_vals );
171 extern int rwm_referral_result_rewrite( dncookie *dc, BerVarray a_vals );