node-opcua-transport 2.55.0 → 2.56.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 (38) hide show
  1. package/dist/source/AcknowledgeMessage.js +5 -5
  2. package/dist/source/AcknowledgeMessage.js.map +1 -1
  3. package/dist/source/TCPErrorMessage.js.map +1 -1
  4. package/dist/source/client_tcp_transport.d.ts +3 -3
  5. package/dist/source/client_tcp_transport.js +2 -2
  6. package/dist/source/client_tcp_transport.js.map +1 -1
  7. package/dist/source/server_tcp_transport.d.ts +3 -0
  8. package/dist/source/server_tcp_transport.js +2 -7
  9. package/dist/source/server_tcp_transport.js.map +1 -1
  10. package/dist/source/tools.d.ts +1 -1
  11. package/dist/source/tools.js +4 -4
  12. package/dist/source/tools.js.map +1 -1
  13. package/dist/source/utils.js +1 -1
  14. package/dist/source/utils.js.map +1 -1
  15. package/dist/test-fixtures/fixture_full_tcp_packets.js +8 -8
  16. package/dist/test-fixtures/fixture_full_tcp_packets.js.map +1 -1
  17. package/dist/test_helpers/direct_transport.d.ts +1 -1
  18. package/dist/test_helpers/direct_transport.js.map +1 -1
  19. package/dist/test_helpers/fake_server.d.ts +2 -2
  20. package/dist/test_helpers/fake_server.js +1 -1
  21. package/dist/test_helpers/fake_server.js.map +1 -1
  22. package/dist/test_helpers/half_com_channel.js +2 -4
  23. package/dist/test_helpers/half_com_channel.js.map +1 -1
  24. package/dist/test_helpers/socket_transport.js +1 -0
  25. package/dist/test_helpers/socket_transport.js.map +1 -1
  26. package/package.json +11 -9
  27. package/source/AcknowledgeMessage.ts +7 -9
  28. package/source/TCPErrorMessage.ts +58 -57
  29. package/source/client_tcp_transport.ts +366 -366
  30. package/source/message_builder_base.ts +2 -2
  31. package/source/server_tcp_transport.ts +11 -12
  32. package/source/tcp_transport.ts +455 -455
  33. package/source/tools.ts +4 -4
  34. package/source/utils.ts +1 -1
  35. package/test_helpers/direct_transport.ts +2 -2
  36. package/test_helpers/fake_server.ts +69 -71
  37. package/test_helpers/half_com_channel.ts +2 -5
  38. package/test_helpers/socket_transport.ts +33 -34
@@ -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
+ }