node-opcua-transport 2.71.0 → 2.72.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 (37) hide show
  1. package/dist/source/AcknowledgeMessage.d.ts +27 -27
  2. package/dist/source/AcknowledgeMessage.js +78 -78
  3. package/dist/source/HelloMessage.d.ts +27 -27
  4. package/dist/source/HelloMessage.js +94 -94
  5. package/dist/source/TCPErrorMessage.d.ts +18 -18
  6. package/dist/source/TCPErrorMessage.js +46 -46
  7. package/dist/source/client_tcp_transport.d.ts +72 -72
  8. package/dist/source/client_tcp_transport.js +322 -322
  9. package/dist/source/index.d.ts +13 -13
  10. package/dist/source/index.js +29 -29
  11. package/dist/source/message_builder_base.d.ts +81 -81
  12. package/dist/source/message_builder_base.js +229 -229
  13. package/dist/source/server_tcp_transport.d.ts +44 -44
  14. package/dist/source/server_tcp_transport.js +228 -228
  15. package/dist/source/status_codes.d.ts +100 -100
  16. package/dist/source/status_codes.js +110 -110
  17. package/dist/source/tcp_transport.d.ts +119 -119
  18. package/dist/source/tcp_transport.js +386 -386
  19. package/dist/source/tools.d.ts +14 -14
  20. package/dist/source/tools.js +103 -103
  21. package/dist/source/utils.d.ts +3 -3
  22. package/dist/source/utils.js +9 -9
  23. package/dist/test-fixtures/fixture_full_tcp_packets.d.ts +21 -21
  24. package/dist/test-fixtures/fixture_full_tcp_packets.js +41 -41
  25. package/dist/test-fixtures/index.d.ts +1 -1
  26. package/dist/test-fixtures/index.js +17 -17
  27. package/dist/test_helpers/direct_transport.d.ts +18 -18
  28. package/dist/test_helpers/direct_transport.js +62 -62
  29. package/dist/test_helpers/fake_server.d.ts +19 -19
  30. package/dist/test_helpers/fake_server.js +54 -54
  31. package/dist/test_helpers/half_com_channel.d.ts +17 -17
  32. package/dist/test_helpers/half_com_channel.js +31 -31
  33. package/dist/test_helpers/index.d.ts +4 -4
  34. package/dist/test_helpers/index.js +20 -20
  35. package/dist/test_helpers/socket_transport.d.ts +10 -10
  36. package/dist/test_helpers/socket_transport.js +30 -30
  37. package/package.json +3 -3
