Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
afw_environment.h
Go to the documentation of this file.
1 // See the 'COPYING' file in the project root for licensing information.
2 /*
3  * Adaptive Framework Environment Header
4  *
5  * Copyright (c) 2010-2023 Clemson University
6  *
7  */
8 
9 #ifndef __AFW_ENVIRONMENT_H__
10 #define __AFW_ENVIRONMENT_H__
11 
12 #include "afw_interface.h"
13 
28 
48 #define AFW_ENVIRONMENT_REGISTRY_TYPE_MAP(XX) \
49  \
50  XX(registry_type, \
51  NULL, \
52  false, \
53  "registryType", \
54  "_AdaptiveEnvironmentRegistryType_", \
55  "The afw_environment_registry_type_t associated with this property " \
56  "name .") \
57  \
58  XX(singleton, \
59  impl_internal_additional_register_key_only, \
60  false, \
61  "singleton", \
62  "_AdaptiveSingleton_", \
63  "The void pointer for a singleton key.") \
64  \
65  XX(adaptor_id, \
66  impl_internal_additional_register_default, \
67  false, \
68  "adaptorId", \
69  "_AdaptiveAdaptor_", \
70  "The afw_adaptor_id_t struct for this adaptor id.") \
71  \
72  XX(adaptor_type, \
73  impl_internal_additional_register_default, \
74  false, \
75  "adaptorType", \
76  "_AdaptiveAdaptorType_", \
77  "The afw_adaptor_factory_t instance for an adaptor type.") \
78  \
79  XX(authorization_handler_id, \
80  impl_internal_additional_register_default, \
81  false, \
82  "authorizationHandlerId", \
83  "_AdaptiveAuthorizationHandler_", \
84  "The afw_authorization_handler_id_t struct for an " \
85  "authorization handler id.") \
86  \
87  XX(authorization_handler_type, \
88  impl_internal_additional_register_default, \
89  false, \
90  "authorizationHandlerType", \
91  "_AdaptiveAuthorizationHandlerType_", \
92  "The afw_authorization_handler_factory_t instance for an " \
93  "authorization handler type.") \
94  \
95  XX(conf_type, \
96  impl_internal_additional_register_default, \
97  false, \
98  "confType", \
99  "_AdaptiveConfType_", \
100  "The afw_environment_conf_type_t for a configuration type.") \
101  \
102  XX(content_type, \
103  impl_internal_additional_register_key_only, \
104  false, \
105  "contentType", \
106  "_AdaptiveContentType_", \
107  "The afw_content_type_t instance for a content type.") \
108  \
109  XX(context_type, \
110  impl_internal_additional_register_object, \
111  true, \
112  "contextType", \
113  "_AdaptiveContextType_", \
114  "The context type object. " \
115  "`/afw/_AdaptiveContextType_/<context_type_id>`" \
116  " runtime object will be set to this object as well.") \
117  \
118  XX(data_type, \
119  NULL, \
120  false, \
121  "dataType", \
122  "_AdaptiveDataType_", \
123  "The afw_data_type_t struct for a data type id.") \
124  \
125  XX(error_rv_decoder, \
126  impl_internal_additional_register_key_only, \
127  false, \
128  "errorRVDecoder", \
129  "_AdaptiveErrorRVDecoder_", \
130  "The afw_environment_error_rv_decoder_z_t function for a rv source id.")\
131  \
132  XX(extension, \
133  impl_internal_additional_register_default, \
134  false, \
135  "extension", \
136  "_AdaptiveExtension_", \
137  "The afw_extension_t for a loaded extension.") \
138  \
139  XX(flag, \
140  NULL, \
141  false, \
142  "flagType", \
143  "_AdaptiveFlag_", \
144  "The afw_flag_t for a flag_id.") \
145  \
146  XX(function, \
147  NULL, \
148  false, \
149  "function", \
150  "_AdaptiveFunction_", \
151  "The afw_value_function_definition_t struct for a function id.") \
152  \
153  XX(lock, \
154  impl_internal_additional_register_default, \
155  true, \
156  "lockId", \
157  "_AdaptiveLock_", \
158  "The afw_lock_t instance for a log id.") \
159  \
160  XX(log, \
161  impl_internal_additional_register_default, \
162  true, \
163  "logId", \
164  "_AdaptiveLog_", \
165  "The afw_log_t instance for a log id.") \
166  \
167  XX(log_type, \
168  impl_internal_additional_register_log_type, \
169  false, \
170  "logType", \
171  "_AdaptiveLogType_", \
172  "The afw_log_factory_t instance for a log type.") \
173  \
174  XX(policy_combining_algorithm, \
175  impl_internal_additional_register_default, \
176  false, \
177  "policyCombiningAlgorithmId", \
178  "_AdaptivePolicyCombiningAlgorithm_", \
179  "The afw_value_function_definition_t struct for a policy combining algorithm.") \
180  \
181  XX(request_handler, \
182  impl_internal_additional_register_key_only, \
183  false, \
184  "requestHandler", \
185  "_AdaptiveRequestHandler_", \
186  "The afw_request_handler_t instance for a request handler entry.") \
187  \
188  XX(request_handler_type, \
189  impl_internal_additional_register_default, \
190  false, \
191  "requestHandlerType", \
192  "_AdaptiveRequestHandlerType_", \
193  "The afw_request_handler_factory_t instance for a handler type.") \
194  \
195  XX(rule_combining_algorithm, \
196  impl_internal_additional_register_default, \
197  false, \
198  "ruleCombiningAlgorithmId", \
199  "_AdaptiveRuleCombiningAlgorithm_", \
200  "The afw_value_function_definition_t struct for a rule combining algorithm.") \
201  \
202  XX(runtime_custom, \
203  impl_internal_additional_register_key_only, \
204  false, \
205  "runtimeCustom", \
206  "_AdaptiveRuntimeCustom_", \
207  "The afw_runtime_custom_t for custom afw object type handling.") \
208  \
209  XX(runtime_object_map_inf, \
210  NULL, \
211  false, \
212  "runtimeObjectMapInf", \
213  "_AdaptiveRuntimeObjectMapInf_", \
214  "The runtime object map interface for an object type id.") \
215  \
216  XX(runtime_value_accessor, \
217  impl_internal_additional_register_key_only, \
218  false, \
219  "runtimeValueAccessor", \
220  "_AdaptiveRuntimeValueAccessor_", \
221  "The afw_runtime_value_accessor_t for an accessor name.") \
222  \
223  XX(service, \
224  NULL, \
225  true, \
226  "serviceId", \
227  "_AdaptiveService_", \
228  "The afw_service_t for a service_id.") \
229  \
230  XX(service_type, \
231  impl_internal_additional_register_default, \
232  false, \
233  "serviceType", \
234  "_AdaptiveServiceType_", \
235  "The afw_service_type_t for a service_type_id.") \
236  \
237  XX(value_inf, \
238  impl_internal_additional_register_key_only, \
239  false, \
240  "valueInf", \
241  "_AdaptiveValueInf_", \
242  "The afw_value_inf_t struct for a value interface implementation.") \
243 
244 
246 typedef enum {
247 #define XX(id, register_additional, allow_reregister, property_name, \
248  object_type_id, description) \
249  afw_environemnt_registry_type_ ## id,
251 #undef XX
252  afw_environemnt_registry_type_max_core_type
254 
255 
256 
259  const afw_utf8_t *key;
261 
262 
263 
265 #define AFW_ENVIRONMENT_Q_EXTENSION_INSTANCE \
266  "afw_environment_extension_instance"
267 
268 
277 #define AFW_ENVIRONMENT_DEFINE_EXTENSION_IMPL() \
278 static const afw_extension_t \
279 impl_extension = \
280 { \
281  &impl_afw_extension_inf, \
282  AFW_UTF8_LITERAL(AFW_IMPLEMENTATION_ID), \
283  AFW_UTF8_LITERAL(AFW_IMPLEMENTATION_VERSION), \
284  AFW_UTF8_LITERAL(AFW_VERSION_STRING), \
285  AFW_VERSION_HEX \
286 }; \
287 \
288 AFW_DEFINE_DSO(const afw_extension_t *) \
289 afw_environment_extension_instance = &impl_extension
290 
291 
292 
306  const afw_utf8_t *type, const afw_object_t *conf,
307  const afw_utf8_t *source_location,
308  const afw_pool_t *p, afw_xctx_t *xctx);
309 
310 
311 
321 typedef void * (*afw_environment_auto_register_cb_t)(
322  const afw_utf8_t *registry_type_id,
323  const afw_utf8_t *key,
324  afw_xctx_t *xctx);
325 
326 
327 
338  const afw_utf8_t *registry_type_id,
339  int type_number,
340  const afw_utf8_t *key,
341  const void *value,
342  const void *register_additional_param,
343  const void **register_additional_use,
344  afw_xctx_t *xctx);
345 
346 
347 
348 /* @brief Entries in environemnt->registry_types[] */
350 
351  /* Registry type id */
352  const afw_utf8_t *registry_type_id;
353 
354  /* Type number */
355  int number;
356 
357  /* Object type id */
358  const afw_utf8_t *object_type_id;
359 
360  /* Description */
361  const afw_utf8_t *description;
362 
363  /* Key Name */
364  const afw_utf8_t *property_name;
365 
366  /* Indicates reregister of a key is allowed. */
367  afw_boolean_t allow_reregister;
368 
369  /* Set and used by _AdaptiveEnvironmentRegistryType_. */
370  afw_boolean_t auto_register_specified;
371 
372  /* Hash table used to hold keyed values for this type. */
373  apr_hash_t *ht;
374 
375  /* Function to call for auto register or NULL. */
377 
378  /* Function to call after normal registration or NULL. */
379  afw_environment_register_additional_cb_t register_additional;
380 
381  /* Parameter for register_additional function. */
382  void *register_additional_param;
383 
384  /* &register_additional_use passed to register_additional for it's use. */
385  const void *register_additional_use;
386 
387 };
388 
389 
392 
395 
398 
401 
404 
407 
410 
413 
416 
419 
422 
425 };
426 
427 
428 
439 typedef const afw_utf8_z_t * (*afw_environment_error_rv_decoder_z_t) (
440  int rv, afw_utf8_z_t *wa, afw_size_t wa_size);
441 
442 
503  unsigned int version,
504  int argc, const char * const *argv,
505  const afw_error_t **environment_create_error);
506 
519 #define AFW_ENVIRONMENT_CREATE(xctx, argc, argv, environment_create_error) \
520  AFW_VERSION_ABORT_IF_NOT_COMPATIBLE("AFW_ENVIRONMENT_CREATE()"); \
521  xctx = afw_environment_create(AFW_VERSION_HEX, argc, argv, \
522  environment_create_error)
523 
524 
529 AFW_DECLARE(void)
531 
532 
533 
539 AFW_DEFINE(const afw_object_t *)
541 
542 
543 
552 AFW_DECLARE(void)
554  const afw_object_t *conf,
555  const afw_utf8_t *source_location,
556  afw_xctx_t *xctx);
557 
558 
569 AFW_DECLARE(void)
571  const afw_list_t *entry_list,
572  const afw_utf8_t *source_location,
573  afw_xctx_t *xctx);
574 
575 
576 
588 AFW_DECLARE(const afw_object_t *)
590  afw_boolean_t preload_variables,
591  afw_xctx_t *xctx);
592 
593 
594 
625  const afw_utf8_t *extension_id,
626  const afw_utf8_t *module_path,
627  const afw_object_t *properties,
628  afw_xctx_t *xctx);
629 
630 
631 
649  int type_number,
650  void *data,
651  const afw_utf8_octet_t *key_s,
652  afw_size_t key_len,
653  void *value,
654  const afw_pool_t *p,
655  afw_xctx_t *xctx);
656 
657 
666 AFW_DECLARE(void)
668  int type_number,
670  void *data,
671  const afw_pool_t *p,
672  afw_xctx_t *xctx);
673 
674 
690 AFW_DECLARE(int)
692  const afw_utf8_t *registry_type_id,
693  const afw_utf8_t *property_name,
694  const afw_utf8_t *object_type_id,
695  const afw_utf8_t *description,
696  afw_boolean_t allow_reregister,
698  afw_environment_register_additional_cb_t register_additional,
699  void * register_additional_param,
700  afw_xctx_t *xctx);
701 
702 
714  const afw_utf8_t *registry_type_id,
715  afw_boolean_t load_extension,
716  afw_xctx_t *xctx);
717 
718 
729  int registry_type_number,
730  afw_xctx_t *xctx);
731 
732 
733 
741 AFW_DECLARE(void)
743  int type_number,
744  const afw_utf8_t *key,
745  const void *value,
746  afw_xctx_t *xctx);
747 
748 
758  int type_number,
759  const afw_utf8_t *key,
760  afw_xctx_t *xctx);
761 
762 
770 AFW_DECLARE(void *)
772  int type_number,
773  const afw_utf8_t *key,
774  afw_xctx_t *xctx);
775 
776 
789 AFW_DECLARE(void *)
791  const afw_environment_t *env,
792  int type_number,
793  const afw_utf8_t *key);
794 
795 
796 
805 AFW_DEFINE_STATIC_INLINE(const afw_environment_registry_type_t *)
807  const afw_utf8_t *property_name,
808  afw_xctx_t *xctx)
809 {
811  afw_environemnt_registry_type_registry_type,
812  property_name,
813  xctx);
814 }
815 
816 
817 
827 AFW_DEFINE_STATIC_INLINE(void)
829  const afw_utf8_t *singleton_key,
830  const void *void_ptr,
831  afw_xctx_t *xctx)
832 {
834  afw_environemnt_registry_type_singleton,
835  singleton_key,
836  void_ptr,
837  xctx);
838 }
839 
840 
847 AFW_DEFINE_STATIC_INLINE(void *)
849  const afw_utf8_t *singleton_key, afw_xctx_t *xctx)
850 {
852  afw_environemnt_registry_type_singleton,
853  singleton_key,
854  xctx);
855 }
856 
857 
867 AFW_DEFINE(void)
869  const afw_utf8_t *adaptor_type,
870  const afw_adaptor_factory_t *adaptor_factory,
871  afw_xctx_t *xctx);
872 
873 
880 AFW_DEFINE_STATIC_INLINE(const afw_adaptor_factory_t *)
882  const afw_utf8_t *adaptor_type,
883  afw_xctx_t *xctx)
884 {
886  afw_environemnt_registry_type_adaptor_type,
887  adaptor_type,
888  xctx);
889 }
890 
891 
898 AFW_DEFINE_STATIC_INLINE(void)
900  const afw_utf8_t *adaptor_id,
901  const afw_adaptor_id_anchor_t *anchor,
902  afw_xctx_t *xctx)
903 {
905  afw_environemnt_registry_type_adaptor_id,
906  adaptor_id,
907  anchor,
908  xctx);
909 }
910 
911 
918 AFW_DEFINE_STATIC_INLINE(const afw_adaptor_id_anchor_t *)
920  const afw_utf8_t *adaptor_id,
921  afw_xctx_t *xctx)
922 {
924  afw_environemnt_registry_type_adaptor_id,
925  adaptor_id,
926  xctx);
927 }
928 
929 
941 AFW_DEFINE(void)
943  const afw_utf8_t *authorization_handler_type,
944  const afw_authorization_handler_factory_t *authorization_handler_factory,
945  afw_xctx_t *xctx);
946 
947 
948 
956 AFW_DEFINE_STATIC_INLINE(const afw_authorization_handler_factory_t *)
958  const afw_utf8_t *authorization_handler_type,
959  afw_xctx_t *xctx)
960 {
961  return (const afw_authorization_handler_factory_t *)
963  afw_environemnt_registry_type_authorization_handler_type,
964  authorization_handler_type,
965  xctx);
966 }
967 
968 
969 
976 AFW_DEFINE_STATIC_INLINE(void)
978  const afw_utf8_t *authorization_handler_id,
980  afw_xctx_t *xctx)
981 {
983  afw_environemnt_registry_type_authorization_handler_id,
984  authorization_handler_id,
985  anchor,
986  xctx);
987 }
988 
989 
990 
998 AFW_DEFINE_STATIC_INLINE(const afw_authorization_handler_id_anchor_t *)
1000  const afw_utf8_t *authorization_handler_id,
1001  afw_xctx_t *xctx)
1002 {
1003  return (const afw_authorization_handler_id_anchor_t *)
1005  afw_environemnt_registry_type_authorization_handler_id,
1006  authorization_handler_id,
1007  xctx);
1008 }
1009 
1010 
1011 
1036 AFW_DECLARE(void)
1038  const afw_utf8_t *conf_type_id,
1040  const afw_utf8_t *title,
1041  const afw_utf8_t *description,
1042  const afw_utf8_t *id_property_name,
1043  const afw_utf8_t *id_registry_type_id,
1044  const afw_utf8_t *id_runtime_object_type_id,
1045  const afw_utf8_t *subtype_property_name,
1046  const afw_utf8_t *subtype_registry_type_id,
1047  const afw_utf8_t *subtype_runtime_object_type_id,
1048  afw_boolean_t is_unique,
1049  afw_xctx_t *xctx);
1050 
1051 
1058 AFW_DEFINE_STATIC_INLINE(const afw_environment_conf_type_t *)
1060 const afw_utf8_t *type,
1061  afw_xctx_t *xctx)
1062 {
1064  afw_environemnt_registry_type_conf_type,
1065  type, xctx);
1066 }
1067 
1068 
1069 
1121 AFW_DECLARE(const afw_object_t *)
1123  const afw_object_t *properties,
1124  afw_xctx_t *xctx);
1125 
1126 
1127 
1134 AFW_DEFINE_STATIC_INLINE(void)
1136  const afw_utf8_t *type,
1137  const afw_content_type_t *content_type,
1138  afw_xctx_t *xctx)
1139 {
1141  afw_environemnt_registry_type_content_type,
1142  type,
1143  content_type,
1144  xctx);
1145 }
1146 
1147 
1148 
1155 AFW_DEFINE_STATIC_INLINE(const afw_content_type_t *)
1157  const afw_utf8_t *type,
1158  afw_xctx_t *xctx)
1159 {
1161  afw_environemnt_registry_type_content_type,
1162  type, xctx);
1163 }
1164 
1165 
1166 
1173 AFW_DEFINE_STATIC_INLINE(void)
1175  const afw_utf8_t *context_type_id,
1176  const afw_object_t *context_type_object,
1177  afw_xctx_t *xctx)
1178 {
1180  afw_environemnt_registry_type_context_type,
1181  context_type_id,
1182  context_type_object,
1183  xctx);
1184 }
1185 
1186 
1187 
1195 AFW_DEFINE_STATIC_INLINE(const afw_object_t *)
1197  const afw_utf8_t *context_type_id,
1198  afw_xctx_t *xctx)
1199 {
1201  afw_environemnt_registry_type_context_type,
1202  context_type_id, xctx);
1203 }
1204 
1205 
1206 
1213 AFW_DECLARE(void)
1215  const afw_utf8_t *data_type_id,
1216  const afw_data_type_t *data_type,
1217  afw_xctx_t *xctx);
1218 
1219 
1220 
1226 AFW_DECLARE(void)
1228  const afw_data_type_t * const *data_types,
1229  afw_xctx_t *xctx);
1230 
1231 
1232 
1240 AFW_DEFINE_STATIC_INLINE(const afw_data_type_t *)
1242  const afw_utf8_t *type,
1243  afw_xctx_t *xctx)
1244 {
1246  afw_environemnt_registry_type_data_type,
1247  type, xctx);
1248 }
1249 
1250 
1251 
1258 AFW_DEFINE_STATIC_INLINE(void)
1260  const afw_utf8_t *rv_source_id,
1262  afw_xctx_t *xctx)
1263 {
1265  afw_environemnt_registry_type_error_rv_decoder,
1266  rv_source_id,
1267  rv_decoder,
1268  xctx);
1269 }
1270 
1271 
1272 
1279 AFW_DEFINE_STATIC_INLINE(afw_environment_error_rv_decoder_z_t)
1281  const afw_utf8_t *rv_source_id,
1282  afw_xctx_t *xctx)
1283 {
1285  afw_environemnt_registry_type_error_rv_decoder,
1286  rv_source_id, xctx);
1287 }
1288 
1289 
1290 
1300 #define afw_environment_register_flag( \
1301  flag_id, brief, description, included_by_flag_id, xctx) \
1302 afw_flag_environment_register_flag( \
1303  flag_id, brief, description, included_by_flag_id, xctx)
1304 
1305 
1306 
1313 AFW_DEFINE_STATIC_INLINE(const afw_flag_t *)
1315  const afw_utf8_t *flag_id,
1316  afw_xctx_t *xctx)
1317 {
1319  afw_environemnt_registry_type_flag,
1320  flag_id,
1321  xctx);
1322 }
1323 
1324 
1325 
1335 AFW_DECLARE(void)
1337  const afw_utf8_t *function_id,
1338  const afw_value_function_definition_t *function,
1339  afw_xctx_t *xctx);
1340 
1341 
1342 
1348 AFW_DECLARE(void)
1350  const afw_value_function_definition_t **functions,
1351  afw_xctx_t *xctx);
1352 
1353 
1360 AFW_DEFINE_STATIC_INLINE(const afw_value_function_definition_t *)
1362  const afw_utf8_t *function_id,
1363  afw_xctx_t *xctx)
1364 {
1366  afw_environemnt_registry_type_function,
1367  function_id,
1368  xctx);
1369 }
1370 
1371 
1381  const afw_utf8_t *qualifier,
1382  const afw_utf8_t *name,
1383  afw_xctx_t *xctx);
1384 
1385 
1395  const afw_data_type_t * data_type,
1396  afw_integer_t dataTypeMethodNumber,
1397  afw_xctx_t *xctx);
1398 
1399 
1406 AFW_DEFINE_STATIC_INLINE(void)
1408  const afw_utf8_t *lock_id,
1409  const afw_lock_t *lock,
1410  afw_xctx_t *xctx)
1411 {
1413  afw_environemnt_registry_type_lock,
1414  lock_id,
1415  lock,
1416  xctx);
1417 }
1418 
1419 
1426 AFW_DEFINE_STATIC_INLINE(const afw_lock_t *)
1428  const afw_utf8_t *log_type,
1429  afw_xctx_t *xctx)
1430 {
1431  return (const afw_lock_t *)afw_environment_registry_get(
1432  afw_environemnt_registry_type_log_type,
1433  log_type,
1434  xctx);
1435 }
1436 
1437 
1444 AFW_DEFINE_STATIC_INLINE(void)
1446  const afw_utf8_t *log_type,
1447  const afw_log_factory_t *log_factory,
1448  afw_xctx_t *xctx)
1449 {
1451  afw_environemnt_registry_type_log_type,
1452  log_type,
1453  log_factory,
1454  xctx);
1455 }
1456 
1457 
1458 
1465 AFW_DEFINE_STATIC_INLINE(const afw_log_factory_t *)
1467  const afw_utf8_t *log_type,
1468  afw_xctx_t *xctx)
1469 {
1471  afw_environemnt_registry_type_log_type,
1472  log_type,
1473  xctx);
1474 }
1475 
1476 
1486 AFW_DEFINE_STATIC_INLINE(void)
1488  const afw_utf8_t *log_id,
1489  const afw_log_t *log,
1490  afw_xctx_t *xctx)
1491 {
1493  afw_environemnt_registry_type_log,
1494  log_id,
1495  log,
1496  xctx);
1497 }
1498 
1499 
1500 
1507 AFW_DEFINE_STATIC_INLINE(const afw_log_t *)
1509  const afw_utf8_t *log_id,
1510  afw_xctx_t *xctx)
1511 {
1512  return (const afw_log_t *)afw_environment_registry_get(
1513  afw_environemnt_registry_type_log,
1514  log_id,
1515  xctx);
1516 }
1517 
1518 
1519 
1526 AFW_DEFINE_STATIC_INLINE(void)
1528  const afw_utf8_t *policy_combining_algorithm_id,
1529  const afw_value_function_definition_t *function,
1530  afw_xctx_t *xctx)
1531 {
1533  afw_environemnt_registry_type_policy_combining_algorithm,
1534  policy_combining_algorithm_id,
1535  function,
1536  xctx);
1537 }
1538 
1539 
1540 
1548 AFW_DEFINE_STATIC_INLINE(const afw_value_function_definition_t *)
1550  const afw_utf8_t *policy_combining_algorithm_id,
1551  afw_xctx_t *xctx)
1552 {
1554  afw_environemnt_registry_type_policy_combining_algorithm,
1555  policy_combining_algorithm_id,
1556  xctx);
1557 }
1558 
1559 
1560 
1568 AFW_DEFINE_STATIC_INLINE(void)
1570  const afw_utf8_t *handler_type,
1571  const afw_request_handler_factory_t *request_handler_factory,
1572  afw_xctx_t *xctx)
1573 {
1575  afw_environemnt_registry_type_request_handler_type,
1576  handler_type,
1577  request_handler_factory,
1578  xctx);
1579 }
1580 
1581 
1582 
1590 AFW_DEFINE_STATIC_INLINE(const afw_request_handler_factory_t *)
1592  const afw_utf8_t *handler_type,
1593  afw_xctx_t *xctx)
1594 
1595 {
1596  return (const afw_request_handler_factory_t *)
1598  afw_environemnt_registry_type_request_handler_type,
1599  handler_type,
1600  xctx);
1601 }
1602 
1603 
1610 AFW_DEFINE_STATIC_INLINE(void)
1612  const afw_utf8_t *rule_combining_algorithm_id,
1613  const afw_value_function_definition_t *function,
1614  afw_xctx_t *xctx)
1615 {
1617  afw_environemnt_registry_type_rule_combining_algorithm,
1618  rule_combining_algorithm_id,
1619  function,
1620  xctx);
1621 }
1622 
1623 
1624 
1632 AFW_DEFINE_STATIC_INLINE(const afw_value_function_definition_t *)
1634  const afw_utf8_t *rule_combining_algorithm_id,
1635  afw_xctx_t *xctx)
1636 {
1638  afw_environemnt_registry_type_rule_combining_algorithm,
1639  rule_combining_algorithm_id,
1640  xctx);
1641 }
1642 
1643 
1644 
1652 AFW_DEFINE_STATIC_INLINE(void)
1654  const afw_utf8_t *object_type_id,
1655  const afw_runtime_custom_t *custom,
1656  afw_xctx_t *xctx)
1657 {
1659  afw_environemnt_registry_type_runtime_custom,
1660  object_type_id,
1661  custom,
1662  xctx);
1663 }
1664 
1665 
1672 AFW_DEFINE_STATIC_INLINE(const afw_runtime_custom_t *)
1674  const afw_utf8_t *object_type_id,
1675  afw_xctx_t *xctx)
1676 
1677 {
1678  return (const afw_runtime_custom_t *)
1680  afw_environemnt_registry_type_runtime_custom,
1681  object_type_id,
1682  xctx);
1683 }
1684 
1685 
1692 AFW_DEFINE_STATIC_INLINE(void)
1694  const afw_utf8_t *object_type_id,
1695  const afw_object_inf_t *inf,
1696  afw_xctx_t *xctx)
1697 {
1699  afw_environemnt_registry_type_runtime_object_map_inf,
1700  object_type_id,
1701  inf,
1702  xctx);
1703 }
1704 
1705 
1712 AFW_DEFINE_STATIC_INLINE(const afw_object_inf_t *)
1714  const afw_utf8_t *object_type_id,
1715  afw_xctx_t *xctx)
1716 {
1718  afw_environemnt_registry_type_runtime_object_map_inf,
1719  object_type_id,
1720  xctx);
1721 }
1722 
1723 
1730 AFW_DEFINE_STATIC_INLINE(void)
1732  const afw_utf8_t *accessor_name,
1733  afw_runtime_value_accessor_t function,
1734  afw_xctx_t *xctx)
1735 {
1737  afw_environemnt_registry_type_runtime_value_accessor,
1738  accessor_name,
1739  function,
1740  xctx);
1741 }
1742 
1743 
1750 AFW_DEFINE_STATIC_INLINE(afw_runtime_value_accessor_t)
1752  const afw_utf8_t *accessor_name,
1753  afw_xctx_t *xctx)
1754 {
1755  return (afw_runtime_value_accessor_t)afw_environment_registry_get(
1756  afw_environemnt_registry_type_runtime_value_accessor,
1757  accessor_name,
1758  xctx);
1759 }
1760 
1761 
1762 
1769 AFW_DEFINE_STATIC_INLINE(void)
1771  const afw_utf8_t *service_id,
1772  afw_service_t *service,
1773  afw_xctx_t *xctx)
1774 {
1776  afw_environemnt_registry_type_service,
1777  service_id,
1778  service,
1779  xctx);
1780 }
1781 
1782 
1789 AFW_DEFINE_STATIC_INLINE(afw_service_t *)
1791  const afw_utf8_t *service_id,
1792  afw_xctx_t *xctx)
1793 {
1795  afw_environemnt_registry_type_service,
1796  service_id,
1797  xctx);
1798 }
1799 
1800 
1801 
1808 AFW_DEFINE_STATIC_INLINE(void)
1810  const afw_utf8_t *service_type_id,
1811  const afw_service_type_t *service_type,
1812  afw_xctx_t *xctx)
1813 {
1815  afw_environemnt_registry_type_service_type,
1816  service_type_id,
1817  service_type,
1818  xctx);
1819 }
1820 
1821 
1822 
1823 
1830 AFW_DEFINE_STATIC_INLINE(const afw_service_type_t *)
1832  const afw_utf8_t *service_type_id,
1833  afw_xctx_t *xctx)
1834 {
1836  afw_environemnt_registry_type_service_type,
1837  service_type_id,
1838  xctx);
1839 }
1840 
1841 
1842 
1851 AFW_DEFINE_STATIC_INLINE(void)
1853  const afw_utf8_t *value_inf_id,
1854  const afw_value_inf_t *value_inf,
1855  afw_xctx_t *xctx)
1856 {
1858  afw_environemnt_registry_type_value_inf,
1859  value_inf_id,
1860  value_inf,
1861  xctx);
1862 }
1863 
1864 
1871 AFW_DEFINE_STATIC_INLINE(const afw_value_inf_t *)
1873  const afw_utf8_t *value_inf_id,
1874  afw_xctx_t *xctx)
1875 {
1877  afw_environemnt_registry_type_value_inf,
1878  value_inf_id,
1879  xctx);
1880 }
1881 
1882 
1890 AFW_DECLARE(void)
1891 afw_environment_set_debug_fd(FILE *fd, afw_xctx_t *xctx);
1892 
1893 
1901 AFW_DECLARE(void)
1902 afw_environment_set_stderr_fd(FILE *fd, afw_xctx_t *xctx);
1903 
1904 
1912 AFW_DECLARE(void)
1913 afw_environment_set_stdout_fd(FILE *fd, afw_xctx_t *xctx);
1914 
1915 AFW_END_DECLARES
1916 
1919 #endif /* __AFW_ENVIRONMENT_H__ */
AFW_DEFINE(const afw_object_t *)
#define AFW_BEGIN_DECLARES
#define AFW_DECLARE(type)
Declare a public afw function.
Interfaceafw_interface 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
char afw_utf8_octet_t
8 bits of utf-8 codepoint.
Definition: afw_common.h:236
apr_size_t afw_size_t
size_t.
Definition: afw_common.h:151
apr_int64_t afw_integer_t
typedef for big signed int.
Definition: afw_common.h:321
const afw_value_function_definition_t * afw_environment_get_function(const afw_utf8_t *function_id, afw_xctx_t *xctx)
Get the function instance associated with function id.
const afw_value_function_definition_t * afw_environment_get_policy_combining_algorithm(const afw_utf8_t *policy_combining_algorithm_id, afw_xctx_t *xctx)
Get the function instance associated with a policy combining algorithm id.
void afw_environment_set_stdout_fd(FILE *fd, afw_xctx_t *xctx)
Override fd used for stdout.
void afw_environment_register_request_handler_type(const afw_utf8_t *handler_type, const afw_request_handler_factory_t *request_handler_factory, afw_xctx_t *xctx)
Register a request_handler factory.
void afw_environment_register_runtime_custom(const afw_utf8_t *object_type_id, const afw_runtime_custom_t *custom, afw_xctx_t *xctx)
Register afw_runtime_custom_t for a custom handled runtime object type.
const afw_environment_registry_type_t * afw_environment_get_registry_type_by_id(const afw_utf8_t *registry_type_id, afw_boolean_t load_extension, afw_xctx_t *xctx)
Get the registry type associated with a registry type id.
const afw_runtime_custom_t * afw_environment_get_runtime_custom(const afw_utf8_t *object_type_id, afw_xctx_t *xctx)
Get afw_runtime_custom_t for a custom handled runtime object type.
struct afw_environment_default_register_additional_s afw_environment_default_register_additional_t
Default register_additional object struct.
void afw_environment_register_authorization_handler_id(const afw_utf8_t *authorization_handler_id, const afw_authorization_handler_id_anchor_t *anchor, afw_xctx_t *xctx)
Register an authorization handler id anchor.
void afw_environment_register_context_type(const afw_utf8_t *context_type_id, const afw_object_t *context_type_object, afw_xctx_t *xctx)
Register an context type.
void afw_environment_register_service_type(const afw_utf8_t *service_type_id, const afw_service_type_t *service_type, afw_xctx_t *xctx)
Register a service type.
int afw_environment_create_registry_type(const afw_utf8_t *registry_type_id, const afw_utf8_t *property_name, const afw_utf8_t *object_type_id, const afw_utf8_t *description, afw_boolean_t allow_reregister, afw_environment_auto_register_cb_t auto_register, afw_environment_register_additional_cb_t register_additional, void *register_additional_param, afw_xctx_t *xctx)
Create a new registry type.
afw_environment_registry_type_enum_t
Enum for the core registry types.
void afw_environment_register_singleton(const afw_utf8_t *singleton_key, const void *void_ptr, afw_xctx_t *xctx)
Register an singleton.
void afw_environment_register_content_type(const afw_utf8_t *type, const afw_content_type_t *content_type, afw_xctx_t *xctx)
Register an content type.
afw_boolean_t afw_environment_registry_key_exists(int type_number, const afw_utf8_t *key, afw_xctx_t *xctx)
Check to see if a key exists.
void afw_environment_register_lock(const afw_utf8_t *lock_id, const afw_lock_t *lock, afw_xctx_t *xctx)
Register an lock.
void afw_environment_register_adaptor_id(const afw_utf8_t *adaptor_id, const afw_adaptor_id_anchor_t *anchor, afw_xctx_t *xctx)
Register an adaptor id anchor.
const afw_environment_conf_type_t * afw_environment_get_conf_type(const afw_utf8_t *type, afw_xctx_t *xctx)
Get the conf_type associated with type.
const afw_value_function_definition_t * afw_environment_registry_get_data_type_method(const afw_data_type_t *data_type, afw_integer_t dataTypeMethodNumber, afw_xctx_t *xctx)
Get the function associated with a data type method.
void afw_environment_register_data_types(const afw_data_type_t *const *data_types, afw_xctx_t *xctx)
Register a NULL terminated list of data types.
const afw_environment_registry_type_t * afw_environment_get_registry_type(const afw_utf8_t *property_name, afw_xctx_t *xctx)
Get the registry type associated with property name.
const afw_environment_registry_type_t * afw_environment_get_registry_type_by_number(int registry_type_number, afw_xctx_t *xctx)
Get the registry type associated with a registry type number.
const afw_object_t * afw_environment_prepare_conf_type_properties(const afw_object_t *properties, afw_xctx_t *xctx)
Prepare properties for a conf type.
afw_environment_register_adaptor_type(const afw_utf8_t *adaptor_type, const afw_adaptor_factory_t *adaptor_factory, afw_xctx_t *xctx)
Register an adaptor factory.
void afw_environment_register_rule_combining_algorithm(const afw_utf8_t *rule_combining_algorithm_id, const afw_value_function_definition_t *function, afw_xctx_t *xctx)
Register a rule combining algorithm function.
const afw_value_function_definition_t * afw_environment_get_qualified_function(const afw_utf8_t *qualifier, const afw_utf8_t *name, afw_xctx_t *xctx)
Get the qualified function instance.
const afw_extension_t * afw_environment_load_extension(const afw_utf8_t *extension_id, const afw_utf8_t *module_path, const afw_object_t *properties, afw_xctx_t *xctx)
Load and initialize environment extension.
const afw_authorization_handler_id_anchor_t * afw_environment_get_authorization_handler_id(const afw_utf8_t *authorization_handler_id, afw_xctx_t *xctx)
Get the authorization handler id anchor associated with authorization handler id.
const afw_log_t * afw_environment_get_log(const afw_utf8_t *log_id, afw_xctx_t *xctx)
Get the log instance associated with log id.
afw_xctx_t * afw_environment_create(unsigned int version, int argc, const char *const *argv, const afw_error_t **environment_create_error)
Create the Adaptive Framework core environment and return base xctx.
void afw_environment_create_and_register_conf_type(const afw_utf8_t *conf_type_id, afw_environment_conf_type_create_cede_p_t create, const afw_utf8_t *title, const afw_utf8_t *description, const afw_utf8_t *id_property_name, const afw_utf8_t *id_registry_type_id, const afw_utf8_t *id_runtime_object_type_id, const afw_utf8_t *subtype_property_name, const afw_utf8_t *subtype_registry_type_id, const afw_utf8_t *subtype_runtime_object_type_id, afw_boolean_t is_unique, afw_xctx_t *xctx)
Create and register a configuration (conf) type.
const afw_data_type_t * afw_environment_get_data_type(const afw_utf8_t *type, afw_xctx_t *xctx)
Get the data_type associated with configuration entry type.
void * afw_environment_registry_get_without_xctx(const afw_environment_t *env, int type_number, const afw_utf8_t *key)
Limited get the value associated with a key for a registry type.
void afw_environment_registry_register(int type_number, const afw_utf8_t *key, const void *value, afw_xctx_t *xctx)
Register a value by key for a registry type.
#define AFW_ENVIRONMENT_REGISTRY_TYPE_MAP(XX)
Environment Core Registry Type Map.
void afw_environment_register_functions(const afw_value_function_definition_t **functions, afw_xctx_t *xctx)
Register a NULL terminated list of functions.
const afw_log_factory_t * afw_environment_get_log_type(const afw_utf8_t *log_type, afw_xctx_t *xctx)
Get the log factory instance associated with log type.
const afw_lock_t * afw_environment_get_lock(const afw_utf8_t *log_type, afw_xctx_t *xctx)
Get the lock instance associated a lock id.
const afw_flag_t * afw_environment_get_flag(const afw_utf8_t *flag_id, afw_xctx_t *xctx)
Get the flag instance associated with flag_id.
void * afw_environment_get_singleton(const afw_utf8_t *singleton_key, afw_xctx_t *xctx)
Get the singleton value.
void afw_environment_register_value_inf(const afw_utf8_t *value_inf_id, const afw_value_inf_t *value_inf, afw_xctx_t *xctx)
Register a value inf.
afw_boolean_t(* afw_environment_foreach_cb_t)(int type_number, void *data, const afw_utf8_octet_t *key_s, afw_size_t key_len, void *value, const afw_pool_t *p, afw_xctx_t *xctx)
Callback function typedef for afw_environment_foreach().
void afw_environment_register_runtime_object_map_inf(const afw_utf8_t *object_type_id, const afw_object_inf_t *inf, afw_xctx_t *xctx)
Register a runtime object map interface.
void afw_environment_register_log(const afw_utf8_t *log_id, const afw_log_t *log, afw_xctx_t *xctx)
Register a log.
const afw_utf8_z_t *(* afw_environment_error_rv_decoder_z_t)(int rv, afw_utf8_z_t *wa, afw_size_t wa_size)
Typedef for error rv decoder functions.
afw_runtime_value_accessor_t afw_environment_get_runtime_value_accessor(const afw_utf8_t *accessor_name, afw_xctx_t *xctx)
Get the interface associated with a runtime object map.
void(* afw_environment_conf_type_create_cede_p_t)(const afw_utf8_t *type, const afw_object_t *conf, const afw_utf8_t *source_location, const afw_pool_t *p, afw_xctx_t *xctx)
Typedef for afw conf type create functions.
void afw_environment_register_service(const afw_utf8_t *service_id, afw_service_t *service, afw_xctx_t *xctx)
Register a service.
const afw_adaptor_factory_t * afw_environment_get_adaptor_type(const afw_utf8_t *adaptor_type, afw_xctx_t *xctx)
Get the adaptor factory instance associated with adaptor type.
void afw_environment_configure_with_object(const afw_object_t *conf, const afw_utf8_t *source_location, afw_xctx_t *xctx)
Configure environment with a configuration entry.
void afw_environment_register_log_type(const afw_utf8_t *log_type, const afw_log_factory_t *log_factory, afw_xctx_t *xctx)
Register an log factory.
const afw_object_t * afw_environment_get_context_type(const afw_utf8_t *context_type_id, afw_xctx_t *xctx)
Get the afw_environment_context_type struct associated with a context type.
afw_environment_error_rv_decoder_z_t afw_environment_get_error_rv_decoder(const afw_utf8_t *rv_source_id, afw_xctx_t *xctx)
Get the error rv decoder function associated with rv_source_id.
void(* afw_environment_register_additional_cb_t)(const afw_utf8_t *registry_type_id, int type_number, const afw_utf8_t *key, const void *value, const void *register_additional_param, const void **register_additional_use, afw_xctx_t *xctx)
Additional register callback function.
const afw_authorization_handler_factory_t * afw_environment_get_authorization_handler_type(const afw_utf8_t *authorization_handler_type, afw_xctx_t *xctx)
Get the authorization_handler factory instance associated with authorization handler type.
const afw_content_type_t * afw_environment_get_content_type(const afw_utf8_t *type, afw_xctx_t *xctx)
Get the afw_content_type struct associated with a content type.
const afw_request_handler_factory_t * afw_environment_get_request_handler_type(const afw_utf8_t *handler_type, afw_xctx_t *xctx)
Get the request_handler factory instance associated with handler type.
const afw_object_inf_t * afw_environment_get_runtime_object_map_inf(const afw_utf8_t *object_type_id, afw_xctx_t *xctx)
Get the interface associated with a runtime object map.
afw_environment_register_authorization_handler_type(const afw_utf8_t *authorization_handler_type, const afw_authorization_handler_factory_t *authorization_handler_factory, afw_xctx_t *xctx)
Register an authorization handler factory.
afw_environment_registry_object_get_current(afw_xctx_t *xctx)
Get current environment registry object.
const afw_service_type_t * afw_environment_get_service_type(const afw_utf8_t *service_type_id, afw_xctx_t *xctx)
Get the service type instance associated with service_type_id.
void afw_environment_foreach(int type_number, afw_environment_foreach_cb_t callback, void *data, const afw_pool_t *p, afw_xctx_t *xctx)
Call a callback function for each entry of a registry type.
void afw_environment_register_function(const afw_utf8_t *function_id, const afw_value_function_definition_t *function, afw_xctx_t *xctx)
Register a function.
void afw_environment_release(afw_xctx_t *xctx)
Create the Adaptive Framework core environment and return base xctx.
void * afw_environment_registry_get(int type_number, const afw_utf8_t *key, afw_xctx_t *xctx)
Get the value associated with a key for a registry type.
const afw_value_inf_t * afw_environment_get_value_inf(const afw_utf8_t *value_inf_id, afw_xctx_t *xctx)
Get the value inf associated with a value inf id.
void afw_environment_register_policy_combining_algorithm(const afw_utf8_t *policy_combining_algorithm_id, const afw_value_function_definition_t *function, afw_xctx_t *xctx)
Register a policy combining algorithm function.
const afw_value_function_definition_t * afw_environment_get_rule_combining_algorithm(const afw_utf8_t *rule_combining_algorithm_id, afw_xctx_t *xctx)
Get the function instance associated with a rule combining algorithm id.
void afw_environment_register_error_rv_decoder(const afw_utf8_t *rv_source_id, afw_environment_error_rv_decoder_z_t rv_decoder, afw_xctx_t *xctx)
Register an error rv decoder.
void *(* afw_environment_auto_register_cb_t)(const afw_utf8_t *registry_type_id, const afw_utf8_t *key, afw_xctx_t *xctx)
Auto register callback function.
void afw_environment_register_runtime_value_accessor(const afw_utf8_t *accessor_name, afw_runtime_value_accessor_t function, afw_xctx_t *xctx)
Register a runtime value accessor function.
const afw_adaptor_id_anchor_t * afw_environment_get_adaptor_id(const afw_utf8_t *adaptor_id, afw_xctx_t *xctx)
Get the adaptor id anchor associated with adaptor id.
void afw_environment_set_stderr_fd(FILE *fd, afw_xctx_t *xctx)
Override fd used for stderr.
void afw_environment_configure_with_object_list(const afw_list_t *entry_list, const afw_utf8_t *source_location, afw_xctx_t *xctx)
Configure environment with list of configuration entries.
void afw_environment_set_debug_fd(FILE *fd, afw_xctx_t *xctx)
Override fd used for debug.
void afw_environment_register_data_type(const afw_utf8_t *data_type_id, const afw_data_type_t *data_type, afw_xctx_t *xctx)
Register a data type.
const afw_object_t * afw_environment_create_environment_variables_object(afw_boolean_t preload_variables, afw_xctx_t *xctx)
Create a readonly object for accessing environment variables.
afw_service_t * afw_environment_get_service(const afw_utf8_t *service_id, afw_xctx_t *xctx)
Get the service instance associated with service_id.
Interface afw_adaptor_factory public struct.
Interface afw_authorization_handler_factory public struct.
Interface afw_content_type public struct.
Interface afw_data_type public struct.
Struct for afw environment conf type.
const afw_utf8_t * subtype_property_name
Subtype property name for instances of this conf type.
const afw_utf8_t * subtype_runtime_object_type_id
Subtype runtime object type for instances of this conf type.
const afw_utf8_t * id_property_name
Id property name for instances of this conf type.
afw_boolean_t is_unique
This conf type can only be specified once.
afw_environment_conf_type_create_cede_p_t create
Create function for this type.
afw_utf8_t conf_type_id
Id of type.
const afw_utf8_t * description
Description of this type.
const afw_utf8_t * title
Title of this type.
const afw_utf8_t * id_runtime_object_type_id
Runtime object type for instances of this conf type.
const afw_utf8_t * subtype_registry_type_id
Subtype registry type for instances of this conf type.
const afw_utf8_t * id_registry_type_id
Registry type for instances of this conf type.
Default register_additional object struct.
Struct for typedef afw_environment_t defined in afw_common.h.
Definition: afw_common.h:1383
Adaptive Framework Error.
Definition: afw_error.h:65
Interface afw_extension public struct.
Definition: afw_interface.h:55
Struct used for a registered flag.
Definition: afw_flag.h:32
Interface afw_list public struct.
Interface afw_log_factory public struct.
Interface afw_log public struct.
Interface afw_object_inf_s struct.
Interface afw_object public struct.
Interface afw_pool public struct.
Interface afw_request_handler_factory public struct.
Runtime service struct.
Definition: afw_service.h:46
Interface afw_service_type public struct.
NFC normalized UTF-8 string.
Definition: afw_common.h:545
Struct for function value.
Definition: afw_value.h:102
Interface afw_value_inf_s struct.
Interface afw_xctx public struct.