xref: /unit/src/nxt_port.h (revision 1558)
111Sigor@sysoev.ru 
211Sigor@sysoev.ru /*
311Sigor@sysoev.ru  * Copyright (C) Igor Sysoev
411Sigor@sysoev.ru  * Copyright (C) NGINX, Inc.
511Sigor@sysoev.ru  */
611Sigor@sysoev.ru 
711Sigor@sysoev.ru #ifndef _NXT_PORT_H_INCLUDED_
811Sigor@sysoev.ru #define _NXT_PORT_H_INCLUDED_
911Sigor@sysoev.ru 
1011Sigor@sysoev.ru 
11320Smax.romanov@nginx.com struct nxt_port_handlers_s {
12320Smax.romanov@nginx.com     /* RPC responses. */
13320Smax.romanov@nginx.com     nxt_port_handler_t  rpc_ready;
14320Smax.romanov@nginx.com     nxt_port_handler_t  rpc_error;
15320Smax.romanov@nginx.com 
16320Smax.romanov@nginx.com     /* Main process RPC requests. */
171488St.nateldemoura@f5.com     nxt_port_handler_t  start_process;
18320Smax.romanov@nginx.com     nxt_port_handler_t  socket;
19320Smax.romanov@nginx.com     nxt_port_handler_t  modules;
20320Smax.romanov@nginx.com     nxt_port_handler_t  conf_store;
21774Svbart@nginx.com     nxt_port_handler_t  cert_get;
22774Svbart@nginx.com     nxt_port_handler_t  cert_delete;
23630Svbart@nginx.com     nxt_port_handler_t  access_log;
24320Smax.romanov@nginx.com 
25320Smax.romanov@nginx.com     /* File descriptor exchange. */
26320Smax.romanov@nginx.com     nxt_port_handler_t  change_file;
27320Smax.romanov@nginx.com     nxt_port_handler_t  new_port;
281545Smax.romanov@nginx.com     nxt_port_handler_t  get_port;
29320Smax.romanov@nginx.com     nxt_port_handler_t  mmap;
301546Smax.romanov@nginx.com     nxt_port_handler_t  get_mmap;
31320Smax.romanov@nginx.com 
321488St.nateldemoura@f5.com     /* New process */
331488St.nateldemoura@f5.com     nxt_port_handler_t  process_created;
34320Smax.romanov@nginx.com     nxt_port_handler_t  process_ready;
35320Smax.romanov@nginx.com 
36320Smax.romanov@nginx.com     /* Process exit/crash notification. */
37320Smax.romanov@nginx.com     nxt_port_handler_t  remove_pid;
38320Smax.romanov@nginx.com 
39320Smax.romanov@nginx.com     /* Stop process command. */
40320Smax.romanov@nginx.com     nxt_port_handler_t  quit;
41320Smax.romanov@nginx.com 
421131Smax.romanov@nginx.com     /* Request headers. */
431131Smax.romanov@nginx.com     nxt_port_handler_t  req_headers;
441547Smax.romanov@nginx.com     nxt_port_handler_t  req_headers_ack;
451555Smax.romanov@nginx.com     nxt_port_handler_t  req_body;
461131Smax.romanov@nginx.com 
471131Smax.romanov@nginx.com     /* Websocket frame. */
481131Smax.romanov@nginx.com     nxt_port_handler_t  websocket_frame;
491131Smax.romanov@nginx.com 
50320Smax.romanov@nginx.com     /* Various data. */
51320Smax.romanov@nginx.com     nxt_port_handler_t  data;
521321Smax.romanov@nginx.com 
531321Smax.romanov@nginx.com     nxt_port_handler_t  oosm;
541321Smax.romanov@nginx.com     nxt_port_handler_t  shm_ack;
551555Smax.romanov@nginx.com     nxt_port_handler_t  read_queue;
561555Smax.romanov@nginx.com     nxt_port_handler_t  read_socket;
57320Smax.romanov@nginx.com };
58320Smax.romanov@nginx.com 
59320Smax.romanov@nginx.com 
60320Smax.romanov@nginx.com #define nxt_port_handler_idx(name)                                            \
61389Smax.romanov@nginx.com     ( offsetof(nxt_port_handlers_t, name) / sizeof(nxt_port_handler_t) )
62320Smax.romanov@nginx.com 
631488St.nateldemoura@f5.com #define nxt_msg_last(handler)                                                 \
641488St.nateldemoura@f5.com     (handler | NXT_PORT_MSG_LAST)
65320Smax.romanov@nginx.com 
6642Smax.romanov@nginx.com typedef enum {
671488St.nateldemoura@f5.com     NXT_PORT_MSG_LAST             = 0x100,
681488St.nateldemoura@f5.com     NXT_PORT_MSG_CLOSE_FD         = 0x200,
691488St.nateldemoura@f5.com     NXT_PORT_MSG_SYNC             = 0x400,
70189Smax.romanov@nginx.com 
711488St.nateldemoura@f5.com     NXT_PORT_MSG_MASK             = 0xFF,
72189Smax.romanov@nginx.com 
731488St.nateldemoura@f5.com     _NXT_PORT_MSG_RPC_READY       = nxt_port_handler_idx(rpc_ready),
741488St.nateldemoura@f5.com     _NXT_PORT_MSG_RPC_ERROR       = nxt_port_handler_idx(rpc_error),
75320Smax.romanov@nginx.com 
761488St.nateldemoura@f5.com     _NXT_PORT_MSG_START_PROCESS   = nxt_port_handler_idx(start_process),
771488St.nateldemoura@f5.com     _NXT_PORT_MSG_SOCKET          = nxt_port_handler_idx(socket),
781488St.nateldemoura@f5.com     _NXT_PORT_MSG_MODULES         = nxt_port_handler_idx(modules),
791488St.nateldemoura@f5.com     _NXT_PORT_MSG_CONF_STORE      = nxt_port_handler_idx(conf_store),
801488St.nateldemoura@f5.com     _NXT_PORT_MSG_CERT_GET        = nxt_port_handler_idx(cert_get),
811488St.nateldemoura@f5.com     _NXT_PORT_MSG_CERT_DELETE     = nxt_port_handler_idx(cert_delete),
821488St.nateldemoura@f5.com     _NXT_PORT_MSG_ACCESS_LOG      = nxt_port_handler_idx(access_log),
8342Smax.romanov@nginx.com 
841488St.nateldemoura@f5.com     _NXT_PORT_MSG_CHANGE_FILE     = nxt_port_handler_idx(change_file),
851488St.nateldemoura@f5.com     _NXT_PORT_MSG_NEW_PORT        = nxt_port_handler_idx(new_port),
861545Smax.romanov@nginx.com     _NXT_PORT_MSG_GET_PORT        = nxt_port_handler_idx(get_port),
871488St.nateldemoura@f5.com     _NXT_PORT_MSG_MMAP            = nxt_port_handler_idx(mmap),
881546Smax.romanov@nginx.com     _NXT_PORT_MSG_GET_MMAP        = nxt_port_handler_idx(get_mmap),
89320Smax.romanov@nginx.com 
901488St.nateldemoura@f5.com     _NXT_PORT_MSG_PROCESS_CREATED = nxt_port_handler_idx(process_created),
911488St.nateldemoura@f5.com     _NXT_PORT_MSG_PROCESS_READY   = nxt_port_handler_idx(process_ready),
921488St.nateldemoura@f5.com     _NXT_PORT_MSG_REMOVE_PID      = nxt_port_handler_idx(remove_pid),
931488St.nateldemoura@f5.com     _NXT_PORT_MSG_QUIT            = nxt_port_handler_idx(quit),
941131Smax.romanov@nginx.com 
951488St.nateldemoura@f5.com     _NXT_PORT_MSG_REQ_HEADERS     = nxt_port_handler_idx(req_headers),
961547Smax.romanov@nginx.com     _NXT_PORT_MSG_REQ_HEADERS_ACK = nxt_port_handler_idx(req_headers_ack),
971555Smax.romanov@nginx.com     _NXT_PORT_MSG_REQ_BODY        = nxt_port_handler_idx(req_body),
981488St.nateldemoura@f5.com     _NXT_PORT_MSG_WEBSOCKET       = nxt_port_handler_idx(websocket_frame),
99189Smax.romanov@nginx.com 
1001488St.nateldemoura@f5.com     _NXT_PORT_MSG_DATA            = nxt_port_handler_idx(data),
1011321Smax.romanov@nginx.com 
1021488St.nateldemoura@f5.com     _NXT_PORT_MSG_OOSM            = nxt_port_handler_idx(oosm),
1031488St.nateldemoura@f5.com     _NXT_PORT_MSG_SHM_ACK         = nxt_port_handler_idx(shm_ack),
1041555Smax.romanov@nginx.com     _NXT_PORT_MSG_READ_QUEUE      = nxt_port_handler_idx(read_queue),
1051555Smax.romanov@nginx.com     _NXT_PORT_MSG_READ_SOCKET     = nxt_port_handler_idx(read_socket),
106320Smax.romanov@nginx.com 
1071488St.nateldemoura@f5.com     NXT_PORT_MSG_MAX              = sizeof(nxt_port_handlers_t)
1081488St.nateldemoura@f5.com                                     / sizeof(nxt_port_handler_t),
109320Smax.romanov@nginx.com 
1101488St.nateldemoura@f5.com     NXT_PORT_MSG_RPC_READY        = _NXT_PORT_MSG_RPC_READY,
1111488St.nateldemoura@f5.com     NXT_PORT_MSG_RPC_READY_LAST   = nxt_msg_last(_NXT_PORT_MSG_RPC_READY),
1121488St.nateldemoura@f5.com     NXT_PORT_MSG_RPC_ERROR        = nxt_msg_last(_NXT_PORT_MSG_RPC_ERROR),
1131488St.nateldemoura@f5.com     NXT_PORT_MSG_START_PROCESS    = nxt_msg_last(_NXT_PORT_MSG_START_PROCESS),
1141488St.nateldemoura@f5.com     NXT_PORT_MSG_SOCKET           = nxt_msg_last(_NXT_PORT_MSG_SOCKET),
1151488St.nateldemoura@f5.com     NXT_PORT_MSG_MODULES          = nxt_msg_last(_NXT_PORT_MSG_MODULES),
1161488St.nateldemoura@f5.com     NXT_PORT_MSG_CONF_STORE       = nxt_msg_last(_NXT_PORT_MSG_CONF_STORE),
1171488St.nateldemoura@f5.com     NXT_PORT_MSG_CERT_GET         = nxt_msg_last(_NXT_PORT_MSG_CERT_GET),
1181488St.nateldemoura@f5.com     NXT_PORT_MSG_CERT_DELETE      = nxt_msg_last(_NXT_PORT_MSG_CERT_DELETE),
1191488St.nateldemoura@f5.com     NXT_PORT_MSG_ACCESS_LOG       = nxt_msg_last(_NXT_PORT_MSG_ACCESS_LOG),
1201488St.nateldemoura@f5.com     NXT_PORT_MSG_CHANGE_FILE      = nxt_msg_last(_NXT_PORT_MSG_CHANGE_FILE),
1211488St.nateldemoura@f5.com     NXT_PORT_MSG_NEW_PORT         = nxt_msg_last(_NXT_PORT_MSG_NEW_PORT),
1221545Smax.romanov@nginx.com     NXT_PORT_MSG_GET_PORT         = nxt_msg_last(_NXT_PORT_MSG_GET_PORT),
1231488St.nateldemoura@f5.com     NXT_PORT_MSG_MMAP             = nxt_msg_last(_NXT_PORT_MSG_MMAP)
1241547Smax.romanov@nginx.com                                     | NXT_PORT_MSG_SYNC,
1251547Smax.romanov@nginx.com     NXT_PORT_MSG_GET_MMAP         = nxt_msg_last(_NXT_PORT_MSG_GET_MMAP),
126320Smax.romanov@nginx.com 
1271488St.nateldemoura@f5.com     NXT_PORT_MSG_PROCESS_CREATED  = nxt_msg_last(_NXT_PORT_MSG_PROCESS_CREATED),
1281488St.nateldemoura@f5.com     NXT_PORT_MSG_PROCESS_READY    = nxt_msg_last(_NXT_PORT_MSG_PROCESS_READY),
1291488St.nateldemoura@f5.com     NXT_PORT_MSG_QUIT             = nxt_msg_last(_NXT_PORT_MSG_QUIT),
1301488St.nateldemoura@f5.com     NXT_PORT_MSG_REMOVE_PID       = nxt_msg_last(_NXT_PORT_MSG_REMOVE_PID),
1311131Smax.romanov@nginx.com 
1321488St.nateldemoura@f5.com     NXT_PORT_MSG_REQ_HEADERS      = _NXT_PORT_MSG_REQ_HEADERS,
1331555Smax.romanov@nginx.com     NXT_PORT_MSG_REQ_BODY         = _NXT_PORT_MSG_REQ_BODY,
1341488St.nateldemoura@f5.com     NXT_PORT_MSG_WEBSOCKET        = _NXT_PORT_MSG_WEBSOCKET,
1351488St.nateldemoura@f5.com     NXT_PORT_MSG_WEBSOCKET_LAST   = nxt_msg_last(_NXT_PORT_MSG_WEBSOCKET),
1361321Smax.romanov@nginx.com 
1371488St.nateldemoura@f5.com     NXT_PORT_MSG_DATA             = _NXT_PORT_MSG_DATA,
1381488St.nateldemoura@f5.com     NXT_PORT_MSG_DATA_LAST        = nxt_msg_last(_NXT_PORT_MSG_DATA),
1391488St.nateldemoura@f5.com 
1401488St.nateldemoura@f5.com     NXT_PORT_MSG_OOSM             = nxt_msg_last(_NXT_PORT_MSG_OOSM),
1411488St.nateldemoura@f5.com     NXT_PORT_MSG_SHM_ACK          = nxt_msg_last(_NXT_PORT_MSG_SHM_ACK),
1421555Smax.romanov@nginx.com     NXT_PORT_MSG_READ_QUEUE       = _NXT_PORT_MSG_READ_QUEUE,
1431555Smax.romanov@nginx.com     NXT_PORT_MSG_READ_SOCKET      = _NXT_PORT_MSG_READ_SOCKET,
144125Smax.romanov@nginx.com } nxt_port_msg_type_t;
14542Smax.romanov@nginx.com 
14614Sigor@sysoev.ru 
14742Smax.romanov@nginx.com /* Passed as a first iov chunk. */
14842Smax.romanov@nginx.com typedef struct {
14942Smax.romanov@nginx.com     uint32_t             stream;
15042Smax.romanov@nginx.com     nxt_pid_t            pid;
15142Smax.romanov@nginx.com     nxt_port_id_t        reply_port;
15242Smax.romanov@nginx.com 
153189Smax.romanov@nginx.com     uint8_t              type;
154423Smax.romanov@nginx.com 
155423Smax.romanov@nginx.com     /* Last message for this stream. */
15642Smax.romanov@nginx.com     uint8_t              last;      /* 1 bit */
15742Smax.romanov@nginx.com 
15842Smax.romanov@nginx.com     /* Message data send using mmap, next chunk is a nxt_port_mmap_msg_t. */
15942Smax.romanov@nginx.com     uint8_t              mmap;      /* 1 bit */
160352Smax.romanov@nginx.com 
161423Smax.romanov@nginx.com     /* Non-First fragment in fragmented message sequence. */
162423Smax.romanov@nginx.com     uint8_t              nf;        /* 1 bit */
163423Smax.romanov@nginx.com 
164423Smax.romanov@nginx.com     /* More Fragments followed. */
165423Smax.romanov@nginx.com     uint8_t              mf;        /* 1 bit */
166423Smax.romanov@nginx.com 
167423Smax.romanov@nginx.com     /* Message delivery tracking enabled, next chunk is tracking msg. */
168423Smax.romanov@nginx.com     uint8_t              tracking;  /* 1 bit */
169168Svbart@nginx.com } nxt_port_msg_t;
17014Sigor@sysoev.ru 
17114Sigor@sysoev.ru 
17214Sigor@sysoev.ru typedef struct {
17314Sigor@sysoev.ru     nxt_queue_link_t    link;
17414Sigor@sysoev.ru     nxt_buf_t           *buf;
17514Sigor@sysoev.ru     size_t              share;
176*1558Smax.romanov@nginx.com     nxt_fd_t            fd[2];
17714Sigor@sysoev.ru     nxt_port_msg_t      port_msg;
178423Smax.romanov@nginx.com     uint32_t            tracking_msg[2];
1791125Smax.romanov@nginx.com     uint8_t             close_fd;   /* 1 bit */
1801125Smax.romanov@nginx.com     uint8_t             allocated;  /* 1 bit */
18114Sigor@sysoev.ru } nxt_port_send_msg_t;
18214Sigor@sysoev.ru 
18314Sigor@sysoev.ru 
18420Sigor@sysoev.ru struct nxt_port_recv_msg_s {
185*1558Smax.romanov@nginx.com     nxt_fd_t            fd[2];
18614Sigor@sysoev.ru     nxt_buf_t           *buf;
18714Sigor@sysoev.ru     nxt_port_t          *port;
18842Smax.romanov@nginx.com     nxt_port_msg_t      port_msg;
18982Smax.romanov@nginx.com     size_t              size;
190423Smax.romanov@nginx.com     nxt_bool_t          cancelled;
191347Smax.romanov@nginx.com     union {
192347Smax.romanov@nginx.com         nxt_port_t      *new_port;
193347Smax.romanov@nginx.com         nxt_pid_t       removed_pid;
194347Smax.romanov@nginx.com         void            *data;
195347Smax.romanov@nginx.com     } u;
19620Sigor@sysoev.ru };
19714Sigor@sysoev.ru 
198141Smax.romanov@nginx.com typedef struct nxt_app_s  nxt_app_t;
19914Sigor@sysoev.ru 
20014Sigor@sysoev.ru struct nxt_port_s {
20114Sigor@sysoev.ru     nxt_fd_event_t      socket;
20214Sigor@sysoev.ru 
203125Smax.romanov@nginx.com     nxt_queue_link_t    link;       /* for nxt_process_t.ports */
204141Smax.romanov@nginx.com     nxt_process_t       *process;
205141Smax.romanov@nginx.com 
206141Smax.romanov@nginx.com     nxt_queue_link_t    app_link;   /* for nxt_app_t.ports */
207141Smax.romanov@nginx.com     nxt_app_t           *app;
2081547Smax.romanov@nginx.com     nxt_port_t          *main_app_port;
20942Smax.romanov@nginx.com 
210507Smax.romanov@nginx.com     nxt_queue_link_t    idle_link;  /* for nxt_app_t.idle_ports */
211507Smax.romanov@nginx.com     nxt_msec_t          idle_start;
212507Smax.romanov@nginx.com 
21314Sigor@sysoev.ru     nxt_queue_t         messages;   /* of nxt_port_send_msg_t */
214343Smax.romanov@nginx.com     nxt_thread_mutex_t  write_mutex;
21514Sigor@sysoev.ru 
21614Sigor@sysoev.ru     /* Maximum size of message part. */
21714Sigor@sysoev.ru     uint32_t            max_size;
21814Sigor@sysoev.ru     /* Maximum interleave of message parts. */
21914Sigor@sysoev.ru     uint32_t            max_share;
220343Smax.romanov@nginx.com 
221343Smax.romanov@nginx.com     uint32_t            app_responses;
22214Sigor@sysoev.ru 
2231547Smax.romanov@nginx.com     uint32_t            active_websockets;
2241547Smax.romanov@nginx.com     uint32_t            active_requests;
2251131Smax.romanov@nginx.com 
22614Sigor@sysoev.ru     nxt_port_handler_t  handler;
227141Smax.romanov@nginx.com     nxt_port_handler_t  *data;
22814Sigor@sysoev.ru 
22965Sigor@sysoev.ru     nxt_mp_t            *mem_pool;
230141Smax.romanov@nginx.com     nxt_event_engine_t  *engine;
231141Smax.romanov@nginx.com 
23214Sigor@sysoev.ru     nxt_buf_t           *free_bufs;
23314Sigor@sysoev.ru     nxt_socket_t        pair[2];
23414Sigor@sysoev.ru 
23542Smax.romanov@nginx.com     nxt_port_id_t       id;
23614Sigor@sysoev.ru     nxt_pid_t           pid;
23742Smax.romanov@nginx.com 
238190Smax.romanov@nginx.com     nxt_lvlhsh_t        rpc_streams; /* stream to nxt_port_rpc_reg_t */
239190Smax.romanov@nginx.com     nxt_lvlhsh_t        rpc_peers;   /* peer to queue of nxt_port_rpc_reg_t */
240190Smax.romanov@nginx.com 
241352Smax.romanov@nginx.com     nxt_lvlhsh_t        frags;
242352Smax.romanov@nginx.com 
243343Smax.romanov@nginx.com     nxt_atomic_t        use_count;
244343Smax.romanov@nginx.com 
245141Smax.romanov@nginx.com     nxt_process_type_t  type;
2461555Smax.romanov@nginx.com 
2471555Smax.romanov@nginx.com     nxt_fd_t            queue_fd;
2481555Smax.romanov@nginx.com     void                *queue;
2491555Smax.romanov@nginx.com 
2501555Smax.romanov@nginx.com     void                *socket_msg;
2511555Smax.romanov@nginx.com     int                 from_socket;
25214Sigor@sysoev.ru };
25314Sigor@sysoev.ru 
25414Sigor@sysoev.ru 
25511Sigor@sysoev.ru typedef struct {
25642Smax.romanov@nginx.com     nxt_port_id_t       id;
25714Sigor@sysoev.ru     nxt_pid_t           pid;
25814Sigor@sysoev.ru     size_t              max_size;
25914Sigor@sysoev.ru     size_t              max_share;
26042Smax.romanov@nginx.com     nxt_process_type_t  type:8;
261168Svbart@nginx.com } nxt_port_msg_new_port_t;
26211Sigor@sysoev.ru 
26311Sigor@sysoev.ru 
2641545Smax.romanov@nginx.com typedef struct {
2651545Smax.romanov@nginx.com     nxt_port_id_t       id;
2661545Smax.romanov@nginx.com     nxt_pid_t           pid;
2671545Smax.romanov@nginx.com } nxt_port_msg_get_port_t;
2681545Smax.romanov@nginx.com 
2691545Smax.romanov@nginx.com 
2701546Smax.romanov@nginx.com typedef struct {
2711546Smax.romanov@nginx.com     uint32_t            id;
2721546Smax.romanov@nginx.com } nxt_port_msg_get_mmap_t;
2731546Smax.romanov@nginx.com 
2741546Smax.romanov@nginx.com 
27511Sigor@sysoev.ru /*
27614Sigor@sysoev.ru  * nxt_port_data_t size is allocation size
27714Sigor@sysoev.ru  * which enables effective reuse of memory pool cache.
27811Sigor@sysoev.ru  */
27911Sigor@sysoev.ru typedef union {
28011Sigor@sysoev.ru     nxt_buf_t                buf;
28114Sigor@sysoev.ru     nxt_port_msg_new_port_t  new_port;
28214Sigor@sysoev.ru } nxt_port_data_t;
28311Sigor@sysoev.ru 
28411Sigor@sysoev.ru 
285343Smax.romanov@nginx.com typedef void (*nxt_port_post_handler_t)(nxt_task_t *task, nxt_port_t *port,
286343Smax.romanov@nginx.com     void *data);
287343Smax.romanov@nginx.com 
288197Smax.romanov@nginx.com nxt_port_t *nxt_port_new(nxt_task_t *task, nxt_port_id_t id, nxt_pid_t pid,
289163Smax.romanov@nginx.com     nxt_process_type_t type);
290163Smax.romanov@nginx.com 
291141Smax.romanov@nginx.com nxt_port_id_t nxt_port_get_next_id(void);
292141Smax.romanov@nginx.com void nxt_port_reset_next_id(void);
293141Smax.romanov@nginx.com 
29414Sigor@sysoev.ru nxt_int_t nxt_port_socket_init(nxt_task_t *task, nxt_port_t *port,
29514Sigor@sysoev.ru     size_t max_size);
29614Sigor@sysoev.ru void nxt_port_destroy(nxt_port_t *port);
297343Smax.romanov@nginx.com void nxt_port_close(nxt_task_t *task, nxt_port_t *port);
29814Sigor@sysoev.ru void nxt_port_write_enable(nxt_task_t *task, nxt_port_t *port);
29914Sigor@sysoev.ru void nxt_port_write_close(nxt_port_t *port);
30014Sigor@sysoev.ru void nxt_port_read_enable(nxt_task_t *task, nxt_port_t *port);
30114Sigor@sysoev.ru void nxt_port_read_close(nxt_port_t *port);
3021555Smax.romanov@nginx.com nxt_int_t nxt_port_socket_write2(nxt_task_t *task, nxt_port_t *port,
3031555Smax.romanov@nginx.com     nxt_uint_t type, nxt_fd_t fd, nxt_fd_t fd2, uint32_t stream,
3041555Smax.romanov@nginx.com     nxt_port_id_t reply_port, nxt_buf_t *b);
305423Smax.romanov@nginx.com 
306423Smax.romanov@nginx.com nxt_inline nxt_int_t
307423Smax.romanov@nginx.com nxt_port_socket_write(nxt_task_t *task, nxt_port_t *port,
308423Smax.romanov@nginx.com     nxt_uint_t type, nxt_fd_t fd, uint32_t stream, nxt_port_id_t reply_port,
309423Smax.romanov@nginx.com     nxt_buf_t *b)
310423Smax.romanov@nginx.com {
3111555Smax.romanov@nginx.com     return nxt_port_socket_write2(task, port, type, fd, -1, stream, reply_port,
3121555Smax.romanov@nginx.com                                   b);
313423Smax.romanov@nginx.com }
31414Sigor@sysoev.ru 
315141Smax.romanov@nginx.com void nxt_port_enable(nxt_task_t *task, nxt_port_t *port,
3161302St.nateldemoura@f5.com     const nxt_port_handlers_t *handlers);
31781Smax.romanov@nginx.com nxt_int_t nxt_port_send_port(nxt_task_t *task, nxt_port_t *port,
318141Smax.romanov@nginx.com     nxt_port_t *new_port, uint32_t stream);
31920Sigor@sysoev.ru void nxt_port_change_log_file(nxt_task_t *task, nxt_runtime_t *rt,
32011Sigor@sysoev.ru     nxt_uint_t slot, nxt_fd_t fd);
32111Sigor@sysoev.ru 
32214Sigor@sysoev.ru void nxt_port_quit_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg);
32314Sigor@sysoev.ru void nxt_port_new_port_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg);
324320Smax.romanov@nginx.com void nxt_port_process_ready_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg);
32514Sigor@sysoev.ru void nxt_port_change_log_file_handler(nxt_task_t *task,
32611Sigor@sysoev.ru     nxt_port_recv_msg_t *msg);
32742Smax.romanov@nginx.com void nxt_port_mmap_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg);
32814Sigor@sysoev.ru void nxt_port_data_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg);
329125Smax.romanov@nginx.com void nxt_port_remove_pid_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg);
33014Sigor@sysoev.ru void nxt_port_empty_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg);
33111Sigor@sysoev.ru 
332343Smax.romanov@nginx.com nxt_int_t nxt_port_post(nxt_task_t *task, nxt_port_t *port,
333343Smax.romanov@nginx.com     nxt_port_post_handler_t handler, void *data);
334343Smax.romanov@nginx.com void nxt_port_use(nxt_task_t *task, nxt_port_t *port, int i);
33511Sigor@sysoev.ru 
336425Smax.romanov@nginx.com nxt_inline void nxt_port_inc_use(nxt_port_t *port)
337425Smax.romanov@nginx.com {
338425Smax.romanov@nginx.com     nxt_atomic_fetch_add(&port->use_count, 1);
339425Smax.romanov@nginx.com }
340425Smax.romanov@nginx.com 
34111Sigor@sysoev.ru #endif /* _NXT_PORT_H_INCLUDED_ */
342