44 static void print_usage(
void)
47 "Usage: afw_server_fcgi_main [-f filename] [-p path] [-n threads] [-e extension] "
48 "[-t content-type] [--help] [--version]\n");
61 args->number_of_threads = 1;
64 for (i = 1; i < argc; i++) {
65 if (strcmp(argv[i],
"-f") == 0) {
67 if (args->conf_file_z || i >= argc) {
71 args->conf_file_z = argv[i];
73 else if (strcmp(argv[i],
"-p") == 0) {
75 if (args->path_z || i >= argc) {
80 args->path_z = argv[i];
82 else if (strcmp(argv[i],
"-n") == 0) {
84 n = strtol(argv[i], NULL, 10);
85 if (n < 0 || n > 9999 || errno == ERANGE) {
89 args->number_of_threads = n;
91 else if (strcmp(argv[i],
"--help") == 0) {
94 args->help_option =
true;
97 else if (strcmp(argv[i],
"--version") == 0) {
100 AFW_SERVER_FCGI_VERSION_COMMAND_STRING
"\n");
101 args->help_option =
true;
104 else if (strcmp(argv[i],
"-t") == 0) {
110 args->type_in_z = argv[i];
112 else if (strcmp(argv[i],
"-e") == 0) {
129 if (!args->conf_file_z) {
130 args->conf_file_z =
"afw.conf";
134 if (!args->type_in_z) {
135 args->type_in_z =
"json";
137 args->type_in.len = strlen(args->type_in_z);
141 args->path_z =
":9345";
145 args->conf_file.len = strlen(args->conf_file_z);
146 args->path.len = strlen(args->path_z);
158 int main(
int argc,
const char *
const * argv) {
182 rv = process_args(argc, argv, &args, xctx);
183 if (args.help_option || rv != EXIT_SUCCESS) {
191 &args.type_in, xctx);
192 if (!args.content_type_in) {
197 conf_file, &args.conf_file, xctx->p, xctx);
203 &args.conf_file, xctx);
207 args.number_of_threads, xctx);
211 args.conf_file_z, xctx->p, xctx);
Adaptive Framework Core API.
const afw_server_t * afw_server_fcgi_internal_create(const char *path, afw_integer_t thread_count, afw_xctx_t *xctx)
Create an FCGI afw_server.
void afw_server_fcgi_generated_register(afw_xctx_t *xctx)
Generated register for afw_server_fcgi.
Adaptive Framework register generated (afw_server_fcgi) header.
Internal header file for AFW FCGI Server.
Adaptive Framework Version (afw_server_fcgi_) header.
#define afw_value_is_list(A_VALUE)
Macro to determine if value is evaluated list.
#define AFW_UTF8_Z_LEN
String is NUL (0) terminate.
afw_utf8_octet_t afw_utf8_z_t
NFC normalized UTF-8 null terminated string.
apr_int64_t afw_integer_t
typedef for big signed int.
#define afw_content_type_raw_to_value(instance, raw, source_location, p, xctx)
Call method raw_to_value of interface afw_content_type.
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.
#define AFW_ENVIRONMENT_CREATE(xctx, argc, argv, environment_create_error)
Call afw_environment_create() supplying version compiled with.
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.
afw_environment_release(afw_xctx_t *xctx)
Create the Adaptive Framework core environment and return base xctx.
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.
#define AFW_CATCH_UNHANDLED
Catch an unhandled error that occurs in a AFW_TRY block.
afw_error_print(FILE *fp, const afw_error_t *error)
Print error.
#define AFW_ENDTRY
Ends an AFW try block.
#define AFW_TRY
Begin an AFW TRY block.
#define AFW_ERROR_THROWN
Access the thrown error. See AFW_TRY.
#define AFW_THROW_ERROR_Z(code, message_z, xctx)
Macro used to set error and 0 rv in xctx and throw it.
afw_file_to_memory(const afw_utf8_t *file_path, apr_size_t file_size, const afw_pool_t *p, afw_xctx_t *xctx)
Read a file into a memory in a specifed pool.
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.
#define afw_server_run(instance, handler, xctx)
Call method run of interface afw_server.
#define afw_utf8_create(s, len, p, xctx)
Create utf-8 string without copy unless necessary in pool specified.
Interface afw_content_type public struct.
FILE * stderr_fd
Open file descriptor used for writing error output. Default stderr.
Adaptive Framework Error.
Struct for memory pointer and size.
Interface afw_request_handler public struct.
Interface afw_server public struct.
NFC normalized UTF-8 string.
struct for data type list values.
Interface afw_value public struct.
Interface afw_xctx public struct.