Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
afw_ldap_internal.h
Go to the documentation of this file.
1 // See the 'COPYING' file in the project root for licensing information.
2 /*
3  * Adaptive Framework LDAP Internal Header
4  *
5  * Copyright (c) 2010-2023 Clemson University
6  *
7  */
8 
9 #ifndef __AFW_LDAP_INTERNAL_H__
10 #define __AFW_LDAP_INTERNAL_H__
11 
12 
19 #include "afw_minimal.h"
21 #include <apr_ldap.h>
22 #if APR_HAS_MICROSOFT_LDAPSDK == 1
23 #include <winber.h>
24 #endif
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 /* @brief afw_ldap_metadata_attribute_type_t opaque typedef. */
33 
34 /* @brief afw_ldap_metadata_syntax_handler_t opaque typedef. */
37 
38 /* @brief afw_ldap_metadata_t opaque typedef. */
39 typedef struct afw_ldap_metadata_s
41 
42 /* @brief afw_ldap_object_type_attribute_t opaque typedef. */
45 
46 /* @brief typedef for ber to value callback. */
47 typedef const afw_value_t *
48 (*afw_ldap_ber_to_value_p_cb_t)(
49  const afw_ldap_metadata_attribute_type_t *attribute_type,
50  void *data,
51  struct berval * *bv,
52  const afw_pool_t *p,
53  afw_xctx_t *xctx);
54 
55 /* @brief typedef for value to ber callback. */
56 typedef struct berval **
57 (*afw_ldap_value_to_ber_p_cb_t)(
58  const afw_ldap_metadata_attribute_type_t *attribute_type,
59  void *data,
60  const afw_value_t *value,
61  const afw_pool_t *p,
62  afw_xctx_t *xctx);
63 
64 /* Note: A register function might be added to register these callbacks */
65 
67 
68 #ifdef WIN32
69 #define AFW_LDAP_TIMEVAL LDAP_TIMEVAL
70 #else
71 #define AFW_LDAP_TIMEVAL struct timeval
72 #endif
73 
74 
76  afw_adaptor_t pub;
77  const afw_utf8_z_t *url_z;
78  const afw_value_t *bind_parameters;
79  apr_ldap_url_desc_t *lud;
80  afw_ldap_metadata_t *metadata;
81  AFW_LDAP_TIMEVAL timeout;
82  afw_boolean_t prevent_verify_cert;
84 
88  afw_adaptor_session_t *metadata_session;
89  const afw_utf8_z_t * bind_dn_z;
90  const afw_utf8_z_t * bind_password_z;
91  afw_adaptor_object_type_cache_t object_type_cache;
92  afw_boolean_t release_called_from_cleanup;
93  LDAP *ld;
95 
96 extern char * afw_ldap_internal_allattrs[];
97 
98 
106 const afw_adaptor_t *
108  const afw_object_t *properties,
109  const afw_pool_t *p, afw_xctx_t *xctx);
110 
111 
120  afw_ldap_internal_adaptor_t * adaptor,
121  afw_xctx_t *xctx);
122 
123 void
124 afw_ldap_internal_cleanup_ldap_msgfree(
125  void *data, void *data2, const afw_pool_t *p, afw_xctx_t *xctx);
126 
127 void
128 afw_ldap_internal_cleanup_ldap_value_free_len(
129  void *data, void *data2, const afw_pool_t *p, afw_xctx_t *xctx);
130 
131 void
132 afw_ldap_internal_cleanup_ldap_memfree(
133  void *data, void *data2, const afw_pool_t *p, afw_xctx_t *xctx);
134 
135 LDAPMessage *
136 afw_ldap_internal_search_s(
138  int ldap_scope, const afw_utf8_z_t *filter, afw_xctx_t *xctx);
139 
140 const afw_utf8_t *
141 afw_ldap_internal_get_object_id(
143  LDAPMessage *e, afw_boolean_t check_base, afw_xctx_t *xctx);
144 
145 void
146 afw_ldap_internal_session_begin(
148  afw_xctx_t *xctx);
149 
150 void
151 afw_ldap_internal_session_end(afw_ldap_internal_adaptor_session_t *self);
152 
153 /* Internal create an adaptive object from an LDAPMessage. */
154 const afw_object_t *
155 afw_ldap_internal_create_object_from_entry(
157  const afw_utf8_t *object_type_id,
158  const afw_utf8_t *object_id,
159  LDAPMessage *e,
160  const afw_pool_t *p,
161  afw_xctx_t *xctx);
162 
163 const afw_utf8_t *
164 afw_ldap_internal_expression_from_query_criteria(
166  const afw_query_criteria_filter_entry_t * entry,
167  afw_xctx_t *xctx);
168 
169 /* Implemented in afw_ldap_syntax_handler.c. */
170 void
172  afw_ldap_metadata_t *metadata,
173  afw_ldap_metadata_attribute_type_t *attribute_type,
174  afw_xctx_t *xctx);
175 
176 
177 const afw_value_t *
178 afw_ldap_internal_syntax_handler_unknown_to_value(
179  struct berval * *bv,
180  const afw_pool_t *p, afw_xctx_t *xctx);
181 
182 #ifdef __cplusplus
183 }
184 #endif
185 
186 #endif /* __AFW_LDAP_INTERNAL_H__ */
#define AFW_LDAP_DECLARE_INTERNAL_CONST_DATA(type)
Declare an internal variable for /src/afw_ldap/ source*.h files.
Adaptive Framework register generated (afw_ldap) header.
void afw_ldap_internal_syntax_handler_assign(afw_ldap_metadata_t *metadata, afw_ldap_metadata_attribute_type_t *attribute_type, afw_xctx_t *xctx)
afw_ldap_internal_adaptor_session_t * afw_ldap_internal_adaptor_session_create(afw_ldap_internal_adaptor_t *adaptor, afw_xctx_t *xctx)
Internal create an LDAP adaptor session.
const afw_adaptor_t * afw_ldap_internal_adaptor_create_cede_p(const afw_object_t *properties, const afw_pool_t *p, afw_xctx_t *xctx)
Internal create an LDAP adaptor.
Adaptive Framework Minimal Header.
_Bool afw_boolean_t
Definition: afw_common.h:373
afw_utf8_octet_t afw_utf8_z_t
NFC normalized UTF-8 null terminated string.
Definition: afw_common.h:523
Interface afw_adaptor_factory public struct.
Interface afw_adaptor_object_type_cache public struct.
Interface afw_adaptor public struct.
Interface afw_adaptor_session public struct.
Interface afw_object public struct.
Interface afw_pool public struct.
Parsed filter entry from query string.
NFC normalized UTF-8 string.
Definition: afw_common.h:545
Interface afw_value public struct.
Interface afw_xctx public struct.