10Sigor@sysoev.ru 20Sigor@sysoev.ru /* 30Sigor@sysoev.ru * Copyright (C) Igor Sysoev 40Sigor@sysoev.ru * Copyright (C) NGINX, Inc. 50Sigor@sysoev.ru */ 60Sigor@sysoev.ru 70Sigor@sysoev.ru #ifndef _NXT_LIB_H_INCLUDED_ 80Sigor@sysoev.ru #define _NXT_LIB_H_INCLUDED_ 90Sigor@sysoev.ru 100Sigor@sysoev.ru 110Sigor@sysoev.ru #include <nxt_auto_config.h> 12953Salexander.borisov@nginx.com #include <nxt_version.h> 13221Sigor@sysoev.ru 142436Sa.clayton@nginx.com #define NXT_NAME "Unit" 152436Sa.clayton@nginx.com #define NXT_SERVER NXT_NAME "/" NXT_VERSION 16221Sigor@sysoev.ru 17164Smax.romanov@nginx.com typedef struct nxt_port_s nxt_port_t; 18164Smax.romanov@nginx.com typedef struct nxt_task_s nxt_task_t; 19164Smax.romanov@nginx.com typedef struct nxt_port_recv_msg_s nxt_port_recv_msg_t; 20164Smax.romanov@nginx.com typedef void (*nxt_port_handler_t)(nxt_task_t *task, nxt_port_recv_msg_t *msg); 21320Smax.romanov@nginx.com typedef struct nxt_port_handlers_s nxt_port_handlers_t; 22164Smax.romanov@nginx.com typedef struct nxt_sig_event_s nxt_sig_event_t; 23164Smax.romanov@nginx.com typedef struct nxt_runtime_s nxt_runtime_t; 24164Smax.romanov@nginx.com 25164Smax.romanov@nginx.com typedef struct nxt_thread_s nxt_thread_t; 26164Smax.romanov@nginx.com typedef struct nxt_event_engine_s nxt_event_engine_t; 27164Smax.romanov@nginx.com typedef struct nxt_log_s nxt_log_t; 28164Smax.romanov@nginx.com typedef struct nxt_thread_pool_s nxt_thread_pool_t; 29164Smax.romanov@nginx.com 30164Smax.romanov@nginx.com typedef void (*nxt_work_handler_t)(nxt_task_t *task, void *obj, void *data); 31164Smax.romanov@nginx.com 320Sigor@sysoev.ru #include <nxt_unix.h> 330Sigor@sysoev.ru #include <nxt_clang.h> 340Sigor@sysoev.ru #include <nxt_types.h> 350Sigor@sysoev.ru #include <nxt_time.h> 3665Sigor@sysoev.ru #include <nxt_mp.h> 3720Sigor@sysoev.ru #include <nxt_array.h> 3820Sigor@sysoev.ru 3942Smax.romanov@nginx.com typedef uint16_t nxt_port_id_t; 4020Sigor@sysoev.ru 4142Smax.romanov@nginx.com #include <nxt_queue.h> 420Sigor@sysoev.ru 430Sigor@sysoev.ru #include <nxt_thread_id.h> 440Sigor@sysoev.ru 450Sigor@sysoev.ru #include <nxt_errno.h> 460Sigor@sysoev.ru #include <nxt_file.h> 470Sigor@sysoev.ru 480Sigor@sysoev.ru #include <nxt_random.h> 490Sigor@sysoev.ru #include <nxt_string.h> 5088Smax.romanov@nginx.com #include <nxt_lvlhsh.h> 5190Smax.romanov@nginx.com #include <nxt_atomic.h> 5290Smax.romanov@nginx.com #include <nxt_spinlock.h> 5390Smax.romanov@nginx.com #include <nxt_work_queue.h> 5490Smax.romanov@nginx.com #include <nxt_log.h> 5590Smax.romanov@nginx.com #include <nxt_thread_time.h> 5690Smax.romanov@nginx.com #include <nxt_rbtree.h> 5790Smax.romanov@nginx.com #include <nxt_timer.h> 5890Smax.romanov@nginx.com #include <nxt_fiber.h> 5990Smax.romanov@nginx.com #include <nxt_thread.h> 60245Smax.romanov@nginx.com #include <nxt_process_type.h> 611182St.nateldemoura@f5.com #include <nxt_capability.h> 621305St.nateldemoura@f5.com #include <nxt_credential.h> 632216Sa.clayton@nginx.com #include <nxt_fs_mount.h> 641489St.nateldemoura@f5.com #include <nxt_fs.h> 6588Smax.romanov@nginx.com #include <nxt_process.h> 660Sigor@sysoev.ru #include <nxt_utf8.h> 670Sigor@sysoev.ru #include <nxt_file_name.h> 680Sigor@sysoev.ru 690Sigor@sysoev.ru #include <nxt_sprintf.h> 700Sigor@sysoev.ru #include <nxt_parse.h> 71*2504Sz.hong@f5.com 72*2504Sz.hong@f5.com typedef struct nxt_tstr_state_s nxt_tstr_state_t; 731563Svbart@nginx.com #include <nxt_var.h> 742246Sz.hong@f5.com #include <nxt_tstr.h> 750Sigor@sysoev.ru 760Sigor@sysoev.ru 770Sigor@sysoev.ru /* TODO: remove unused */ 780Sigor@sysoev.ru 7912Sigor@sysoev.ru typedef struct nxt_fd_event_s nxt_fd_event_t; 800Sigor@sysoev.ru typedef struct nxt_sockaddr_s nxt_sockaddr_t; 810Sigor@sysoev.ru 820Sigor@sysoev.ru 830Sigor@sysoev.ru #include <nxt_malloc.h> 840Sigor@sysoev.ru #include <nxt_mem_map.h> 850Sigor@sysoev.ru #include <nxt_socket.h> 860Sigor@sysoev.ru #include <nxt_dyld.h> 870Sigor@sysoev.ru 880Sigor@sysoev.ru 890Sigor@sysoev.ru typedef void *(*nxt_mem_proto_alloc_t)(void *pool, size_t size); 900Sigor@sysoev.ru typedef void (*nxt_mem_proto_free_t)(void *pool, void *p); 910Sigor@sysoev.ru 920Sigor@sysoev.ru typedef struct { 930Sigor@sysoev.ru nxt_mem_proto_alloc_t alloc; 940Sigor@sysoev.ru nxt_mem_proto_free_t free; 950Sigor@sysoev.ru } nxt_mem_proto_t; 960Sigor@sysoev.ru 970Sigor@sysoev.ru 980Sigor@sysoev.ru #include <nxt_mem_zone.h> 990Sigor@sysoev.ru #include <nxt_signal.h> 1000Sigor@sysoev.ru #include <nxt_semaphore.h> 1010Sigor@sysoev.ru 1020Sigor@sysoev.ru #include <nxt_djb_hash.h> 1030Sigor@sysoev.ru #include <nxt_murmur_hash.h> 1040Sigor@sysoev.ru #include <nxt_hash.h> 1050Sigor@sysoev.ru 1060Sigor@sysoev.ru #include <nxt_sort.h> 1070Sigor@sysoev.ru #include <nxt_vector.h> 1080Sigor@sysoev.ru #include <nxt_list.h> 1090Sigor@sysoev.ru 1100Sigor@sysoev.ru #include <nxt_service.h> 1110Sigor@sysoev.ru 1120Sigor@sysoev.ru typedef struct nxt_buf_s nxt_buf_t; 1130Sigor@sysoev.ru #include <nxt_buf.h> 1140Sigor@sysoev.ru #include <nxt_buf_pool.h> 1150Sigor@sysoev.ru #include <nxt_recvbuf.h> 1160Sigor@sysoev.ru 11762Sigor@sysoev.ru typedef struct nxt_conn_s nxt_conn_t; 1180Sigor@sysoev.ru #include <nxt_sendbuf.h> 1190Sigor@sysoev.ru 1200Sigor@sysoev.ru #include <nxt_log_moderation.h> 1210Sigor@sysoev.ru 122771Sigor@sysoev.ru #if (NXT_TLS) 123771Sigor@sysoev.ru #include <nxt_tls.h> 1240Sigor@sysoev.ru #endif 1250Sigor@sysoev.ru 1260Sigor@sysoev.ru 12720Sigor@sysoev.ru #define nxt_thread() \ 1280Sigor@sysoev.ru (nxt_thread_t *) nxt_thread_get_data(nxt_thread_context) 1290Sigor@sysoev.ru 1300Sigor@sysoev.ru nxt_thread_extern_data(nxt_thread_t, nxt_thread_context); 1310Sigor@sysoev.ru 1320Sigor@sysoev.ru 1330Sigor@sysoev.ru #include <nxt_thread_log.h> 1340Sigor@sysoev.ru 13512Sigor@sysoev.ru #include <nxt_fd_event.h> 13662Sigor@sysoev.ru #include <nxt_file_event.h> 1370Sigor@sysoev.ru 13814Sigor@sysoev.ru #include <nxt_port.h> 13942Smax.romanov@nginx.com #include <nxt_port_memory.h> 140190Smax.romanov@nginx.com #include <nxt_port_rpc.h> 1410Sigor@sysoev.ru #include <nxt_thread_pool.h> 1420Sigor@sysoev.ru 1430Sigor@sysoev.ru 14462Sigor@sysoev.ru typedef void (*nxt_event_conn_handler_t)(nxt_thread_t *thr, nxt_conn_t *c); 1450Sigor@sysoev.ru #include <nxt_listen_socket.h> 1460Sigor@sysoev.ru 14762Sigor@sysoev.ru #include <nxt_conn.h> 1480Sigor@sysoev.ru #include <nxt_event_engine.h> 1490Sigor@sysoev.ru 1500Sigor@sysoev.ru #include <nxt_job.h> 1510Sigor@sysoev.ru 1520Sigor@sysoev.ru #include <nxt_sockaddr.h> 1530Sigor@sysoev.ru 15416Svbart@nginx.com #include <nxt_http_parse.h> 15520Sigor@sysoev.ru #include <nxt_runtime.h> 15675Smax.romanov@nginx.com #include <nxt_port_hash.h> 1570Sigor@sysoev.ru 1580Sigor@sysoev.ru 1590Sigor@sysoev.ru /* 1600Sigor@sysoev.ru * The envp argument must be &environ if application may 1610Sigor@sysoev.ru * change its process title with nxt_process_title(). 1620Sigor@sysoev.ru */ 1630Sigor@sysoev.ru NXT_EXPORT nxt_int_t nxt_lib_start(const char *app, char **argv, char ***envp); 1640Sigor@sysoev.ru NXT_EXPORT void nxt_lib_stop(void); 1650Sigor@sysoev.ru 1660Sigor@sysoev.ru 1670Sigor@sysoev.ru NXT_EXPORT extern nxt_uint_t nxt_ncpu; 1680Sigor@sysoev.ru NXT_EXPORT extern nxt_uint_t nxt_pagesize; 1691Sigor@sysoev.ru NXT_EXPORT extern nxt_task_t nxt_main_task; 1701Sigor@sysoev.ru NXT_EXPORT extern nxt_atomic_t nxt_task_ident; 1710Sigor@sysoev.ru 1720Sigor@sysoev.ru 1730Sigor@sysoev.ru #endif /* _NXT_LIB_H_INCLUDED_ */ 174