summaryrefslogtreecommitdiffhomepage
path: root/src/nodejs/unit-http/unit.h
diff options
context:
space:
mode:
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_ */