node-opcua-transport 2.98.0 → 2.99.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.d.ts +27 -0
- package/dist/source/AcknowledgeMessage.js +79 -0
- package/dist/source/AcknowledgeMessage.js.map +1 -0
- package/dist/source/HelloMessage.d.ts +27 -0
- package/dist/source/HelloMessage.js +95 -0
- package/dist/source/HelloMessage.js.map +1 -0
- package/dist/source/TCPErrorMessage.d.ts +18 -0
- package/dist/source/TCPErrorMessage.js +47 -0
- package/dist/source/TCPErrorMessage.js.map +1 -0
- package/dist/source/client_tcp_transport.d.ts +87 -0
- package/dist/source/client_tcp_transport.js +335 -0
- package/dist/source/client_tcp_transport.js.map +1 -0
- package/dist/source/index.d.ts +13 -0
- package/dist/source/index.js +30 -0
- package/dist/source/index.js.map +1 -0
- package/dist/source/message_builder_base.d.ts +112 -0
- package/dist/source/message_builder_base.js +245 -0
- package/dist/source/message_builder_base.js.map +1 -0
- package/dist/source/server_tcp_transport.d.ts +44 -0
- package/dist/source/server_tcp_transport.js +233 -0
- package/dist/source/server_tcp_transport.js.map +1 -0
- package/dist/source/status_codes.d.ts +100 -0
- package/dist/source/status_codes.js +111 -0
- package/dist/source/status_codes.js.map +1 -0
- package/dist/source/tcp_transport.d.ts +136 -0
- package/dist/source/tcp_transport.js +380 -0
- package/dist/source/tcp_transport.js.map +1 -0
- package/dist/source/tools.d.ts +14 -0
- package/dist/source/tools.js +104 -0
- package/dist/source/tools.js.map +1 -0
- package/dist/source/utils.d.ts +3 -0
- package/dist/source/utils.js +10 -0
- package/dist/source/utils.js.map +1 -0
- package/dist/test-fixtures/fixture_full_tcp_packets.d.ts +21 -0
- package/dist/test-fixtures/fixture_full_tcp_packets.js +413 -0
- package/dist/test-fixtures/fixture_full_tcp_packets.js.map +1 -0
- package/dist/test-fixtures/index.d.ts +1 -0
- package/dist/test-fixtures/index.js +18 -0
- package/dist/test-fixtures/index.js.map +1 -0
- package/dist/test_helpers/direct_transport.d.ts +18 -0
- package/{test_helpers/direct_transport.ts → dist/test_helpers/direct_transport.js} +21 -34
- package/dist/test_helpers/direct_transport.js.map +1 -0
- package/dist/test_helpers/fake_server.d.ts +19 -0
- package/{test_helpers/fake_server.ts → dist/test_helpers/fake_server.js} +20 -32
- package/dist/test_helpers/fake_server.js.map +1 -0
- package/dist/test_helpers/half_com_channel.d.ts +17 -0
- package/dist/test_helpers/half_com_channel.js +32 -0
- package/dist/test_helpers/half_com_channel.js.map +1 -0
- package/dist/test_helpers/index.js +21 -0
- package/dist/test_helpers/index.js.map +1 -0
- package/dist/test_helpers/socket_transport.d.ts +10 -0
- package/dist/test_helpers/socket_transport.js +31 -0
- package/dist/test_helpers/socket_transport.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +18 -14
- package/test_helpers/half_com_channel.ts +0 -41
- package/test_helpers/socket_transport.ts +0 -33
- /package/{test_helpers/index.ts → dist/test_helpers/index.d.ts} +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module node-opcua-transport
|
|
3
|
+
*/
|
|
4
|
+
import { UInt32 } from "node-opcua-basic-types";
|
|
5
|
+
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
|
|
6
|
+
import { BaseUAObject, IStructuredTypeSchema } from "node-opcua-factory";
|
|
7
|
+
interface AcknowledgeMessageOptions {
|
|
8
|
+
protocolVersion?: UInt32;
|
|
9
|
+
receiveBufferSize?: UInt32;
|
|
10
|
+
sendBufferSize?: UInt32;
|
|
11
|
+
maxMessageSize?: UInt32;
|
|
12
|
+
maxChunkCount?: UInt32;
|
|
13
|
+
}
|
|
14
|
+
export declare class AcknowledgeMessage extends BaseUAObject {
|
|
15
|
+
static possibleFields: string[];
|
|
16
|
+
static schema: IStructuredTypeSchema;
|
|
17
|
+
protocolVersion: UInt32;
|
|
18
|
+
receiveBufferSize: UInt32;
|
|
19
|
+
sendBufferSize: UInt32;
|
|
20
|
+
maxMessageSize: UInt32;
|
|
21
|
+
maxChunkCount: UInt32;
|
|
22
|
+
constructor(options?: AcknowledgeMessageOptions);
|
|
23
|
+
encode(stream: OutputBinaryStream): void;
|
|
24
|
+
decode(stream: BinaryStream): void;
|
|
25
|
+
toString(): string;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AcknowledgeMessage = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @module node-opcua-transport
|
|
6
|
+
*/
|
|
7
|
+
const node_opcua_basic_types_1 = require("node-opcua-basic-types");
|
|
8
|
+
const node_opcua_factory_1 = require("node-opcua-factory");
|
|
9
|
+
const schemaAcknowledgeMessage = (0, node_opcua_factory_1.buildStructuredType)({
|
|
10
|
+
name: "AcknowledgeMessage",
|
|
11
|
+
baseType: "BaseObjectType",
|
|
12
|
+
fields: [
|
|
13
|
+
{
|
|
14
|
+
name: "protocolVersion",
|
|
15
|
+
fieldType: "UInt32",
|
|
16
|
+
documentation: "The latest version of the OPC UA TCP protocol supported by the Server."
|
|
17
|
+
},
|
|
18
|
+
{ name: "receiveBufferSize", fieldType: "UInt32" },
|
|
19
|
+
{ name: "sendBufferSize", fieldType: "UInt32" },
|
|
20
|
+
{ name: "maxMessageSize", fieldType: "UInt32", documentation: "The maximum size for any request message." },
|
|
21
|
+
{
|
|
22
|
+
name: "maxChunkCount",
|
|
23
|
+
fieldType: "UInt32",
|
|
24
|
+
documentation: "The maximum number of chunks in any request message."
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
class AcknowledgeMessage extends node_opcua_factory_1.BaseUAObject {
|
|
29
|
+
constructor(options) {
|
|
30
|
+
options = options || {};
|
|
31
|
+
super();
|
|
32
|
+
const schema = schemaAcknowledgeMessage;
|
|
33
|
+
/* istanbul ignore next */
|
|
34
|
+
if (node_opcua_factory_1.parameters.debugSchemaHelper) {
|
|
35
|
+
(0, node_opcua_factory_1.check_options_correctness_against_schema)(this, schema, options);
|
|
36
|
+
}
|
|
37
|
+
this.protocolVersion = (0, node_opcua_factory_1.initialize_field)(schema.fields[0], options.protocolVersion);
|
|
38
|
+
this.receiveBufferSize = (0, node_opcua_factory_1.initialize_field)(schema.fields[1], options.receiveBufferSize);
|
|
39
|
+
this.sendBufferSize = (0, node_opcua_factory_1.initialize_field)(schema.fields[2], options.sendBufferSize);
|
|
40
|
+
this.maxMessageSize = (0, node_opcua_factory_1.initialize_field)(schema.fields[3], options.maxMessageSize);
|
|
41
|
+
this.maxChunkCount = (0, node_opcua_factory_1.initialize_field)(schema.fields[4], options.maxChunkCount);
|
|
42
|
+
}
|
|
43
|
+
encode(stream) {
|
|
44
|
+
super.encode(stream);
|
|
45
|
+
(0, node_opcua_basic_types_1.encodeUInt32)(this.protocolVersion, stream);
|
|
46
|
+
(0, node_opcua_basic_types_1.encodeUInt32)(this.receiveBufferSize, stream);
|
|
47
|
+
(0, node_opcua_basic_types_1.encodeUInt32)(this.sendBufferSize, stream);
|
|
48
|
+
(0, node_opcua_basic_types_1.encodeUInt32)(this.maxMessageSize, stream);
|
|
49
|
+
(0, node_opcua_basic_types_1.encodeUInt32)(this.maxChunkCount, stream);
|
|
50
|
+
}
|
|
51
|
+
decode(stream) {
|
|
52
|
+
// call base class implementation first
|
|
53
|
+
super.decode(stream);
|
|
54
|
+
this.protocolVersion = (0, node_opcua_basic_types_1.decodeUInt32)(stream);
|
|
55
|
+
this.receiveBufferSize = (0, node_opcua_basic_types_1.decodeUInt32)(stream);
|
|
56
|
+
this.sendBufferSize = (0, node_opcua_basic_types_1.decodeUInt32)(stream);
|
|
57
|
+
this.maxMessageSize = (0, node_opcua_basic_types_1.decodeUInt32)(stream);
|
|
58
|
+
this.maxChunkCount = (0, node_opcua_basic_types_1.decodeUInt32)(stream);
|
|
59
|
+
}
|
|
60
|
+
toString() {
|
|
61
|
+
let str = "";
|
|
62
|
+
str += "protocolVersion = " + this.protocolVersion + "\n";
|
|
63
|
+
str += "receiveBufferSize = " + this.receiveBufferSize + "\n";
|
|
64
|
+
str += "sendBufferSize = " + this.sendBufferSize + "\n";
|
|
65
|
+
str += "maxMessageSize = " + this.maxMessageSize + "\n";
|
|
66
|
+
str += "maxChunkCount = " + this.maxChunkCount + "\n";
|
|
67
|
+
return str;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
AcknowledgeMessage.possibleFields = [
|
|
71
|
+
"protocolVersion",
|
|
72
|
+
"receiveBufferSize",
|
|
73
|
+
"sendBufferSize",
|
|
74
|
+
"maxMessageSize",
|
|
75
|
+
"maxChunkCount"
|
|
76
|
+
];
|
|
77
|
+
AcknowledgeMessage.schema = schemaAcknowledgeMessage;
|
|
78
|
+
exports.AcknowledgeMessage = AcknowledgeMessage;
|
|
79
|
+
//# sourceMappingURL=AcknowledgeMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcknowledgeMessage.js","sourceRoot":"","sources":["../../source/AcknowledgeMessage.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,mEAA4E;AAE5E,2DAO4B;AAE5B,MAAM,wBAAwB,GAAG,IAAA,wCAAmB,EAAC;IACjD,IAAI,EAAE,oBAAoB;IAE1B,QAAQ,EAAE,gBAAgB;IAE1B,MAAM,EAAE;QACJ;YACI,IAAI,EAAE,iBAAiB;YAEvB,SAAS,EAAE,QAAQ;YAEnB,aAAa,EAAE,wEAAwE;SAC1F;QACD,EAAE,IAAI,EAAE,mBAAmB,EAAE,SAAS,EAAE,QAAQ,EAAE;QAClD,EAAE,IAAI,EAAE,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE;QAC/C,EAAE,IAAI,EAAE,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,2CAA2C,EAAE;QAC3G;YACI,IAAI,EAAE,eAAe;YAEr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|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module node-opcua-transport
|
|
3
|
+
*/
|
|
4
|
+
import { UAString, UInt32 } from "node-opcua-basic-types";
|
|
5
|
+
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
|
|
6
|
+
import { BaseUAObject } from "node-opcua-factory";
|
|
7
|
+
export interface HelloMessageOptions {
|
|
8
|
+
protocolVersion?: UInt32;
|
|
9
|
+
receiveBufferSize?: UInt32;
|
|
10
|
+
sendBufferSize?: UInt32;
|
|
11
|
+
maxMessageSize?: UInt32;
|
|
12
|
+
maxChunkCount?: UInt32;
|
|
13
|
+
endpointUrl?: UAString;
|
|
14
|
+
}
|
|
15
|
+
export declare class HelloMessage extends BaseUAObject {
|
|
16
|
+
static possibleFields: string[];
|
|
17
|
+
protocolVersion: UInt32;
|
|
18
|
+
receiveBufferSize: UInt32;
|
|
19
|
+
sendBufferSize: UInt32;
|
|
20
|
+
maxMessageSize: UInt32;
|
|
21
|
+
maxChunkCount: UInt32;
|
|
22
|
+
endpointUrl: UAString;
|
|
23
|
+
constructor(options?: HelloMessageOptions);
|
|
24
|
+
encode(stream: OutputBinaryStream): void;
|
|
25
|
+
decode(stream: BinaryStream): void;
|
|
26
|
+
toString(): string;
|
|
27
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HelloMessage = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @module node-opcua-transport
|
|
6
|
+
*/
|
|
7
|
+
const node_opcua_basic_types_1 = require("node-opcua-basic-types");
|
|
8
|
+
const node_opcua_factory_1 = require("node-opcua-factory");
|
|
9
|
+
const schemaHelloMessage = (0, node_opcua_factory_1.buildStructuredType)({
|
|
10
|
+
name: "HelloMessage",
|
|
11
|
+
baseType: "BaseUAObject",
|
|
12
|
+
fields: [
|
|
13
|
+
{
|
|
14
|
+
name: "protocolVersion",
|
|
15
|
+
fieldType: "UInt32",
|
|
16
|
+
documentation: "The latest version of the OPC UA TCP protocol supported by the Client"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: "receiveBufferSize",
|
|
20
|
+
fieldType: "UInt32",
|
|
21
|
+
documentation: "The largest message that the sender can receive."
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "sendBufferSize",
|
|
25
|
+
fieldType: "UInt32",
|
|
26
|
+
documentation: "The largest message that the sender will send."
|
|
27
|
+
},
|
|
28
|
+
{ name: "maxMessageSize", fieldType: "UInt32", documentation: "The maximum size for any response message." },
|
|
29
|
+
{
|
|
30
|
+
name: "maxChunkCount",
|
|
31
|
+
fieldType: "UInt32",
|
|
32
|
+
documentation: "The maximum number of chunks in any response message"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "endpointUrl",
|
|
36
|
+
fieldType: "String",
|
|
37
|
+
documentation: "The URL of the Endpoint which the Client wished to connect to."
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
class HelloMessage extends node_opcua_factory_1.BaseUAObject {
|
|
42
|
+
constructor(options) {
|
|
43
|
+
options = options || {};
|
|
44
|
+
super();
|
|
45
|
+
const schema = schemaHelloMessage;
|
|
46
|
+
/* istanbul ignore next */
|
|
47
|
+
if (node_opcua_factory_1.parameters.debugSchemaHelper) {
|
|
48
|
+
(0, node_opcua_factory_1.check_options_correctness_against_schema)(this, schema, options);
|
|
49
|
+
}
|
|
50
|
+
this.protocolVersion = (0, node_opcua_factory_1.initialize_field)(schema.fields[0], options.protocolVersion);
|
|
51
|
+
this.receiveBufferSize = (0, node_opcua_factory_1.initialize_field)(schema.fields[1], options.receiveBufferSize);
|
|
52
|
+
this.sendBufferSize = (0, node_opcua_factory_1.initialize_field)(schema.fields[2], options.sendBufferSize);
|
|
53
|
+
this.maxMessageSize = (0, node_opcua_factory_1.initialize_field)(schema.fields[3], options.maxMessageSize);
|
|
54
|
+
this.maxChunkCount = (0, node_opcua_factory_1.initialize_field)(schema.fields[4], options.maxChunkCount);
|
|
55
|
+
this.endpointUrl = (0, node_opcua_factory_1.initialize_field)(schema.fields[5], options.endpointUrl);
|
|
56
|
+
}
|
|
57
|
+
encode(stream) {
|
|
58
|
+
super.encode(stream);
|
|
59
|
+
(0, node_opcua_basic_types_1.encodeUInt32)(this.protocolVersion, stream);
|
|
60
|
+
(0, node_opcua_basic_types_1.encodeUInt32)(this.receiveBufferSize, stream);
|
|
61
|
+
(0, node_opcua_basic_types_1.encodeUInt32)(this.sendBufferSize, stream);
|
|
62
|
+
(0, node_opcua_basic_types_1.encodeUInt32)(this.maxMessageSize, stream);
|
|
63
|
+
(0, node_opcua_basic_types_1.encodeUInt32)(this.maxChunkCount, stream);
|
|
64
|
+
(0, node_opcua_basic_types_1.encodeUAString)(this.endpointUrl, stream);
|
|
65
|
+
}
|
|
66
|
+
decode(stream) {
|
|
67
|
+
super.decode(stream);
|
|
68
|
+
this.protocolVersion = (0, node_opcua_basic_types_1.decodeUInt32)(stream);
|
|
69
|
+
this.receiveBufferSize = (0, node_opcua_basic_types_1.decodeUInt32)(stream);
|
|
70
|
+
this.sendBufferSize = (0, node_opcua_basic_types_1.decodeUInt32)(stream);
|
|
71
|
+
this.maxMessageSize = (0, node_opcua_basic_types_1.decodeUInt32)(stream);
|
|
72
|
+
this.maxChunkCount = (0, node_opcua_basic_types_1.decodeUInt32)(stream);
|
|
73
|
+
this.endpointUrl = (0, node_opcua_basic_types_1.decodeUAString)(stream);
|
|
74
|
+
}
|
|
75
|
+
toString() {
|
|
76
|
+
let str = "";
|
|
77
|
+
str += "protocolVersion = " + this.protocolVersion + "\n";
|
|
78
|
+
str += "receiveBufferSize = " + this.receiveBufferSize + "\n";
|
|
79
|
+
str += "sendBufferSize = " + this.sendBufferSize + "\n";
|
|
80
|
+
str += "maxMessageSize = " + this.maxMessageSize + "\n";
|
|
81
|
+
str += "maxChunkCount = " + this.maxChunkCount + "\n";
|
|
82
|
+
str += "endpointUrl = " + this.endpointUrl + "\n";
|
|
83
|
+
return str;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
HelloMessage.possibleFields = [
|
|
87
|
+
"protocolVersion",
|
|
88
|
+
"receiveBufferSize",
|
|
89
|
+
"sendBufferSize",
|
|
90
|
+
"maxMessageSize",
|
|
91
|
+
"maxChunkCount",
|
|
92
|
+
"endpointUrl"
|
|
93
|
+
];
|
|
94
|
+
exports.HelloMessage = HelloMessage;
|
|
95
|
+
//# sourceMappingURL=HelloMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HelloMessage.js","sourceRoot":"","sources":["../../source/HelloMessage.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,mEAAsH;AAEtH,2DAM4B;AAE5B,MAAM,kBAAkB,GAAG,IAAA,wCAAmB,EAAC;IAC3C,IAAI,EAAE,cAAc;IAEpB,QAAQ,EAAE,cAAc;IAExB,MAAM,EAAE;QACJ;YACI,IAAI,EAAE,iBAAiB;YAEvB,SAAS,EAAE,QAAQ;YAEnB,aAAa,EAAE,uEAAuE;SACzF;QACD;YACI,IAAI,EAAE,mBAAmB;YAEzB,SAAS,EAAE,QAAQ;YAEnB,aAAa,EAAE,kDAAkD;SACpE;QACD;YACI,IAAI,EAAE,gBAAgB;YAEtB,SAAS,EAAE,QAAQ;YAEnB,aAAa,EAAE,gDAAgD;SAClE;QACD,EAAE,IAAI,EAAE,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,4CAA4C,EAAE;QAC5G;YACI,IAAI,EAAE,eAAe;YAErB,SAAS,EAAE,QAAQ;YAEnB,aAAa,EAAE,sDAAsD;SACxE;QACD;YACI,IAAI,EAAE,aAAa;YAEnB,SAAS,EAAE,QAAQ;YAEnB,aAAa,EAAE,gEAAgE;SAClF;KACJ;CACJ,CAAC,CAAC;AAWH,MAAa,YAAa,SAAQ,iCAAY;IAgB1C,YAAY,OAA6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AO,GAAG,CAAC;IACf,CAAC;;AA5Da,2BAAc,GAAa;IACrC,iBAAiB;IACjB,mBAAmB;IACnB,gBAAgB;IAChB,gBAAgB;IAChB,eAAe;IACf,aAAa;CAChB,CAAC;AARO,oCAAY"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module node-opcua-transport
|
|
3
|
+
*/
|
|
4
|
+
import { UAString } from "node-opcua-basic-types";
|
|
5
|
+
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
|
|
6
|
+
import { BaseUAObject } from "node-opcua-factory";
|
|
7
|
+
import { StatusCode } from "node-opcua-status-code";
|
|
8
|
+
export declare class TCPErrorMessage extends BaseUAObject {
|
|
9
|
+
static possibleFields: string[];
|
|
10
|
+
statusCode: StatusCode;
|
|
11
|
+
reason: UAString;
|
|
12
|
+
constructor(options?: {
|
|
13
|
+
statusCode?: StatusCode;
|
|
14
|
+
reason?: string;
|
|
15
|
+
});
|
|
16
|
+
encode(stream: OutputBinaryStream): void;
|
|
17
|
+
decode(stream: BinaryStream): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TCPErrorMessage = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @module node-opcua-transport
|
|
6
|
+
*/
|
|
7
|
+
const node_opcua_basic_types_1 = require("node-opcua-basic-types");
|
|
8
|
+
const node_opcua_factory_1 = require("node-opcua-factory");
|
|
9
|
+
const node_opcua_status_code_1 = require("node-opcua-status-code");
|
|
10
|
+
// TCP Error Message OPC Unified Architecture, Part 6 page 46
|
|
11
|
+
// the server always close the connection after sending the TCPError message
|
|
12
|
+
const schemaTCPErrorMessage = (0, node_opcua_factory_1.buildStructuredType)({
|
|
13
|
+
name: "TCPErrorMessage",
|
|
14
|
+
baseType: "BaseUAObject",
|
|
15
|
+
fields: [
|
|
16
|
+
{ name: "statusCode", fieldType: "StatusCode" },
|
|
17
|
+
{ name: "reason", fieldType: "String" } // A more verbose description of the error.
|
|
18
|
+
]
|
|
19
|
+
});
|
|
20
|
+
class TCPErrorMessage extends node_opcua_factory_1.BaseUAObject {
|
|
21
|
+
constructor(options) {
|
|
22
|
+
options = options || {};
|
|
23
|
+
const schema = schemaTCPErrorMessage;
|
|
24
|
+
super();
|
|
25
|
+
/* istanbul ignore next */
|
|
26
|
+
if (node_opcua_factory_1.parameters.debugSchemaHelper) {
|
|
27
|
+
(0, node_opcua_factory_1.check_options_correctness_against_schema)(this, schema, options);
|
|
28
|
+
}
|
|
29
|
+
this.statusCode = (0, node_opcua_factory_1.initialize_field)(schema.fields[0], options.statusCode);
|
|
30
|
+
this.reason = (0, node_opcua_factory_1.initialize_field)(schema.fields[1], options.reason);
|
|
31
|
+
}
|
|
32
|
+
encode(stream) {
|
|
33
|
+
// call base class implementation first
|
|
34
|
+
super.encode(stream);
|
|
35
|
+
(0, node_opcua_status_code_1.encodeStatusCode)(this.statusCode, stream);
|
|
36
|
+
(0, node_opcua_basic_types_1.encodeString)(this.reason, stream);
|
|
37
|
+
}
|
|
38
|
+
decode(stream) {
|
|
39
|
+
// call base class implementation first
|
|
40
|
+
super.decode(stream);
|
|
41
|
+
this.statusCode = (0, node_opcua_status_code_1.decodeStatusCode)(stream);
|
|
42
|
+
this.reason = (0, node_opcua_basic_types_1.decodeString)(stream);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
TCPErrorMessage.possibleFields = ["statusCode", "reason"];
|
|
46
|
+
exports.TCPErrorMessage = TCPErrorMessage;
|
|
47
|
+
//# sourceMappingURL=TCPErrorMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TCPErrorMessage.js","sourceRoot":"","sources":["../../source/TCPErrorMessage.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,mEAA8E;AAE9E,2DAM4B;AAC5B,mEAAwF;AAExF,8DAA8D;AAC9D,4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AC3C,IAAI,CAAC,MAAM,GAAG,IAAA,qCAAY,EAAC,MAAM,CAAC,CAAC;IACvC,CAAC;;AA5Ba,8BAAc,GAAa,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;AADzD,0CAAe"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ErrorCallback } from "node-opcua-status-code";
|
|
3
|
+
import { TCP_transport } from "./tcp_transport";
|
|
4
|
+
import { AcknowledgeMessage } from "./AcknowledgeMessage";
|
|
5
|
+
export interface ClientTCP_transport {
|
|
6
|
+
on(eventName: "chunk", eventHandler: (messageChunk: Buffer) => void): this;
|
|
7
|
+
on(eventName: "socket_closed", eventHandler: (err: Error | null) => void): this;
|
|
8
|
+
on(eventName: "close", eventHandler: (err: Error | null) => void): this;
|
|
9
|
+
on(eventName: "connection_break", eventHandler: () => void): this;
|
|
10
|
+
on(eventName: "connect", eventHandler: () => void): this;
|
|
11
|
+
once(eventName: "chunk", eventHandler: (messageChunk: Buffer) => void): this;
|
|
12
|
+
once(eventName: "socket_closed", eventHandler: (err: Error | null) => void): this;
|
|
13
|
+
once(eventName: "close", eventHandler: (err: Error | null) => void): this;
|
|
14
|
+
once(eventName: "connection_break", eventHandler: () => void): this;
|
|
15
|
+
once(eventName: "connect", eventHandler: () => void): this;
|
|
16
|
+
emit(eventName: "chunk", messageChunk: Buffer): boolean;
|
|
17
|
+
emit(eventName: "socket_closed", err?: Error | null): boolean;
|
|
18
|
+
emit(eventName: "close", err?: Error | null): boolean;
|
|
19
|
+
emit(eventName: "connection_break"): boolean;
|
|
20
|
+
emit(eventName: "connect"): boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface TransportSettingsOptions {
|
|
23
|
+
maxChunkCount?: number;
|
|
24
|
+
maxMessageSize?: number;
|
|
25
|
+
receiveBufferSize?: number;
|
|
26
|
+
sendBufferSize?: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* a ClientTCP_transport connects to a remote server socket and
|
|
30
|
+
* initiates a communication with a HEL/ACK transaction.
|
|
31
|
+
* It negotiates the communication parameters with the other end.
|
|
32
|
+
*
|
|
33
|
+
* @class ClientTCP_transport
|
|
34
|
+
* @extends TCP_transport
|
|
35
|
+
* @constructor
|
|
36
|
+
* @example
|
|
37
|
+
*
|
|
38
|
+
* ```javascript
|
|
39
|
+
* const transport = ClientTCP_transport(url);
|
|
40
|
+
*
|
|
41
|
+
* transport.timeout = 10000;
|
|
42
|
+
*
|
|
43
|
+
* transport.connect(function(err)) {
|
|
44
|
+
* if (err) {
|
|
45
|
+
* // cannot connect
|
|
46
|
+
* } else {
|
|
47
|
+
* // connected
|
|
48
|
+
*
|
|
49
|
+
* }
|
|
50
|
+
* });
|
|
51
|
+
* ....
|
|
52
|
+
*
|
|
53
|
+
* transport.write(message_chunk,'F');
|
|
54
|
+
*
|
|
55
|
+
* ....
|
|
56
|
+
*
|
|
57
|
+
* transport.on("chunk",function(message_chunk) {
|
|
58
|
+
* // do something with chunk from server...
|
|
59
|
+
* });
|
|
60
|
+
*
|
|
61
|
+
*
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
*
|
|
65
|
+
*/
|
|
66
|
+
export declare class ClientTCP_transport extends TCP_transport {
|
|
67
|
+
static defaultMaxChunk: number;
|
|
68
|
+
static defaultMaxMessageSize: number;
|
|
69
|
+
static defaultReceiveBufferSize: number;
|
|
70
|
+
static defaultSendBufferSize: number;
|
|
71
|
+
endpointUrl: string;
|
|
72
|
+
serverUri: string;
|
|
73
|
+
numberOfRetry: number;
|
|
74
|
+
parameters?: AcknowledgeMessage;
|
|
75
|
+
private connected;
|
|
76
|
+
private _counter;
|
|
77
|
+
private _helloSettings;
|
|
78
|
+
constructor(transportSettings?: TransportSettingsOptions);
|
|
79
|
+
getTransportSettings(): TransportSettingsOptions;
|
|
80
|
+
dispose(): void;
|
|
81
|
+
connect(endpointUrl: string, callback: ErrorCallback): void;
|
|
82
|
+
protected on_socket_ended(err: Error | null): void;
|
|
83
|
+
private _handle_ACK_response;
|
|
84
|
+
private _send_HELLO_request;
|
|
85
|
+
private _on_ACK_response;
|
|
86
|
+
private _perform_HEL_ACK_transaction;
|
|
87
|
+
}
|