node-opcua-transport 2.55.0 → 2.59.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.
Files changed (43) hide show
  1. package/.mocharc.yml +10 -10
  2. package/LICENSE +20 -20
  3. package/dist/source/AcknowledgeMessage.js +5 -5
  4. package/dist/source/AcknowledgeMessage.js.map +1 -1
  5. package/dist/source/TCPErrorMessage.js.map +1 -1
  6. package/dist/source/client_tcp_transport.d.ts +3 -3
  7. package/dist/source/client_tcp_transport.js +2 -2
  8. package/dist/source/client_tcp_transport.js.map +1 -1
  9. package/dist/source/server_tcp_transport.d.ts +3 -0
  10. package/dist/source/server_tcp_transport.js +2 -7
  11. package/dist/source/server_tcp_transport.js.map +1 -1
  12. package/dist/source/tcp_transport.js +2 -2
  13. package/dist/source/tools.d.ts +1 -1
  14. package/dist/source/tools.js +4 -4
  15. package/dist/source/tools.js.map +1 -1
  16. package/dist/source/utils.js +1 -1
  17. package/dist/source/utils.js.map +1 -1
  18. package/dist/test-fixtures/fixture_full_tcp_packets.js +8 -8
  19. package/dist/test-fixtures/fixture_full_tcp_packets.js.map +1 -1
  20. package/dist/test_helpers/direct_transport.d.ts +1 -1
  21. package/dist/test_helpers/direct_transport.js.map +1 -1
  22. package/dist/test_helpers/fake_server.d.ts +2 -2
  23. package/dist/test_helpers/fake_server.js +1 -1
  24. package/dist/test_helpers/fake_server.js.map +1 -1
  25. package/dist/test_helpers/half_com_channel.js +2 -4
  26. package/dist/test_helpers/half_com_channel.js.map +1 -1
  27. package/dist/test_helpers/socket_transport.js +1 -0
  28. package/dist/test_helpers/socket_transport.js.map +1 -1
  29. package/package.json +11 -9
  30. package/source/AcknowledgeMessage.ts +7 -9
  31. package/source/TCPErrorMessage.ts +58 -57
  32. package/source/client_tcp_transport.ts +366 -366
  33. package/source/index.ts +11 -11
  34. package/source/message_builder_base.ts +2 -2
  35. package/source/server_tcp_transport.ts +11 -12
  36. package/source/tcp_transport.ts +455 -455
  37. package/source/tools.ts +4 -4
  38. package/source/utils.ts +1 -1
  39. package/test_helpers/direct_transport.ts +2 -2
  40. package/test_helpers/fake_server.ts +69 -71
  41. package/test_helpers/half_com_channel.ts +2 -5
  42. package/test_helpers/index.ts +4 -4
  43. package/test_helpers/socket_transport.ts +33 -34
@@ -5,7 +5,8 @@ import { decodeUInt32, encodeUInt32, UInt32 } from "node-opcua-basic-types";
5
5
  import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
