Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
afw_command_local_server.c
Go to the documentation of this file.
1 // See the 'COPYING' file in the project root for licensing information.
2 /*
3  * Adaptive Framework
4  *
5  * Copyright (c) 2010-2023 Clemson University
6  *
7  */
8 
9 #include "afw.h"
10 #include "afw_command_internal.h"
14 
15 /* Declares and rti/inf defines for interface afw_server */
16 #define AFW_IMPLEMENTATION_ID "afw_command_local"
18 
31 /* Compiled afw version. */
32 static const afw_utf8_t
33 impl_compiled_afw_version =
34 AFW_UTF8_LITERAL(AFW_VERSION_STRING);
35 
36 static const afw_utf8_t
37 impl_default_afw_conf = AFW_UTF8_LITERAL(
38 "[\n"
39 " {\n"
40 " \"type\" : \"requestHandler\",\n"
41 " \"uriPrefix\" : \"/\",\n"
42 " \"requestHandlerType\" : \"adaptor\"\n"
43 " }\n"
44 "]\n"
45 );
46 
47 
48 /* Get input in local mode. */
49 static const afw_memory_t *
50 impl_local_get_input(
52  afw_xctx_t *xctx)
53 {
54  afw_memory_t *result;
55  long long len;
56  int rv;
57  int c;
58 
59  /* If eof, just return NULL. */
60  if (self->eof) {
61  return NULL;
62  }
63 
64  /* Read chunks into input buffer. */
65  apr_array_clear(self->input_buffer);
66  for (;;) {
67 
68  /*
69  * Get and unget first char to make sure it is a digit. Function
70  * fscanf() can skip characters, so this is here to make sure
71  * a stealth chunk error doesn't occur.
72  */
73  c = fgetc(self->fd_input);
74  if (c == EOF) {
75  if (self->input_buffer->nelts != 0) {
76  goto error;
77  }
78  return NULL;
79  }
80  if (c < '0' || c > '9') {
81  goto error;
82  }
83  rv = ungetc(c, self->fd_input);
84  if (rv != c) {
85  goto error;
86  }
87 
88  /* Get len followed by \n. If 0\n, break. */
89  rv = fscanf(self->fd_input, "%lld", &len);
90  if (rv < 0 || rv != 1) {
91  goto error;
92  }
93  c = fgetc(self->fd_input);
94  if (c != '\n') {
95  goto error;
96  }
97  if (len == 0) {
98  break;
99  }
100 
101  /* Push the characters from chunk on input buffer. */
102  for (; len > 0; len--) {
103  c = fgetc(self->fd_input);
104  if (c < 0 || c > 255) {
105  goto error;
106  }
107  APR_ARRAY_PUSH(self->input_buffer, unsigned char) = c;
108  }
109  }
110 
111  /* Return result. */
112  result = afw_xctx_malloc_type(afw_memory_t, xctx);
113  result->ptr = (const afw_byte_t *)self->input_buffer->elts;
114  result->size = self->input_buffer->nelts;
115  return result;
116 
117 error:
118  self->fatal_error = true;
119  AFW_THROW_ERROR_Z(general, "Invalid chunk", xctx);
120 }
121 
122 
123 static const afw_object_t *
124 impl_get_directive_input(
126  const afw_utf8_t *string,
127  afw_size_t directive_len,
128  afw_xctx_t *xctx)
129 {
130  const afw_object_t *result;
131  afw_utf8_t s;
132 
133  if (string->len == directive_len) {
134  return afw_object_create_managed(self->pub.xctx->p, self->pub.xctx);
135  }
136 
137  if (string->s[directive_len] != ':') {
138  AFW_THROW_ERROR_Z(general, "Missing ':'", xctx);
139  }
140 
141  s.s = string->s + directive_len + 1;
142  s.len = string->len - directive_len - 1;
144  &result, &s, afw_data_type_object, self->pub.xctx->p, self->pub.xctx);
145 
146  return result;
147 }
148 
149 
150 
151 static void
152 impl_process_directive(
154  const afw_memory_t *input,
155  afw_xctx_t *xctx)
156 {
157  afw_utf8_t partial;
158  const afw_utf8_t *string;
159  afw_boolean_t is_invalid;
160 
161  is_invalid = true;
162 
163  /* Create string from input in current's requests memory so it will free. */
164  string = afw_utf8_create(
165  (const afw_utf8_octet_t *)input->ptr, input->size,
166  xctx->p, xctx);
167 
168  /* ++afw-local-mode-evaluate-direct */
169  if (afw_utf8_starts_with(string,
170  &afw_command_s_a_local_mode_evaluate_direct))
171  {
172  self->mode = afw_command_local_server_mode_evaluate_direct;
173  if (self->multi_request_mode_properties) {
174  afw_object_release(self->multi_request_mode_properties,
175  self->pub.xctx);
176  }
177  self->multi_request_mode_properties = impl_get_directive_input(self,
178  string, afw_command_s_a_local_mode_evaluate_direct.len, xctx);
179  is_invalid = false;
180  }
181 
182  /* ++afw-local-mode-evaluate */
183  else if (afw_utf8_starts_with(string,
184  &afw_command_s_a_local_mode_evaluate))
185  {
186  self->mode = afw_command_local_server_mode_evaluate;
187  if (self->multi_request_mode_properties) {
188  afw_object_release(self->multi_request_mode_properties,
189  self->pub.xctx);
190  }
191  self->multi_request_mode_properties = impl_get_directive_input(self,
192  string, afw_command_s_a_local_mode_evaluate.len, xctx);
193  is_invalid = false;
194  }
195 
196  /* ++afw-local-mode-action-direct */
197  else if (afw_utf8_starts_with(string,
198  &afw_command_s_a_local_mode_action_direct))
199  {
200  self->mode = afw_command_local_server_mode_action_direct;
201  if (self->multi_request_mode_properties) {
202  afw_object_release(self->multi_request_mode_properties,
203  self->pub.xctx);
204  }
205  self->multi_request_mode_properties = impl_get_directive_input(self,
206  string, afw_command_s_a_local_mode_action_direct.len, xctx);
207  is_invalid = false;
208  }
209 
210  /* ++afw-local-mode-action */
211  else if (afw_utf8_starts_with(string,
212  &afw_command_s_a_local_mode_action))
213  {
214  self->mode = afw_command_local_server_mode_action;
215  if (self->multi_request_mode_properties) {
216  afw_object_release(self->multi_request_mode_properties,
217  self->pub.xctx);
218  }
219  self->multi_request_mode_properties = impl_get_directive_input(self,
220  string, afw_command_s_a_local_mode_action.len, xctx);
221  is_invalid = false;
222  }
223 
224  /* ++afw-local-mode-http-like */
225  else if (afw_utf8_starts_with(string,
226  &afw_command_s_a_local_mode_http_like))
227  {
228  self->mode = afw_command_local_server_mode_http_like;
229  if (self->multi_request_mode_properties) {
230  afw_object_release(self->multi_request_mode_properties,
231  self->pub.xctx);
232  }
233  self->multi_request_mode_properties = impl_get_directive_input(self,
234  string, afw_command_s_a_local_mode_http_like.len, xctx);
235  is_invalid = false;
236  }
237 
238  /* ++afw-local-multi-request-properties */
239  else if (afw_utf8_starts_with(string,
240  &afw_command_s_a_local_request_properties))
241  {
242  if (self->multi_request_properties) {
243  afw_object_release(self->multi_request_properties, self->pub.xctx);
244  }
245  self->multi_request_properties = impl_get_directive_input(self,
246  string, afw_command_s_a_local_request_properties.len, xctx);
247  is_invalid = false;
248  }
249 
250  /* Invalid directive. */
251  if (is_invalid) {
252  if (string->len <= 30) {
253  AFW_THROW_ERROR_FZ(general, xctx,
254  "Invalid directive: %" AFW_UTF8_FMT,
255  AFW_UTF8_FMT_ARG(string));
256  }
257  else {
258  partial.s = string->s;
259  partial.len = 30;
260  AFW_THROW_ERROR_FZ(general, xctx,
261  "Invalid directive beginning: %" AFW_UTF8_FMT,
262  AFW_UTF8_FMT_ARG(&partial));
263  }
264  }
265 }
266 
267 
268 
269 static afw_boolean_t
270 impl_read_and_process_request(
272 {
273  const afw_pool_t *p;
274  afw_xctx_t *xctx;
275  const afw_memory_t *input;
276  const afw_memory_t *body;
277  const afw_object_t *action_object;
278  const afw_object_t *response_object;
279  const afw_utf8_t *string;
280  afw_boolean_t error_occurred;
281  afw_boolean_t keep_going;
282 
283  xctx = afw_xctx_create(&afw_command_s_afw_command_local_mode,
284  0, self->command_self->xctx);
285  p = xctx->p;
286  error_occurred = false;
287  keep_going = true;
288 
289  AFW_TRY {
290 
291  /*
292  * Loop until an error, exit, or request processed. This is to allow
293  * directives to be processed and then a request.
294  */
295  for (;;) {
296 
297  /* Get next input segment. */
298  input = impl_local_get_input(self, xctx);
299 
300  /* If fatal error, set keep_going to false and break out of loop. */
301  if (self->fatal_error) {
302  keep_going = false;
303  break;
304  }
305 
306  /* If no input, break out of loop. */
307  if (!input) {
308  break;
309  }
310 
312  /* If "exit", set keep_going to false and break out of loop. */
313  if (afw_utf8_equal_utf8_z((const afw_utf8_t *)input, "exit\n") ||
314  afw_utf8_equal_utf8_z((const afw_utf8_t *)input, "exit"))
315  {
316  keep_going = false;
317  break;
318  }
319 
320  /* If this is a directive, process it and continue looping. */
321  if (afw_utf8_starts_with((const afw_utf8_t *)input,
322  &afw_command_s_a_local_directive_starts_with))
323  {
324  impl_process_directive(self, input, xctx);
325  continue;
326  }
327 
328  /*
329  * At this point there is a request to process. Process it then
330  * break out of loop.
331  */
332  self->pub.request_count++;
333  self->this_request_properties = afw_object_create(p, xctx);
334  switch (self->mode) {
335 
336  case afw_command_local_server_mode_action:
337  xctx->request = afw_command_local_request_create(self,
338  input, self->request_properties, xctx);
339  afw_request_handler_process(self->director,
340  xctx->request, xctx);
341  break;
342 
343  case afw_command_local_server_mode_action_direct:
344  string = afw_utf8_create(
345  (const afw_utf8_octet_t *)input->ptr, input->size,
346  p, xctx);
347  action_object = afw_json_to_object(string, false, p, xctx);
348  response_object = afw_action_perform(
349  action_object, self->content_type, NULL, p, xctx);
350  string = afw_data_type_object_to_utf8(response_object,
351  p, xctx);
352  afw_command_local_server_write_result(self,
353  "%" AFW_UTF8_FMT, AFW_UTF8_FMT_ARG(string));
354  break;
355 
356  case afw_command_local_server_mode_evaluate:
357  string = afw_utf8_create(
358  (const afw_utf8_octet_t *)input->ptr, input->size,
359  p, xctx);
360  string = afw_json_utf8_string_create(string, p, xctx);
361  input = (const afw_memory_t *)afw_utf8_printf(p, xctx,
362  "{\n"
363  " \"function\": \"%" AFW_UTF8_FMT "\",\n"
364  " \"source\": %" AFW_UTF8_FMT "\n"
365  "}\n",
366  AFW_UTF8_FMT_ARG(self->evaluate_function_id),
367  AFW_UTF8_FMT_ARG(string)
368  );
369  xctx->request = afw_command_local_request_create(self,
370  (const afw_memory_t *)input, self->request_properties,
371  xctx);
372  afw_request_handler_process(self->director,
373  xctx->request, xctx);
374  break;
375 
376  case afw_command_local_server_mode_evaluate_direct:
377  string = afw_utf8_create(
378  (const afw_utf8_octet_t *)input->ptr, input->size,
379  p, xctx);
380  action_object = afw_object_create(p, xctx);
381  afw_object_set_property_as_string(action_object,
382  &afw_s_function, &afw_s_evaluate_expression, xctx);
383  afw_object_set_property_as_string(action_object,
384  &afw_s_source, string, xctx);
385  response_object = afw_action_perform(
386  action_object, self->content_type, NULL, p, xctx);
387  string = afw_data_type_object_to_utf8(response_object,
388  p, xctx);
389  afw_command_local_server_write_result(self,
390  "%" AFW_UTF8_FMT, AFW_UTF8_FMT_ARG(string));
391  break;
392 
393  case afw_command_local_server_mode_http_like:
394  body = afw_command_local_parse_request(self, &input, xctx);
395  xctx->request = afw_command_local_request_create(
396  self, body, self->request_properties, xctx);
397  afw_request_handler_process(self->director,
398  xctx->request, xctx);
399  break;
400 
401  default:
402  AFW_THROW_ERROR_Z(general, "Not implemented", xctx);
403  }
404  break; // Break out of loop
405  }
406  }
407 
409  afw_command_local_server_write_error(self, AFW_ERROR_THROWN, xctx);
410  error_occurred = true;
411  }
412 
413  AFW_FINALLY{
414  xctx->request = NULL;
415  afw_adaptor_session_commit_and_release_cache(error_occurred, xctx);
416  /* Special case: xctx is gone, so return before AFW_ENDTRY. */
417  if (keep_going) {
418  afw_command_local_server_write_end(self);
419  }
420  afw_xctx_release(xctx, self->command_self->xctx);
421  return keep_going && !self->fatal_error;
422  }
423 
424  AFW_ENDTRY;
425 
426  /* Fix warning. Should not get to here. See Special case comment above. */
427  return false;
428 }
429 
430 
431 
432 /*
433  * Implementation of method release for interface afw_server.
434  */
435 void
437  const afw_server_t * instance,
438  afw_xctx_t *xctx)
439 {
440  /* Everything will be released by afw_command.c */
441 }
442 
443 
444 
445 /*
446  * Implementation of method run for interface afw_server.
447  */
448 void
450  const afw_server_t * instance,
451  const afw_request_handler_t * handler,
452  afw_xctx_t *xctx)
453 {
456 
457 
458  afw_command_local_server_write_result(self,
459  "afw " AFW_VERSION_STRING "\n\n" "Local mode.\n");
460  afw_command_local_server_write_end(self);
461 
462  while (impl_read_and_process_request(self));
463 }
464 
465 
466 
469  afw_command_self_t *command_self)
470 {
472  afw_xctx_t *xctx;
473  const afw_pool_t *p;
474  const afw_value_t *conf;
475 
476  xctx = command_self->xctx;
477  p = xctx->p;
478 
480  self->pub.inf = &impl_afw_server_inf;
481  self->pub.xctx = xctx;
482  self->pub.properties = afw_object_create_managed(xctx->p, xctx);
483  self->pub.afw_compiled_version = &impl_compiled_afw_version;
484  self->pub.afw_version = afw_version_string();
485  self->pub.concurrent = 1;
486  self->pub.max_concurrent = 1;
487  self->pub.server_type = &afw_command_s_afw_command_local_mode;
488  self->pub.server_version = &impl_compiled_afw_version; /* Use afw version. */
489  self->pub.start_time = afw_dateTime_now_local(xctx->p, xctx);
490  self->pub.thread_count = 1;
491  self->pub.server_version = &impl_compiled_afw_version;
492 
493  self->command_self = command_self;
494  self->input_buffer = apr_array_make(afw_pool_get_apr_pool(p), 2000, 1);
495  self->fd_input = command_self->fd_input;
496  self->fd_output = command_self->fd_output;
497 
498  self->mode = afw_command_local_server_mode_evaluate_direct;
499 
501  self->evaluate_function_id = &afw_s_evaluate_expression;
502  self->content_type = command_self->content_type_in;
503 
504  /* Create and set runtime object for server. */
506  &afw_s__AdaptiveServer_,
507  &afw_s_current, self, true, xctx);
508 
509  /* If there's not a conf file already processed, process a default one. */
510  if (!self->command_self->conf_z) {
511  self->command_self->conf_z = "internal";
512  self->command_self->conf.len = strlen("internal");
515  (const afw_memory_t *)&impl_default_afw_conf,
516  &self->command_self->conf,
517  p, xctx);
518  if (!afw_value_is_list(conf)) {
519  AFW_THROW_ERROR_Z(general, "Invalid internal configuration", xctx);
520  }
522  ((const afw_value_list_t *)conf)->internal,
523  &self->command_self->conf, xctx);
524  }
525 
526  /* Create request directory. */
527  self->director = afw_request_handler_director_create(
528  (const afw_server_t *)self,
529  self->command_self->conf_z,
530  p, xctx);
531 
532  /* Make aggregate request properties object. */
533  self->multi_request_mode_properties = afw_object_create_managed(p, xctx);
534  self->mode = afw_command_local_server_mode_evaluate_direct;
535  if (self->multi_request_mode_properties) {
536  afw_object_release(self->multi_request_mode_properties,
537  self->pub.xctx);
538  }
539  self->multi_request_mode_properties =
540  afw_object_create_managed(self->pub.xctx->p, self->pub.xctx);
541  self->request_properties = afw_object_aggregate_external_create(
542  &self->properties_array[0], p, xctx);
543  afw_object_meta_set_ids(self->request_properties,
544  &afw_s_afw, &afw_s__AdaptiveRequestProperties_, &afw_s_current, xctx);
545  afw_runtime_env_set_object(self->request_properties, false, xctx);
546 
547  /* Return self. */
548  return (const afw_server_t *)self;
549 }
550 
551 
552 
554 afw_command_local_server_write_result(
556  const char *format, ...)
557 {
558  va_list ap;
559  int len;
560  int rv;
561 
562  /*
563  * If length of result is not 0, print length followed\n by a \n and then
564  * result. Do nothing if length is 0.
565  */
566  va_start (ap, format);
567  len = vsnprintf(NULL, 0, format, ap);
568  va_end(ap);
569  if (len < 0) exit(EXIT_FAILURE);
570  if (len > 0) {
571  rv = fprintf(self->fd_output, "%d\n", len);
572  if (rv < 0) exit(EXIT_FAILURE);
573  rv = fflush(self->fd_output);
574  if (rv < 0) exit(EXIT_FAILURE);
575 
576  va_start (ap, format);
577  rv = vfprintf(self->fd_output, format, ap);
578  va_end(ap);
579  if (rv < 0) exit(EXIT_FAILURE);
580 
581  rv = fflush(self->fd_output);
582  if (rv < 0) exit(EXIT_FAILURE);
583  }
584 }
585 
586 
587 
589 afw_command_local_server_write_error(
591  const afw_error_t *error,
592  afw_xctx_t *xctx)
593 {
594  const afw_object_t *error_object;
595  const afw_object_t *response_object;
596  const afw_utf8_t *status;
597  const afw_utf8_t *string;
598  int rv;
599 
600  response_object = afw_object_create(xctx->p, xctx);
601 
602  status = (self->fatal_error) ? &afw_s_fatal : &afw_s_error;
603  afw_object_set_property_as_string(response_object,
604  &afw_s_status, status, xctx);
605 
606  error_object = afw_error_to_object(error, xctx->p, xctx);
607  afw_object_set_property_as_object(response_object,
608  &afw_s_error, error_object, xctx);
609 
610  string = afw_data_type_object_to_utf8(response_object, xctx->p, xctx);
611  rv = fprintf(self->fd_output, "%" AFW_SIZE_T_FMT "\n", string->len);
612  if (rv < 0) exit(EXIT_FAILURE);
613  rv = fprintf(self->fd_output, "%" AFW_UTF8_FMT,
614  AFW_UTF8_FMT_ARG(string));
615  if (rv < 0) exit(EXIT_FAILURE);
616  rv = fflush(self->fd_output);
617  if (rv < 0) exit(EXIT_FAILURE);
618 }
619 
620 
621 
623 afw_command_local_server_write_end(
625 {
626  int rv;
627 
628  if (self) {
629  rv = fprintf(self->fd_output, "0\n");
630  if (rv < 0) exit(EXIT_FAILURE);
631  rv = fflush(self->fd_output);
632  if (rv < 0) exit(EXIT_FAILURE);
633  }
634 }
635 
Adaptive Framework Core API.
#define AFW_COMMAND_DEFINE_INTERNAL(type)
Define an internal function for /src/afw_command/ source*.c files.
Adaptive Framework afw command internal header.
Parse function to support afw command local server.
Implementation for interface afw_command_local.
Implementation for interface afw_command_local.
Interface afw_interface implementation declares.
afw_action_perform(const afw_object_t *request, const afw_content_type_t *response_content_type, const afw_object_t *response, const afw_pool_t *p, afw_xctx_t *xctx)
Perform actions(s) specified in AdaptiveActions object.
Definition: afw_action.c:228
afw_adaptor_session_commit_and_release_cache(afw_boolean_t abort, afw_xctx_t *xctx)
Commit/Abort changes and release cached sessions and objects.
Definition: afw_adaptor.c:391
#define afw_value_is_list(A_VALUE)
Macro to determine if value is evaluated list.
afw_object_set_property_as_object(const afw_object_t *object, const afw_utf8_t *property_name, const afw_object_t *internal, afw_xctx_t *xctx)
Set property function for data type object values.
afw_data_type_object
Data type struct for object.
afw_data_type_object_to_utf8(const afw_object_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Convert data type object internal representation to utf-8.
afw_data_type_string
Data type struct for string.
afw_object_set_property_as_string(const afw_object_t *object, const afw_utf8_t *property_name, const afw_utf8_t *internal, afw_xctx_t *xctx)
Set property function for data type string values.
afw_command_local_server_create(afw_command_self_t *command_self)
#define AFW_UTF8_FMT_ARG(A_STRING)
Convenience Macro for use with AFW_UTF8_FMT to specify arg.
Definition: afw_common.h:605
#define AFW_UTF8_LITERAL(A_STRING)
String literal initializer.
Definition: afw_common.h:582
_Bool afw_boolean_t
Definition: afw_common.h:373
unsigned char afw_byte_t
A byte of memory (unsigned).
Definition: afw_common.h:208
#define AFW_UTF8_FMT
Format string specifier used for afw_utf8_t.
Definition: afw_common.h:588
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
#define AFW_SIZE_T_FMT
Format string specifier used for afw_size_t.
Definition: afw_common.h:341
#define afw_content_type_raw_to_value(instance, raw, source_location, p, xctx)
Call method raw_to_value of interface afw_content_type.
#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.
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.
#define AFW_FINALLY
Always executed regardless of error.
Definition: afw_error.h:702
#define AFW_CATCH_UNHANDLED
Catch an unhandled error that occurs in a AFW_TRY block.
Definition: afw_error.h:684
#define AFW_ENDTRY
Ends an AFW try block.
Definition: afw_error.h:727
#define AFW_TRY
Begin an AFW TRY block.
Definition: afw_error.h:634
#define AFW_THROW_ERROR_FZ(code, xctx, format_z,...)
Macro used to set error and 0 rv in xctx and throw it.
Definition: afw_error.h:319
const afw_object_t * afw_error_to_object(const afw_error_t *error, const afw_pool_t *p, afw_xctx_t *xctx)
Create an object with error info in specified pool.
Definition: afw_error.c:998
#define AFW_ERROR_THROWN
Access the thrown error. See AFW_TRY.
Definition: afw_error.h:554
#define AFW_THROW_ERROR_Z(code, message_z, xctx)
Macro used to set error and 0 rv in xctx and throw it.
Definition: afw_error.h:283
afw_json_utf8_string_create(const afw_utf8_t *string, const afw_pool_t *p, afw_xctx_t *xctx)
Create a json encoded quoted string.
#define afw_json_to_object(string, cede_p, p, xctx)
Compile json string to adaptive object.
Definition: afw_json.h:142
afw_json_content_type_get()
Get the content type instance for json.
Definition: afw_json.c:65
#define afw_object_release(instance, xctx)
Call method release of interface afw_object.
afw_object_meta_set_ids(const afw_object_t *instance, const afw_utf8_t *adaptor_id, const afw_utf8_t *object_type_id, const afw_utf8_t *object_id, afw_xctx_t *xctx)
Set object's ids.
#define afw_object_create_managed(p, xctx)
Create an empty entity object in its own pool.
Definition: afw_object.h:913
#define afw_object_create(p, xctx)
Create an empty unmanaged object in memory.
Definition: afw_object.h:948
const afw_object_t * afw_object_aggregate_external_create(const afw_object_t *const *object_list, const afw_pool_t *p, afw_xctx_t *xctx)
Create an aggregate object with an external object list.
#define afw_pool_get_apr_pool(instance)
Call method get_apr_pool of interface afw_pool.
#define afw_pool_calloc_type(instance, type, xctx)
Macro to allocate cleared memory to hold type in pool.
Definition: afw_pool.h:167
#define afw_request_handler_process(instance, request, xctx)
Call method process of interface afw_request_handler.
const afw_request_handler_t * afw_request_handler_director_create(const afw_server_t *server, const afw_utf8_z_t *config_file, const afw_pool_t *p, afw_xctx_t *xctx)
Create a request handler for director.
afw_runtime_env_create_and_set_indirect_object(const afw_utf8_t *object_type_id, const afw_utf8_t *object_id, void *internal, afw_boolean_t overwrite, afw_xctx_t *xctx)
Create and set an indirect runtime object.
Definition: afw_runtime.c:528
afw_runtime_env_set_object(const afw_object_t *object, afw_boolean_t overwrite, afw_xctx_t *xctx)
Set an object pointer in the environment's runtime objects.
Definition: afw_runtime.c:210
impl_afw_server_release(const afw_server_t *instance, afw_xctx_t *xctx)
impl_afw_server_run(const afw_server_t *instance, const afw_request_handler_t *handler, afw_xctx_t *xctx)
afw_dateTime_now_local(const afw_pool_t *p, afw_xctx_t *xctx)
Get now local time as dateTime in specified pool.
Definition: afw_time.c:639
afw_boolean_t afw_utf8_equal_utf8_z(const afw_utf8_t *s1, const afw_utf8_z_t *s2_z)
Check to see if a string equals a utf8_z string.
afw_utf8_printf(const afw_pool_t *p, afw_xctx_t *xctx, const afw_utf8_z_t *format,...)
Create a utf-8 string using a c format string in specified pool.
Definition: afw_utf8.c:459
afw_boolean_t afw_utf8_starts_with(const afw_utf8_t *string, const afw_utf8_t *starts_with)
Check to see if a string starts with another string.
#define afw_utf8_create(s, len, p, xctx)
Create utf-8 string without copy unless necessary in pool specified.
Definition: afw_utf8.h:239
const afw_utf8_t * afw_version_string()
#define afw_xctx_release(instance, xctx)
Call method release of interface afw_xctx.
#define afw_xctx_malloc_type(type, xctx)
Macro to allocate uncleared memory to hold type in xctx's pool.
Definition: afw_xctx.h:223
afw_xctx_create(const afw_utf8_t *name, afw_integer_t number, afw_xctx_t *xctx)
Create an Adaptive Framework xctx.
Definition: afw_xctx.c:145
Self typedef for afw_command_local implementation of afw_server.
Self typedef for afw_command self.
Adaptive Framework Error.
Definition: afw_error.h:65
Struct for memory pointer and size.
Definition: afw_common.h:505
Interface afw_object public struct.
Interface afw_pool public struct.
Interface afw_request_handler public struct.
Interface afw_server public struct.
NFC normalized UTF-8 string.
Definition: afw_common.h:545
struct for data type list values.
Interface afw_value public struct.
Interface afw_xctx public struct.