Deleted
Added
nxt_unit.h (953:00d8049418cf) | nxt_unit.h (1131:ec7d924d8dfb) |
---|---|
1 2/* 3 * Copyright (C) NGINX, Inc. 4 */ 5 6#ifndef _NXT_UNIT_H_INCLUDED_ 7#define _NXT_UNIT_H_INCLUDED_ 8 9 10#include <inttypes.h> 11#include <sys/types.h> | 1 2/* 3 * Copyright (C) NGINX, Inc. 4 */ 5 6#ifndef _NXT_UNIT_H_INCLUDED_ 7#define _NXT_UNIT_H_INCLUDED_ 8 9 10#include <inttypes.h> 11#include <sys/types.h> |
12#include <sys/uio.h> |
|
12#include <string.h> 13 14#include "nxt_version.h" 15#include "nxt_unit_typedefs.h" 16 17 18enum { 19 NXT_UNIT_OK = 0, --- 81 unchanged lines hidden (view full) --- 101 uint32_t response_max_fields; 102 103 nxt_unit_buf_t *content_buf; 104 uint64_t content_length; 105 106 void *data; 107}; 108 | 13#include <string.h> 14 15#include "nxt_version.h" 16#include "nxt_unit_typedefs.h" 17 18 19enum { 20 NXT_UNIT_OK = 0, --- 81 unchanged lines hidden (view full) --- 102 uint32_t response_max_fields; 103 104 nxt_unit_buf_t *content_buf; 105 uint64_t content_length; 106 107 void *data; 108}; 109 |
110 |
|
109/* 110 * Set of application-specific callbacks. Application may leave all optional 111 * callbacks as NULL. 112 */ 113struct nxt_unit_callbacks_s { 114 /* | 111/* 112 * Set of application-specific callbacks. Application may leave all optional 113 * callbacks as NULL. 114 */ 115struct nxt_unit_callbacks_s { 116 /* |
115 * Process request data. Unlike all other callback, this callback | 117 * Process request. Unlike all other callback, this callback |
116 * need to be defined by application. 117 */ 118 void (*request_handler)(nxt_unit_request_info_t *req); 119 | 118 * need to be defined by application. 119 */ 120 void (*request_handler)(nxt_unit_request_info_t *req); 121 |
122 /* Process websocket frame. */ 123 void (*websocket_handler)(nxt_unit_websocket_frame_t *ws); 124 125 /* Connection closed. */ 126 void (*close_handler)(nxt_unit_request_info_t *req); 127 |
|
120 /* Add new Unit port to communicate with process pid. Optional. */ 121 int (*add_port)(nxt_unit_ctx_t *, nxt_unit_port_t *port); 122 123 /* Remove previously added port. Optional. */ 124 void (*remove_port)(nxt_unit_ctx_t *, nxt_unit_port_id_t *port_id); 125 126 /* Remove all data associated with process pid including ports. Optional. */ 127 void (*remove_pid)(nxt_unit_ctx_t *, pid_t pid); --- 160 unchanged lines hidden (view full) --- 288 */ 289int nxt_unit_response_send(nxt_unit_request_info_t *req); 290 291int nxt_unit_response_is_sent(nxt_unit_request_info_t *req); 292 293nxt_unit_buf_t *nxt_unit_response_buf_alloc(nxt_unit_request_info_t *req, 294 uint32_t size); 295 | 128 /* Add new Unit port to communicate with process pid. Optional. */ 129 int (*add_port)(nxt_unit_ctx_t *, nxt_unit_port_t *port); 130 131 /* Remove previously added port. Optional. */ 132 void (*remove_port)(nxt_unit_ctx_t *, nxt_unit_port_id_t *port_id); 133 134 /* Remove all data associated with process pid including ports. Optional. */ 135 void (*remove_pid)(nxt_unit_ctx_t *, pid_t pid); --- 160 unchanged lines hidden (view full) --- 296 */ 297int nxt_unit_response_send(nxt_unit_request_info_t *req); 298 299int nxt_unit_response_is_sent(nxt_unit_request_info_t *req); 300 301nxt_unit_buf_t *nxt_unit_response_buf_alloc(nxt_unit_request_info_t *req, 302 uint32_t size); 303 |
304int nxt_unit_request_is_websocket_handshake(nxt_unit_request_info_t *req); 305 306int nxt_unit_response_upgrade(nxt_unit_request_info_t *req); 307 308int nxt_unit_response_is_websocket(nxt_unit_request_info_t *req); 309 310nxt_unit_request_info_t *nxt_unit_get_request_info_from_data(void *data); 311 |
|
296int nxt_unit_buf_send(nxt_unit_buf_t *buf); 297 298void nxt_unit_buf_free(nxt_unit_buf_t *buf); 299 300nxt_unit_buf_t *nxt_unit_buf_next(nxt_unit_buf_t *buf); 301 302uint32_t nxt_unit_buf_max(void); 303 --- 6 unchanged lines hidden (view full) --- 310 nxt_unit_read_info_t *read_info); 311 312ssize_t nxt_unit_request_read(nxt_unit_request_info_t *req, void *dst, 313 size_t size); 314 315void nxt_unit_request_done(nxt_unit_request_info_t *req, int rc); 316 317 | 312int nxt_unit_buf_send(nxt_unit_buf_t *buf); 313 314void nxt_unit_buf_free(nxt_unit_buf_t *buf); 315 316nxt_unit_buf_t *nxt_unit_buf_next(nxt_unit_buf_t *buf); 317 318uint32_t nxt_unit_buf_max(void); 319 --- 6 unchanged lines hidden (view full) --- 326 nxt_unit_read_info_t *read_info); 327 328ssize_t nxt_unit_request_read(nxt_unit_request_info_t *req, void *dst, 329 size_t size); 330 331void nxt_unit_request_done(nxt_unit_request_info_t *req, int rc); 332 333 |
334int nxt_unit_websocket_send(nxt_unit_request_info_t *req, uint8_t opcode, 335 uint8_t last, const void *start, size_t size); 336 337int nxt_unit_websocket_sendv(nxt_unit_request_info_t *req, uint8_t opcode, 338 uint8_t last, const struct iovec *iov, int iovcnt); 339 340ssize_t nxt_unit_websocket_read(nxt_unit_websocket_frame_t *ws, void *dst, 341 size_t size); 342 343int nxt_unit_websocket_retain(nxt_unit_websocket_frame_t *ws); 344 345void nxt_unit_websocket_done(nxt_unit_websocket_frame_t *ws); 346 347 |
|
318void nxt_unit_log(nxt_unit_ctx_t *ctx, int level, const char* fmt, ...); 319 320void nxt_unit_req_log(nxt_unit_request_info_t *req, int level, 321 const char* fmt, ...); 322 323#if (NXT_DEBUG) 324 325#define nxt_unit_debug(ctx, fmt, ARGS...) \ --- 34 unchanged lines hidden --- | 348void nxt_unit_log(nxt_unit_ctx_t *ctx, int level, const char* fmt, ...); 349 350void nxt_unit_req_log(nxt_unit_request_info_t *req, int level, 351 const char* fmt, ...); 352 353#if (NXT_DEBUG) 354 355#define nxt_unit_debug(ctx, fmt, ARGS...) \ --- 34 unchanged lines hidden --- |