6
6
  import {
7
7
  BaseUAObject,
8
- buildStructuredType, check_options_correctness_against_schema,
8
+ buildStructuredType,
9
+ check_options_correctness_against_schema,
9
10
  initialize_field,
10
11
  parameters,
11
12
  StructuredTypeSchema
@@ -46,7 +47,6 @@ interface AcknowledgeMessageOptions {
46
47
  }
47
48
 
48
49
  export class AcknowledgeMessage extends BaseUAObject {
49
-
50
50
  public static possibleFields: string[] = [
51
51
  "protocolVersion",
52
52
  "receiveBufferSize",
@@ -63,7 +63,6 @@ export class AcknowledgeMessage extends BaseUAObject {
63
63
  public maxChunkCount: UInt32;
64
64
 
65
65
  constructor(options?: AcknowledgeMessageOptions) {
66
-
67
66
  options = options || {};
68
67
 
69
68
  super();
@@ -81,7 +80,6 @@ export class AcknowledgeMessage extends BaseUAObject {
81
80
  }
82
81
 
83
82
  public encode(stream: OutputBinaryStream): void {
84
-
85
83
  super.encode(stream);
86
84
  encodeUInt32(this.protocolVersion, stream);
87
85
  encodeUInt32(this.receiveBufferSize, stream);
@@ -102,11 +100,11 @@ export class AcknowledgeMessage extends BaseUAObject {
102
100
 
103
101
  public toString(): string {
104
102
  let str = "";
105
- str += 'protocolVersion = ' + this.protocolVersion +'\n';
106
- str += 'receiveBufferSize = ' + this.receiveBufferSize +'\n';
107
- str += 'sendBufferSize = ' + this.sendBufferSize +'\n';
108
- str += 'maxMessageSize = ' + this.maxMessageSize +'\n';
109
- str += 'maxChunkCount = ' + this.maxChunkCount +'\n';
103
+ str += "protocolVersion = " + this.protocolVersion + "\n";
104
+ str += "receiveBufferSize = " + this.receiveBufferSize + "\n";
105
+ str += "sendBufferSize = " + this.sendBufferSize + "\n";
106
+ str += "maxMessageSize = " + this.maxMessageSize + "\n";
107
+ str += "maxChunkCount = " + this.maxChunkCount + "\n";
110
108
  return str;
111
109
  }
112
110
  }
@@ -1,57 +1,58 @@
1
- /**
2
- * @module node-opcua-transport
3
- */
4
- import { decodeString, encodeString, UAString } from "node-opcua-basic-types";
5
- import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
6
- import {
7
- BaseUAObject,
8
- buildStructuredType, check_options_correctness_against_schema,
9
- initialize_field,
10
- parameters
11
- } from "node-opcua-factory";
12
- import { decodeStatusCode, encodeStatusCode, StatusCode } from "node-opcua-status-code";
13
-
14
- // TCP Error Message OPC Unified Architecture, Part 6 page 46
15
- // the server always close the connection after sending the TCPError message
16
- const schemaTCPErrorMessage = buildStructuredType({
17
- name: "TCPErrorMessage",
18
-
19
- baseType: "BaseUAObject",
20
-
21
- fields: [
22
- {name: "statusCode", fieldType: "StatusCode"},
23
- {name: "reason", fieldType: "String"} // A more verbose description of the error.
24
- ]
25
- });
26
-
27
- export class TCPErrorMessage extends BaseUAObject {
28
- public static possibleFields: string[] = ["statusCode", "reason"];
29
- public statusCode: StatusCode;
30
- public reason: UAString;
31
- constructor(options?: { statusCode?: StatusCode, reason?: string}) {
32
- options = options || {};
33
- const schema = schemaTCPErrorMessage;
34
-
35
- super();
36
- /* istanbul ignore next */
37
- if (parameters.debugSchemaHelper) {
38
- check_options_correctness_against_schema(this, schema, options);
39
- }
40
- this.statusCode = initialize_field(schema.fields[0], options.statusCode);
41
- this.reason = initialize_field(schema.fields[1], options.reason);
42
- }
43
-
44
- public encode(stream: OutputBinaryStream): void {
45
- // call base class implementation first
46
- super.encode(stream);
47
- encodeStatusCode(this.statusCode, stream);
48
- encodeString(this.reason, stream);
49
- }
50
-
51
- public decode(stream: BinaryStream): void {
52
- // call base class implementation first
53
- super.decode(stream);
54
- this.statusCode = decodeStatusCode(stream);
55
- this.reason = decodeString(stream);
56
- }
57
- }
1
+ /**
2
+ * @module node-opcua-transport
3
+ */
4
+ import { decodeString, encodeString, UAString } from "node-opcua-basic-types";
5
+ import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
6
+ import {
7
+ BaseUAObject,
8
+ buildStructuredType,
9
+ check_options_correctness_against_schema,
10
+ initialize_field,
11
+ parameters
12
+ } from "node-opcua-factory";
13
+ import { decodeStatusCode, encodeStatusCode, StatusCode } from "node-opcua-status-code";
14
+
15
+ // TCP Error Message OPC Unified Architecture, Part 6 page 46
16
+ // the server always close the connection after sending the TCPError message
17
+ const schemaTCPErrorMessage = buildStructuredType({
18
+ name: "TCPErrorMessage",
19
+
20
+ baseType: "BaseUAObject",
21
+
22
+ fields: [
23
+ { name: "statusCode", fieldType: "StatusCode" },
24
+ { name: "reason", fieldType: "String" } // A more verbose description of the error.
25
+ ]
26
+ });
27
+
28
+ export class TCPErrorMessage extends BaseUAObject {
29
+ public static possibleFields: string[] = ["statusCode", "reason"];
30
+ public statusCode: StatusCode;
31
+ public reason: UAString;
32
+ constructor(options?: { statusCode?: StatusCode; reason?: string }) {
33
+ options = options || {};
34
+ const schema = schemaTCPErrorMessage;
35
+
36
+ super();
37
+ /* istanbul ignore next */
38
+ if (parameters.debugSchemaHelper) {
39
+ check_options_correctness_against_schema(this, schema, options);
40
+ }
41
+ this.statusCode = initialize_field(schema.fields[0], options.statusCode);
42
+ this.reason = initialize_field(schema.fields[1], options.reason);
43
+ }
44
+
45
+ public encode(stream: OutputBinaryStream): void {
46
+ // call base class implementation first
47
+ super.encode(stream);
48
+ encodeStatusCode(this.statusCode, stream);
49
+ encodeString(this.reason, stream);
50
+ }
51
+
52
+ public decode(stream: BinaryStream): void {
53
+ // call base class implementation first
54
+ super.decode(stream);
55
+ this.statusCode = decodeStatusCode(stream);
56
+ this.reason = decodeString(stream);
57
+ }
58
+ }