summaryrefslogtreecommitdiffhomepage
path: root/src/nodejs/unit-http/unit.h
diff options
context:
space:
mode:
authorAndrei Belov <defan@nginx.com>2019-05-30 17:44:29 +0300
committerAndrei Belov <defan@nginx.com>2019-05-30 17:44:29 +0300
commit4921df052be8437d912f3c60faa9a667890e4498 (patch)
tree3678c551f148a0d177721597de978c090237f205 /src/nodejs/unit-http/unit.h
parent3b7a7ff2aa5840d4238584410ee1ebc6860fb9c5 (diff)
parent7da320a93af07765e79c929287704936c431f3cd (diff)
downloadunit-4921df052be8437d912f3c60faa9a667890e4498.tar.gz
unit-4921df052be8437d912f3c60faa9a667890e4498.tar.bz2
Merged with the default branch.1.9.0-1
Diffstat (limited to 'src/nodejs/unit-http/unit.h')
-rw-r--r--src/nodejs/unit-http/unit.h35
1 files changed, 7 insertions, 28 deletions
diff --git a/src/nodejs/unit-http/unit.h b/src/nodejs/unit-http/unit.h
index db85e85c..e76d805a 100644
--- a/src/nodejs/unit-http/unit.h
+++ b/src/nodejs/unit-http/unit.h
@@ -6,34 +6,15 @@
#ifndef _NXT_NODEJS_UNIT_H_INCLUDED_
#define _NXT_NODEJS_UNIT_H_INCLUDED_
-#include <node_api.h>
+#include "nxt_napi.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-#include "version.h"
-#include <nxt_unit.h>
-
-#if NXT_VERNUM != NXT_NODE_VERNUM
-#error "libunit version mismatch."
-#endif
-
-#include <nxt_unit_response.h>
-#include <nxt_unit_request.h>
-
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-
-class Unit {
+class Unit : public nxt_napi {
public:
static napi_value init(napi_env env, napi_value exports);
private:
- Unit(napi_env env);
+ Unit(napi_env env, napi_value jsthis);
~Unit();
static napi_value create(napi_env env, napi_callback_info info);
@@ -56,7 +37,7 @@ private:
napi_value create_response(napi_value server_obj, napi_value socket,
napi_value request,
- nxt_unit_request_info_t *req, Unit *obj);
+ nxt_unit_request_info_t *req);
static napi_value response_send_headers(napi_env env,
napi_callback_info info);
@@ -64,18 +45,16 @@ private:
static napi_value response_write(napi_env env, napi_callback_info info);
static napi_value response_end(napi_env env, napi_callback_info info);
- napi_status create_headers(nxt_unit_request_info_t *req,
- napi_value request);
+ void create_headers(nxt_unit_request_info_t *req, napi_value request);
- inline napi_status append_header(nxt_unit_field_t *f, napi_value headers,
+ void append_header(nxt_unit_field_t *f, napi_value headers,
napi_value raw_headers, uint32_t idx);
static napi_ref constructor_;
- napi_env env_;
napi_ref wrapper_;
nxt_unit_ctx_t *unit_ctx_;
};
-#endif /* _NXT_NODEJS_H_INCLUDED_ */
+#endif /* _NXT_NODEJS_UNIT_H_INCLUDED_ */