Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
afw_ldap_adaptor.c
Go to the documentation of this file.
1 // See the 'COPYING' file in the project root for licensing information.
2 /*
3  * Implementation of afw_adaptor interface for LDAP
4  *
5  * Copyright (c) 2010-2023 Clemson University
6  *
7  */
8 
9 
15 #include "afw.h"
16 #include "afw_ldap_internal.h"
17 #include "afw_adaptor_impl.h"
18 #include "afw_ldap_metadata.h"
20 
21 /* Declares and rti/inf defines for interface afw_adaptor */
22 #define AFW_IMPLEMENTATION_ID "ldap"
24 
25 
26 const afw_adaptor_t *
28  const afw_object_t *properties,
29  const afw_pool_t *p, afw_xctx_t *xctx)
30 {
32  afw_adaptor_t *adaptor;
33  apr_ldap_err_t *err;
34  apr_status_t rv;
35  afw_boolean_t found;
36 
37 
38  /* Create adaptor, process common properties, check required. */
40  &impl_afw_adaptor_inf,
42  properties, p, xctx);
43  self = (afw_ldap_internal_adaptor_t *)adaptor;
44 
45  /* Process url property. */
46  self->url_z = afw_object_old_get_property_as_utf8_z(properties,
47  &afw_ldap_s_url, p, xctx);
48  rv = apr_ldap_url_parse(
49  afw_pool_get_apr_pool(self->pub.p),
50  self->url_z,
51  &(self->lud), &err);
52  if (rv != APR_SUCCESS) {
54  &afw_ldap_s_url, xctx);
55  }
56 
57  /* Get compiled bindParameter. */
58  self->bind_parameters = afw_object_old_get_property_as_compiled_hybrid(
59  properties, &afw_ldap_s_bindParameters,
60  adaptor->impl->source_location, NULL, adaptor->p, xctx);
61 
62  /* Get preventVerifyCert. */
63  self->prevent_verify_cert = afw_object_old_get_property_as_boolean(
64  properties, &afw_ldap_s_preventVerifyCert, &found, xctx);
65 
67  self->timeout.tv_sec = 30;
68 
69  /* Load metadata. */
70  afw_ldap_metadata_load(self, xctx);
71 
72  /* Return adaptor. */
73  return (const afw_adaptor_t *)self;
74 }
75 
76 
77 
78 /*
79  * Implementation of method destroy of interface afw_adaptor.
80  */
81 void
83  const afw_adaptor_t * instance,
84  afw_xctx_t *xctx)
85 {
86  /* Release pool. */
87  afw_pool_release(instance->p, xctx);
88 }
89 
90 
91 
92 /*
93  * Implementation of method create_adaptor_session of interface afw_adaptor.
94  */
97  const afw_adaptor_t * instance,
98  afw_xctx_t *xctx)
99 {
101 
102  return (const afw_adaptor_session_t *)
104 }
105 
106 
107 /*
108  * Implementation of method get_additional_metrics of interface afw_adaptor.
109  */
110 const afw_object_t *
112  const afw_adaptor_t * instance,
113  const afw_pool_t * p,
114  afw_xctx_t *xctx)
115 {
116  /* There are no adaptor specific metrics. */
117  return NULL;
118 }
Adaptive Framework Core API.
Helpers for adaptor implementation development.
Interface afw_interface implementation declares.
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.
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.
Adaptive Framework register generated (afw_ldap) header.
Adaptive Framework LDAP Internal Header
void afw_ldap_metadata_load(afw_ldap_internal_adaptor_t *adaptor, afw_xctx_t *xctx)
Load LDAP adaptors Metadata .
Adaptive Framework LDAP Metadata Header.
const afw_object_t * impl_afw_adaptor_get_additional_metrics(const afw_adaptor_t *instance, const afw_pool_t *p, afw_xctx_t *xctx)
void impl_afw_adaptor_destroy(const afw_adaptor_t *instance, afw_xctx_t *xctx)
const afw_adaptor_session_t * impl_afw_adaptor_create_adaptor_session(const afw_adaptor_t *instance, afw_xctx_t *xctx)
afw_adaptor_impl_throw_property_invalid(const afw_adaptor_t *adaptor, const afw_utf8_t *property_name, afw_xctx_t *xctx)
Developers should call this for configuration property errors.
afw_adaptor_impl_create_cede_p(const afw_adaptor_inf_t *inf, afw_size_t instance_size, const afw_object_t *properties, const afw_pool_t *p, afw_xctx_t *xctx)
Developers should call this in all create functions for afw_adaptor.
#define afw_object_old_get_property_as_boolean(object, property_name, found, xctx)
Get property function for data type boolean value.
_Bool afw_boolean_t
Definition: afw_common.h:373
afw_object_old_get_property_as_utf8_z(const afw_object_t *instance, const afw_utf8_t *property_name, const afw_pool_t *p, afw_xctx_t *xctx)
Get an object's property value including ancestors as utf8_z in specified pool.
Definition: afw_object.c:555
afw_object_old_get_property_as_compiled_hybrid(const afw_object_t *instance, const afw_utf8_t *property_name, const afw_utf8_t *source_location, const afw_compile_shared_t *shared, const afw_pool_t *p, afw_xctx_t *xctx)
Return a compiled hybrid property value.
Definition: afw_object.c:402
#define afw_pool_get_apr_pool(instance)
Call method get_apr_pool of interface afw_pool.
#define afw_pool_release(instance, xctx)
Call method release of interface afw_pool.
const afw_utf8_t * source_location
Source location associated with this adaptor.
Interface afw_adaptor public struct.
Interface afw_adaptor_session public struct.
Interface afw_object public struct.
Interface afw_pool public struct.
Interface afw_xctx public struct.