Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
afw_common.h
Go to the documentation of this file.
1 // See the 'COPYING' file in the project root for licensing information.
2 /*
3  * Adaptive Framework Common Header
4  *
5  * Copyright (c) 2010-2023 Clemson University
6  *
7  */
8 
9 #ifndef __AFW_COMMON_H__
10 #define __AFW_COMMON_H__
11 
12 /* Need to include doxygen groups. */
13 #include "afw_doxygen.h"
14 
15 
49 /* For pool debugging use -D AFW_POOL_DEBUG */
50 /* For lock debugging use -D AFW_LOCK_DEBUG */
51 
52 /* Adaptive Framework uses Apache Portable Runtime. */
53 #include <apr_general.h>
54 #include <apr_tables.h>
55 #include <apr_strings.h>
56 #include <apr_time.h>
57 #include <apr_hash.h>
58 #include <apr_buckets.h>
59 #include <apr_atomic.h>
60 #include <apr_thread_proc.h>
61 #include <apr_thread_rwlock.h>
62 
63 
64 /* Common standard headers. */
65 #include <assert.h>
66 #include <limits.h>
67 #include <setjmp.h>
68 #include <string.h>
69 #include <stdint.h>
70 #include <stdarg.h>
71 #include <ctype.h>
72 #include <math.h>
73 #include <stdbool.h>
74 #include <stdlib.h>
75 #include <inttypes.h>
76 
77 
78 /*
79  * Adaptive Framework common opaque typedefs are contained in
80  * afw_common_opaques.h.
81  */
82 #include "afw_common_opaques.h"
83 
84 /*
85  * Adaptive Framework interface opaque typedefs are contained in
86  * afw_interface_opaques.h.
87  */
88 #include "afw_interface_opaques.h"
89 
90 /*
91  * Atomic.
92  *
93  * On Windows, volatile has atomic semantics; otherwise require C11 or higher
94  * and atomic primitives and types.
95  */
96 #if defined(_WIN32) || defined(WIN32)
97 #define AFW_ATOMIC volatile
98 #define AFW_WINDOWS 1
99 #else
100 #if __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_ATOMICS__)
101 #define AFW_HAS_ATOMIC
102 #include <stdatomic.h>
103 #define AFW_ATOMIC _Atomic
104 #else
105 #error C11 or higher with atomic primitives and types is required to compile Adaptive Framework
106 #endif
107 #endif
108 
109 /* Include generated declare helpers. */
110 #include "afw_declare_helpers.h"
111 
112 /* Include template headers. */
114 
124 #ifdef __GNUC__
125 #define AFW_POSSIBLY_UNUSED_VARIABLE __attribute__((unused))
126 #else
127 #define AFW_POSSIBLY_UNUSED_VARIABLE
128 #endif
129 
131 #define AFW_ASSERT(e) assert(e)
132 
134 #ifndef offsetof
135 #define offsetof(type, member) __builtin_offsetof (type, member)
136 #endif
137 
139 
141 #define AFW_ADAPTOR_ID "afw"
142 
144 #define AFW_STRINGIFY(x) AFW_STRINGIFY_x(x)
145 #define AFW_STRINGIFY_x(x) #x
146 
148 #define AFW__FILE_LINE__ __FILE__ ":" AFW_STRINGIFY(__LINE__)
149 
151 typedef apr_size_t afw_size_t;
152 
154 typedef apr_off_t afw_off_t;
155 
157 typedef int8_t afw_int8_t;
158 
160 typedef apr_int16_t afw_int16_t;
161 
163 typedef apr_int32_t afw_int32_t;
164 
166 #define AFW_INT32_MIN -2147483647 - 1
167 
169 #define AFW_INT32_MAX 2147483647
170 
172 typedef apr_int64_t afw_int64_t;
173 
175 typedef uint8_t afw_uint8_t;
176 
178 typedef apr_uint16_t afw_uint16_t;
179 
181 #define AFW_UINT16_MAX 65536
182 
184 typedef apr_uint32_t afw_uint32_t;
185 
187 #define AFW_UINT32_MAX 4294967296
188 
190 typedef apr_uint64_t afw_uint64_t;
191 
193 typedef float afw_float32_t;
194 
196 typedef double afw_float64_t;
197 
199 typedef double afw_float_t;
200 
202 typedef double afw_double_t;
203 
206 
208 typedef unsigned char afw_byte_t;
209 
211 typedef unsigned char afw_octet_t;
212 
236 typedef char afw_utf8_octet_t;
237 
245  void *data, afw_xctx_t *xctx);
246 
247 
255 typedef int (*afw_utf8_octet_get_cb_t) (
256  afw_utf8_octet_t *octet,
257  void *data, afw_xctx_t *xctx);
258 
259 
266 #define AFW_UTF8_Z_LEN -1
267 
268 
275 #define AFW_INTEGER_MAX_BUFFER 21
276 
277 
281 #define AFW_INTEGER_MAX APR_INT64_MAX
282 
286 #define AFW_INTEGER_Q_MAX "9223372036854775807"
287 
291 #define AFW_INTEGER_MIN APR_INT64_MIN
292 
296 #define AFW_INTEGER_Q_MIN "-9223372036854775808"
297 
301 #define AFW_INTEGER_MAX_SAFE_DOUBLE 9007199254740991
302 
306 #define AFW_INTEGER_MIN_SAFE_DOUBLE -9007199254740991
307 
313 #define AFW_INTEGER_IS_SAFE_DOUBLE(integer) \
314  ((integer) <= AFW_INTEGER_MAX_SAFE_DOUBLE && \
315  ((integer) >= AFW_INTEGER_MIN_SAFE_DOUBLE)
316 
317 
321 typedef apr_int64_t afw_integer_t;
322 
326 #define AFW_INTEGER_FMT APR_INT64_T_FMT
327 
331 #define AFW_INTEGER_MAX_DIGITS 19
332 
336 #define AFW_Q_INTEGER_MAX_DIGITS "19"
337 
341 #define AFW_SIZE_T_FMT APR_SIZE_T_FMT
342 
346 #define AFW_SIZE_T_MAX APR_SIZE_MAX
347 
351 #define AFW_SIZE_T_MAX_DIGITS 19
352 
356 #define AFW_Q_SIZE_T_MAX_DIGITS "19"
357 
362 #define AFW_SIZE_T_MAX_BUFFER AFW_SIZE_T_MAX_DIGITS + 1
363 
364 
365 
369 typedef apr_uint64_t afw_unsigned_integer_t;
370 
371 
373 typedef _Bool afw_boolean_t;
374 
375 
383 #define AFW_TRUE true
384 
385 
392 #define AFW_FALSE false
393 
394 
396 #define AFW_CRLF "\x0d\x0a"
397 
398 
400 #define AFW_CRLF_STRLEN 2
401 
402 
409 #define AFW_COMPILE_TYPE_MAP(XX) \
410  \
411  XX(error, \
412  string, NULL, \
413  "This is an error") \
414  \
415  XX(expression, \
416  expression, \
417  &afw_function_definition_compile_expression, \
418  "See production Expression in src/afw/doc/syntax/index.html or " \
419  "src/afw/generated/ebnf/syntax.ebnf for syntax.") \
420  \
421  XX(expression_tuple, \
422  hybrid, \
423  &afw_function_definition_compile_expression_tuple, \
424  "See production ExpressionTuple in src/afw/doc/syntax/index.html or " \
425  "src/afw/generated/ebnf/syntax.ebnf for syntax.") \
426  \
427  XX(hybrid, \
428  hybrid, \
429  &afw_function_definition_compile_hybrid, \
430  "See production Hybrid in src/afw/doc/syntax/index.html or " \
431  "src/afw/generated/ebnf/syntax.ebnf for syntax.") \
432  \
433  XX(json, \
434  string, \
435  &afw_function_definition_compile_json, \
436  "Compile strict json") \
437  \
438  XX(parenthesized_expression, \
439  expression, \
440  &afw_function_definition_compile_expression, \
441  "See production ParenthesizedExpression in " \
442  "src/afw/doc/syntax/index.html " \
443  "or src/afw/generated/ebnf/syntax.ebnf for syntax.") \
444  \
445  XX(regexp, \
446  regexp, \
447  &afw_function_definition_compile_regexp, \
448  "Parses a regular expression conforming to XML Schemas Part 2 " \
449  "Datatype Appendix F and builds an automata suitable for testing " \
450  "strings against that regular expression ") \
451  \
452  XX(relaxed_json, \
453  string, \
454  &afw_function_definition_compile_relaxed_json, \
455  "1) Allows inline and block comments\n" \
456  "2) Allows property names to be unquoted if they start with '_',\n" \
457  " '$', 'a-z', 'A-Z', or char > 127 followed by any of those or\n" \
458  " '0' - '9'.\n" \
459  "3) Allows Infinity, -Infinity, NaN, and -NaN for number values.\n" \
460  "4) Allows a trailing comma in Object and List.") \
461  \
462  XX(script, \
463  script, \
464  &afw_function_definition_compile_script, \
465  "See production Script in src/afw/doc/syntax/index.html or " \
466  "src/afw/generated/ebnf/syntax.ebnf for syntax.") \
467  \
468  XX(template, \
469  template, \
470  &afw_function_definition_compile_template, \
471  "See production Template in src/afw/doc/syntax/index.html or " \
472  "src/afw/generated/ebnf/syntax.ebnf for syntax.") \
473  \
474  XX(test_script, \
475  script, \
476  &afw_function_definition_compile_script, \
477  "See production TestScript in src/afw/doc/syntax/index.html or " \
478  "src/afw/generated/ebnf/syntax.ebnf for syntax.") \
479  \
480  XX(xpathExpression, \
481  xpathExpression, \
482  &afw_function_definition_compile_xpathExpression, \
483  "XML Path Language (XPath) expression")
484 
488 typedef enum afw_compile_type_e {
489 #define XX(name, data_type, compile_function, description) \
490  afw_compile_type_ ## name,
492 #undef XX
493  afw_compile_type_count
495 
496 
505 typedef struct afw_memory_s {
506  const afw_byte_t *ptr;
507  afw_size_t size;
509 
510 
524 
525 
545 typedef struct afw_utf8_s {
546  const afw_utf8_octet_t *s;
547  afw_size_t len;
549 
550 
551 
555 typedef union afw_utf8_utf8_z_s {
556  afw_utf8_t s;
557  const afw_utf8_z_t *s_z;
559 
560 
561 
565 typedef struct afw_utf8_array_s {
566  afw_integer_t count;
567  union {
568  afw_utf8_t *first;
569  afw_utf8_t (*array)[];
570  };
572 
573 
582 #define AFW_UTF8_LITERAL(A_STRING) {A_STRING, sizeof(A_STRING) - 1}
583 
584 
588 #define AFW_UTF8_FMT ".*s"
589 
591 #define AFW_UTF8_CONTEXTUAL_LABEL_FMT_SEP "> "
592 
593 
595 #define AFW_UTF8_CONTEXTUAL_LABEL_FMT \
596 AFW_UTF8_FMT AFW_UTF8_CONTEXTUAL_LABEL_FMT_SEP
597 
605 #define AFW_UTF8_FMT_ARG(A_STRING) \
606  (int)(A_STRING)->len, (const char *)(A_STRING)->s
607 
608 
616 #define AFW_UTF8_FMT_OPTIONAL_ARG(A_STRING) \
617  (A_STRING) ? (int)(A_STRING)->len : 0, \
618  (A_STRING) ? (const char *)(A_STRING)->s : ""
619 
620 
628 #define AFW_UTF8_FMT_OPTIONAL_UNDEFINED_ARG(A_STRING) \
629  (A_STRING) ? (int)(A_STRING)->len : 0, \
630  (A_STRING) ? (const char *)(A_STRING)->s : "<undefined>"
631 
632 
636 #define AFW_MESSAGE_PREFIX __FILE__ ":" AFW_STRINGIFY(__LINE__) " "
637 
638 
642 #define AFW_UTF8_ENCODING "UTF-8"
643 
644 
649 typedef uint32_t afw_u_cp_t;
650 
651 
655 typedef char *afw_uri_t;
656 
657 
660 
661 
663 typedef int afw_rc_t;
664 
665 
669 struct afw_stack_s {
670  const afw_pool_t *p;
671  void *first;
672  void *top;
673  void *end;
674 };
675 
676 
680 typedef struct afw_name_value_s {
681  const afw_utf8_t *name;
682  const afw_value_t *value;
684 
685 
689 typedef struct afw_key_string_s {
690  const afw_utf8_t *key;
691  const afw_utf8_t *string;
693 
694 
698 typedef struct afw_key_z_string_z_s {
699  union {
700  afw_utf8_t key;
701  const afw_utf8_z_t *key_z;
702  };
703  union {
704  afw_utf8_t string;
705  const afw_utf8_z_t *string_z;
706  };
708 
709 
718 #define AFW_STACK_STRUCT(struct_name, entry_type) \
719 struct struct_name { \
720  union { \
721  afw_stack_t pub; \
722  struct { \
723  const afw_pool_t *p; \
724  entry_type *first; \
725  entry_type *top; \
726  entry_type *end; \
727  }; \
728  }; \
729 }
730 
734 AFW_STACK_STRUCT(afw_utf8_stack_s, afw_utf8_t);
735 
739 AFW_STACK_STRUCT(afw_const_utf8_a_stack_s, const afw_utf8_t *);
740 
744 AFW_STACK_STRUCT(afw_name_value_stack_s, afw_name_value_t);
745 
746 
753 typedef struct afw_object_meta_s {
754 
762 
769 
782  const afw_utf8_t *id;
783 
797 
812 
814 
815 
816 
896 #define AFW_ERROR_CODE_MAP(XX) \
897  XX(none, true, 200, "OK" )\
898  XX(general, true, 500, "General Error" )\
899  XX(bad_request, true, 400, "Bad Request" )\
900  XX(query_too_complex, true, 400, "Query Too Complex" )\
901  XX(request_syntax, true, 400, "Request Syntax Error" )\
902  XX(objects_needed, true, 400, "Objects Needed To Complete Request")\
903  XX(authentication_required,true, 401, "Authentication Needed" )\
904  XX(denied, true, 403, "Forbidden - Access Denied" )\
905  XX(read_only, true, 403, "Forbidden - Read Only" )\
906  XX(not_found, true, 404, "Not Found" )\
907  XX(method_not_allowed, true, 405, "Method Not Allowed" )\
908  XX(unsupported_accept, false, 406, "Unsupported Content Type Requested")\
909  XX(client_time_out, true, 408, "Request Timeout" )\
910  XX(im_a_teapot, true, 418, "I'm a Teapot" )\
911  XX(conflict, true, 409, "Conflict" )\
912  XX(length_required, true, 411, "Content Length Required" )\
913  XX(payload_too_large, true, 413, "Payload too large" )\
914  XX(unsupported_content, true, 415, "Unsupported Content Type" )\
915  XX(memory, true, 500, "Memory Error" )\
916  XX(syntax, true, 500, "Server Side Syntax Error" )\
917  XX(method_not_supported, true, 501, "Method Not Supported" )\
918  XX(client_closed, false, 000, "Client Closed Connection" )\
919  XX(assertion_failed, true, 400, "Assertion failed" )\
920  XX(cast_error, true, 400, "Adaptive Type Cast Error" )\
921  XX(arg_error, true, 400, "Adaptive Function Arg Error" )\
922  XX(evaluate, true, 400, "Evaluation error" )\
923  XX(undefined, true, 400, "Undefined value" )\
924  XX(code, true, 500, "Clearly an internal coding error" )\
925 
927 typedef enum afw_error_code_e {
928  afw_error_code_is_not_specified = 0,
929 
930 #define XX(id, error_allow_in_response, http_response_code, description) \
931  afw_error_code_ ## id,
933 #undef XX
934 
942 
944 
945 
946 
955  void *data, void *data2, const afw_pool_t *p, afw_xctx_t *xctx);
956 
957 
958 
968 typedef const afw_value_t *
969 (*afw_xctx_get_variable_t)(
971  const afw_utf8_t *name,
972  afw_xctx_t *xctx);
973 
974 
976 typedef enum afw_log_priority_e {
977 
978  afw_log_priority_invalid = -1,
980  /* These go to the configured log. */
992  /* These go to the configured trace destination. */
1005 
1006 
1027 
1038 
1050 
1061 
1096 
1119 
1146 
1148 
1149 
1176 (*afw_object_cb_t)(
1177  const afw_object_t *object,
1178  void *context,
1179  afw_xctx_t *xctx);
1180 
1181 
1190 (*afw_value_cb_t)(
1191  const void *value,
1192  void *context,
1193  afw_xctx_t *xctx);
1194 
1195 
1206 typedef afw_size_t
1207 (*afw_read_cb_t)(
1208  void *context,
1209  const void * buffer,
1210  afw_size_t size,
1211  afw_boolean_t *more_to_read,
1212  const afw_pool_t *p,
1213  afw_xctx_t *xctx);
1214 
1215 
1225 typedef afw_size_t
1226 (*afw_write_cb_t)(
1227  void *context,
1228  const void * buffer,
1229  afw_size_t size,
1230  const afw_pool_t *p,
1231  afw_xctx_t *xctx);
1232 
1233 /*
1234  * @brief Runtime value accessor function.
1235  * @param property is associated afw_runtime_object_map_property_t *.
1236  * @param internal value.
1237  * @param p pool to use.
1238  * @param xctx xctx of caller.
1239  */
1240 typedef const afw_value_t *
1241 (*afw_runtime_value_accessor_t) (
1242  const afw_runtime_object_map_property_t * property,
1243  const void *internal, const afw_pool_t *p, afw_xctx_t *xctx);
1244 
1245 
1251 typedef const afw_value_t *
1252 (*afw_function_execute_cb_t) (afw_function_execute_t *x);
1253 
1254 
1255 
1265 typedef const afw_value_t *
1266 (*afw_function_thunk_execute_t) (
1267  const afw_value_function_thunk_t *function,
1268  afw_size_t argc,
1269  const afw_value_t *const *argv,
1270  const afw_pool_t *p,
1271  afw_xctx_t *xctx);
1272 
1273 
1274 
1288 typedef const afw_utf8_t *
1289 (*afw_function_arg_check_t)(
1291  afw_size_t argc,
1292  const afw_value_t * argv[],
1293  const afw_pool_t *p,
1294  afw_xctx_t *xctx);
1295 
1296 
1298 #define AFW_SERVICE_STARTUP_MAP(XX) \
1299  XX(disabled, "Service is disabled and cannot be started." )\
1300  XX(permanent, "Service is permanently started and can not be stopped." )\
1301  XX(manual, "Service is started and stopped manually." )\
1302  XX(immediate, "Service is started immediately and can be stopped and " \
1303  "started manually." )\
1304 
1312 
1313 #define XX(id, desc) afw_service_startup_ ## id,
1315 #undef XX
1316 
1317  afw_service_startup_invalid
1319 
1321 #define AFW_SERVICE_STATUS_MAP(XX) \
1322  XX(error, "Service is not running because of an error." )\
1323  XX(disabled, "Service is disabled." )\
1324  XX(ready_to_start, "Service is ready to start." )\
1325  XX(starting, "Service is starting." )\
1326  XX(running, "Service is running." )\
1327  XX(stopping, "Service is finishing active work and releasing resources." )\
1328  XX(stopped, "Service is stopped and can be started manually." )\
1329  XX(restarting,"Service is restarting." )\
1330 
1337 typedef enum afw_service_status_e {
1338 
1339 #define XX(id, desc) afw_service_status_ ## id,
1341 #undef XX
1342 
1343  afw_service_status_invalid
1345 
1346 
1348 #define afw_thread_mutex_t apr_thread_mutex_t
1349 
1351 #define afw_thread_mutex_create apr_thread_mutex_create
1352 
1354 #define afw_thread_mutex_lock apr_thread_mutex_lock
1355 
1357 #define afw_thread_mutex_trylock apr_thread_mutex_trylock
1358 
1360 #define afw_thread_mutex_unlock apr_thread_mutex_unlock
1361 
1363 #define afw_thread_mutex_destroy apr_thread_mutex_destroy
1364 
1366 #define AFW_THREAD_FUNCTION APR_THREAD_FUNC
1367 
1369 typedef void
1371  (const afw_thread_t *thread, void *arg);
1372 
1374 typedef struct afw_thread_attr_s afw_thread_attr_t;
1375 
1377 #define AFW_ENVIRONMENT_DEFAULT_EVALUATION_STACK_INITIAL_COUNT 100
1378 
1380 #define AFW_ENVIRONMENT_DEFAULT_EVALUATION_STACK_MAXIMUM_COUNT 200
1381 
1384 
1386  const afw_pool_t *p;
1387 
1389  union {
1390  afw_utf8_t program_name;
1391  const afw_utf8_z_t * program_name_z;
1392  };
1393 
1396 
1399 
1402 
1405 
1408 
1411 
1414 
1417 
1419  const afw_log_t *log;
1420 
1422  FILE *debug_fd;
1423 
1425  FILE *stderr_fd;
1426 
1428  FILE *stdout_fd;
1429 
1432 
1435 
1438 
1441 
1444 
1447 
1450 
1453 
1456 
1459 
1462 
1465 
1468 
1469 
1470  /*---------- LOCKS ----------*/
1471 
1474 
1477 
1480 
1489 
1494 
1499 
1500 
1501  /*---------- FLAGS ----------*/
1502 
1505 
1508 
1519  AFW_ATOMIC const afw_boolean_t *default_flags;
1520 
1528  const afw_flag_t * AFW_ATOMIC const *flag_by_index;
1529 
1532 
1535 
1538 
1541 
1544 
1547 
1550 
1553 
1556 
1559 
1562 
1565 
1568 
1571 
1574 
1577 
1578 };
1579 
1581 typedef union afw_c_types_u {
1582 
1583  afw_integer_t integer;
1584  afw_integer_t integer_p;
1585 
1586  afw_int8_t int8;
1587  afw_int8_t * int8_p;
1588 
1589  afw_uint8_t uint8;
1590  afw_uint8_t * uint8_p;
1591 
1592  afw_int16_t int16;
1593  afw_int16_t * int16_p;
1594 
1595  afw_uint16_t uint16;
1596  afw_uint16_t * uint16_p;
1597 
1598  afw_int32_t int32;
1599  afw_int32_t * int32_p;
1600 
1601  afw_uint32_t uint32;
1602  afw_uint32_t * uint32_p;
1603 
1604  afw_int64_t int64;
1605  afw_int64_t * int64_p;
1606 
1607  afw_uint64_t uint64;
1608  afw_uint64_t * uint64_p;
1609 
1610  afw_list_t * list_p;
1611 
1612  afw_float32_t float32;
1613  afw_float32_t * float32_p;
1614 
1615  afw_float64_t float64;
1616  afw_float64_t * float64_p;
1617 
1618  afw_float_t floating;
1619  afw_float_t * floating_p;
1620 
1621  afw_object_t * object_p;
1622 
1623  afw_utf8_t string;
1624  afw_utf8_t * string_p;
1625 
1627 
1628 
1635 typedef struct afw_time_with_offset_s {
1636  apr_time_t time;
1637  apr_time_t offset;
1639 
1640 
1646 typedef struct afw_yearMonthDuration_s {
1647  afw_int32_t years;
1648  afw_int32_t months;
1650 
1651 
1657 typedef struct afw_dayTimeDuration_s {
1658  afw_int32_t days;
1659  afw_int32_t hours;
1660  afw_int32_t minutes;
1661  afw_int32_t seconds;
1662  afw_int32_t microseconds;
1664 
1665 
1669 typedef struct afw_time_duration_s {
1670  afw_yearMonthDuration_t yearMonth;
1671  afw_dayTimeDuration_t dayTime;
1673 
1674 
1678 typedef struct afw_time_zone_s {
1683 
1690 
1691 
1695 typedef struct afw_date_no_time_zone_s {
1696 
1699 
1702 
1705 
1707 
1708 
1712 typedef struct afw_date_s {
1713 
1716 
1719 
1721 
1722 
1726 typedef struct afw_time_no_time_zone_s {
1727 
1730 
1733 
1736 
1739 
1741 
1742 
1746 typedef struct afw_time_s {
1747 
1750 
1753 
1755 
1756 
1760 typedef struct afw_dateTime_s {
1761 
1764 
1767 
1770 
1772 
1773 
1779 typedef void
1781  void *data, afw_xctx_t *xctx);
1782 
1783 
1789 typedef void
1791  void *data, afw_xctx_t *xctx);
1792 
1793 
1794 AFW_END_DECLARES
1795 
1798 #endif /* __AFW_COMMON_H__ */
(deprecated) Adaptive Framework associative array templates
Adaptive Framework Common Opaques Header.
Adaptive Framework declare helpers for afw_.
#define AFW_BEGIN_DECLARES
Adaptive Framework Base Package main Doxygen groups.
Interface afw_interface opaque typedefs.
struct afw_object_meta_s afw_object_meta_t
Typedef for meta variable in afw_object interface.
#define AFW_SERVICE_STARTUP_MAP(XX)
Map used for afw_service_startup_t enum.
Definition: afw_common.h:1298
void(* afw_service_wrapper_stop_cb)(void *data, afw_xctx_t *xctx)
Typedef for service wrapper stop call back.
Definition: afw_common.h:1790
#define AFW_STACK_STRUCT(struct_name, entry_type)
Define a struct for a stack with the specified entry type.
Definition: afw_common.h:718
uint8_t afw_uint8_t
8-bit unsigned integer.
Definition: afw_common.h:175
struct afw_name_value_s afw_name_value_t
Typedef for name/value pair.
apr_uint64_t afw_uint64_t
64-bit unsigned integer.
Definition: afw_common.h:190
double afw_float64_t
64-bit float.
Definition: afw_common.h:196
struct afw_dateTime_s afw_dateTime_t
date, time, and time zone.
afw_boolean_t(* afw_object_cb_t)(const afw_object_t *object, void *context, afw_xctx_t *xctx)
Typedef for afw_adaptor_session_object callback.
Definition: afw_common.h:1176
afw_log_priority_e
Log levels. See afw_log.h for more information.
Definition: afw_common.h:976
struct afw_time_no_time_zone_s afw_time_no_time_zone_t
time with no time zone.
apr_uint16_t afw_uint16_t
16-bit unsigned integer.
Definition: afw_common.h:178
void *(AFW_THREAD_FUNCTION * afw_thread_function_t)(const afw_thread_t *thread, void *arg)
Typedef for thread start function.
Definition: afw_common.h:1371
double afw_double_t
Normal AFW number is double.
Definition: afw_common.h:202
apr_int32_t afw_int32_t
32-bit signed integer.
Definition: afw_common.h:163
afw_service_status_e
Typedef for service status enum.
Definition: afw_common.h:1337
apr_int16_t afw_int16_t
16-bit signed integer.
Definition: afw_common.h:160
apr_uint64_t afw_unsigned_integer_t
typedef for big unsigned int.
Definition: afw_common.h:369
struct afw_time_s afw_time_t
time with time zone.
_Bool afw_boolean_t
Definition: afw_common.h:373
#define AFW_THREAD_FUNCTION
Uses APR_THREAD_FUNC as AFW_THREAD_FUNCTION.
Definition: afw_common.h:1366
double afw_float_t
Normal float.
Definition: afw_common.h:199
afw_service_startup_e
Typedef for service startup type enum.
Definition: afw_common.h:1311
struct afw_yearMonthDuration_s afw_yearMonthDuration_t
yearMonth duration
int8_t afw_int8_t
8-bit signed integer.
Definition: afw_common.h:157
enum afw_error_code_e afw_error_code_t
int afw_log_priority_mask_t
Definition: afw_common.h:659
unsigned char afw_byte_t
A byte of memory (unsigned).
Definition: afw_common.h:208
afw_boolean_t(* afw_value_cb_t)(const void *value, void *context, afw_xctx_t *xctx)
Typedef for value callback.
Definition: afw_common.h:1190
struct afw_key_z_string_z_s afw_key_z_string_z_t
Typedef for key/string pair that have both utf8 and utf8_z.
enum afw_service_status_e afw_service_status_t
Typedef for service status enum.
afw_int32_t afw_code_point_t
Unicode code point.
Definition: afw_common.h:205
struct afw_time_zone_s afw_time_zone_t
time zone
enum afw_service_startup_e afw_service_startup_t
Typedef for service startup type enum.
struct afw_dayTimeDuration_s afw_dayTimeDuration_t
dayTime duration
#define AFW_SERVICE_STATUS_MAP(XX)
Map used for afw_service_status_t enum.
Definition: afw_common.h:1321
char * afw_uri_t
this implementation uses UTF-8.
Definition: afw_common.h:655
#define AFW_COMPILE_TYPE_MAP(XX)
Compile Type Map.
Definition: afw_common.h:409
int(* afw_utf8_octet_get_cb_t)(afw_utf8_octet_t *octet, void *data, afw_xctx_t *xctx)
Get an utf-8 octet (8 bits).
Definition: afw_common.h:255
struct afw_memory_s afw_memory_t
Struct for memory pointer and size.
struct afw_utf8_array_s afw_utf8_array_t
Array of strings.
struct afw_date_s afw_date_t
date with time zone.
afw_utf8_octet_t afw_utf8_z_t
NFC normalized UTF-8 null terminated string.
Definition: afw_common.h:523
apr_int64_t afw_int64_t
64-bit signed integer.
Definition: afw_common.h:172
afw_size_t(* afw_read_cb_t)(void *context, const void *buffer, afw_size_t size, afw_boolean_t *more_to_read, const afw_pool_t *p, afw_xctx_t *xctx)
Typedef for read callback function.
Definition: afw_common.h:1207
apr_uint32_t afw_uint32_t
32-bit unsigned integer.
Definition: afw_common.h:184
float afw_float32_t
32-bit float.
Definition: afw_common.h:193
enum afw_compile_type_e afw_compile_type_t
Compile type enum.
char afw_utf8_octet_t
8 bits of utf-8 codepoint.
Definition: afw_common.h:236
uint32_t afw_u_cp_t
A Unicode codepoint. Range is 0 to 0x10ffff. Other values are illegal Unicode codepoints.
Definition: afw_common.h:649
apr_size_t afw_size_t
size_t.
Definition: afw_common.h:151
int afw_rc_t
Definition: afw_common.h:663
afw_adaptor_journal_option_e
Typedef for afw_adaptor_journal get_entry options enum.
Definition: afw_common.h:1026
struct afw_time_with_offset_s afw_time_with_offset_t
Time with offset (old)
void(* afw_pool_cleanup_function_p_t)(void *data, void *data2, const afw_pool_t *p, afw_xctx_t *xctx)
Typedef for pool cleanup functions.
Definition: afw_common.h:954
struct afw_time_duration_s afw_time_duration_t
Time duration.
struct afw_thread_attr_s afw_thread_attr_t
Typedef for afw_thread_attr.
Definition: afw_common.h:1374
afw_compile_type_e
Compile type enum.
Definition: afw_common.h:488
unsigned char afw_octet_t
8 bits (unsigned).
Definition: afw_common.h:211
enum afw_log_priority_e afw_log_priority_t
Log levels. See afw_log.h for more information.
struct afw_utf8_s afw_utf8_t
NFC normalized UTF-8 string.
struct afw_key_string_s afw_key_string_t
Typedef for key/string pair.
void(* afw_service_wrapper_start_cb)(void *data, afw_xctx_t *xctx)
Typedef for service wrapper start call back.
Definition: afw_common.h:1780
#define AFW_ERROR_CODE_MAP(XX)
Error code map. IMPORTANT>>> Do not change the order of these entries. The order must match the order...
Definition: afw_common.h:896
afw_code_point_t(* afw_code_point_get_cb_t)(void *data, afw_xctx_t *xctx)
Get Unicode code point callback.
Definition: afw_common.h:244
afw_size_t(* afw_write_cb_t)(void *context, const void *buffer, afw_size_t size, const afw_pool_t *p, afw_xctx_t *xctx)
Typedef for write callback function.
Definition: afw_common.h:1226
apr_int64_t afw_integer_t
typedef for big signed int.
Definition: afw_common.h:321
union afw_c_types_u afw_c_types_t
Typedef for union of all cType.
enum afw_adaptor_journal_option_e afw_adaptor_journal_option_t
Typedef for afw_adaptor_journal get_entry options enum.
apr_off_t afw_off_t
off_t.
Definition: afw_common.h:154
struct afw_date_no_time_zone_s afw_date_no_time_zone_t
date with no time zone.
afw_error_code_e
Definition: afw_common.h:927
union afw_utf8_utf8_z_s afw_utf8_utf8_z_t
NFC normalized UTF-8 string accessible as afw_utf8_t or afw_utf8_z_t.
@ afw_log_priority_alert
Definition: afw_common.h:983
@ afw_log_priority_min
Definition: afw_common.h:981
@ afw_log_priority_max
Definition: afw_common.h:990
@ afw_log_priority_trace3
Definition: afw_common.h:996
@ afw_log_priority_crit
Definition: afw_common.h:984
@ afw_log_priority_trace8
Definition: afw_common.h:1001
@ afw_log_priority_debug
Definition: afw_common.h:989
@ afw_log_priority_trace4
Definition: afw_common.h:997
@ afw_log_priority_notice
Definition: afw_common.h:987
@ afw_log_priority_emerg
Definition: afw_common.h:982
@ afw_log_priority_trace2
Definition: afw_common.h:995
@ afw_log_priority_trace5
Definition: afw_common.h:998
@ afw_log_priority_trace_min
Definition: afw_common.h:993
@ afw_log_priority_err
Definition: afw_common.h:985
@ afw_log_priority_trace7
Definition: afw_common.h:1000
@ afw_log_priority_trace6
Definition: afw_common.h:999
@ afw_log_priority_info
Definition: afw_common.h:988
@ afw_log_priority_trace_max
Definition: afw_common.h:1002
@ afw_log_priority_warning
Definition: afw_common.h:986
@ afw_log_priority_trace1
Definition: afw_common.h:994
@ afw_adaptor_journal_option_get_next_for_consumer_after_cursor
afw_adaptor_journal get_entry option get_next_for_consumer_after_cursor
Definition: afw_common.h:1118
@ afw_adaptor_journal_option_get_next_for_consumer
afw_adaptor_journal get_entry option get_next_for_consumer
Definition: afw_common.h:1095
@ afw_adaptor_journal_option_advance_cursor_for_consumer
afw_adaptor_journal get_entry option advance_cursor_for_consumer
Definition: afw_common.h:1145
@ afw_adaptor_journal_option_get_next_after_cursor
afw_adaptor_journal get_entry option get_next_after_cursor
Definition: afw_common.h:1060
@ afw_adaptor_journal_option_get_by_cursor
afw_adaptor_journal get_entry option get_by_cursor
Definition: afw_common.h:1049
@ afw_adaptor_journal_option_get_first
afw_adaptor_journal get_entry option get_first
Definition: afw_common.h:1037
@ afw_error_code_highest_afw
Definition: afw_common.h:941
Interface afw_adaptor public struct.
date with no time zone.
Definition: afw_common.h:1695
date with time zone.
Definition: afw_common.h:1712
afw_date_no_time_zone_t date
Definition: afw_common.h:1715
afw_time_zone_t time_zone
Definition: afw_common.h:1718
date, time, and time zone.
Definition: afw_common.h:1760
afw_time_no_time_zone_t time
Definition: afw_common.h:1766
afw_date_no_time_zone_t date
Definition: afw_common.h:1763
afw_time_zone_t time_zone
Definition: afw_common.h:1769
dayTime duration
Definition: afw_common.h:1657
Struct for typedef afw_environment_t defined in afw_common.h.
Definition: afw_common.h:1383
AFW_ATOMIC const afw_boolean_t * default_flags
Default flags array indexed by flag_index.
Definition: afw_common.h:1519
AFW_ATOMIC afw_integer_t pool_number
Used to give unique number for pool.
Definition: afw_common.h:1464
FILE * stdout_fd
Open file descriptor used for writing standard output. Default stdout.
Definition: afw_common.h:1428
const afw_lock_t * multithreaded_pool_lock
Lock used internal to afw_pool.c.
Definition: afw_common.h:1476
afw_double_t minus_infinity
Double minus infinity.
Definition: afw_common.h:1437
afw_utf8_t application_id
The id of the application.
Definition: afw_common.h:1404
afw_size_t flag_index_trace_request_detail
Flag index of trace:request:detail.
Definition: afw_common.h:1576
AFW_ATOMIC afw_size_t flags_count_allocated
The number of flags allocated in global_flags.
Definition: afw_common.h:1504
afw_size_t flag_index_trace_authorization_check_detail
Flag index of trace:authorization:check:detail.
Definition: afw_common.h:1561
afw_size_t evaluation_stack_maximum_count
maximum_count used to create xctx's evaluation stack.
Definition: afw_common.h:1458
afw_size_t flag_index_debug_pool
Flag index of debug:pool.
Definition: afw_common.h:1537
const afw_adaptor_t * afw_adaptor
Adaptive framework core adaptor.
Definition: afw_common.h:1398
const afw_lock_t * active_log_list_lock
Lock for protecting changes to active log list.
Definition: afw_common.h:1493
afw_size_t flag_index_response_error_hasAdditionalDetail
Flag index of response:error:hasAdditionalDetail.
Definition: afw_common.h:1552
afw_double_t NaN
Double NaN.
Definition: afw_common.h:1443
afw_size_t flag_index_response_error_contextual
Flag index of response:error:contextual.
Definition: afw_common.h:1549
afw_size_t flag_index_debug_function_active_detail
Flag index of debug:function_active:detail.
Definition: afw_common.h:1534
const afw_object_t * application_qualified_variables
Definition: afw_common.h:1410
const afw_log_t * log
Director log. This log will direct to other logs.
Definition: afw_common.h:1419
const afw_object_t * initial_environment_variables
Environment variables at environment create.
Definition: afw_common.h:1395
afw_size_t flag_index_trace_evaluation_detail
Flag index of trace:evaluation:detail.
Definition: afw_common.h:1570
const afw_pool_t * p
Pool used to hold environment.
Definition: afw_common.h:1386
afw_size_t flag_index_response_error_backtraceEvaluation
Flag index of response:error:backtraceEvaluation.
Definition: afw_common.h:1546
const afw_value_t * NaN_value
Double NaN value.
Definition: afw_common.h:1446
afw_size_t flag_index_trace_authorization_check
Flag index of trace:authorization:check.
Definition: afw_common.h:1555
afw_size_t flag_index_debug_function_active
Flag index of debug:function_active.
Definition: afw_common.h:1531
const afw_lock_t * flags_lock
Lock for protecting changes to flags (internal to afw_flag.c).
Definition: afw_common.h:1498
const afw_lock_t * adaptor_id_anchor_lock
Lock for protecting changes to adaptor id anchors.
Definition: afw_common.h:1479
const afw_function_environment_t * function_environment
Used by function execution.
Definition: afw_common.h:1452
const afw_flag_t *AFW_ATOMIC const * flag_by_index
Flag struct indexed by flag_index.
Definition: afw_common.h:1528
afw_size_t flag_index_trace_authorization_decision_detail
Flag index of trace:authorization:decision:detail.
Definition: afw_common.h:1567
const afw_object_t * application_object
Application object - /afw/_AdaptiveApplication_/current.
Definition: afw_common.h:1407
afw_size_t flag_index_trace_authorization_decision
Flag index of trace:authorization:decision.
Definition: afw_common.h:1564
afw_size_t evaluation_stack_initial_count
initial_count used to create xctx's evaluation stack.
Definition: afw_common.h:1455
FILE * debug_fd
Open file descriptor used for debug writes. Default stderr.
Definition: afw_common.h:1422
const afw_lock_rw_t * authorization_handler_id_anchor_rw_lock
Lock for protecting changes to authorization handler id anchors.
Definition: afw_common.h:1488
afw_size_t flag_index_debug_pool_detail
Flag index of debug:pool:detail.
Definition: afw_common.h:1540
const afw_object_t * root_file_paths
rootFilePaths - /afw/_AdaptiveApplication_/current/rootFilePaths.
Definition: afw_common.h:1413
afw_boolean_t terminating
Indicates that environment is terminating.
Definition: afw_common.h:1467
const afw_lock_t * environment_lock
Lock for whole environment.
Definition: afw_common.h:1473
afw_size_t flag_index_trace_authorization_check_bypass
Flag index of trace:authorization:check:bypass.
Definition: afw_common.h:1558
afw_log_priority_mask_t log_mask
Copy of director log's mask for short circuit tests.
Definition: afw_common.h:1461
const afw_value_t * infinity_value
Double infinity value.
Definition: afw_common.h:1434
const afw_utf8_t * layout_adaptor_id
Custom layout adaptor or NULL.
Definition: afw_common.h:1416
const afw_authorization_control_t * authorization_control
Used by authorization.
Definition: afw_common.h:1449
afw_double_t infinity
Double infinity.
Definition: afw_common.h:1431
afw_size_t flag_index_response_error_backtrace
Flag index of response:error:backtrace.
Definition: afw_common.h:1543
FILE * stderr_fd
Open file descriptor used for writing error output. Default stderr.
Definition: afw_common.h:1425
AFW_ATOMIC afw_size_t flags_count_registered
The number of flags registered.
Definition: afw_common.h:1507
afw_size_t flag_index_trace_request
Flag index of trace:request.
Definition: afw_common.h:1573
const afw_adaptor_t * conf_adaptor
Adaptor for application.confAdaptorId or NULL.
Definition: afw_common.h:1401
const afw_value_t * minus_infinity_value
Double minus infinity value.
Definition: afw_common.h:1440
Struct used for a registered flag.
Definition: afw_flag.h:32
Function execute parameter.
Definition: afw_function.h:53
Typedef for key/string pair.
Definition: afw_common.h:689
Typedef for key/string pair that have both utf8 and utf8_z.
Definition: afw_common.h:698
Interface afw_list public struct.
Interface afw_log public struct.
Struct for memory pointer and size.
Definition: afw_common.h:505
Typedef for name/value pair.
Definition: afw_common.h:680
Typedef for meta variable in afw_object interface.
Definition: afw_common.h:753
const afw_utf8_t * id
Object id or property name.
Definition: afw_common.h:782
const afw_utf8_t * object_uri
Object path or NULL.
Definition: afw_common.h:811
const afw_object_t * embedding_object
Embedding object.
Definition: afw_common.h:768
const afw_utf8_t * object_type_uri
Object type object URI or NULL.
Definition: afw_common.h:796
const afw_object_t * meta_object
Meta object.
Definition: afw_common.h:761
Interface afw_object public struct.
Interface afw_pool public struct.
Struct for runtime object map property.
Definition: afw_runtime.h:99
Struct for afw_stack_t typedef.
Definition: afw_common.h:669
Struct for public part of afw_pool_t.
Definition: afw_thread.h:56
Time duration.
Definition: afw_common.h:1669
time with no time zone.
Definition: afw_common.h:1726
afw_uint32_t microsecond
Definition: afw_common.h:1738
time with time zone.
Definition: afw_common.h:1746
afw_time_no_time_zone_t time
Definition: afw_common.h:1749
afw_time_zone_t time_zone
Definition: afw_common.h:1752
Time with offset (old)
Definition: afw_common.h:1635
afw_int8_t minutes
Definition: afw_common.h:1688
afw_int8_t hours
Definition: afw_common.h:1682
Array of strings.
Definition: afw_common.h:565
NFC normalized UTF-8 string.
Definition: afw_common.h:545
Struct for function thunk value.
Interface afw_value public struct.
Definition: afw_xctx.h:352
Interface afw_xctx public struct.
yearMonth duration
Definition: afw_common.h:1646
Typedef for union of all cType.
Definition: afw_common.h:1581
NFC normalized UTF-8 string accessible as afw_utf8_t or afw_utf8_z_t.
Definition: afw_common.h:555