@@ -1,230 +1,230 @@
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_binary_stream_1 = require("node-opcua-binary-stream");
10
- const node_opcua_buffer_utils_1 = require("node-opcua-buffer-utils");
11
- const node_opcua_chunkmanager_1 = require("node-opcua-chunkmanager");
12
- const node_opcua_debug_1 = require("node-opcua-debug");
13
- const node_opcua_packet_assembler_1 = require("node-opcua-packet-assembler");
14
- const node_opcua_utils_1 = require("node-opcua-utils");
15
- const status_codes_1 = require("./status_codes");
16
- const doPerfMonitoring = process.env.NODEOPCUADEBUG && process.env.NODEOPCUADEBUG.indexOf("PERF") >= 0;
17
- const errorLog = (0, node_opcua_debug_1.make_errorLog)("MessageBuilder");
18
- const debugLog = (0, node_opcua_debug_1.make_debugLog)("MessageBuilder");
19
- const warningLog = (0, node_opcua_debug_1.make_warningLog)("MessageBuilder");
20
- function readRawMessageHeader(data) {
21
- const messageHeader = (0, node_opcua_chunkmanager_1.readMessageHeader)(new node_opcua_binary_stream_1.BinaryStream(data));
22
- return {
23
- extra: "",
24
- length: messageHeader.length,
25
- messageHeader
26
- };
27
- }
28
- exports.readRawMessageHeader = readRawMessageHeader;
29
- /**
30
- * @class MessageBuilderBase
31
- * @extends EventEmitter
32
- * @uses PacketAssembler
33
- * @constructor
34
- * @param options {Object}
35
- * @param [options.signatureLength=0] {number}
36
- *
37
- */
38
- class MessageBuilderBase extends events_1.EventEmitter {
39
- constructor(options) {
40
- super();
41
- this.id = "";
42
- this._tick0 = 0;
43
- this._tick1 = 0;
44
- this._hasReceivedError = false;
45
- this.blocks = [];
46
- this.messageChunks = [];
47
- this._expectedChannelId = 0;
48
- options = options || {
49
- maxMessageSize: 0,
50
- maxChunkCount: 0,
51
- maxChunkSize: 0
52
- };
53
- this.signatureLength = options.signatureLength || 0;
54
- this.maxMessageSize = options.maxMessageSize || MessageBuilderBase.defaultMaxMessageSize;
55
- this.maxChunkCount = options.maxChunkCount || MessageBuilderBase.defaultMaxChunkCount;
56
- this.maxChunkSize = options.maxChunkSize || MessageBuilderBase.defaultMaxChunkSize;
57
- this.options = options;
58
- this._packetAssembler = new node_opcua_packet_assembler_1.PacketAssembler({
59
- minimumSizeInBytes: 8,
60
- maxChunkSize: this.maxChunkSize,
61
- readChunkFunc: readRawMessageHeader
62
- });
63
- this._packetAssembler.on("chunk", (messageChunk) => this._feed_messageChunk(messageChunk));
64
- this._packetAssembler.on("startChunk", (info, data) => {
65
- if (doPerfMonitoring) {
66
- // record tick 0: when the first data is received
67
- this._tick0 = (0, node_opcua_utils_1.get_clock_tick)();
68
- }
69
- /**
70
- *
71
- * notify the observers that a new message is being built
72
- * @event start_chunk
73
- * @param info
74
- * @param data
75
- */
76
- this.emit("startChunk", info, data);
77
- });
78
- this._packetAssembler.on("error", (err) => {
79
- warningLog("packet assembler ", err.message);
80
- return this._report_error(status_codes_1.StatusCodes2.BadTcpMessageTooLarge, "packet assembler: " + err.message);
81
- });
82
- this._securityDefeated = false;
83
- this.totalBodySize = 0;
84
- this.totalMessageSize = 0;
85
- this.channelId = 0;
86
- this.offsetBodyStart = 0;
87
- this.sequenceHeader = null;
88
- this._init_new();
89
- }
90
- dispose() {
91
- this.removeAllListeners();
92
- }
93
- /**
94
- * Feed message builder with some data
95
- * @method feed
96
- * @param data
97
- */
98
- feed(data) {
99
- if (!this._securityDefeated && !this._hasReceivedError) {
100
- this._packetAssembler.feed(data);
101
- }
102
- }
103
- _decodeMessageBody(fullMessageBody) {
104
- return true;
105
- }
106
- _read_headers(binaryStream) {
107
- try {
108
- this.messageHeader = (0, node_opcua_chunkmanager_1.readMessageHeader)(binaryStream);
109
- (0, node_opcua_assert_1.assert)(binaryStream.length === 8, "expecting message header to be 8 bytes");
110
- this.channelId = binaryStream.readUInt32();
111
- (0, node_opcua_assert_1.assert)(binaryStream.length === 12);
112
- // verifying secure ChannelId
113
- if (this._expectedChannelId && this.channelId !== this._expectedChannelId) {
114
- return this._report_error(status_codes_1.StatusCodes2.BadTcpSecureChannelUnknown, "Invalid secure channel Id");
115
- }
116
- return true;
117
- }
118
- catch (err) {
119
- return this._report_error(status_codes_1.StatusCodes2.BadTcpInternalError, "_read_headers error " + err.message);
120
- }
121
- }
122
- _report_error(statusCode, errorMessage) {
123
- this._hasReceivedError = true;
124
- /**
125
- * notify the observers that an error has occurred
126
- * @event error
127
- * @param error the error to raise
128
- */
129
- debugLog("Error ", this.id, errorMessage);
130
- // xx errorLog(new Error());
131
- this.emit("error", new Error(errorMessage), statusCode, this.sequenceHeader ? this.sequenceHeader.requestId : null);
132
- return false;
133
- }
134
- _init_new() {
135
- this._securityDefeated = false;
136
- this._hasReceivedError = false;
137
- this.totalBodySize = 0;
138
- this.totalMessageSize = 0;
139
- this.blocks = [];
140
- this.messageChunks = [];
141
- }
142
- /**
143
- * append a message chunk
144
- * @method _append
145
- * @param chunk
146
- * @private
147
- */
148
- _append(chunk) {
149
- if (this._hasReceivedError) {
150
- // the message builder is in error mode and further message chunks should be discarded.
151
- return false;
152
- }
153
- if (this.messageChunks.length + 1 > this.maxChunkCount) {
154
- return this._report_error(status_codes_1.StatusCodes2.BadTcpMessageTooLarge, `max chunk count exceeded: ${this.maxChunkCount}`);
155
- }
156
- this.messageChunks.push(chunk);
157
- this.totalMessageSize += chunk.length;
158
- if (this.totalMessageSize > this.maxMessageSize) {
159
- return this._report_error(status_codes_1.StatusCodes2.BadTcpMessageTooLarge, `max message size exceeded: ${this.maxMessageSize}`);
160
- }
161
- const binaryStream = new node_opcua_binary_stream_1.BinaryStream(chunk);
162
- if (!this._read_headers(binaryStream)) {
163
- return this._report_error(status_codes_1.StatusCodes2.BadTcpInternalError, `Invalid message header detected`);
164
- }
165
- (0, node_opcua_assert_1.assert)(binaryStream.length >= 12);
166
- // verify message chunk length
167
- if (this.messageHeader.length !== chunk.length) {
168
- // tslint:disable:max-line-length
169
- 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}`);
170
- }
171
- // the start of the message body block
172
- const offsetBodyStart = binaryStream.length;
173
- // the end of the message body block
174
- const offsetBodyEnd = binaryStream.buffer.length;
175
- this.totalBodySize += offsetBodyEnd - offsetBodyStart;
176
- this.offsetBodyStart = offsetBodyStart;
177
- // add message body to a queue
178
- // note : Buffer.slice create a shared memory !
179
- // use Buffer.clone
180
- const sharedBuffer = chunk.slice(this.offsetBodyStart, offsetBodyEnd);
181
- const clonedBuffer = (0, node_opcua_buffer_utils_1.createFastUninitializedBuffer)(sharedBuffer.length);
182
- sharedBuffer.copy(clonedBuffer, 0, 0);
183
- this.blocks.push(clonedBuffer);
184
- return true;
185
- }
186
- _feed_messageChunk(chunk) {
187
- (0, node_opcua_assert_1.assert)(chunk);
188
- const messageHeader = (0, node_opcua_chunkmanager_1.readMessageHeader)(new node_opcua_binary_stream_1.BinaryStream(chunk));
189
- /**
190
- * notify the observers that new message chunk has been received
191
- * @event chunk
192
- * @param messageChunk the raw message chunk
193
- */
194
- this.emit("chunk", chunk);
195
- if (messageHeader.isFinal === "F") {
196
- // last message
197
- this._append(chunk);
198
- if (this._hasReceivedError) {
199
- return false;
200
- }
201
- const fullMessageBody = this.blocks.length === 1 ? this.blocks[0] : Buffer.concat(this.blocks);
202
- if (doPerfMonitoring) {
203
- // record tick 1: when a complete message has been received ( all chunks assembled)
204
- this._tick1 = (0, node_opcua_utils_1.get_clock_tick)();
205
- }
206
- /**
207
- * notify the observers that a full message has been received
208
- * @event full_message_body
209
- * @param full_message_body the full message body made of all concatenated chunks.
210
- */
211
- this.emit("full_message_body", fullMessageBody);
212
- this._decodeMessageBody(fullMessageBody);
213
- // be ready for next block
214
- this._init_new();
215
- return true;
216
- }
217
- else if (messageHeader.isFinal === "A") {
218
- return this._report_error(status_codes_1.StatusCodes2.BadRequestInterrupted, "received and Abort Message");
219
- }
220
- else if (messageHeader.isFinal === "C") {
221
- return this._append(chunk);
222
- }
223
- return false;
224
- }
225
- }
226
- exports.MessageBuilderBase = MessageBuilderBase;
227
- MessageBuilderBase.defaultMaxChunkCount = 1000;
228
- MessageBuilderBase.defaultMaxMessageSize = 1024 * 64;
229
- MessageBuilderBase.defaultMaxChunkSize = 1024 * 8;
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_binary_stream_1 = require("node-opcua-binary-stream");
10
+ const node_opcua_buffer_utils_1 = require("node-opcua-buffer-utils");
11
+ const node_opcua_chunkmanager_1 = require("node-opcua-chunkmanager");
12
+ const node_opcua_debug_1 = require("node-opcua-debug");
13
+ const node_opcua_packet_assembler_1 = require("node-opcua-packet-assembler");
14
+ const node_opcua_utils_1 = require("node-opcua-utils");
15
+ const status_codes_1 = require("./status_codes");
16
+ const doPerfMonitoring = process.env.NODEOPCUADEBUG && process.env.NODEOPCUADEBUG.indexOf("PERF") >= 0;
17
+ const errorLog = (0, node_opcua_debug_1.make_errorLog)("MessageBuilder");
18
+ const debugLog = (0, node_opcua_debug_1.make_debugLog)("MessageBuilder");
19
+ const warningLog = (0, node_opcua_debug_1.make_warningLog)("MessageBuilder");
20
+ function readRawMessageHeader(data) {
21
+ const messageHeader = (0, node_opcua_chunkmanager_1.readMessageHeader)(new node_opcua_binary_stream_1.BinaryStream(data));
22
+ return {
23
+ extra: "",
24
+ length: messageHeader.length,
25
+ messageHeader
26
+ };
27
+ }
28
+ exports.readRawMessageHeader = readRawMessageHeader;
29
+ /**
30
+ * @class MessageBuilderBase
31
+ * @extends EventEmitter
32
+ * @uses PacketAssembler
33
+ * @constructor
34
+ * @param options {Object}
35
+ * @param [options.signatureLength=0] {number}
36
+ *
37
+ */
38
+ class MessageBuilderBase extends events_1.EventEmitter {
39
+ constructor(options) {
40
+ super();
41
+ this.id = "";
42
+ this._tick0 = 0;
43
+ this._tick1 = 0;
44
+ this._hasReceivedError = false;
45
+ this.blocks = [];
46
+ this.messageChunks = [];
47
+ this._expectedChannelId = 0;
48
+ options = options || {
49
+ maxMessageSize: 0,
50
+ maxChunkCount: 0,
51
+ maxChunkSize: 0
52
+ };
53
+ this.signatureLength = options.signatureLength || 0;
54
+ this.maxMessageSize = options.maxMessageSize || MessageBuilderBase.defaultMaxMessageSize;
55
+ this.maxChunkCount = options.maxChunkCount || MessageBuilderBase.defaultMaxChunkCount;
56
+ this.maxChunkSize = options.maxChunkSize || MessageBuilderBase.defaultMaxChunkSize;
57
+ this.options = options;
58
+ this._packetAssembler = new node_opcua_packet_assembler_1.PacketAssembler({
59
+ minimumSizeInBytes: 8,
60
+ maxChunkSize: this.maxChunkSize,
61
+ readChunkFunc: readRawMessageHeader
62
+ });
63
+ this._packetAssembler.on("chunk", (messageChunk) => this._feed_messageChunk(messageChunk));
64
+ this._packetAssembler.on("startChunk", (info, data) => {
65
+ if (doPerfMonitoring) {
66
+ // record tick 0: when the first data is received
67
+ this._tick0 = (0, node_opcua_utils_1.get_clock_tick)();
68
+ }
69
+ /**
70
+ *
71
+ * notify the observers that a new message is being built
72
+ * @event start_chunk
73
+ * @param info
74
+ * @param data
75
+ */
76
+ this.emit("startChunk", info, data);
77
+ });
78
+ this._packetAssembler.on("error", (err) => {
79
+ warningLog("packet assembler ", err.message);
80
+ return this._report_error(status_codes_1.StatusCodes2.BadTcpMessageTooLarge, "packet assembler: " + err.message);
81
+ });
82
+ this._securityDefeated = false;
83
+ this.totalBodySize = 0;
84
+ this.totalMessageSize = 0;
85
+ this.channelId = 0;
86
+ this.offsetBodyStart = 0;
87
+ this.sequenceHeader = null;
88
+ this._init_new();
89
+ }
90
+ dispose() {
91
+ this.removeAllListeners();
92
+ }
93
+ /**
94
+ * Feed message builder with some data
95
+ * @method feed
96
+ * @param data
97
+ */
98
+ feed(data) {
99
+ if (!this._securityDefeated && !this._hasReceivedError) {
100
+ this._packetAssembler.feed(data);
101
+ }
102
+ }
103
+ _decodeMessageBody(fullMessageBody) {
104
+ return true;
105
+ }
106
+ _read_headers(binaryStream) {
107
+ try {
108
+ this.messageHeader = (0, node_opcua_chunkmanager_1.readMessageHeader)(binaryStream);
109
+ (0, node_opcua_assert_1.assert)(binaryStream.length === 8, "expecting message header to be 8 bytes");
110
+ this.channelId = binaryStream.readUInt32();
111
+ (0, node_opcua_assert_1.assert)(binaryStream.length === 12);
112
+ // verifying secure ChannelId
113
+ if (this._expectedChannelId && this.channelId !== this._expectedChannelId) {
114
+ return this._report_error(status_codes_1.StatusCodes2.BadTcpSecureChannelUnknown, "Invalid secure channel Id");
115
+ }
116
+ return true;
117
+ }
118
+ catch (err) {
119
+ return this._report_error(status_codes_1.StatusCodes2.BadTcpInternalError, "_read_headers error " + err.message);
120
+ }
121
+ }
122
+ _report_error(statusCode, errorMessage) {
123
+ this._hasReceivedError = true;
124
+ /**
125
+ * notify the observers that an error has occurred
126
+ * @event error
127
+ * @param error the error to raise
128
+ */
129
+ debugLog("Error ", this.id, errorMessage);
130
+ // xx errorLog(new Error());
131
+ this.emit("error", new Error(errorMessage), statusCode, this.sequenceHeader ? this.sequenceHeader.requestId : null);
132
+ return false;
133
+ }
134
+ _init_new() {
135
+ this._securityDefeated = false;
136
+ this._hasReceivedError = false;
137
+ this.totalBodySize = 0;
138
+ this.totalMessageSize = 0;
139
+ this.blocks = [];
140
+ this.messageChunks = [];
141
+ }
142
+ /**
143
+ * append a message chunk
144
+ * @method _append
145
+ * @param chunk
146
+ * @private
147
+ */
148
+ _append(chunk) {
149
+ if (this._hasReceivedError) {
150
+ // the message builder is in error mode and further message chunks should be discarded.
151
+ return false;
152
+ }
153
+ if (this.messageChunks.length + 1 > this.maxChunkCount) {
154
+ return this._report_error(status_codes_1.StatusCodes2.BadTcpMessageTooLarge, `max chunk count exceeded: ${this.maxChunkCount}`);
155
+ }
156
+ this.messageChunks.push(chunk);
157
+ this.totalMessageSize += chunk.length;
158
+ if (this.totalMessageSize > this.maxMessageSize) {
159
+ return this._report_error(status_codes_1.StatusCodes2.BadTcpMessageTooLarge, `max message size exceeded: ${this.maxMessageSize}`);
160
+ }
161
+ const binaryStream = new node_opcua_binary_stream_1.BinaryStream(chunk);
162
+ if (!this._read_headers(binaryStream)) {
163
+ return this._report_error(status_codes_1.StatusCodes2.BadTcpInternalError, `Invalid message header detected`);
164
+ }
165
+ (0, node_opcua_assert_1.assert)(binaryStream.length >= 12);
166
+ // verify message chunk length
167
+ if (this.messageHeader.length !== chunk.length) {
168
+ // tslint:disable:max-line-length
169
+ 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}`);
170
+ }
171
+ // the start of the message body block
172
+ const offsetBodyStart = binaryStream.length;
173
+ // the end of the message body block
174
+ const offsetBodyEnd = binaryStream.buffer.length;
175
+ this.totalBodySize += offsetBodyEnd - offsetBodyStart;
176
+ this.offsetBodyStart = offsetBodyStart;
177
+ // add message body to a queue
178
+ // note : Buffer.slice create a shared memory !
179
+ // use Buffer.clone
180
+ const sharedBuffer = chunk.slice(this.offsetBodyStart, offsetBodyEnd);
181
+ const clonedBuffer = (0, node_opcua_buffer_utils_1.createFastUninitializedBuffer)(sharedBuffer.length);
182
+ sharedBuffer.copy(clonedBuffer, 0, 0);
183
+ this.blocks.push(clonedBuffer);
184
+ return true;
185
+ }
186
+ _feed_messageChunk(chunk) {
187
+ (0, node_opcua_assert_1.assert)(chunk);
188
+ const messageHeader = (0, node_opcua_chunkmanager_1.readMessageHeader)(new node_opcua_binary_stream_1.BinaryStream(chunk));
189
+ /**
190
+ * notify the observers that new message chunk has been received
191
+ * @event chunk
192
+ * @param messageChunk the raw message chunk
193
+ */
194
+ this.emit("chunk", chunk);
195
+ if (messageHeader.isFinal === "F") {
196
+ // last message
197
+ this._append(chunk);
198
+ if (this._hasReceivedError) {
199
+ return false;
200
+ }
201
+ const fullMessageBody = this.blocks.length === 1 ? this.blocks[0] : Buffer.concat(this.blocks);
202
+ if (doPerfMonitoring) {
203
+ // record tick 1: when a complete message has been received ( all chunks assembled)
204
+ this._tick1 = (0, node_opcua_utils_1.get_clock_tick)();
205
+ }
206
+ /**
207
+ * notify the observers that a full message has been received
208
+ * @event full_message_body
209
+ * @param full_message_body the full message body made of all concatenated chunks.
210
+ */
211
+ this.emit("full_message_body", fullMessageBody);
212
+ this._decodeMessageBody(fullMessageBody);
213
+ // be ready for next block
214
+ this._init_new();
215
+ return true;
216
+ }
217
+ else if (messageHeader.isFinal === "A") {
218
+ return this._report_error(status_codes_1.StatusCodes2.BadRequestInterrupted, "received and Abort Message");
219
+ }
220
+ else if (messageHeader.isFinal === "C") {
221
+ return this._append(chunk);
222
+ }
223
+ return false;
224
+ }
225
+ }
226
+ exports.MessageBuilderBase = MessageBuilderBase;
227
+ MessageBuilderBase.defaultMaxChunkCount = 1000;
228
+ MessageBuilderBase.defaultMaxMessageSize = 1024 * 64;
229
+ MessageBuilderBase.defaultMaxChunkSize = 1024 * 8;
230
230
  //# sourceMappingURL=message_builder_base.js.map
@@ -1,44 +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
- }
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
+ }