10Sigor@sysoev.ru 20Sigor@sysoev.ru /* 384Smax.romanov@nginx.com * Copyright (C) Max Romanov 40Sigor@sysoev.ru * Copyright (C) Valentin V. Bartenev 50Sigor@sysoev.ru * Copyright (C) NGINX, Inc. 60Sigor@sysoev.ru */ 70Sigor@sysoev.ru 80Sigor@sysoev.ru #ifndef _NXT_APPLICATION_H_INCLUDED_ 90Sigor@sysoev.ru #define _NXT_APPLICATION_H_INCLUDED_ 100Sigor@sysoev.ru 110Sigor@sysoev.ru 12678Svbart@nginx.com #include <nxt_conf.h> 13678Svbart@nginx.com 14743Smax.romanov@nginx.com #include <nxt_unit_typedefs.h> 15743Smax.romanov@nginx.com 16678Svbart@nginx.com 17133Sigor@sysoev.ru typedef enum { 18804Svbart@nginx.com NXT_APP_EXTERNAL, 19141Smax.romanov@nginx.com NXT_APP_PYTHON, 20133Sigor@sysoev.ru NXT_APP_PHP, 21510Salexander.borisov@nginx.com NXT_APP_PERL, 22584Salexander.borisov@nginx.com NXT_APP_RUBY, 23977Smax.romanov@gmail.com NXT_APP_JAVA, 24141Smax.romanov@nginx.com 25216Sigor@sysoev.ru NXT_APP_UNKNOWN, 26133Sigor@sysoev.ru } nxt_app_type_t; 27133Sigor@sysoev.ru 28133Sigor@sysoev.ru 29216Sigor@sysoev.ru typedef struct nxt_app_module_s nxt_app_module_t; 301488St.nateldemoura@f5.com typedef nxt_int_t (*nxt_application_setup_t)(nxt_task_t *task, 311488St.nateldemoura@f5.com nxt_process_t *process, nxt_common_app_conf_t *conf); 32216Sigor@sysoev.ru 33216Sigor@sysoev.ru 34216Sigor@sysoev.ru typedef struct { 35356Svbart@nginx.com nxt_app_type_t type; 36354Svbart@nginx.com u_char *version; 37216Sigor@sysoev.ru char *file; 38743Smax.romanov@nginx.com nxt_app_module_t *module; 391489St.nateldemoura@f5.com nxt_array_t *mounts; /* of nxt_fs_mount_t */ 40216Sigor@sysoev.ru } nxt_app_lang_module_t; 41216Sigor@sysoev.ru 42216Sigor@sysoev.ru 43141Smax.romanov@nginx.com typedef struct { 44804Svbart@nginx.com char *executable; 45804Svbart@nginx.com nxt_conf_value_t *arguments; 46804Svbart@nginx.com } nxt_external_app_conf_t; 47804Svbart@nginx.com 48804Svbart@nginx.com 49804Svbart@nginx.com typedef struct { 501759Svbart@nginx.com char *home; 511759Svbart@nginx.com nxt_conf_value_t *path; 521759Svbart@nginx.com nxt_str_t module; 531759Svbart@nginx.com char *callable; 541759Svbart@nginx.com nxt_str_t protocol; 551759Svbart@nginx.com uint32_t threads; 561759Svbart@nginx.com uint32_t thread_stack_size; 57*1872So.canty@f5.com nxt_conf_value_t *targets; 58141Smax.romanov@nginx.com } nxt_python_app_conf_t; 59141Smax.romanov@nginx.com 60141Smax.romanov@nginx.com 61141Smax.romanov@nginx.com typedef struct { 621473Svbart@nginx.com nxt_conf_value_t *targets; 63687Svbart@nginx.com nxt_conf_value_t *options; 64141Smax.romanov@nginx.com } nxt_php_app_conf_t; 65141Smax.romanov@nginx.com 66141Smax.romanov@nginx.com 67141Smax.romanov@nginx.com typedef struct { 68510Salexander.borisov@nginx.com char *script; 691689Smax.romanov@nginx.com uint32_t threads; 701689Smax.romanov@nginx.com uint32_t thread_stack_size; 71510Salexander.borisov@nginx.com } nxt_perl_app_conf_t; 72510Salexander.borisov@nginx.com 73510Salexander.borisov@nginx.com 74584Salexander.borisov@nginx.com typedef struct { 75584Salexander.borisov@nginx.com nxt_str_t script; 761687Smax.romanov@nginx.com uint32_t threads; 77584Salexander.borisov@nginx.com } nxt_ruby_app_conf_t; 78584Salexander.borisov@nginx.com 79584Salexander.borisov@nginx.com 80977Smax.romanov@gmail.com typedef struct { 81977Smax.romanov@gmail.com nxt_conf_value_t *classpath; 82977Smax.romanov@gmail.com char *webapp; 83977Smax.romanov@gmail.com nxt_conf_value_t *options; 84977Smax.romanov@gmail.com char *unit_jars; 851684Smax.romanov@nginx.com uint32_t threads; 861684Smax.romanov@nginx.com uint32_t thread_stack_size; 87977Smax.romanov@gmail.com } nxt_java_app_conf_t; 88977Smax.romanov@gmail.com 89977Smax.romanov@gmail.com 90141Smax.romanov@nginx.com struct nxt_common_app_conf_s { 91678Svbart@nginx.com nxt_str_t name; 92678Svbart@nginx.com nxt_str_t type; 93678Svbart@nginx.com nxt_str_t user; 94678Svbart@nginx.com nxt_str_t group; 95141Smax.romanov@nginx.com 96678Svbart@nginx.com char *working_directory; 97678Svbart@nginx.com nxt_conf_value_t *environment; 98271Smax.romanov@nginx.com 991182St.nateldemoura@f5.com nxt_conf_value_t *isolation; 1001320Smax.romanov@nginx.com nxt_conf_value_t *limits; 1011320Smax.romanov@nginx.com 1021320Smax.romanov@nginx.com size_t shm_limit; 1031182St.nateldemoura@f5.com 104141Smax.romanov@nginx.com union { 105804Svbart@nginx.com nxt_external_app_conf_t external; 106804Svbart@nginx.com nxt_python_app_conf_t python; 107804Svbart@nginx.com nxt_php_app_conf_t php; 108804Svbart@nginx.com nxt_perl_app_conf_t perl; 109804Svbart@nginx.com nxt_ruby_app_conf_t ruby; 110977Smax.romanov@gmail.com nxt_java_app_conf_t java; 111141Smax.romanov@nginx.com } u; 1121473Svbart@nginx.com 1131473Svbart@nginx.com nxt_conf_value_t *self; 114141Smax.romanov@nginx.com }; 115141Smax.romanov@nginx.com 116141Smax.romanov@nginx.com 117216Sigor@sysoev.ru struct nxt_app_module_s { 118258Sigor@sysoev.ru size_t compat_length; 119258Sigor@sysoev.ru uint32_t *compat; 120258Sigor@sysoev.ru 121216Sigor@sysoev.ru nxt_str_t type; 122612Salexander.borisov@nginx.com const char *version; 123141Smax.romanov@nginx.com 1241489St.nateldemoura@f5.com const nxt_fs_mount_t *mounts; 1251489St.nateldemoura@f5.com nxt_uint_t nmounts; 1261489St.nateldemoura@f5.com 1271488St.nateldemoura@f5.com nxt_application_setup_t setup; 1281488St.nateldemoura@f5.com nxt_process_start_t start; 129141Smax.romanov@nginx.com }; 1300Sigor@sysoev.ru 1310Sigor@sysoev.ru 132216Sigor@sysoev.ru nxt_app_lang_module_t *nxt_app_lang_module(nxt_runtime_t *rt, nxt_str_t *name); 133510Salexander.borisov@nginx.com nxt_app_type_t nxt_app_parse_type(u_char *p, size_t length); 134216Sigor@sysoev.ru 135743Smax.romanov@nginx.com NXT_EXPORT extern nxt_str_t nxt_server; 136804Svbart@nginx.com extern nxt_app_module_t nxt_external_module; 137743Smax.romanov@nginx.com 138743Smax.romanov@nginx.com NXT_EXPORT nxt_int_t nxt_unit_default_init(nxt_task_t *task, 139743Smax.romanov@nginx.com nxt_unit_init_t *init); 140216Sigor@sysoev.ru 141216Sigor@sysoev.ru 1420Sigor@sysoev.ru #endif /* _NXT_APPLICATION_H_INCLIDED_ */ 143