nxt_port.h (320:d385755599d6) nxt_port.h (343:9fa845db60fb)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#ifndef _NXT_PORT_H_INCLUDED_
8#define _NXT_PORT_H_INCLUDED_

--- 101 unchanged lines hidden (view full) ---

110
111
112typedef struct {
113 nxt_queue_link_t link;
114 nxt_buf_t *buf;
115 size_t share;
116 nxt_fd_t fd;
117 nxt_bool_t close_fd;
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#ifndef _NXT_PORT_H_INCLUDED_
8#define _NXT_PORT_H_INCLUDED_

--- 101 unchanged lines hidden (view full) ---

110
111
112typedef struct {
113 nxt_queue_link_t link;
114 nxt_buf_t *buf;
115 size_t share;
116 nxt_fd_t fd;
117 nxt_bool_t close_fd;
118 nxt_bool_t opened;
119 nxt_port_msg_t port_msg;
120
121 nxt_work_t work;
122 nxt_event_engine_t *engine;
123 nxt_mp_t *mem_pool;
124} nxt_port_send_msg_t;
125
126

--- 13 unchanged lines hidden (view full) ---

140
141 nxt_queue_link_t link; /* for nxt_process_t.ports */
142 nxt_process_t *process;
143
144 nxt_queue_link_t app_link; /* for nxt_app_t.ports */
145 nxt_app_t *app;
146
147 nxt_queue_t messages; /* of nxt_port_send_msg_t */
118 nxt_port_msg_t port_msg;
119
120 nxt_work_t work;
121 nxt_event_engine_t *engine;
122 nxt_mp_t *mem_pool;
123} nxt_port_send_msg_t;
124
125

--- 13 unchanged lines hidden (view full) ---

