From 949548da293fa30ef200d07c3e4ff108174404b7 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Thu, 17 Aug 2017 21:47:19 +0300 Subject: The new module configuration interface. Configuration and building example: ./configure ./configure python ./configure php ./configure go make all or ./configure make nginext ./configure python make python ./configure php make php ./configure go make go Modules configuration options and building examples: ./configure python --module=python2 --config=python2.7-config make python2 ./configure php --module=php7 --config=php7.0-config --lib-path=/usr/local/php7.0 make php7 ./configure go --go=go1.6 --go-path=${HOME}/go1.6 make go1.6 --- src/nxt_application.h | 67 +++++++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 32 deletions(-) (limited to 'src/nxt_application.h') diff --git a/src/nxt_application.h b/src/nxt_application.h index 9efb5008..c8d9998d 100644 --- a/src/nxt_application.h +++ b/src/nxt_application.h @@ -10,20 +10,26 @@ typedef enum { - NXT_APP_UNKNOWN = 0, NXT_APP_PYTHON, - NXT_APP_PYTHON2, - NXT_APP_PYTHON3, NXT_APP_PHP, - NXT_APP_PHP5, - NXT_APP_PHP7, - NXT_APP_RUBY, NXT_APP_GO, - NXT_APP_MAX, + NXT_APP_UNKNOWN, } nxt_app_type_t; +typedef struct nxt_app_module_s nxt_application_module_t; +typedef struct nxt_app_module_s nxt_app_module_t; + + +typedef struct { + nxt_str_t type; + nxt_str_t version; + char *file; + nxt_application_module_t *module; +} nxt_app_lang_module_t; + + typedef struct nxt_common_app_conf_s nxt_common_app_conf_t; @@ -48,7 +54,6 @@ typedef struct { struct nxt_common_app_conf_s { nxt_str_t name; nxt_str_t type; - nxt_app_type_t type_id; nxt_str_t user; nxt_str_t group; @@ -148,13 +153,13 @@ nxt_inline u_char * nxt_app_msg_write_length(u_char *dst, size_t length); /* TODO asynchronous mmap buffer assignment */ -u_char *nxt_app_msg_write_get_buf(nxt_task_t *task, nxt_app_wmsg_t *msg, - size_t size); +NXT_EXPORT u_char *nxt_app_msg_write_get_buf(nxt_task_t *task, + nxt_app_wmsg_t *msg, size_t size); -nxt_int_t nxt_app_msg_write(nxt_task_t *task, nxt_app_wmsg_t *msg, +NXT_EXPORT nxt_int_t nxt_app_msg_write(nxt_task_t *task, nxt_app_wmsg_t *msg, u_char *c, size_t size); -nxt_int_t nxt_app_msg_write_prefixed_upcase(nxt_task_t *task, +NXT_EXPORT nxt_int_t nxt_app_msg_write_prefixed_upcase(nxt_task_t *task, nxt_app_wmsg_t *msg, const nxt_str_t *prefix, const nxt_str_t *v); nxt_inline nxt_int_t @@ -178,44 +183,37 @@ nxt_app_msg_write_nvp_(nxt_task_t *task, nxt_app_wmsg_t *msg, nxt_inline nxt_int_t nxt_app_msg_write_size(nxt_task_t *task, nxt_app_wmsg_t *msg, size_t size); -nxt_int_t nxt_app_msg_flush(nxt_task_t *task, nxt_app_wmsg_t *msg, +NXT_EXPORT nxt_int_t nxt_app_msg_flush(nxt_task_t *task, nxt_app_wmsg_t *msg, nxt_bool_t last); -nxt_int_t nxt_app_msg_write_raw(nxt_task_t *task, nxt_app_wmsg_t *msg, - const u_char *c, size_t size); +NXT_EXPORT nxt_int_t nxt_app_msg_write_raw(nxt_task_t *task, + nxt_app_wmsg_t *msg, const u_char *c, size_t size); -nxt_int_t nxt_app_msg_read_str(nxt_task_t *task, nxt_app_rmsg_t *msg, +NXT_EXPORT nxt_int_t nxt_app_msg_read_str(nxt_task_t *task, nxt_app_rmsg_t *msg, nxt_str_t *str); -size_t nxt_app_msg_read_raw(nxt_task_t *task, nxt_app_rmsg_t *msg, void *buf, - size_t size); +NXT_EXPORT size_t nxt_app_msg_read_raw(nxt_task_t *task, + nxt_app_rmsg_t *msg, void *buf, size_t size); -nxt_int_t nxt_app_msg_read_nvp(nxt_task_t *task, nxt_app_rmsg_t *rmsg, - nxt_str_t *n, nxt_str_t *v); +NXT_EXPORT nxt_int_t nxt_app_msg_read_nvp(nxt_task_t *task, + nxt_app_rmsg_t *rmsg, nxt_str_t *n, nxt_str_t *v); -nxt_int_t nxt_app_msg_read_size(nxt_task_t *task, nxt_app_rmsg_t *rmsg, - size_t *size); +NXT_EXPORT nxt_int_t nxt_app_msg_read_size(nxt_task_t *task, + nxt_app_rmsg_t *rmsg, size_t *size); -typedef struct nxt_app_module_s nxt_application_module_t; -typedef struct nxt_app_module_s nxt_app_module_t; - struct nxt_app_module_s { + nxt_str_t type; + nxt_str_t version; + nxt_int_t (*init)(nxt_task_t *task, nxt_common_app_conf_t *conf); - nxt_int_t (*prepare_msg)(nxt_task_t *task, - nxt_app_request_t *r, - nxt_app_wmsg_t *wmsg); nxt_int_t (*run)(nxt_task_t *task, nxt_app_rmsg_t *rmsg, nxt_app_wmsg_t *wmsg); }; -extern nxt_application_module_t *nxt_app_modules[NXT_APP_MAX]; - - - nxt_int_t nxt_app_http_read_body(nxt_app_request_t *r, u_char *data, size_t len); nxt_int_t nxt_app_write(nxt_app_request_t *r, const u_char *data, size_t len); @@ -290,6 +288,11 @@ nxt_app_msg_read_length(u_char *src, size_t *length) } +nxt_app_lang_module_t *nxt_app_lang_module(nxt_runtime_t *rt, nxt_str_t *name); nxt_app_type_t nxt_app_parse_type(nxt_str_t *str); + +extern nxt_application_module_t nxt_go_module; + + #endif /* _NXT_APPLICATION_H_INCLIDED_ */ -- cgit