1 2 /* 3 * Copyright (C) Igor Sysoev 4 * Copyright (C) NGINX, Inc. 5 */ 6 7 #ifndef _NXT_LIB_H_INCLUDED_ 8 #define _NXT_LIB_H_INCLUDED_ 9 10 11 #include <nxt_auto_config.h> 12 #include <nxt_version.h> 13 14 #define NXT_SERVER "Unit/" NXT_VERSION 15 16 typedef struct nxt_port_s nxt_port_t; 17 typedef struct nxt_task_s nxt_task_t; 18 typedef struct nxt_port_recv_msg_s nxt_port_recv_msg_t; 19 typedef void (*nxt_port_handler_t)(nxt_task_t *task, nxt_port_recv_msg_t *msg); 20 typedef struct nxt_port_handlers_s nxt_port_handlers_t; 21 typedef struct nxt_sig_event_s nxt_sig_event_t; 22 typedef struct nxt_runtime_s nxt_runtime_t; 23 24 typedef struct nxt_thread_s nxt_thread_t; 25 typedef struct nxt_event_engine_s nxt_event_engine_t; 26 typedef struct nxt_log_s nxt_log_t; 27 typedef struct nxt_thread_pool_s nxt_thread_pool_t; 28 29 typedef void (*nxt_work_handler_t)(nxt_task_t *task, void *obj, void *data); 30 31 #include <nxt_unix.h> 32 #include <nxt_clang.h> 33 #include <nxt_types.h> 34 #include <nxt_time.h> 35 #include <nxt_mp.h> 36 #include <nxt_array.h> 37 38 typedef uint16_t nxt_port_id_t; 39 40 #include <nxt_queue.h> 41 42 #include <nxt_thread_id.h> 43 44 #include <nxt_errno.h> 45 #include <nxt_file.h> 46 47 #include <nxt_random.h> 48 #include <nxt_string.h> 49 #include <nxt_lvlhsh.h> 50 #include <nxt_atomic.h> 51 #include <nxt_spinlock.h> 52 #include <nxt_work_queue.h> 53 #include <nxt_log.h> 54 #include <nxt_thread_time.h> 55 #include <nxt_rbtree.h> 56 #include <nxt_timer.h> 57 #include <nxt_fiber.h> 58 #include <nxt_thread.h> 59 #include <nxt_process_type.h> 60 #include <nxt_capability.h> 61 #include <nxt_credential.h> 62 #include <nxt_fs_mount.h> 63 #include <nxt_fs.h> 64 #include <nxt_process.h> 65 #include <nxt_utf8.h> 66 #include <nxt_file_name.h> 67 68 #include <nxt_sprintf.h> 69 #include <nxt_parse.h> 70 #include <nxt_var.h> 71 #include <nxt_tstr.h> 72 73 74 /* TODO: remove unused */ 75 76 typedef struct nxt_fd_event_s nxt_fd_event_t; 77 typedef struct nxt_sockaddr_s nxt_sockaddr_t; 78 79 80 #include <nxt_malloc.h> 81 #include <nxt_mem_map.h> 82 #include <nxt_socket.h> 83 #include <nxt_dyld.h> 84 85 86 typedef void *(*nxt_mem_proto_alloc_t)(void *pool, size_t size); 87 typedef void (*nxt_mem_proto_free_t)(void *pool, void *p); 88 89 typedef struct { 90 nxt_mem_proto_alloc_t alloc; 91 nxt_mem_proto_free_t free; 92 } nxt_mem_proto_t; 93 94 95 #include <nxt_mem_zone.h> 96 #include <nxt_signal.h> 97 #include <nxt_semaphore.h> 98 99 #include <nxt_djb_hash.h> 100 #include <nxt_murmur_hash.h> 101 #include <nxt_hash.h> 102 103 #include <nxt_sort.h> 104 #include <nxt_vector.h> 105 #include <nxt_list.h> 106 107 #include <nxt_service.h> 108 109 typedef struct nxt_buf_s nxt_buf_t; 110 #include <nxt_buf.h> 111 #include <nxt_buf_pool.h> 112 #include <nxt_recvbuf.h> 113 114 typedef struct nxt_conn_s nxt_conn_t; 115 #include <nxt_sendbuf.h> 116 117 #include <nxt_log_moderation.h> 118 119 #if (NXT_TLS) 120 #include <nxt_tls.h> 121 #endif 122 123 124 #define nxt_thread() \ 125 (nxt_thread_t *) nxt_thread_get_data(nxt_thread_context) 126 127 nxt_thread_extern_data(nxt_thread_t, nxt_thread_context); 128 129 130 #include <nxt_thread_log.h> 131 132 #include <nxt_fd_event.h> 133 #include <nxt_file_event.h> 134 135 #include <nxt_port.h> 136 #include <nxt_port_memory.h> 137 #include <nxt_port_rpc.h> 138 #include <nxt_thread_pool.h> 139 140 141 typedef void (*nxt_event_conn_handler_t)(nxt_thread_t *thr, nxt_conn_t *c); 142 #include <nxt_listen_socket.h> 143 144 #include <nxt_conn.h> 145 #include <nxt_event_engine.h> 146 147 #include <nxt_job.h> 148 #include <nxt_job_file.h> 149 #include <nxt_buf_filter.h> 150 151 #include <nxt_sockaddr.h> 152 153 #include <nxt_cache.h> 154 155 #include <nxt_http_parse.h> 156 #include <nxt_runtime.h> 157 #include <nxt_port_hash.h> 158 159 160 /* 161 * The envp argument must be &environ if application may 162 * change its process title with nxt_process_title(). 163 */ 164 NXT_EXPORT nxt_int_t nxt_lib_start(const char *app, char **argv, char ***envp); 165 NXT_EXPORT void nxt_lib_stop(void); 166 167 168 NXT_EXPORT extern nxt_uint_t nxt_ncpu; 169 NXT_EXPORT extern nxt_uint_t nxt_pagesize; 170 NXT_EXPORT extern nxt_task_t nxt_main_task; 171 NXT_EXPORT extern nxt_atomic_t nxt_task_ident; 172 173 174 #endif /* _NXT_LIB_H_INCLUDED_ */ 175