139
140 nxt_queue_link_t link; /* for nxt_process_t.ports */
141 nxt_process_t *process;
142
143 nxt_queue_link_t app_link; /* for nxt_app_t.ports */
144 nxt_app_t *app;
145
146 nxt_queue_t messages; /* of nxt_port_send_msg_t */
147 nxt_thread_mutex_t write_mutex;
148
149 /* Maximum size of message part. */
150 uint32_t max_size;
151 /* Maximum interleave of message parts. */
152 uint32_t max_share;
148
149 /* Maximum size of message part. */
150 uint32_t max_size;
151 /* Maximum interleave of message parts. */
152 uint32_t max_share;
153 uint32_t app_stream;
154
153
154 uint32_t app_requests;
155 uint32_t app_responses;
156
155 nxt_port_handler_t handler;
156 nxt_port_handler_t *data;
157
158 nxt_mp_t *mem_pool;
159 nxt_event_engine_t *engine;
160
161 nxt_buf_t *free_bufs;
162 nxt_socket_t pair[2];
163
164 nxt_port_id_t id;
165 nxt_pid_t pid;
166
167 nxt_lvlhsh_t rpc_streams; /* stream to nxt_port_rpc_reg_t */
168 nxt_lvlhsh_t rpc_peers; /* peer to queue of nxt_port_rpc_reg_t */
169
157 nxt_port_handler_t handler;
158 nxt_port_handler_t *data;
159
160 nxt_mp_t *mem_pool;
161 nxt_event_engine_t *engine;
162
163 nxt_buf_t *free_bufs;
164 nxt_socket_t pair[2];
165
166 nxt_port_id_t id;
167 nxt_pid_t pid;
168
169 nxt_lvlhsh_t rpc_streams; /* stream to nxt_port_rpc_reg_t */
170 nxt_lvlhsh_t rpc_peers; /* peer to queue of nxt_port_rpc_reg_t */
171
172 nxt_atomic_t use_count;
173
170 nxt_process_type_t type;
174 nxt_process_type_t type;
171 nxt_work_t work;
172
173 struct iovec *iov;
174 void *mmsg_buf;
175};
176
177
178typedef struct {
179 nxt_port_id_t id;

--- 9 unchanged lines hidden (view full) ---

189 * which enables effective reuse of memory pool cache.
190 */
191typedef union {
192 nxt_buf_t buf;
193 nxt_port_msg_new_port_t new_port;
194} nxt_port_data_t;
195
196
175
176 struct iovec *iov;
177 void *mmsg_buf;
178};
179
180
181typedef struct {
182 nxt_port_id_t id;

--- 9 unchanged lines hidden (view full) ---

192 * which enables effective reuse of memory pool cache.
193 */
194typedef union {
195 nxt_buf_t buf;
196 nxt_port_msg_new_port_t new_port;
197} nxt_port_data_t;
198
199
200typedef void (*nxt_port_post_handler_t)(nxt_task_t *task, nxt_port_t *port,
201 void *data);
202
197nxt_port_t *nxt_port_new(nxt_task_t *task, nxt_port_id_t id, nxt_pid_t pid,
198 nxt_process_type_t type);
203nxt_port_t *nxt_port_new(nxt_task_t *task, nxt_port_id_t id, nxt_pid_t pid,
204 nxt_process_type_t type);
199nxt_bool_t nxt_port_release(nxt_port_t *port);
200
201nxt_port_id_t nxt_port_get_next_id(void);
202void nxt_port_reset_next_id(void);
203
204nxt_int_t nxt_port_socket_init(nxt_task_t *task, nxt_port_t *port,
205 size_t max_size);
206void nxt_port_destroy(nxt_port_t *port);
205
206nxt_port_id_t nxt_port_get_next_id(void);
207void nxt_port_reset_next_id(void);
208
209nxt_int_t nxt_port_socket_init(nxt_task_t *task, nxt_port_t *port,
210 size_t max_size);
211void nxt_port_destroy(nxt_port_t *port);
212void nxt_port_close(nxt_task_t *task, nxt_port_t *port);
207void nxt_port_write_enable(nxt_task_t *task, nxt_port_t *port);
208void nxt_port_write_close(nxt_port_t *port);
209void nxt_port_read_enable(nxt_task_t *task, nxt_port_t *port);
210void nxt_port_read_close(nxt_port_t *port);
211nxt_int_t nxt_port_socket_write(nxt_task_t *task, nxt_port_t *port,
212 nxt_uint_t type, nxt_fd_t fd, uint32_t stream, nxt_port_id_t reply_port,
213 nxt_buf_t *b);
214

--- 11 unchanged lines hidden (view full) ---

226void nxt_port_process_ready_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg);
227void nxt_port_change_log_file_handler(nxt_task_t *task,
228 nxt_port_recv_msg_t *msg);
229void nxt_port_mmap_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg);
230void nxt_port_data_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg);
231void nxt_port_remove_pid_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg);
232void nxt_port_empty_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg);
233
213void nxt_port_write_enable(nxt_task_t *task, nxt_port_t *port);
214void nxt_port_write_close(nxt_port_t *port);
215void nxt_port_read_enable(nxt_task_t *task, nxt_port_t *port);
216void nxt_port_read_close(nxt_port_t *port);
217nxt_int_t nxt_port_socket_write(nxt_task_t *task, nxt_port_t *port,
218 nxt_uint_t type, nxt_fd_t fd, uint32_t stream, nxt_port_id_t reply_port,
219 nxt_buf_t *b);
220

--- 11 unchanged lines hidden (view full) ---

232void nxt_port_process_ready_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg);
233void nxt_port_change_log_file_handler(nxt_task_t *task,
234 nxt_port_recv_msg_t *msg);
235void nxt_port_mmap_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg);
236void nxt_port_data_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg);
237void nxt_port_remove_pid_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg);
238void nxt_port_empty_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg);
239
240nxt_int_t nxt_port_post(nxt_task_t *task, nxt_port_t *port,
241 nxt_port_post_handler_t handler, void *data);
242void nxt_port_use(nxt_task_t *task, nxt_port_t *port, int i);
234
235#endif /* _NXT_PORT_H_INCLUDED_ */
243
244#endif /* _NXT_PORT_H_INCLUDED_ */