20 static const struct berval
21 impl_ber_true = { 4,
"TRUE" };
23 static const struct berval
24 impl_ber_false = { 5,
"FALSE" };
27 impl_x_nds_syntax_handler(
35 impl_syntax_handler_single_binary_to_value(
37 void *data,
struct berval * *bv,
40 static struct berval **
41 impl_syntax_handler_single_binary_to_ber(
47 impl_syntax_handler_single_binary =
50 impl_syntax_handler_single_binary_to_value,
51 impl_syntax_handler_single_binary_to_ber
56 impl_syntax_handler_single_boolean_to_value(
58 void *data,
struct berval * *bv,
61 static struct berval **
62 impl_syntax_handler_single_boolean_to_ber(
68 impl_syntax_handler_single_boolean =
71 impl_syntax_handler_single_boolean_to_value,
72 impl_syntax_handler_single_boolean_to_ber
77 impl_syntax_handler_single_generalized_time_to_value(
83 static struct berval **
84 impl_syntax_handler_single_generalized_time_to_ber(
91 impl_syntax_handler_single_generalized_time =
94 impl_syntax_handler_single_generalized_time_to_value,
95 impl_syntax_handler_single_generalized_time_to_ber
100 impl_syntax_handler_single_integer_to_value(
102 void *data,
struct berval * *bv,
105 static struct berval **
106 impl_syntax_handler_single_integer_to_ber(
112 impl_syntax_handler_single_integer =
115 impl_syntax_handler_single_integer_to_value,
116 impl_syntax_handler_single_integer_to_ber
121 impl_syntax_handler_single_string_to_value(
123 void *data,
struct berval * *bv,
126 static struct berval **
127 impl_syntax_handler_single_string_to_ber(
133 impl_syntax_handler_single_string =
136 impl_syntax_handler_single_string_to_value,
137 impl_syntax_handler_single_string_to_ber
142 impl_syntax_handler_single_unknown_to_value(
144 void *data,
struct berval * *bv,
147 static struct berval **
148 impl_syntax_handler_single_unknown_to_ber(
154 impl_syntax_handler_single_unknown =
157 impl_syntax_handler_single_unknown_to_value,
158 impl_syntax_handler_single_unknown_to_ber
163 impl_syntax_handler_list_binary_to_value(
165 void *data,
struct berval * *bv,
168 static struct berval **
169 impl_syntax_handler_list_binary_to_ber(
175 impl_syntax_handler_list_binary =
178 impl_syntax_handler_list_binary_to_value,
179 impl_syntax_handler_list_binary_to_ber
184 impl_syntax_handler_list_boolean_to_value(
186 void *data,
struct berval * *bv,
189 static struct berval **
190 impl_syntax_handler_list_boolean_to_ber(
196 impl_syntax_handler_list_boolean =
199 impl_syntax_handler_list_boolean_to_value,
200 impl_syntax_handler_list_boolean_to_ber
205 impl_syntax_handler_list_generalized_time_to_value(
211 static struct berval **
212 impl_syntax_handler_list_generalized_time_to_ber(
219 impl_syntax_handler_list_generalized_time =
222 impl_syntax_handler_list_generalized_time_to_value,
223 impl_syntax_handler_list_generalized_time_to_ber
228 impl_syntax_handler_list_integer_to_value(
230 void *data,
struct berval * *bv,
233 static struct berval **
234 impl_syntax_handler_list_integer_to_ber(
240 impl_syntax_handler_list_integer =
243 impl_syntax_handler_list_integer_to_value,
244 impl_syntax_handler_list_integer_to_ber
249 impl_syntax_handler_list_string_to_value(
251 void *data,
struct berval * *bv,
254 static struct berval **
255 impl_syntax_handler_list_string_to_ber(
261 impl_syntax_handler_list_string =
264 impl_syntax_handler_list_string_to_value,
265 impl_syntax_handler_list_string_to_ber
271 impl_syntax_handler_list_unknown_to_value(
273 void *data,
struct berval * *bv,
276 static struct berval **
277 impl_syntax_handler_list_unknown_to_ber(
283 impl_syntax_handler_list_unknown =
286 impl_syntax_handler_list_unknown_to_value,
287 impl_syntax_handler_list_unknown_to_ber
294 impl_syntax_handler_single_binary_to_value(
296 void *data,
struct berval * *bv,
301 if (ldap_count_values_len(bv) != 1) {
306 raw.size = (*bv)->bv_len;
312 static struct berval **
313 impl_syntax_handler_single_binary_to_ber(
320 struct berval **result;
329 if (
afw_utf8_equal(&value_data_type->cType, &afw_s_afw_memory_t)) {
333 else if (
afw_utf8_equal(&value_data_type->cType, &afw_s_afw_utf8_t)) {
339 "Expecting a data type with cType afw_memory_t or afw_utf8_t",
345 result[0]->bv_len = (ber_len_t)size;
346 result[0]->bv_val = (
char *)ptr;
353 impl_syntax_handler_single_boolean_to_value(
355 void *data,
struct berval * *bv,
360 if (ldap_count_values_len(bv) != 1) {
364 if ((*bv)->bv_len == 4 && memcmp((*bv)->bv_val,
"TRUE", 4) == 0) {
367 else if ((*bv)->bv_len == 5 && memcmp((*bv)->bv_val,
"FALSE", 5) == 0) {
378 static struct berval **
379 impl_syntax_handler_single_boolean_to_ber(
384 struct berval **result;
385 const struct berval *ber;
394 result[0] = (
struct berval *)ber;
401 impl_syntax_handler_single_generalized_time_to_value(
403 void *data,
struct berval * *bv,
410 count = ldap_count_values_len(bv);
415 generalized_time.s = (*bv)->bv_val;
416 generalized_time.len = (*bv)->bv_len;
425 static struct berval **
426 impl_syntax_handler_single_generalized_time_to_ber(
431 struct berval **result;
441 result[0]->bv_len = (ber_len_t)s->len;
442 result[0]->bv_val = (
char *)s->s;
447 result = impl_syntax_handler_single_string_to_ber(
448 attribute_type, data, value, p, xctx);
456 impl_syntax_handler_single_integer_to_value(
458 void *data,
struct berval * *bv,
464 if (ldap_count_values_len(bv) != 1) {
469 s.len = (*bv)->bv_len;
477 static struct berval **
478 impl_syntax_handler_single_integer_to_ber(
484 return impl_syntax_handler_single_string_to_ber(
485 attribute_type, data, value, p, xctx);
490 impl_syntax_handler_single_string_to_value(
492 void *data,
struct berval * *bv,
498 count = ldap_count_values_len(bv);
508 static struct berval **
509 impl_syntax_handler_single_string_to_ber(
514 struct berval **result;
528 result[0]->bv_len = (ber_len_t)string->internal.len;
529 result[0]->bv_val = (
char *)
string->internal.s;
536 impl_syntax_handler_single_unknown_to_value(
538 void *data,
struct berval * *bv,
543 count = ldap_count_values_len(bv);
549 return impl_syntax_handler_single_string_to_value(
550 attribute_type, data, bv, p, xctx);
553 return impl_syntax_handler_single_binary_to_value(
554 attribute_type, data, bv, p, xctx);
559 static struct berval **
560 impl_syntax_handler_single_unknown_to_ber(
566 return impl_syntax_handler_single_binary_to_ber(
567 attribute_type, data, value, p, xctx);
572 impl_syntax_handler_list_binary_to_value(
574 void *data,
struct berval * *bv,
582 count = ldap_count_values_len(bv);
588 for (; count > 0; count--, bv++, e++) {
590 e->size = (*bv)->bv_len;
597 static struct berval **
598 impl_syntax_handler_list_binary_to_ber(
603 struct berval **result;
619 for (iterator = NULL, bv = result; ;bv++) {
621 list, &iterator, NULL, (
const void **)&raw, xctx);
626 (*bv)->bv_len = (ber_len_t)raw->size;
627 (*bv)->bv_val = (
char *)raw->ptr;
631 for (iterator = NULL, bv = result; ;bv++) {
633 list, &iterator, NULL, (
const void **)&s, xctx);
638 (*bv)->bv_len = (ber_len_t)s->len;
639 (*bv)->bv_val = (
char *)s->s;
644 "Expecting a data type with cType afw_memory_t or afw_utf8_t",
655 (*result)->bv_len = (ber_len_t)raw->size;
656 (*result)->bv_val = (
char *)raw->ptr;
661 (*result)->bv_len = (ber_len_t)s->len;
662 (*result)->bv_val = (
char *)s->s;
666 "Expecting a data type with cType afw_memory_t or afw_utf8_t",
676 impl_syntax_handler_list_boolean_to_value(
678 void *data,
struct berval * *bv,
686 count = ldap_count_values_len(bv);
696 for (; count > 0; count--, bv++, e++) {
697 if ((*bv)->bv_len == 4 && memcmp((*bv)->bv_val,
"TRUE", 4) == 0) {
699 }
else if ((*bv)->bv_len == 5 && memcmp((*bv)->bv_val,
"FALSE", 5) == 0) {
710 static struct berval **
711 impl_syntax_handler_list_boolean_to_ber(
716 struct berval **result;
724 const void *
internal;
741 result[count] = NULL;
743 for (iterator = NULL, bv = result; ;bv++) {
745 &iterator, &data_type, &
internal, xctx);
756 *bv = (
struct berval *)
767 impl_syntax_handler_list_generalized_time_to_value(
769 void *data,
struct berval * *bv,
778 count = ldap_count_values_len(bv);
786 for (; count > 0; count--, bv++, e++) {
787 generalized_time.s = (*bv)->bv_val;
788 generalized_time.len = (*bv)->bv_len;
790 &generalized_time, e, xctx);
797 static struct berval **
798 impl_syntax_handler_list_generalized_time_to_ber(
803 struct berval **result;
817 (*result)->bv_len = (ber_len_t)s->len;
818 (*result)->bv_val = (
char *)s->s;
827 for (iterator = NULL, bv = result; ;bv++) {
829 list, &iterator, NULL, (
const void **)&val, xctx);
835 (*bv)->bv_len = (ber_len_t)s->len;
836 (*bv)->bv_val = (
char *)s->s;
842 result = impl_syntax_handler_list_string_to_ber(
843 attribute_type, data, value, p, xctx);
852 impl_syntax_handler_list_integer_to_value(
854 void *data,
struct berval * *bv,
863 count = ldap_count_values_len(bv);
872 for (; count > 0; count--, bv++, e++) {
874 s.len = (*bv)->bv_len;
882 static struct berval **
883 impl_syntax_handler_list_integer_to_ber(
889 return impl_syntax_handler_list_string_to_ber(
890 attribute_type, data, value, p, xctx);
895 impl_syntax_handler_list_string_to_value(
897 void *data,
struct berval * *bv,
906 count = ldap_count_values_len(bv);
916 for (; count > 0; count--, bv++, e++) {
926 static struct berval **
927 impl_syntax_handler_list_string_to_ber(
932 struct berval **result;
938 const void *
internal;
956 result[count] = NULL;
959 for (iterator = NULL, bv = result; ;bv++) {
961 list, &iterator, NULL, &
internal, xctx);
972 (*bv)->bv_len = (ber_len_t)s->len;
973 (*bv)->bv_val = (
char *)s->s;
982 impl_syntax_handler_list_unknown_to_value(
984 void *data,
struct berval * *bv,
988 struct berval * *save_bv;
991 count = ldap_count_values_len(bv);
996 for (; count > 0; count--, bv++) {
1004 ? impl_syntax_handler_list_string_to_value(
1005 attribute_type, data, save_bv, p, xctx)
1006 : impl_syntax_handler_list_binary_to_value(
1007 attribute_type, data, save_bv, p, xctx);
1012 afw_ldap_internal_syntax_handler_unknown_to_value(
1013 struct berval * *bv,
1017 struct berval * *save_bv;
1022 count = ldap_count_values_len(bv);
1023 single = count == 1;
1028 for (; count > 0; count--, bv++) {
1036 result = (valid_utf8)
1037 ? impl_syntax_handler_single_string_to_value(
1038 NULL, NULL, save_bv, p, xctx)
1039 : impl_syntax_handler_single_binary_to_value(
1040 NULL, NULL, save_bv, p, xctx);
1043 result = (valid_utf8)
1044 ? impl_syntax_handler_list_string_to_value(
1045 NULL, NULL, save_bv, p, xctx)
1046 : impl_syntax_handler_list_binary_to_value(
1047 NULL, NULL, save_bv, p, xctx);
1053 static struct berval **
1054 impl_syntax_handler_list_unknown_to_ber(
1060 return impl_syntax_handler_list_binary_to_ber(
1061 attribute_type, data, value, p, xctx);
1066 impl_x_nds_syntax_handler(
1078 *data_type_id_value = NULL;
1085 *handler = (is_single)
1086 ? &impl_syntax_handler_single_binary
1087 : &impl_syntax_handler_list_binary;
1092 *handler = (is_single)
1093 ? &impl_syntax_handler_single_string
1094 : &impl_syntax_handler_list_string;
1099 *handler = (is_single)
1100 ? &impl_syntax_handler_single_string
1101 : &impl_syntax_handler_list_string;
1106 *handler = (is_single)
1107 ? &impl_syntax_handler_single_string
1108 : &impl_syntax_handler_list_string;
1113 *handler = (is_single)
1114 ? &impl_syntax_handler_single_string
1115 : &impl_syntax_handler_list_string;
1120 *handler = (is_single)
1121 ? &impl_syntax_handler_single_string
1122 : &impl_syntax_handler_list_string;
1127 *handler = &impl_syntax_handler_list_string;
1132 *handler = (is_single)
1133 ? &impl_syntax_handler_single_boolean
1134 : &impl_syntax_handler_list_boolean;
1139 *handler = (is_single)
1140 ? &impl_syntax_handler_single_integer
1141 : &impl_syntax_handler_list_integer;
1146 *handler = (is_single)
1147 ? &impl_syntax_handler_single_binary
1148 : &impl_syntax_handler_list_binary;
1153 *handler = (is_single)
1154 ? &impl_syntax_handler_single_string
1155 : &impl_syntax_handler_list_string;
1160 *handler = (is_single)
1161 ? &impl_syntax_handler_single_string
1162 : &impl_syntax_handler_list_string;
1167 *handler = (is_single)
1168 ? &impl_syntax_handler_single_binary
1169 : &impl_syntax_handler_list_binary;
1174 *handler = (is_single)
1175 ? &impl_syntax_handler_single_binary
1176 : &impl_syntax_handler_list_binary;
1181 *handler = (is_single)
1182 ? &impl_syntax_handler_single_binary
1183 : &impl_syntax_handler_list_binary;
1188 *handler = (is_single)
1189 ? &impl_syntax_handler_single_unknown
1190 : &impl_syntax_handler_list_unknown;
1194 *handler = (is_single)
1195 ? &impl_syntax_handler_single_binary
1196 : &impl_syntax_handler_list_binary;
1201 *handler = (is_single)
1202 ? &impl_syntax_handler_single_binary
1203 : &impl_syntax_handler_list_binary;
1208 *handler = &impl_syntax_handler_list_string;
1213 *handler = (is_single)
1214 ? &impl_syntax_handler_single_binary
1215 : &impl_syntax_handler_list_binary;
1220 *handler = (is_single)
1221 ? &impl_syntax_handler_single_string
1222 : &impl_syntax_handler_list_string;
1227 *handler = (is_single)
1228 ? &impl_syntax_handler_single_binary
1229 : &impl_syntax_handler_list_binary;
1234 *handler = (is_single)
1235 ? &impl_syntax_handler_single_integer
1236 : &impl_syntax_handler_list_integer;
1241 *handler = (is_single)
1242 ? &impl_syntax_handler_single_binary
1243 : &impl_syntax_handler_list_binary;
1248 *handler = (is_single)
1249 ? &impl_syntax_handler_single_generalized_time
1250 : &impl_syntax_handler_list_generalized_time;
1255 *handler = (is_single)
1256 ? &impl_syntax_handler_single_binary
1257 : &impl_syntax_handler_list_binary;
1262 *handler = (is_single)
1263 ? &impl_syntax_handler_single_integer
1264 : &impl_syntax_handler_list_integer;
1269 *handler = (is_single)
1270 ? &impl_syntax_handler_single_binary
1271 : &impl_syntax_handler_list_binary;
1275 *handler = (is_single)
1276 ? &impl_syntax_handler_single_integer
1277 : &impl_syntax_handler_list_integer;
1282 *handler = (is_single)
1283 ? &impl_syntax_handler_single_unknown
1284 : &impl_syntax_handler_list_unknown;
1301 ldap_syntax_object = apr_hash_get(metadata->ldap_syntax_objects,
1302 attribute_type->syntax_oid->s,
1303 attribute_type->syntax_oid->len);
1304 if (ldap_syntax_object) {
1309 &afw_ldap_s_a_X_NDS_SYNTAX, xctx);
1311 impl_x_nds_syntax_handler(
1312 &attribute_type->syntax_handler,
1313 &attribute_type->data_type_id_value,
1314 attribute_type->attribute_type_object,
1316 attribute_type->is_single, xctx);
1321 attribute_type->syntax_handler = (attribute_type->is_single)
1322 ? &impl_syntax_handler_single_unknown
1323 : &impl_syntax_handler_list_unknown;
1332 attribute_type->syntax_handler = (attribute_type->is_single)
1333 ? &impl_syntax_handler_single_unknown
1334 : &impl_syntax_handler_list_unknown;
1335 attribute_type->never_allow_read =
true;
1336 attribute_type->never_allow_write =
true;
Adaptive Framework Core API.
Adaptive Framework LDAP Internal 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_data_type_base64Binary_id_value
Adaptive string value for "base64Binary".
afw_value_create_base64Binary(const afw_memory_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type base64Binary value.
afw_data_type_base64Binary
Data type struct for base64Binary.
afw_data_type_boolean
Data type struct for boolean.
afw_value_as_boolean(const afw_value_t *value, afw_xctx_t *xctx)
Typesafe cast of data type boolean.
afw_data_type_boolean_id_value
Adaptive string value for "boolean".
afw_data_type_dateTime_id_value
Adaptive string value for "dateTime".
#define afw_value_is_list_of_dateTime(A_VALUE)
Macro to determine if value is evaluated list of dateTime.
afw_data_type_dateTime
Data type struct for dateTime.
#define afw_value_is_dateTime(A_VALUE)
Macro to determine if value is evaluated dateTime.
afw_value_create_dateTime(const afw_dateTime_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type dateTime value.
afw_value_create_integer(afw_integer_t internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type integer value.
afw_data_type_integer_id_value
Adaptive string value for "integer".
afw_data_type_integer
Data type struct for integer.
afw_value_create_list(const afw_list_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type list value.
#define afw_value_is_list(A_VALUE)
Macro to determine if value is evaluated list.
afw_value_create_string(const afw_utf8_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type string value.
#define afw_object_old_get_property_as_string(object, property_name, xctx)
Get property function for data type string value.
afw_data_type_string
Data type struct for string.
#define afw_value_is_string(A_VALUE)
Macro to determine if value is evaluated string.
afw_data_type_string_id_value
Adaptive string value for "string".
struct afw_iterator_s afw_iterator_t
unsigned char afw_byte_t
A byte of memory (unsigned).
apr_size_t afw_size_t
size_t.
apr_int64_t afw_integer_t
typedef for big signed int.
#define afw_data_type_convert_internal(instance, to_internal, from_internal, to_data_type, p, xctx)
Call method convert_internal of interface afw_data_type.
#define afw_data_type_internal_to_utf8(instance, from_internal, p, xctx)
Call method internal_to_utf8 of interface afw_data_type.
#define AFW_THROW_ERROR_Z(code, message_z, xctx)
Macro used to set error and 0 rv in xctx and throw it.
#define afw_list_get_next_internal(instance, iterator, data_type, internal, xctx)
Call method get_next_internal of interface afw_list.
#define afw_list_get_data_type(instance, xctx)
Call method get_data_type of interface afw_list.
#define afw_list_get_count(instance, xctx)
Call method get_count of interface afw_list.
afw_list_create_wrapper_for_array(const void *array, afw_boolean_t indirect, const afw_data_type_t *data_type, afw_size_t count, const afw_pool_t *p, afw_xctx_t *xctx)
Create a immutable list wrapper for an array.
#define AFW_LIST_INITIALIZE_WRAPPER_FOR_ARRAY_P(instance, _internal, _indirect, _data_type, _count, _p)
Helper macro to fill out afw_list_wrapper_for_array_self_t.
void * afw_memory_dup(const void *from, apr_size_t size, const afw_pool_t *p, afw_xctx_t *xctx)
Duplicate a block of memory into specified pool.
afw_integer_t afw_number_utf8_to_integer(const afw_utf8_t *s, const afw_pool_t *p, afw_xctx_t *xctx)
Convert a utf8 string to integer in specified pool.
#define afw_pool_malloc(instance, size, xctx)
Call method malloc of interface afw_pool.
#define afw_pool_calloc(instance, size, xctx)
Call method calloc of interface afw_pool.
#define afw_pool_calloc_type(instance, type, xctx)
Macro to allocate cleared memory to hold type in pool.
#define afw_pool_malloc_type(instance, type, xctx)
Macro to allocate uncleared memory to hold type in pool.
afw_dataType_generalized_time_set_internal(const afw_utf8_t *generalized_time, afw_dateTime_t *internal, afw_xctx_t *xctx)
Convert generalized time (see X.208) to internal and set.
afw_dateType_internal_to_generalized_time(const afw_dateTime_t *dateTime, const afw_pool_t *p, afw_xctx_t *xctx)
Convert internal dateTime to generalized time (see X.208) in specified pool.
#define afw_utf8_create_copy(s, len, p, xctx)
Make a utf-8 sting from chars in pool specified.
afw_boolean_t afw_utf8_equal(const afw_utf8_t *s1, const afw_utf8_t *s2)
Check to see if a string equals another string.
#define afw_utf8_is_valid(s, len, xctx)
Determine if series of bytes is valid utf-8.
#define afw_value_get_data_type(instance, xctx)
Call method get_data_type of interface afw_value.
afw_value_false
Adaptive value false.
#define afw_value_is_defined_and_evaluated(A_VALUE)
Macro to determine if value is defined and evaluated.
afw_value_convert(const afw_value_t *value, const afw_data_type_t *to_data_type, afw_boolean_t required, const afw_pool_t *p, afw_xctx_t *xctx)
Convert a value to a value/data type.
#define AFW_VALUE_INTERNAL(_VALUE_)
Macro to get const void * of the internal of a value.
afw_value_true
Adaptive value true.
Interface afw_data_type public struct.
date, time, and time zone.
Interface afw_list public struct.
Self for immutable list wrapper for a array.
Struct for memory pointer and size.
Interface afw_object public struct.
Interface afw_pool public struct.
NFC normalized UTF-8 string.
struct for data type dateTime values.
struct for data type hexBinary values.
struct for data type list values.
Interface afw_value public struct.
struct for data type string values.
Interface afw_xctx public struct.