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,245 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageBuilderBase = exports.readRawMessageHeader = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @module node-opcua-transport
|
|
6
|
+
*/
|
|
7
|
+
const events_1 = require("events");
|
|
8
|
+
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
9
|
+
const node_opcua_basic_types_1 = require("node-opcua-basic-types");
|
|
10
|
+
const node_opcua_binary_stream_1 = require("node-opcua-binary-stream");
|
|
11
|
+
const node_opcua_buffer_utils_1 = require("node-opcua-buffer-utils");
|
|
12
|
+
const node_opcua_chunkmanager_1 = require("node-opcua-chunkmanager");
|
|
13
|
+
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
14
|
+
const node_opcua_packet_assembler_1 = require("node-opcua-packet-assembler");
|
|
15
|
+
const node_opcua_utils_1 = require("node-opcua-utils");
|
|
16
|
+
const status_codes_1 = require("./status_codes");
|
|
17
|
+
const doPerfMonitoring = process.env.NODEOPCUADEBUG && process.env.NODEOPCUADEBUG.indexOf("PERF") >= 0;
|
|
18
|
+
const errorLog = (0, node_opcua_debug_1.make_errorLog)("MessageBuilder");
|
|
19
|
+
const debugLog = (0, node_opcua_debug_1.make_debugLog)("MessageBuilder");
|
|
20
|
+
const warningLog = (0, node_opcua_debug_1.make_warningLog)("MessageBuilder");
|
|
21
|
+
function readRawMessageHeader(data) {
|
|
22
|
+
const messageHeader = (0, node_opcua_chunkmanager_1.readMessageHeader)(new node_opcua_binary_stream_1.BinaryStream(data));
|
|
23
|
+
return {
|
|
24
|
+
extra: "",
|
|
25
|
+
length: messageHeader.length,
|
|
26
|
+
messageHeader
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
exports.readRawMessageHeader = readRawMessageHeader;
|
|
30
|
+
/**
|
|
31
|
+
* @class MessageBuilderBase
|
|
32
|
+
* @extends EventEmitter
|
|
33
|
+
* @uses PacketAssembler
|
|
34
|
+
* @constructor
|
|
35
|
+
* @param options {Object}
|
|
36
|
+
* @param [options.signatureLength=0] {number}
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
class MessageBuilderBase extends events_1.EventEmitter {
|
|
40
|
+
constructor(options) {
|
|
41
|
+
super();
|
|
42
|
+
this.id = "";
|
|
43
|
+
this._tick0 = 0;
|
|
44
|
+
this._tick1 = 0;
|
|
45
|
+
this._hasReceivedError = false;
|
|
46
|
+
this.blocks = [];
|
|
47
|
+
this.messageChunks = [];
|
|
48
|
+
this._expectedChannelId = 0;
|
|
49
|
+
options = options || {
|
|
50
|
+
maxMessageSize: 0,
|
|
51
|
+
maxChunkCount: 0,
|
|
52
|
+
maxChunkSize: 0
|
|
53
|
+
};
|
|
54
|
+
this.signatureLength = options.signatureLength || 0;
|
|
55
|
+
this.maxMessageSize = options.maxMessageSize || MessageBuilderBase.defaultMaxMessageSize;
|
|
56
|
+
this.maxChunkCount = options.maxChunkCount || MessageBuilderBase.defaultMaxChunkCount;
|
|
57
|
+
this.maxChunkSize = options.maxChunkSize || MessageBuilderBase.defaultMaxChunkSize;
|
|
58
|
+
this.options = options;
|
|
59
|
+
this._packetAssembler = new node_opcua_packet_assembler_1.PacketAssembler({
|
|
60
|
+
minimumSizeInBytes: 8,
|
|
61
|
+
maxChunkSize: this.maxChunkSize,
|
|
62
|
+
readChunkFunc: readRawMessageHeader
|
|
63
|
+
});
|
|
64
|
+
this._packetAssembler.on("chunk", (messageChunk) => this._feed_messageChunk(messageChunk));
|
|
65
|
+
this._packetAssembler.on("startChunk", (info, data) => {
|
|
66
|
+
if (doPerfMonitoring) {
|
|
67
|
+
// record tick 0: when the first data is received
|
|
68
|
+
this._tick0 = (0, node_opcua_utils_1.get_clock_tick)();
|
|
69
|
+
}
|
|
70
|
+
this.emit("startChunk", info, data);
|
|
71
|
+
});
|
|
72
|
+
this._packetAssembler.on("error", (err) => {
|
|
73
|
+
warningLog("packet assembler ", err.message);
|
|
74
|
+
return this._report_error(status_codes_1.StatusCodes2.BadTcpMessageTooLarge, "packet assembler: " + err.message);
|
|
75
|
+
});
|
|
76
|
+
this._securityDefeated = false;
|
|
77
|
+
this.totalBodySize = 0;
|
|
78
|
+
this.totalMessageSize = 0;
|
|
79
|
+
this.channelId = 0;
|
|
80
|
+
this.offsetBodyStart = 0;
|
|
81
|
+
this.sequenceHeader = null;
|
|
82
|
+
this._init_new();
|
|
83
|
+
}
|
|
84
|
+
dispose() {
|
|
85
|
+
this.removeAllListeners();
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Feed message builder with some data
|
|
89
|
+
* @method feed
|
|
90
|
+
* @param data
|
|
91
|
+
*/
|
|
92
|
+
feed(data) {
|
|
93
|
+
if (!this._securityDefeated && !this._hasReceivedError) {
|
|
94
|
+
this._packetAssembler.feed(data);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
_decodeMessageBody(fullMessageBody) {
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
_read_headers(binaryStream) {
|
|
101
|
+
try {
|
|
102
|
+
this.messageHeader = (0, node_opcua_chunkmanager_1.readMessageHeader)(binaryStream);
|
|
103
|
+
(0, node_opcua_assert_1.assert)(binaryStream.length === 8, "expecting message header to be 8 bytes");
|
|
104
|
+
this.channelId = binaryStream.readUInt32();
|
|
105
|
+
(0, node_opcua_assert_1.assert)(binaryStream.length === 12);
|
|
106
|
+
// verifying secure ChannelId
|
|
107
|
+
if (this._expectedChannelId && this.channelId !== this._expectedChannelId) {
|
|
108
|
+
return this._report_error(status_codes_1.StatusCodes2.BadTcpSecureChannelUnknown, "Invalid secure channel Id");
|
|
109
|
+
}
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
return this._report_error(status_codes_1.StatusCodes2.BadTcpInternalError, "_read_headers error " + err.message);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
_report_abandon(channelId, tokenId, sequenceHeader) {
|
|
117
|
+
// the server has not been able to send a complete message and has abandoned the request
|
|
118
|
+
// the connection can probably continue
|
|
119
|
+
this._hasReceivedError = false; ///
|
|
120
|
+
this.emit("abandon", sequenceHeader.requestId);
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
_report_error(statusCode, errorMessage) {
|
|
124
|
+
var _a;
|
|
125
|
+
this._hasReceivedError = true;
|
|
126
|
+
debugLog("Error ", this.id, errorMessage);
|
|
127
|
+
// xx errorLog(new Error());
|
|
128
|
+
this.emit("error", new Error(errorMessage), statusCode, ((_a = this.sequenceHeader) === null || _a === void 0 ? void 0 : _a.requestId) || null);
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
_init_new() {
|
|
132
|
+
this._securityDefeated = false;
|
|
133
|
+
this._hasReceivedError = false;
|
|
134
|
+
this.totalBodySize = 0;
|
|
135
|
+
this.totalMessageSize = 0;
|
|
136
|
+
this.blocks = [];
|
|
137
|
+
this.messageChunks = [];
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* append a message chunk
|
|
141
|
+
* @method _append
|
|
142
|
+
* @param chunk
|
|
143
|
+
* @private
|
|
144
|
+
*/
|
|
145
|
+
_append(chunk) {
|
|
146
|
+
if (this._hasReceivedError) {
|
|
147
|
+
// the message builder is in error mode and further message chunks should be discarded.
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
if (this.messageChunks.length + 1 > this.maxChunkCount) {
|
|
151
|
+
return this._report_error(status_codes_1.StatusCodes2.BadTcpMessageTooLarge, `max chunk count exceeded: ${this.maxChunkCount}`);
|
|
152
|
+
}
|
|
153
|
+
this.messageChunks.push(chunk);
|
|
154
|
+
this.totalMessageSize += chunk.length;
|
|
155
|
+
if (this.totalMessageSize > this.maxMessageSize) {
|
|
156
|
+
return this._report_error(status_codes_1.StatusCodes2.BadTcpMessageTooLarge, `max message size exceeded: ${this.maxMessageSize} : total message size ${this.totalMessageSize}`);
|
|
157
|
+
}
|
|
158
|
+
const binaryStream = new node_opcua_binary_stream_1.BinaryStream(chunk);
|
|
159
|
+
if (!this._read_headers(binaryStream)) {
|
|
160
|
+
return this._report_error(status_codes_1.StatusCodes2.BadTcpInternalError, `Invalid message header detected`);
|
|
161
|
+
}
|
|
162
|
+
(0, node_opcua_assert_1.assert)(binaryStream.length >= 12);
|
|
163
|
+
// verify message chunk length
|
|
164
|
+
if (this.messageHeader.length !== chunk.length) {
|
|
165
|
+
// tslint:disable:max-line-length
|
|
166
|
+
return this._report_error(status_codes_1.StatusCodes2.BadTcpInternalError, `Invalid messageChunk size: the provided chunk is ${chunk.length} bytes long but header specifies ${this.messageHeader.length}`);
|
|
167
|
+
}
|
|
168
|
+
// the start of the message body block
|
|
169
|
+
const offsetBodyStart = binaryStream.length;
|
|
170
|
+
// the end of the message body block
|
|
171
|
+
const offsetBodyEnd = binaryStream.buffer.length;
|
|
172
|
+
this.totalBodySize += offsetBodyEnd - offsetBodyStart;
|
|
173
|
+
this.offsetBodyStart = offsetBodyStart;
|
|
174
|
+
// add message body to a queue
|
|
175
|
+
// note : Buffer.slice create a shared memory !
|
|
176
|
+
// use Buffer.clone
|
|
177
|
+
const sharedBuffer = chunk.subarray(this.offsetBodyStart, offsetBodyEnd);
|
|
178
|
+
const clonedBuffer = (0, node_opcua_buffer_utils_1.createFastUninitializedBuffer)(sharedBuffer.length);
|
|
179
|
+
sharedBuffer.copy(clonedBuffer, 0, 0);
|
|
180
|
+
this.blocks.push(clonedBuffer);
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
_feed_messageChunk(chunk) {
|
|
184
|
+
(0, node_opcua_assert_1.assert)(chunk);
|
|
185
|
+
const messageHeader = (0, node_opcua_chunkmanager_1.readMessageHeader)(new node_opcua_binary_stream_1.BinaryStream(chunk));
|
|
186
|
+
this.emit("chunk", chunk);
|
|
187
|
+
if (messageHeader.isFinal === "F") {
|
|
188
|
+
if (messageHeader.msgType === "ERR") {
|
|
189
|
+
const binaryStream = new node_opcua_binary_stream_1.BinaryStream(chunk);
|
|
190
|
+
binaryStream.length = 8;
|
|
191
|
+
const errorCode = (0, node_opcua_basic_types_1.decodeStatusCode)(binaryStream);
|
|
192
|
+
const message = (0, node_opcua_basic_types_1.decodeString)(binaryStream);
|
|
193
|
+
this._report_error(errorCode, message || "Error message not specified");
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
this._append(chunk);
|
|
198
|
+
// last message
|
|
199
|
+
if (this._hasReceivedError) {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
const fullMessageBody = this.blocks.length === 1 ? this.blocks[0] : Buffer.concat(this.blocks);
|
|
203
|
+
if (doPerfMonitoring) {
|
|
204
|
+
// record tick 1: when a complete message has been received ( all chunks assembled)
|
|
205
|
+
this._tick1 = (0, node_opcua_utils_1.get_clock_tick)();
|
|
206
|
+
}
|
|
207
|
+
this.emit("full_message_body", fullMessageBody);
|
|
208
|
+
const messageOk = this._decodeMessageBody(fullMessageBody);
|
|
209
|
+
// be ready for next block
|
|
210
|
+
this._init_new();
|
|
211
|
+
return messageOk;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
else if (messageHeader.isFinal === "A") {
|
|
215
|
+
try {
|
|
216
|
+
// only valid for MSG, according to spec
|
|
217
|
+
const stream = new node_opcua_binary_stream_1.BinaryStream(chunk);
|
|
218
|
+
(0, node_opcua_chunkmanager_1.readMessageHeader)(stream);
|
|
219
|
+
(0, node_opcua_assert_1.assert)(stream.length === 8);
|
|
220
|
+
// instead of
|
|
221
|
+
// const securityHeader = new SymmetricAlgorithmSecurityHeader();
|
|
222
|
+
// securityHeader.decode(stream);
|
|
223
|
+
const channelId = stream.readUInt32();
|
|
224
|
+
const tokenId = (0, node_opcua_basic_types_1.decodeUInt32)(stream);
|
|
225
|
+
const sequenceHeader = new node_opcua_chunkmanager_1.SequenceHeader();
|
|
226
|
+
sequenceHeader.decode(stream);
|
|
227
|
+
return this._report_abandon(channelId, tokenId, sequenceHeader);
|
|
228
|
+
}
|
|
229
|
+
catch (err) {
|
|
230
|
+
warningLog((0, node_opcua_debug_1.hexDump)(chunk));
|
|
231
|
+
warningLog("Cannot interpret message chunk: ", err.message);
|
|
232
|
+
return this._report_error(status_codes_1.StatusCodes2.BadTcpInternalError, "Error decoding message header " + err.message);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
else if (messageHeader.isFinal === "C") {
|
|
236
|
+
return this._append(chunk);
|
|
237
|
+
}
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
MessageBuilderBase.defaultMaxChunkCount = 1000;
|
|
242
|
+
MessageBuilderBase.defaultMaxMessageSize = 1024 * 64 * 1024; // 64Mo
|
|
243
|
+
MessageBuilderBase.defaultMaxChunkSize = 1024 * 8;
|
|
244
|
+
exports.MessageBuilderBase = MessageBuilderBase;
|
|
245
|
+
//# sourceMappingURL=message_builder_base.js.map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B,UAAU,CAAC,kCAAkC,EAAG,GAAa,CAAC,OAAO,CAAC,CAAC;gBACvE,OAAO,IAAI,CAAC,aAAa,CACrB,2BAAY,CAAC,mBAAmB,EAChC,gCAAgC,GAAI,GAAa,CAAC,OAAO,CAC5D,CAAC;aACL;SACJ;aAAM,IAAI,aAAa,CAAC,OAAO,KAAK,GAAG,EAAE;YACtC,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;SAC9B;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;;AAjRa,uCAAoB,GAAG,IAAI,CAAC;AAC5B,wCAAqB,GAAG,IAAI,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,OAAO;AACjD,sCAAmB,GAAG,IAAI,GAAG,CAAC,CAAC;AAHpC,gDAAkB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/**
|
|
4
|
+
* @module node-opcua-transport
|
|
5
|
+
*/
|
|
6
|
+
import { Socket } from "net";
|
|
7
|
+
import { StatusCode } from "node-opcua-status-code";
|
|
8
|
+
import { ErrorCallback } from "node-opcua-status-code";
|
|
9
|
+
import { TCP_transport } from "./tcp_transport";
|
|
10
|
+
/**
|
|
11
|
+
* @class ServerTCP_transport
|
|
12
|
+
* @extends TCP_transport
|
|
13
|
+
* @constructor
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
export declare class ServerTCP_transport extends TCP_transport {
|
|
17
|
+
static throttleTime: number;
|
|
18
|
+
private _aborted;
|
|
19
|
+
private _helloReceived;
|
|
20
|
+
constructor();
|
|
21
|
+
protected _write_chunk(messageChunk: Buffer): void;
|
|
22
|
+
/**
|
|
23
|
+
* Initialize the server transport.
|
|
24
|
+
*
|
|
25
|
+
*
|
|
26
|
+
* The ServerTCP_transport initialization process starts by waiting for the client to send a "HEL" message.
|
|
27
|
+
*
|
|
28
|
+
* The ServerTCP_transport replies with a "ACK" message and then start waiting for further messages of any size.
|
|
29
|
+
*
|
|
30
|
+
* The callback function received an error:
|
|
31
|
+
* - if no message from the client is received within the ```self.timeout``` period,
|
|
32
|
+
* - or, if the connection has dropped within the same interval.
|
|
33
|
+
* - if the protocol version specified within the HEL message is invalid or is greater
|
|
34
|
+
* than ```self.protocolVersion```
|
|
35
|
+
*
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
init(socket: Socket, callback: ErrorCallback): void;
|
|
39
|
+
abortWithError(statusCode: StatusCode, extraErrorDescription: string, callback: ErrorCallback): void;
|
|
40
|
+
private _abortWithError;
|
|
41
|
+
private _send_ACK_response;
|
|
42
|
+
private _install_HEL_message_receiver;
|
|
43
|
+
private _on_HEL_message;
|
|
44
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServerTCP_transport = void 0;
|
|
4
|
+
const chalk = require("chalk");
|
|
5
|
+
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
6
|
+
// opcua requires
|
|
7
|
+
const debug = require("node-opcua-debug");
|
|
8
|
+
const node_opcua_binary_stream_1 = require("node-opcua-binary-stream");
|
|
9
|
+
const node_opcua_chunkmanager_1 = require("node-opcua-chunkmanager");
|
|
10
|
+
const node_opcua_status_code_1 = require("node-opcua-status-code");
|
|
11
|
+
// this package requires
|
|
12
|
+
const AcknowledgeMessage_1 = require("./AcknowledgeMessage");
|
|
13
|
+
const HelloMessage_1 = require("./HelloMessage");
|
|
14
|
+
const tcp_transport_1 = require("./tcp_transport");
|
|
15
|
+
const tools_1 = require("./tools");
|
|
16
|
+
const utils_1 = require("./utils");
|
|
17
|
+
const hexDump = debug.hexDump;
|
|
18
|
+
const debugLog = debug.make_debugLog(__filename);
|
|
19
|
+
const errorLog = debug.make_errorLog(__filename);
|
|
20
|
+
const doDebug = debug.checkDebugFlag(__filename);
|
|
21
|
+
function clamp_value(value, minVal, maxVal) {
|
|
22
|
+
(0, node_opcua_assert_1.assert)(minVal < maxVal);
|
|
23
|
+
if (value === 0) {
|
|
24
|
+
return maxVal;
|
|
25
|
+
}
|
|
26
|
+
if (value < minVal) {
|
|
27
|
+
return minVal;
|
|
28
|
+
}
|
|
29
|
+
/* istanbul ignore next*/
|
|
30
|
+
if (value >= maxVal) {
|
|
31
|
+
return maxVal;
|
|
32
|
+
}
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
35
|
+
const minimumBufferSize = 8192;
|
|
36
|
+
/**
|
|
37
|
+
* @class ServerTCP_transport
|
|
38
|
+
* @extends TCP_transport
|
|
39
|
+
* @constructor
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
class ServerTCP_transport extends tcp_transport_1.TCP_transport {
|
|
43
|
+
constructor() {
|
|
44
|
+
super();
|
|
45
|
+
this._aborted = 0;
|
|
46
|
+
this._helloReceived = false;
|
|
47
|
+
// before HEL/ACK
|
|
48
|
+
this.maxChunkCount = 1;
|
|
49
|
+
this.maxMessageSize = 4 * 1024;
|
|
50
|
+
this.receiveBufferSize = 4 * 1024;
|
|
51
|
+
}
|
|
52
|
+
_write_chunk(messageChunk) {
|
|
53
|
+
// istanbul ignore next
|
|
54
|
+
if (this.sendBufferSize > 0 && messageChunk.length > this.sendBufferSize) {
|
|
55
|
+
errorLog("write chunk exceed sendBufferSize messageChunk length = ", messageChunk.length, "sendBufferSize = ", this.sendBufferSize);
|
|
56
|
+
}
|
|
57
|
+
super._write_chunk(messageChunk);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Initialize the server transport.
|
|
61
|
+
*
|
|
62
|
+
*
|
|
63
|
+
* The ServerTCP_transport initialization process starts by waiting for the client to send a "HEL" message.
|
|
64
|
+
*
|
|
65
|
+
* The ServerTCP_transport replies with a "ACK" message and then start waiting for further messages of any size.
|
|
66
|
+
*
|
|
67
|
+
* The callback function received an error:
|
|
68
|
+
* - if no message from the client is received within the ```self.timeout``` period,
|
|
69
|
+
* - or, if the connection has dropped within the same interval.
|
|
70
|
+
* - if the protocol version specified within the HEL message is invalid or is greater
|
|
71
|
+
* than ```self.protocolVersion```
|
|
72
|
+
*
|
|
73
|
+
*
|
|
74
|
+
*/
|
|
75
|
+
init(socket, callback) {
|
|
76
|
+
if (debugLog) {
|
|
77
|
+
debugLog(chalk.cyan("init socket"));
|
|
78
|
+
}
|
|
79
|
+
(0, node_opcua_assert_1.assert)(!this._socket, "init already called!");
|
|
80
|
+
(0, node_opcua_assert_1.assert)(typeof callback === "function", "expecting a valid callback ");
|
|
81
|
+
this._install_socket(socket);
|
|
82
|
+
this._install_HEL_message_receiver(callback);
|
|
83
|
+
}
|
|
84
|
+
abortWithError(statusCode, extraErrorDescription, callback) {
|
|
85
|
+
return this._abortWithError(statusCode, extraErrorDescription, callback);
|
|
86
|
+
}
|
|
87
|
+
_abortWithError(statusCode, extraErrorDescription, callback) {
|
|
88
|
+
// When a fatal error occurs, the Server shall send an Error Message to the Client and
|
|
89
|
+
// closes the TransportConnection gracefully.
|
|
90
|
+
doDebug && debugLog(chalk.cyan("_abortWithError"));
|
|
91
|
+
/* istanbul ignore next */
|
|
92
|
+
if (this._aborted) {
|
|
93
|
+
// already called
|
|
94
|
+
return callback(new Error(statusCode.name));
|
|
95
|
+
}
|
|
96
|
+
this._aborted = 1;
|
|
97
|
+
setTimeout(() => {
|
|
98
|
+
// send the error message and close the connection
|
|
99
|
+
this.sendErrorMessage(statusCode, statusCode.description);
|
|
100
|
+
this.disconnect(() => {
|
|
101
|
+
this._aborted = 2;
|
|
102
|
+
callback(new Error(extraErrorDescription + " StatusCode = " + statusCode.name));
|
|
103
|
+
});
|
|
104
|
+
}, ServerTCP_transport.throttleTime);
|
|
105
|
+
}
|
|
106
|
+
_send_ACK_response(helloMessage) {
|
|
107
|
+
(0, node_opcua_assert_1.assert)(helloMessage.receiveBufferSize >= minimumBufferSize);
|
|
108
|
+
(0, node_opcua_assert_1.assert)(helloMessage.sendBufferSize >= minimumBufferSize);
|
|
109
|
+
const minBufferSize = 8192;
|
|
110
|
+
const maxBufferSize = 8 * 64 * 1024;
|
|
111
|
+
const minMaxMessageSize = 128 * 1024;
|
|
112
|
+
const defaultMaxMessageSize = 16 * 1024 * 1024;
|
|
113
|
+
const maxMaxMessageSize = 128 * 1024 * 1024;
|
|
114
|
+
const minMaxChunkCount = 1;
|
|
115
|
+
const defaultMaxChunkCount = defaultMaxMessageSize / maxBufferSize;
|
|
116
|
+
const maxMaxChunkCount = 9000;
|
|
117
|
+
const defaultReceiveBufferSize = 64 * 1024;
|
|
118
|
+
const defaultSendBufferSize = 64 * 1024;
|
|
119
|
+
const receiveBufferSize = clamp_value(helloMessage.receiveBufferSize || defaultReceiveBufferSize, minBufferSize, maxBufferSize);
|
|
120
|
+
const sendBufferSize = clamp_value(helloMessage.sendBufferSize || defaultSendBufferSize, minBufferSize, maxBufferSize);
|
|
121
|
+
const maxMessageSize = clamp_value(helloMessage.maxMessageSize || defaultMaxMessageSize, minMaxMessageSize, maxMaxMessageSize);
|
|
122
|
+
if (!helloMessage.maxChunkCount && sendBufferSize) {
|
|
123
|
+
helloMessage.maxChunkCount = Math.ceil(helloMessage.maxMessageSize / Math.min(sendBufferSize, receiveBufferSize));
|
|
124
|
+
}
|
|
125
|
+
const maxChunkCount = clamp_value(helloMessage.maxChunkCount || defaultMaxChunkCount, minMaxChunkCount, maxMaxChunkCount);
|
|
126
|
+
this.setLimits({
|
|
127
|
+
receiveBufferSize,
|
|
128
|
+
sendBufferSize,
|
|
129
|
+
maxMessageSize,
|
|
130
|
+
maxChunkCount
|
|
131
|
+
});
|
|
132
|
+
// istanbul ignore next
|
|
133
|
+
if (utils_1.doTraceHelloAck) {
|
|
134
|
+
console.log(`received Hello \n${helloMessage.toString()}`);
|
|
135
|
+
console.log("Client accepts only message of size => ", this.maxMessageSize);
|
|
136
|
+
}
|
|
137
|
+
debugLog("Client accepts only message of size => ", this.maxMessageSize);
|
|
138
|
+
const acknowledgeMessage = new AcknowledgeMessage_1.AcknowledgeMessage({
|
|
139
|
+
maxChunkCount: this.maxChunkCount,
|
|
140
|
+
maxMessageSize: this.maxMessageSize,
|
|
141
|
+
protocolVersion: this.protocolVersion,
|
|
142
|
+
receiveBufferSize: this.receiveBufferSize,
|
|
143
|
+
sendBufferSize: this.sendBufferSize
|
|
144
|
+
});
|
|
145
|
+
// istanbul ignore next
|
|
146
|
+
if (utils_1.doTraceHelloAck) {
|
|
147
|
+
console.log(`sending Ack \n${acknowledgeMessage.toString()}`);
|
|
148
|
+
}
|
|
149
|
+
const messageChunk = (0, tools_1.packTcpMessage)("ACK", acknowledgeMessage);
|
|
150
|
+
/* istanbul ignore next*/
|
|
151
|
+
if (doDebug) {
|
|
152
|
+
(0, node_opcua_chunkmanager_1.verify_message_chunk)(messageChunk);
|
|
153
|
+
debugLog("server send: " + chalk.yellow("ACK"));
|
|
154
|
+
debugLog("server send: " + hexDump(messageChunk));
|
|
155
|
+
debugLog("acknowledgeMessage=", acknowledgeMessage);
|
|
156
|
+
}
|
|
157
|
+
// send the ACK reply
|
|
158
|
+
this.write(messageChunk);
|
|
159
|
+
}
|
|
160
|
+
_install_HEL_message_receiver(callback) {
|
|
161
|
+
if (debugLog) {
|
|
162
|
+
debugLog(chalk.cyan("_install_HEL_message_receiver "));
|
|
163
|
+
}
|
|
164
|
+
this._install_one_time_message_receiver((err, data) => {
|
|
165
|
+
if (err) {
|
|
166
|
+
this._abortWithError(node_opcua_status_code_1.StatusCodes.BadConnectionRejected, err.message, callback);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
// handle the HEL message
|
|
170
|
+
this._on_HEL_message(data, callback);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
_on_HEL_message(data, callback) {
|
|
175
|
+
if (debugLog) {
|
|
176
|
+
debugLog(chalk.cyan("_on_HEL_message"));
|
|
177
|
+
}
|
|
178
|
+
(0, node_opcua_assert_1.assert)(!this._helloReceived);
|
|
179
|
+
const stream = new node_opcua_binary_stream_1.BinaryStream(data);
|
|
180
|
+
const msgType = data.subarray(0, 3).toString("utf-8");
|
|
181
|
+
/* istanbul ignore next*/
|
|
182
|
+
if (doDebug) {
|
|
183
|
+
debugLog("SERVER received " + chalk.yellow(msgType));
|
|
184
|
+
debugLog("SERVER received " + hexDump(data));
|
|
185
|
+
}
|
|
186
|
+
if (msgType === "HEL") {
|
|
187
|
+
try {
|
|
188
|
+
(0, node_opcua_assert_1.assert)(data.length >= 24);
|
|
189
|
+
const helloMessage = (0, tools_1.decodeMessage)(stream, HelloMessage_1.HelloMessage);
|
|
190
|
+
(0, node_opcua_assert_1.assert)(isFinite(this.protocolVersion));
|
|
191
|
+
// OPCUA Spec 1.03 part 6 - page 41
|
|
192
|
+
// The Server shall always accept versions greater than what it supports.
|
|
193
|
+
if (helloMessage.protocolVersion !== this.protocolVersion) {
|
|
194
|
+
debugLog(`warning ! client sent helloMessage.protocolVersion = ` +
|
|
195
|
+
` 0x${helloMessage.protocolVersion.toString(16)} ` +
|
|
196
|
+
`whereas server protocolVersion is 0x${this.protocolVersion.toString(16)}`);
|
|
197
|
+
}
|
|
198
|
+
if (helloMessage.protocolVersion === 0xdeadbeef || helloMessage.protocolVersion < this.protocolVersion) {
|
|
199
|
+
// Note: 0xDEADBEEF is our special version number to simulate BadProtocolVersionUnsupported in tests
|
|
200
|
+
// invalid protocol version requested by client
|
|
201
|
+
return this._abortWithError(node_opcua_status_code_1.StatusCodes.BadProtocolVersionUnsupported, "Protocol Version Error" + this.protocolVersion, callback);
|
|
202
|
+
}
|
|
203
|
+
// OPCUA Spec 1.04 part 6 - page 45
|
|
204
|
+
// UASC is designed to operate with different TransportProtocols that may have limited buffer
|
|
205
|
+
// sizes. For this reason, OPC UA Secure Conversation will break OPC UA Messages into several
|
|
206
|
+
// pieces (called ‘MessageChunks’) that are smaller than the buffer size allowed by the
|
|
207
|
+
// TransportProtocol. UASC requires a TransportProtocol buffer size that is at least 8 192 bytes
|
|
208
|
+
if (helloMessage.receiveBufferSize < minimumBufferSize || helloMessage.sendBufferSize < minimumBufferSize) {
|
|
209
|
+
return this._abortWithError(node_opcua_status_code_1.StatusCodes.BadConnectionRejected, "Buffer size too small (should be at least " + minimumBufferSize, callback);
|
|
210
|
+
}
|
|
211
|
+
// the helloMessage shall only be received once.
|
|
212
|
+
this._helloReceived = true;
|
|
213
|
+
this._send_ACK_response(helloMessage);
|
|
214
|
+
}
|
|
215
|
+
catch (err) {
|
|
216
|
+
// connection rejected because of malformed message
|
|
217
|
+
return this._abortWithError(node_opcua_status_code_1.StatusCodes.BadConnectionRejected, err instanceof Error ? err.message : "", callback);
|
|
218
|
+
}
|
|
219
|
+
callback(); // no Error
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
// invalid packet , expecting HEL
|
|
223
|
+
/* istanbul ignore next*/
|
|
224
|
+
if (doDebug) {
|
|
225
|
+
debugLog(chalk.red("BadCommunicationError ") + "Expecting 'HEL' message to initiate communication");
|
|
226
|
+
}
|
|
227
|
+
this._abortWithError(node_opcua_status_code_1.StatusCodes.BadCommunicationError, "Expecting 'HEL' message to initiate communication", callback);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
ServerTCP_transport.throttleTime = 1000;
|
|
232
|
+
exports.ServerTCP_transport = ServerTCP_transport;
|
|
233
|
+
//# sourceMappingURL=server_tcp_transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server_tcp_transport.js","sourceRoot":"","sources":["../../source/server_tcp_transport.ts"],"names":[],"mappings":";;;AAMA,+BAA+B;AAC/B,yDAA2C;AAE3C,iBAAiB;AACjB,0CAA0C;AAC1C,uEAAwD;AACxD,qEAA+D;AAC/D,mEAAiE;AAGjE,wBAAwB;AACxB,6DAA0D;AAC1D,iDAA8C;AAC9C,mDAAgD;AAChD,mCAAwD;AACxD,mCAA0C;AAE1C,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;AAC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AW,CAAC,qBAAqB,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;aACrH;YACD,QAAQ,EAAE,CAAC,CAAC,WAAW;SAC1B;aAAM;YACH,iCAAiC;YACjC,yBAAyB;YACzB,IAAI,OAAO,EAAE;gBACT,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,wBAAwB,CAAC,GAAG,mDAAmD,CAAC,CAAC;aACvG;YACD,IAAI,CAAC,eAAe,CAAC,oCAAW,CAAC,qBAAqB,EAAE,mDAAmD,EAAE,QAAQ,CAAC,CAAC;SAC1H;IACL,CAAC;;AAlPa,gCAAY,GAAG,IAAI,CAAC;AADzB,kDAAmB"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export declare const StatusCodes2: {
|
|
2
|
+
/**
|
|
3
|
+
* The Server cannot process the request because it is too busy.
|
|
4
|
+
*
|
|
5
|
+
* It is up to the Server to determine when it needs to return this Message.
|
|
6
|
+
*
|
|
7
|
+
* A Server can control the how frequently a Client reconnects by waiting to return this error.
|
|
8
|
+
*/
|
|
9
|
+
BadTcpServerTooBusy: import("node-opcua-status-code").ConstantStatusCode;
|
|
10
|
+
/**
|
|
11
|
+
* The type of the Message specified in the header invalid.
|
|
12
|
+
* Each Message starts with a 4-byte sequence of ASCII values that identifies the Message type.
|
|
13
|
+
* The Server returns this error if the Message type is not accepted.
|
|
14
|
+
* Some of the Message types are defined by the SecureChannel layer.
|
|
15
|
+
*/
|
|
16
|
+
BadTcpMessageTypeInvalid: import("node-opcua-status-code").ConstantStatusCode;
|
|
17
|
+
/**
|
|
18
|
+
* The SecureChannelId and/or TokenId are not currently in use.
|
|
19
|
+
* This error is reported by the SecureChannel layer.
|
|
20
|
+
*/
|
|
21
|
+
BadTcpSecureChannelUnknown: import("node-opcua-status-code").ConstantStatusCode;
|
|
22
|
+
/**
|
|
23
|
+
* The size of the Message specified in the header is too large.
|
|
24
|
+
* The Server returns this error if the Message size exceeds its maximum buffer size
|
|
25
|
+
* or the receive buffer size negotiated during the Hello/Acknowledge exchange.
|
|
26
|
+
*/
|
|
27
|
+
BadTcpMessageTooLarge: import("node-opcua-status-code").ConstantStatusCode;
|
|
28
|
+
/**
|
|
29
|
+
* A timeout occurred while accessing a resource.
|
|
30
|
+
* It is up to the Server to determine when a timeout occurs.
|
|
31
|
+
*/
|
|
32
|
+
BadTimeout: import("node-opcua-status-code").ConstantStatusCode;
|
|
33
|
+
/**
|
|
34
|
+
* There are not enough resources to process the request.
|
|
35
|
+
* The Server returns this error when it runs out of memory or encounters similar resource problems.
|
|
36
|
+
* A Server can control the how frequently a Client reconnects by waiting to return this error.
|
|
37
|
+
*/
|
|
38
|
+
BadTcpNotEnoughResources: import("node-opcua-status-code").ConstantStatusCode;
|
|
39
|
+
/**
|
|
40
|
+
* An internal error occurred.
|
|
41
|
+
* This should only be returned if an unexpected configuration or programming error occurs.
|
|
42
|
+
*/
|
|
43
|
+
BadTcpInternalError: import("node-opcua-status-code").ConstantStatusCode;
|
|
44
|
+
/**
|
|
45
|
+
* The Server does not recognize the EndpointUrl specified.
|
|
46
|
+
*/
|
|
47
|
+
BadTcpEndpointUrlInvalid: import("node-opcua-status-code").ConstantStatusCode;
|
|
48
|
+
/**
|
|
49
|
+
* The Message was rejected because it could not be verified.
|
|
50
|
+
*/
|
|
51
|
+
BadSecurityChecksFailed: import("node-opcua-status-code").ConstantStatusCode;
|
|
52
|
+
/**
|
|
53
|
+
* The request could not be sent because of a network interruption.
|
|
54
|
+
*/
|
|
55
|
+
BadRequestInterrupted: import("node-opcua-status-code").ConstantStatusCode;
|
|
56
|
+
/**
|
|
57
|
+
* Timeout occurred while processing the request.
|
|
58
|
+
*/
|
|
59
|
+
BadRequestTimeout: import("node-opcua-status-code").ConstantStatusCode;
|
|
60
|
+
/**
|
|
61
|
+
* The secure channel has been closed.
|
|
62
|
+
*/
|
|
63
|
+
BadSecureChannelClosed: import("node-opcua-status-code").ConstantStatusCode;
|
|
64
|
+
/**
|
|
65
|
+
* The SecurityToken has expired or is not recognized. BadSecureChannelTokenUnknown
|
|
66
|
+
*/
|
|
67
|
+
BadSecureChannelTokenUnknown: import("node-opcua-status-code").ConstantStatusCode;
|
|
68
|
+
/**
|
|
69
|
+
* The sender Certificate is not trusted by the receiver.
|
|
70
|
+
*/
|
|
71
|
+
BadCertificateUntrusted: import("node-opcua-status-code").ConstantStatusCode;
|
|
72
|
+
/**
|
|
73
|
+
* The sender Certificate has expired or is not yet valid.
|
|
74
|
+
*/
|
|
75
|
+
BadCertificateTimeInvalid: import("node-opcua-status-code").ConstantStatusCode;
|
|
76
|
+
/**
|
|
77
|
+
* The issuer for the sender Certificate has expired or is not yet valid.
|
|
78
|
+
*/
|
|
79
|
+
BadCertificateIssuerTimeInvalid: import("node-opcua-status-code").ConstantStatusCode;
|
|
80
|
+
/**
|
|
81
|
+
* The sender’s Certificate may not be used for establishing a secure channel.
|
|
82
|
+
*/
|
|
83
|
+
BadCertificateUseNotAllowed: import("node-opcua-status-code").ConstantStatusCode;
|
|
84
|
+
/**
|
|
85
|
+
* The issuer Certificate may not be used as a Certificate Authority.
|
|
86
|
+
*/
|
|
87
|
+
BadCertificateIssuerUseNotAllowed: import("node-opcua-status-code").ConstantStatusCode;
|
|
88
|
+
/**
|
|
89
|
+
* Could not verify the revocation status of the sender’s Certificate.
|
|
90
|
+
*/
|
|
91
|
+
BadCertificateRevocationUnknown: import("node-opcua-status-code").ConstantStatusCode;
|
|
92
|
+
/**
|
|
93
|
+
* Could not verify the revocation status of the issuer Certificate.
|
|
94
|
+
*/
|
|
95
|
+
BadCertificateIssuerRevocationUnknown: import("node-opcua-status-code").ConstantStatusCode;
|
|
96
|
+
/**
|
|
97
|
+
* The sender Certificate has been revoked by the issuer.
|
|
98
|
+
*/
|
|
99
|
+
BadCertificateRevoked: import("node-opcua-status-code").ConstantStatusCode;
|
|
100
|
+
};
|