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.
- package/dist/source/AcknowledgeMessage.js +5 -5
- package/dist/source/AcknowledgeMessage.js.map +1 -1
- package/dist/source/TCPErrorMessage.js.map +1 -1
- package/dist/source/client_tcp_transport.d.ts +3 -3
- package/dist/source/client_tcp_transport.js +2 -2
- package/dist/source/client_tcp_transport.js.map +1 -1
- package/dist/source/server_tcp_transport.d.ts +3 -0
- package/dist/source/server_tcp_transport.js +2 -7
- package/dist/source/server_tcp_transport.js.map +1 -1
- package/dist/source/tools.d.ts +1 -1
- package/dist/source/tools.js +4 -4
- package/dist/source/tools.js.map +1 -1
- package/dist/source/utils.js +1 -1
- package/dist/source/utils.js.map +1 -1
- package/dist/test-fixtures/fixture_full_tcp_packets.js +8 -8
- package/dist/test-fixtures/fixture_full_tcp_packets.js.map +1 -1
- package/dist/test_helpers/direct_transport.d.ts +1 -1
- package/dist/test_helpers/direct_transport.js.map +1 -1
- package/dist/test_helpers/fake_server.d.ts +2 -2
- package/dist/test_helpers/fake_server.js +1 -1
- package/dist/test_helpers/fake_server.js.map +1 -1
- package/dist/test_helpers/half_com_channel.js +2 -4
- package/dist/test_helpers/half_com_channel.js.map +1 -1
- package/dist/test_helpers/socket_transport.js +1 -0
- package/dist/test_helpers/socket_transport.js.map +1 -1
- package/package.json +11 -9
- package/source/AcknowledgeMessage.ts +7 -9
- package/source/TCPErrorMessage.ts +58 -57
- package/source/client_tcp_transport.ts +366 -366
- package/source/message_builder_base.ts +2 -2
- package/source/server_tcp_transport.ts +11 -12
- package/source/tcp_transport.ts +455 -455
- package/source/tools.ts +4 -4
- package/source/utils.ts +1 -1
- package/test_helpers/direct_transport.ts +2 -2
- package/test_helpers/fake_server.ts +69 -71
- package/test_helpers/half_com_channel.ts +2 -5
- 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,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
{name: "
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
public
|
|
30
|
-
public
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
this.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
this.
|
|
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
|
+
}
|