unit.h (1020:53533ba0097c) unit.h (1132:9ac5b5f33ed9)
1
2/*
3 * Copyright (C) NGINX, Inc.
4 */
5
6#ifndef _NXT_NODEJS_UNIT_H_INCLUDED_
7#define _NXT_NODEJS_UNIT_H_INCLUDED_
8

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

14 static napi_value init(napi_env env, napi_value exports);
15
16private:
17 Unit(napi_env env, napi_value jsthis);
18 ~Unit();
19
20 static napi_value create(napi_env env, napi_callback_info info);
21 static void destroy(napi_env env, void *nativeObject, void *finalize_hint);
1
2/*
3 * Copyright (C) NGINX, Inc.
4 */
5
6#ifndef _NXT_NODEJS_UNIT_H_INCLUDED_
7#define _NXT_NODEJS_UNIT_H_INCLUDED_
8

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

14 static napi_value init(napi_env env, napi_value exports);
15
16private:
17 Unit(napi_env env, napi_value jsthis);
18 ~Unit();
19
20 static napi_value create(napi_env env, napi_callback_info info);
21 static void destroy(napi_env env, void *nativeObject, void *finalize_hint);
22 static void conn_destroy(napi_env env, void *nativeObject, void *finalize_hint);
23 static void sock_destroy(napi_env env, void *nativeObject, void *finalize_hint);
24 static void resp_destroy(napi_env env, void *nativeObject, void *finalize_hint);
22
23 static napi_value create_server(napi_env env, napi_callback_info info);
24 static napi_value listen(napi_env env, napi_callback_info info);
25 static napi_value _read(napi_env env, napi_callback_info info);
25
26 static napi_value create_server(napi_env env, napi_callback_info info);
27 static napi_value listen(napi_env env, napi_callback_info info);
28 static napi_value _read(napi_env env, napi_callback_info info);
26 static void request_handler(nxt_unit_request_info_t *req);
29
30 static void request_handler_cb(nxt_unit_request_info_t *req);
31 void request_handler(nxt_unit_request_info_t *req);
32
33 static void websocket_handler_cb(nxt_unit_websocket_frame_t *ws);
34 void websocket_handler(nxt_unit_websocket_frame_t *ws);
35
36 static void close_handler_cb(nxt_unit_request_info_t *req);
37 void close_handler(nxt_unit_request_info_t *req);
38
27 static int add_port(nxt_unit_ctx_t *ctx, nxt_unit_port_t *port);
28 static void remove_port(nxt_unit_ctx_t *ctx, nxt_unit_port_id_t *port_id);
39 static int add_port(nxt_unit_ctx_t *ctx, nxt_unit_port_t *port);
40 static void remove_port(nxt_unit_ctx_t *ctx, nxt_unit_port_id_t *port_id);
29 static void quit(nxt_unit_ctx_t *ctx);
30
41
42 static void quit_cb(nxt_unit_ctx_t *ctx);
43 void quit(nxt_unit_ctx_t *ctx);
44
31 napi_value get_server_object();
32
33 napi_value create_socket(napi_value server_obj,
34 nxt_unit_request_info_t *req);
35
36 napi_value create_request(napi_value server_obj, napi_value socket);
37
45 napi_value get_server_object();
46
47 napi_value create_socket(napi_value server_obj,
48 nxt_unit_request_info_t *req);
49
50 napi_value create_request(napi_value server_obj, napi_value socket);
51
38 napi_value create_response(napi_value server_obj, napi_value socket,
39 napi_value request,
52 napi_value create_response(napi_value server_obj, napi_value request,
40 nxt_unit_request_info_t *req);
41
53 nxt_unit_request_info_t *req);
54
55 napi_value create_websocket_frame(napi_value server_obj,
56 nxt_unit_websocket_frame_t *ws);
57
42 static napi_value response_send_headers(napi_env env,
43 napi_callback_info info);
44
45 static napi_value response_write(napi_env env, napi_callback_info info);
46 static napi_value response_end(napi_env env, napi_callback_info info);
58 static napi_value response_send_headers(napi_env env,
59 napi_callback_info info);
60
61 static napi_value response_write(napi_env env, napi_callback_info info);
62 static napi_value response_end(napi_env env, napi_callback_info info);
63 static napi_value websocket_send_frame(napi_env env,
64 napi_callback_info info);
65 static napi_value websocket_set_sock(napi_env env, napi_callback_info info);
47
48 void create_headers(nxt_unit_request_info_t *req, napi_value request);
49
50 void append_header(nxt_unit_field_t *f, napi_value headers,
66
67 void create_headers(nxt_unit_request_info_t *req, napi_value request);
68
69 void append_header(nxt_unit_field_t *f, napi_value headers,
51 napi_value raw_headers, uint32_t idx);
70 napi_value raw_headers, uint32_t idx);
52
53 static napi_ref constructor_;
54
55 napi_ref wrapper_;
56 nxt_unit_ctx_t *unit_ctx_;
57};
58
59
60#endif /* _NXT_NODEJS_UNIT_H_INCLUDED_ */
71
72 static napi_ref constructor_;
73
74 napi_ref wrapper_;
75 nxt_unit_ctx_t *unit_ctx_;
76};
77
78
79#endif /* _NXT_NODEJS_UNIT_H_INCLUDED_ */