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.
- package/.mocharc.yml +10 -10
- package/LICENSE +20 -20
- 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/tcp_transport.js +2 -2
- 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/index.ts +11 -11
- 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/index.ts +4 -4
- 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,
|
|
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 +=
|
|
106
|
-
str +=
|
|
107
|
-
str +=
|
|
108
|
-
str +=
|
|
109
|
-
str +=
|
|
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,
|
|
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
|
+
}
|