@openziti/ziti-sdk-nodejs 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/ziti_dial.c CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2019-2020 Netfoundry, Inc.
2
+ Copyright Netfoundry, Inc.
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@ limitations under the License.
20
20
  // An item that will be generated here and passed into the JavaScript on_data callback
21
21
  typedef struct OnDataItem {
22
22
 
23
- uint8_t *buf;
23
+ const unsigned char *buf;
24
24
  int len;
25
25
 
26
26
  } OnDataItem;
@@ -139,11 +139,10 @@ static void CallJs_on_data(napi_env env, napi_value js_cb, void* context, void*
139
139
 
140
140
 
141
141
 
142
-
143
142
  /**
144
143
  * This function is the callback invoked by the C-SDK when data arrives on the connection.
145
144
  */
146
- ssize_t on_data(ziti_connection conn, uint8_t *buf, ssize_t len) {
145
+ long on_data(struct ziti_conn *conn, const unsigned char *buf, long len) {
147
146
  napi_status status;
148
147
 
149
148
  ConnAddonData* addon_data = (ConnAddonData*) ziti_conn_data(conn);
@@ -168,7 +167,7 @@ ssize_t on_data(ziti_connection conn, uint8_t *buf, ssize_t len) {
168
167
  OnDataItem* item = memset(malloc(sizeof(*item)), 0, sizeof(*item));
169
168
  item->buf = buf;
170
169
  item->buf = calloc(1, len);
171
- memcpy(item->buf, buf, len);
170
+ memcpy((void*)item->buf, buf, len);
172
171
  item->len = len;
173
172
 
174
173
  // if (addon_data->isWebsocket) {
package/src/ziti_enroll.c CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2019-2020 Netfoundry, Inc.
2
+ Copyright Netfoundry, Inc.
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -110,7 +110,7 @@ static void CallJs_on_enroll(napi_env env, napi_value js_cb, void* context, void
110
110
  /**
111
111
  *
112
112
  */
113
- void on_ziti_enroll(ziti_config *cfg, int status, char *err, void *ctx) {
113
+ void on_ziti_enroll(const ziti_config *cfg, int status, const char *err, void *ctx) {
114
114
 
115
115
  ZITI_NODEJS_LOG(DEBUG, "\nstatus: %d, \nerr: %s,\nctx: %p", status, err, ctx);
116
116
 
package/src/ziti_hello.c CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2019-2020 Netfoundry, Inc.
2
+ Copyright Netfoundry, Inc.
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
package/src/ziti_init.c CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2019-2020 Netfoundry, Inc.
2
+ Copyright Netfoundry, Inc.
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -56,7 +56,7 @@ static void CallJs(napi_env env, napi_value js_cb, void* context, void* data) {
56
56
  status = napi_get_undefined(env, &undefined);
57
57
 
58
58
  // Retrieve the rc created by the worker thread.
59
- int rc = (int)data;
59
+ int64_t rc = (int64_t)data;
60
60
  status = napi_create_int64(env, (int64_t)rc, &js_rc);
61
61
  if (status != napi_ok) {
62
62
  napi_throw_error(env, NULL, "Failed to napi_create_int64");
@@ -269,7 +269,6 @@ napi_value _ziti_init(napi_env env, const napi_callback_info info) {
269
269
 
270
270
  // Create and set up the consumer thread
271
271
  if (NULL == thread_loop) { // Spawn the loop only once
272
- ZITI_NODEJS_LOG(DEBUG, "calling uv_loop_new()");
273
272
  thread_loop = uv_loop_new();
274
273
  uv_async_init(thread_loop, &async, (uv_async_cb)consumer_notify);
275
274
  uv_thread_create(&thread, (uv_thread_cb)child_thread, thread_loop);
@@ -289,6 +288,8 @@ napi_value _ziti_init(napi_env env, const napi_callback_info info) {
289
288
 
290
289
  int rc = ziti_init_opts(opts, thread_loop);
291
290
 
291
+ ZITI_NODEJS_LOG(DEBUG, "ziti_init_opts rc: %d", rc);
292
+
292
293
  status = napi_create_int32(env, rc, &jsRetval);
293
294
  if (status != napi_ok) {
294
295
  napi_throw_error(env, NULL, "Unable to create return value");