node-opcua-server-discovery 2.178.0 → 2.180.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/mdns_responder.d.ts +3 -0
- package/dist/mdns_responder.js +12 -8
- package/dist/mdns_responder.js.map +1 -1
- package/dist/opcua_discovery_server.d.ts +5 -2
- package/dist/opcua_discovery_server.js +75 -45
- package/dist/opcua_discovery_server.js.map +1 -1
- package/package.json +14 -14
- package/source/mdns_responder.ts +15 -11
- package/source/opcua_discovery_server.ts +130 -134
package/dist/mdns_responder.d.ts
CHANGED
package/dist/mdns_responder.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MDNSResponder = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @module node-opcua-server-discovery
|
|
6
4
|
*/
|
|
7
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MDNSResponder = void 0;
|
|
8
7
|
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
9
8
|
const node_opcua_object_registry_1 = require("node-opcua-object-registry");
|
|
10
9
|
const node_opcua_service_discovery_1 = require("node-opcua-service-discovery");
|
|
10
|
+
const sterfive_bonjour_service_1 = require("sterfive-bonjour-service");
|
|
11
11
|
const debugLog = (0, node_opcua_debug_1.make_debugLog)("LDSSERVER");
|
|
12
12
|
const doDebug = (0, node_opcua_debug_1.checkDebugFlag)("LDSSERVER") || true;
|
|
13
13
|
const registry = new node_opcua_object_registry_1.ObjectRegistry();
|
|
@@ -58,7 +58,8 @@ class MDNSResponder {
|
|
|
58
58
|
// },
|
|
59
59
|
const existingIndex = findServiceIndex(service.name);
|
|
60
60
|
if (existingIndex >= 0) {
|
|
61
|
-
|
|
61
|
+
// c8 ignore next
|
|
62
|
+
doDebug && debugLog("Ignoring existing server ", service.name);
|
|
62
63
|
return;
|
|
63
64
|
}
|
|
64
65
|
this.#recordId++;
|
|
@@ -72,7 +73,7 @@ class MDNSResponder {
|
|
|
72
73
|
.map((x) => x.toUpperCase())
|
|
73
74
|
.sort();
|
|
74
75
|
const path = service_txt.path || "";
|
|
75
|
-
const discoveryUrl =
|
|
76
|
+
const discoveryUrl = `opc.tcp://${service.host}:${service.port}${path}`;
|
|
76
77
|
this.registeredServers.push(new node_opcua_service_discovery_1.ServerOnNetwork({
|
|
77
78
|
discoveryUrl,
|
|
78
79
|
recordId,
|
|
@@ -80,14 +81,17 @@ class MDNSResponder {
|
|
|
80
81
|
serverName
|
|
81
82
|
}));
|
|
82
83
|
this.lastUpdateDate = new Date(Date.now());
|
|
83
|
-
|
|
84
|
+
// c8 ignore next
|
|
85
|
+
doDebug && debugLog("a new OPCUA server has been registered on mDNS", service.name, recordId);
|
|
84
86
|
};
|
|
85
87
|
const removeService = (service) => {
|
|
86
88
|
const serverName = service.name;
|
|
87
|
-
|
|
89
|
+
// c8 ignore next
|
|
90
|
+
doDebug && debugLog("a OPCUA server has been unregistered in mDNS", serverName);
|
|
88
91
|
const index = findServiceIndex(serverName);
|
|
89
92
|
if (index === -1) {
|
|
90
|
-
|
|
93
|
+
// c8 ignore next
|
|
94
|
+
doDebug && debugLog("Cannot find server with name ", serverName, " in registeredServers");
|
|
91
95
|
return;
|
|
92
96
|
}
|
|
93
97
|
this.registeredServers.splice(index, 1); // remove element at index
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdns_responder.js","sourceRoot":"","sources":["../source/mdns_responder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mdns_responder.js","sourceRoot":"","sources":["../source/mdns_responder.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,uDAAiE;AACjE,2EAA4D;AAC5D,+EAAgF;AAChF,uEAA+E;AAE/E,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,WAAW,CAAC,CAAC;AAC5C,MAAM,OAAO,GAAG,IAA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CAAC,YAAY,GAAG,SAAS,CAAC;QAClC,CAAC;QACD,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YAChC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,GAAG,EAAE;gBAC5B,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE;oBACvB,OAAO,EAAE,CAAC;gBACd,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QACH,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC1B,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;IACnE,CAAC;CACJ;AArID,sCAqIC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @module node-opcua-server-discovery
|
|
3
3
|
*/
|
|
4
4
|
import { type Message, type MessageSecurityMode, type SecurityPolicy, type ServerSecureChannelLayer } from "node-opcua-secure-channel";
|
|
5
|
-
import { OPCUABaseServer, OPCUABaseServerEvents, type OPCUABaseServerOptions } from "node-opcua-server";
|
|
5
|
+
import { OPCUABaseServer, type OPCUABaseServerEvents, type OPCUABaseServerOptions } from "node-opcua-server";
|
|
6
6
|
import { BonjourHolder, MdnsDiscoveryConfiguration, type RegisteredServer } from "node-opcua-service-discovery";
|
|
7
7
|
import { ApplicationDescription, type ApplicationDescriptionOptions } from "node-opcua-service-endpoints";
|
|
8
8
|
import { MDNSResponder } from "./mdns_responder";
|
|
@@ -17,7 +17,10 @@ export interface OPCUADiscoveryServerOptions extends OPCUABaseServerOptions {
|
|
|
17
17
|
interface RegisteredServerExtended extends RegisteredServer {
|
|
18
18
|
bonjourHolder: BonjourHolder;
|
|
19
19
|
serverInfo: ApplicationDescriptionOptions;
|
|
20
|
-
discoveryConfiguration?:
|
|
20
|
+
discoveryConfiguration?: MdnsDiscoveryConfigurationExtended[];
|
|
21
|
+
}
|
|
22
|
+
interface MdnsDiscoveryConfigurationExtended extends MdnsDiscoveryConfiguration {
|
|
23
|
+
bonjourHolder?: BonjourHolder;
|
|
21
24
|
}
|
|
22
25
|
type RegisterServerMap = Map<string, RegisteredServerExtended>;
|
|
23
26
|
export interface OPCUADiscoveryServerEvents extends OPCUABaseServerEvents {
|
|
@@ -104,9 +104,9 @@ class OPCUADiscoveryServer extends node_opcua_server_1.OPCUABaseServer {
|
|
|
104
104
|
(0, node_opcua_assert_1.assert)(!this.mDnsResponder);
|
|
105
105
|
(0, node_opcua_assert_1.assert)(Array.isArray(this.capabilitiesForMDNS));
|
|
106
106
|
this._preInitTask.push(async () => {
|
|
107
|
-
await this._delayInit();
|
|
107
|
+
await this._delayInit?.();
|
|
108
108
|
});
|
|
109
|
-
await new Promise((resolve, reject) => super.start((err) => err ? reject(err) : resolve()));
|
|
109
|
+
await new Promise((resolve, reject) => super.start((err) => (err ? reject(err) : resolve())));
|
|
110
110
|
const endpointUri = this.getEndpointUrl();
|
|
111
111
|
const { hostname } = new node_url_1.URL(endpointUri);
|
|
112
112
|
this.mDnsResponder = new mdns_responder_1.MDNSResponder();
|
|
@@ -124,26 +124,33 @@ class OPCUADiscoveryServer extends node_opcua_server_1.OPCUABaseServer {
|
|
|
124
124
|
if (this.#shutting_down)
|
|
125
125
|
return;
|
|
126
126
|
this.#shutting_down = true;
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
// c8 ignore next
|
|
128
|
+
doDebug && debugLog("stopping announcement of LDS on mDNS");
|
|
129
|
+
//
|
|
129
130
|
for (const registeredServer of this.registeredServers.values()) {
|
|
130
|
-
|
|
131
|
+
// c8 ignore next
|
|
132
|
+
doDebug && debugLog("LDS is shutting down and is forcefuly unregistering server", registeredServer.serverUri);
|
|
131
133
|
await this.#internalRegisterServerOffline(registeredServer, true);
|
|
132
134
|
}
|
|
133
135
|
if (this.mDnsResponder) {
|
|
134
|
-
|
|
136
|
+
// c8 ignore next
|
|
137
|
+
doDebug && debugLog("disposing mDnsResponder");
|
|
135
138
|
await this.mDnsResponder.dispose();
|
|
136
139
|
this.mDnsResponder = undefined;
|
|
137
|
-
|
|
140
|
+
// c8 ignore next
|
|
141
|
+
doDebug && debugLog(" mDnsResponder disposed");
|
|
138
142
|
}
|
|
139
143
|
if (this.mDnsLDSAnnouncer) {
|
|
140
|
-
|
|
144
|
+
// c8 ignore next
|
|
145
|
+
doDebug && debugLog("disposing mDnsLDSAnnouncer of this LDS to the mDNS");
|
|
141
146
|
await this.mDnsLDSAnnouncer.stopAnnouncedOnMulticastSubnet();
|
|
142
147
|
this.mDnsLDSAnnouncer = undefined;
|
|
143
148
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
149
|
+
// c8 ignore next
|
|
150
|
+
doDebug && debugLog("Shutting down Discovery Server");
|
|
151
|
+
await new Promise((resolve, reject) => super.shutdown((err) => (err ? reject(err) : resolve())));
|
|
152
|
+
// c8 ignore next
|
|
153
|
+
doDebug && debugLog("stopping announcement of LDS on mDNS - DONE");
|
|
147
154
|
// add a extra delay to ensure that the port is really closed
|
|
148
155
|
// and registered server propagated the fact that LDS is not here anymore
|
|
149
156
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
@@ -168,13 +175,15 @@ class OPCUADiscoveryServer extends node_opcua_server_1.OPCUABaseServer {
|
|
|
168
175
|
const request = message.request;
|
|
169
176
|
(0, node_opcua_assert_1.assert)(request.schema.name === "RegisterServer2Request");
|
|
170
177
|
request.discoveryConfiguration = request.discoveryConfiguration || [];
|
|
171
|
-
this.#internalRegisterServer(node_opcua_service_discovery_1.RegisterServer2Response, request.server, request.discoveryConfiguration)
|
|
178
|
+
this.#internalRegisterServer(node_opcua_service_discovery_1.RegisterServer2Response, request.server, request.discoveryConfiguration)
|
|
179
|
+
.then((response) => {
|
|
172
180
|
channel.send_response("MSG", response, message);
|
|
173
|
-
})
|
|
181
|
+
})
|
|
182
|
+
.catch((err) => {
|
|
174
183
|
errorLog("What shall I do ?", err.message);
|
|
175
184
|
errorLog(err);
|
|
176
185
|
let additional_messages = [];
|
|
177
|
-
additional_messages.push(
|
|
186
|
+
additional_messages.push(`EXCEPTION CAUGHT WHILE PROCESSING REQUEST !!! ${request.schema.name}`);
|
|
178
187
|
additional_messages.push(err.message);
|
|
179
188
|
if (err.stack) {
|
|
180
189
|
additional_messages = additional_messages.concat(err.stack.split("\n"));
|
|
@@ -188,11 +197,13 @@ class OPCUADiscoveryServer extends node_opcua_server_1.OPCUABaseServer {
|
|
|
188
197
|
(0, node_opcua_assert_1.assert)(message.request instanceof node_opcua_service_discovery_1.RegisterServerRequest);
|
|
189
198
|
const request = message.request;
|
|
190
199
|
(0, node_opcua_assert_1.assert)(request.schema.name === "RegisterServerRequest");
|
|
191
|
-
this.#internalRegisterServer(node_opcua_service_discovery_1.RegisterServerResponse, request.server, undefined)
|
|
200
|
+
this.#internalRegisterServer(node_opcua_service_discovery_1.RegisterServerResponse, request.server, undefined)
|
|
201
|
+
.then((response) => {
|
|
192
202
|
channel.send_response("MSG", response, message);
|
|
193
|
-
})
|
|
203
|
+
})
|
|
204
|
+
.catch((err) => {
|
|
194
205
|
let additional_messages = [];
|
|
195
|
-
additional_messages.push(
|
|
206
|
+
additional_messages.push(`EXCEPTION CAUGHT WHILE PROCESSING REQUEST !!! ${request.schema.name}`);
|
|
196
207
|
additional_messages.push(err.message);
|
|
197
208
|
if (err.stack) {
|
|
198
209
|
additional_messages = additional_messages.concat(err.stack.split("\n"));
|
|
@@ -249,13 +260,15 @@ class OPCUADiscoveryServer extends node_opcua_server_1.OPCUABaseServer {
|
|
|
249
260
|
const servers = [];
|
|
250
261
|
request.serverCapabilityFilter = request.serverCapabilityFilter || [];
|
|
251
262
|
const serverCapabilityFilter = request.serverCapabilityFilter
|
|
252
|
-
.map((x) => x
|
|
263
|
+
.map((x) => x?.toUpperCase())
|
|
253
264
|
.sort()
|
|
254
265
|
.join(" ");
|
|
255
|
-
|
|
266
|
+
// c8 ignore next
|
|
267
|
+
doDebug && debugLog(" startingRecordId = ", request.startingRecordId);
|
|
256
268
|
if (this.mDnsResponder) {
|
|
257
269
|
for (const serverOnNetwork of this.mDnsResponder.registeredServers) {
|
|
258
|
-
|
|
270
|
+
// c8 ignore next
|
|
271
|
+
doDebug && debugLog("Exploring server ", serverOnNetwork.serverName);
|
|
259
272
|
if (serverOnNetwork.recordId <= request.startingRecordId) {
|
|
260
273
|
continue;
|
|
261
274
|
}
|
|
@@ -266,10 +279,12 @@ class OPCUADiscoveryServer extends node_opcua_server_1.OPCUABaseServer {
|
|
|
266
279
|
}
|
|
267
280
|
continue;
|
|
268
281
|
}
|
|
269
|
-
|
|
282
|
+
// c8 ignore next
|
|
283
|
+
doDebug && debugLog(" server ", serverOnNetwork.serverName, " found");
|
|
270
284
|
servers.push(serverOnNetwork);
|
|
271
285
|
if (servers.length === request.maxRecordsToReturn) {
|
|
272
|
-
|
|
286
|
+
// c8 ignore next
|
|
287
|
+
doDebug && debugLog("max records to return reached", request.maxRecordsToReturn);
|
|
273
288
|
break;
|
|
274
289
|
}
|
|
275
290
|
}
|
|
@@ -282,15 +297,19 @@ class OPCUADiscoveryServer extends node_opcua_server_1.OPCUABaseServer {
|
|
|
282
297
|
}
|
|
283
298
|
async #stopAnnouncedOnMulticastSubnet(conf) {
|
|
284
299
|
const b = conf.bonjourHolder;
|
|
300
|
+
if (!b) {
|
|
301
|
+
throw new Error("#stopAnnouncedOnMulticastSubnet: conf has no bonjourHolder");
|
|
302
|
+
}
|
|
285
303
|
await b.stopAnnouncedOnMulticastSubnet();
|
|
286
304
|
conf.bonjourHolder = undefined;
|
|
287
305
|
}
|
|
288
306
|
async #announcedOnMulticastSubnet(conf, announcement) {
|
|
289
307
|
const serviceConfig = (0, node_opcua_service_discovery_1.announcementToServiceConfig)(announcement);
|
|
290
308
|
let b = conf.bonjourHolder;
|
|
291
|
-
if (b
|
|
309
|
+
if (b?.serviceConfig) {
|
|
292
310
|
if ((0, node_opcua_service_discovery_1.isSameService)(b.serviceConfig, serviceConfig)) {
|
|
293
|
-
|
|
311
|
+
// c8 ignore next
|
|
312
|
+
doDebug && debugLog("Configuration ", conf.mdnsServerName, " has not changed !");
|
|
294
313
|
// nothing to do
|
|
295
314
|
return;
|
|
296
315
|
}
|
|
@@ -310,14 +329,14 @@ class OPCUADiscoveryServer extends node_opcua_server_1.OPCUABaseServer {
|
|
|
310
329
|
}
|
|
311
330
|
async #dealWithDiscoveryConfiguration(previousConfMap, server1, serverInfo, discoveryConfiguration) {
|
|
312
331
|
// mdnsServerName String The name of the Server when it is announced via mDNS.
|
|
313
|
-
// See Part 12 for the details about mDNS. This string shall be
|
|
332
|
+
// See Part 12 for the details about mDNS. This string shall be
|
|
314
333
|
// less than 64 bytes.
|
|
315
|
-
// If not specified the first element of the serverNames array
|
|
334
|
+
// If not specified the first element of the serverNames array
|
|
316
335
|
// is used (truncated to 63 bytes if necessary).
|
|
317
336
|
// serverCapabilities [] String The set of Server capabilities supported by the Server.
|
|
318
337
|
// A Server capability is a short identifier for a feature
|
|
319
338
|
// The set of allowed Server capabilities are defined in Part 12.
|
|
320
|
-
discoveryConfiguration.mdnsServerName ??= server1.serverNames[0].text;
|
|
339
|
+
discoveryConfiguration.mdnsServerName ??= server1.serverNames?.[0].text || null;
|
|
321
340
|
serverInfo.discoveryUrls ??= [];
|
|
322
341
|
const endpointUrl = serverInfo.discoveryUrls[0] || this.getEndpointUrl();
|
|
323
342
|
const parsedUrl = new node_url_1.URL(endpointUrl);
|
|
@@ -331,10 +350,11 @@ class OPCUADiscoveryServer extends node_opcua_server_1.OPCUABaseServer {
|
|
|
331
350
|
};
|
|
332
351
|
if (previousConfMap.has(discoveryConfiguration.mdnsServerName || "")) {
|
|
333
352
|
// configuration already exists
|
|
334
|
-
|
|
353
|
+
// c8 ignore next
|
|
354
|
+
doDebug && debugLog("Configuration ", discoveryConfiguration.mdnsServerName, " already exists !");
|
|
335
355
|
const prevConf = previousConfMap.get(discoveryConfiguration.mdnsServerName || "");
|
|
336
356
|
previousConfMap.delete(discoveryConfiguration.mdnsServerName || "");
|
|
337
|
-
discoveryConfiguration.bonjourHolder = prevConf
|
|
357
|
+
discoveryConfiguration.bonjourHolder = prevConf?.bonjourHolder;
|
|
338
358
|
}
|
|
339
359
|
// let's announce the server on the multicast DNS
|
|
340
360
|
await this.#announcedOnMulticastSubnet(discoveryConfiguration, announcement);
|
|
@@ -359,7 +379,8 @@ class OPCUADiscoveryServer extends node_opcua_server_1.OPCUABaseServer {
|
|
|
359
379
|
if (!serverToUnregister) {
|
|
360
380
|
throw new Error("internal error");
|
|
361
381
|
}
|
|
362
|
-
|
|
382
|
+
// c8 ignore next
|
|
383
|
+
doDebug && debugLog(chalk_1.default.cyan("unregistering server : "), chalk_1.default.yellow(serverToUnregister?.serverUri));
|
|
363
384
|
configurationResults = [];
|
|
364
385
|
const discoveryConfigurations = serverToUnregister?.discoveryConfiguration || [];
|
|
365
386
|
for (const conf of discoveryConfigurations) {
|
|
@@ -374,12 +395,16 @@ class OPCUADiscoveryServer extends node_opcua_server_1.OPCUABaseServer {
|
|
|
374
395
|
}
|
|
375
396
|
async #internalRegisterServerOnline(server, discoveryConfigurations) {
|
|
376
397
|
(0, node_opcua_assert_1.assert)(discoveryConfigurations);
|
|
398
|
+
if (!server.serverUri) {
|
|
399
|
+
throw new Error("#internalRegisterServerOnline: server.serverUri is required");
|
|
400
|
+
}
|
|
377
401
|
const key = server.serverUri;
|
|
378
402
|
let configurationResults = null;
|
|
379
|
-
|
|
403
|
+
// c8 ignore next
|
|
404
|
+
doDebug && debugLog(chalk_1.default.cyan(" registering server : "), chalk_1.default.yellow(server.serverUri));
|
|
380
405
|
// prepare serverInfo which will be used by FindServers
|
|
381
406
|
const serverInfo = {
|
|
382
|
-
applicationName: server.serverNames[0], // which one shall we use ?
|
|
407
|
+
applicationName: server.serverNames?.[0], // which one shall we use ?
|
|
383
408
|
applicationType: server.serverType,
|
|
384
409
|
applicationUri: server.serverUri,
|
|
385
410
|
discoveryUrls: server.discoveryUrls,
|
|
@@ -388,13 +413,15 @@ class OPCUADiscoveryServer extends node_opcua_server_1.OPCUABaseServer {
|
|
|
388
413
|
// XXX ?????? serverInfo.discoveryProfileUri = serverInfo.discoveryProfileUri;
|
|
389
414
|
};
|
|
390
415
|
const previousConfMap = new Map();
|
|
391
|
-
// let check in the server has already been registed on this LDS
|
|
416
|
+
// let check in the server has already been registed on this LDS
|
|
392
417
|
let firstTimeRegistration = true;
|
|
393
|
-
|
|
418
|
+
const previousServer = this.registeredServers.get(key);
|
|
419
|
+
if (previousServer) {
|
|
394
420
|
// server already exists and must only be updated
|
|
395
|
-
const previousServer
|
|
396
|
-
|
|
397
|
-
|
|
421
|
+
for (const conf of previousServer.discoveryConfiguration || []) {
|
|
422
|
+
if (conf.mdnsServerName) {
|
|
423
|
+
previousConfMap.set(conf.mdnsServerName, conf);
|
|
424
|
+
}
|
|
398
425
|
}
|
|
399
426
|
firstTimeRegistration = false;
|
|
400
427
|
}
|
|
@@ -411,15 +438,16 @@ class OPCUADiscoveryServer extends node_opcua_server_1.OPCUABaseServer {
|
|
|
411
438
|
}
|
|
412
439
|
// now also unregister unprocessed
|
|
413
440
|
if (previousConfMap.size !== 0) {
|
|
414
|
-
|
|
441
|
+
// c8 ignore next
|
|
442
|
+
doDebug && debugLog(" Warning some conf need to be removed !");
|
|
415
443
|
}
|
|
416
444
|
return configurationResults;
|
|
417
445
|
}
|
|
418
|
-
// eslint-disable-next-line max-statements
|
|
419
446
|
async #internalRegisterServer(RegisterServerXResponse, rawServer, discoveryConfigurations) {
|
|
420
447
|
// #region check parameter validity
|
|
421
448
|
function sendError(statusCode) {
|
|
422
|
-
|
|
449
|
+
// c8 ignore next
|
|
450
|
+
doDebug && debugLog(chalk_1.default.red("_on_RegisterServer(2)Request error"), statusCode.toString());
|
|
423
451
|
const response1 = new node_opcua_secure_channel_1.ServiceFault({
|
|
424
452
|
responseHeader: { serviceResult: statusCode }
|
|
425
453
|
});
|
|
@@ -431,11 +459,13 @@ class OPCUADiscoveryServer extends node_opcua_server_1.OPCUABaseServer {
|
|
|
431
459
|
const server = rawServer;
|
|
432
460
|
// check serverType is valid
|
|
433
461
|
if (!_isValidServerType(server.serverType)) {
|
|
434
|
-
|
|
462
|
+
// c8 ignore next
|
|
463
|
+
doDebug && debugLog("Invalid server Type", node_opcua_service_endpoints_1.ApplicationType[server.serverType]);
|
|
435
464
|
return sendError(node_opcua_status_code_1.StatusCodes.BadInvalidArgument);
|
|
436
465
|
}
|
|
437
466
|
if (!server.serverUri) {
|
|
438
|
-
|
|
467
|
+
// c8 ignore next
|
|
468
|
+
doDebug && debugLog("Missing serverURI");
|
|
439
469
|
return sendError(node_opcua_status_code_1.StatusCodes.BadInvalidArgument);
|
|
440
470
|
}
|
|
441
471
|
server.serverNames = server.serverNames || [];
|
|
@@ -459,9 +489,9 @@ class OPCUADiscoveryServer extends node_opcua_server_1.OPCUABaseServer {
|
|
|
459
489
|
})
|
|
460
490
|
];
|
|
461
491
|
}
|
|
462
|
-
const configurationResults = server?.isOnline
|
|
463
|
-
await this.#internalRegisterServerOnline(server, discoveryConfigurations)
|
|
464
|
-
await this.#internalRegisterServerOffline(server, false);
|
|
492
|
+
const configurationResults = server?.isOnline
|
|
493
|
+
? await this.#internalRegisterServerOnline(server, discoveryConfigurations)
|
|
494
|
+
: await this.#internalRegisterServerOffline(server, false);
|
|
465
495
|
const response = new RegisterServerXResponse({});
|
|
466
496
|
if (response instanceof node_opcua_service_discovery_1.RegisterServer2Response) {
|
|
467
497
|
response.configurationResults = configurationResults;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opcua_discovery_server.js","sourceRoot":"","sources":["../source/opcua_discovery_server.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;AAGH,sDAAyB;AACzB,0DAA6B;AAC7B,uCAA+B;AAC/B,kDAA0B;AAC1B,0DAAiC;AACjC,yDAA2C;AAE3C,mFAAyE;AACzE,yDAAuD;AACvD,uDAAgF;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C,OAAO,IAAI,CAAC;IACpB,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-server-discovery",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.180.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module server-discovery",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc -b",
|
|
@@ -13,17 +13,17 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"chalk": "4.1.2",
|
|
15
15
|
"env-paths": "2.2.1",
|
|
16
|
-
"node-opcua-assert": "2.
|
|
17
|
-
"node-opcua-basic-types": "2.
|
|
18
|
-
"node-opcua-certificate-manager": "2.
|
|
19
|
-
"node-opcua-common": "2.
|
|
20
|
-
"node-opcua-debug": "2.
|
|
21
|
-
"node-opcua-object-registry": "2.
|
|
22
|
-
"node-opcua-secure-channel": "2.
|
|
23
|
-
"node-opcua-server": "2.
|
|
24
|
-
"node-opcua-service-discovery": "2.
|
|
25
|
-
"node-opcua-service-endpoints": "2.
|
|
26
|
-
"node-opcua-status-code": "2.
|
|
16
|
+
"node-opcua-assert": "2.179.0",
|
|
17
|
+
"node-opcua-basic-types": "2.180.0",
|
|
18
|
+
"node-opcua-certificate-manager": "2.180.0",
|
|
19
|
+
"node-opcua-common": "2.180.0",
|
|
20
|
+
"node-opcua-debug": "2.179.0",
|
|
21
|
+
"node-opcua-object-registry": "2.179.0",
|
|
22
|
+
"node-opcua-secure-channel": "2.180.0",
|
|
23
|
+
"node-opcua-server": "2.180.0",
|
|
24
|
+
"node-opcua-service-discovery": "2.180.0",
|
|
25
|
+
"node-opcua-service-endpoints": "2.180.0",
|
|
26
|
+
"node-opcua-status-code": "2.180.0",
|
|
27
27
|
"sterfive-bonjour-service": "1.1.4",
|
|
28
28
|
"thenify-ex": "4.4.0"
|
|
29
29
|
},
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"internet of things"
|
|
43
43
|
],
|
|
44
44
|
"homepage": "http://node-opcua.github.io/",
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "11ad1e0894355cd279e19443c6c9a4fc090e7d7a",
|
|
46
46
|
"files": [
|
|
47
47
|
"dist",
|
|
48
48
|
"source"
|
|
49
49
|
],
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"node-opcua-pki": "6.
|
|
51
|
+
"node-opcua-pki": "6.21.0"
|
|
52
52
|
}
|
|
53
53
|
}
|
package/source/mdns_responder.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module node-opcua-server-discovery
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
import { checkDebugFlag, make_debugLog } from "node-opcua-debug";
|
|
6
6
|
import { ObjectRegistry } from "node-opcua-object-registry";
|
|
7
7
|
import { ServerOnNetwork, serviceToString } from "node-opcua-service-discovery";
|
|
8
|
+
import { Bonjour, type Browser, type Service } from "sterfive-bonjour-service";
|
|
8
9
|
|
|
9
10
|
const debugLog = make_debugLog("LDSSERVER");
|
|
10
11
|
const doDebug = checkDebugFlag("LDSSERVER") || true;
|
|
@@ -18,7 +19,7 @@ export class MDNSResponder {
|
|
|
18
19
|
public registeredServers: ServerOnNetwork[];
|
|
19
20
|
|
|
20
21
|
#bonjour: Bonjour;
|
|
21
|
-
#mDNSBrowser: Browser;
|
|
22
|
+
#mDNSBrowser: Browser | undefined;
|
|
22
23
|
|
|
23
24
|
#recordId: number;
|
|
24
25
|
public lastUpdateDate: Date = new Date();
|
|
@@ -68,7 +69,8 @@ export class MDNSResponder {
|
|
|
68
69
|
|
|
69
70
|
const existingIndex = findServiceIndex(service.name);
|
|
70
71
|
if (existingIndex >= 0) {
|
|
71
|
-
|
|
72
|
+
// c8 ignore next
|
|
73
|
+
doDebug && debugLog("Ignoring existing server ", service.name);
|
|
72
74
|
return;
|
|
73
75
|
}
|
|
74
76
|
|
|
@@ -77,7 +79,7 @@ export class MDNSResponder {
|
|
|
77
79
|
const serverName = service.name;
|
|
78
80
|
|
|
79
81
|
service.txt = service.txt || {};
|
|
80
|
-
const service_txt = service.txt
|
|
82
|
+
const service_txt = service.txt;
|
|
81
83
|
service_txt.caps = service_txt.caps || "";
|
|
82
84
|
const serverCapabilities = service_txt.caps
|
|
83
85
|
.split(",")
|
|
@@ -85,7 +87,7 @@ export class MDNSResponder {
|
|
|
85
87
|
.sort();
|
|
86
88
|
|
|
87
89
|
const path = service_txt.path || "";
|
|
88
|
-
const discoveryUrl =
|
|
90
|
+
const discoveryUrl = `opc.tcp://${service.host}:${service.port}${path}`;
|
|
89
91
|
|
|
90
92
|
this.registeredServers.push(
|
|
91
93
|
new ServerOnNetwork({
|
|
@@ -97,15 +99,18 @@ export class MDNSResponder {
|
|
|
97
99
|
);
|
|
98
100
|
this.lastUpdateDate = new Date(Date.now());
|
|
99
101
|
|
|
100
|
-
|
|
102
|
+
// c8 ignore next
|
|
103
|
+
doDebug && debugLog("a new OPCUA server has been registered on mDNS", service.name, recordId);
|
|
101
104
|
};
|
|
102
105
|
|
|
103
106
|
const removeService = (service: Service) => {
|
|
104
107
|
const serverName = service.name;
|
|
105
|
-
|
|
108
|
+
// c8 ignore next
|
|
109
|
+
doDebug && debugLog("a OPCUA server has been unregistered in mDNS", serverName);
|
|
106
110
|
const index = findServiceIndex(serverName);
|
|
107
111
|
if (index === -1) {
|
|
108
|
-
|
|
112
|
+
// c8 ignore next
|
|
113
|
+
doDebug && debugLog("Cannot find server with name ", serverName, " in registeredServers");
|
|
109
114
|
return;
|
|
110
115
|
}
|
|
111
116
|
this.registeredServers.splice(index, 1); // remove element at index
|
|
@@ -126,17 +131,16 @@ export class MDNSResponder {
|
|
|
126
131
|
});
|
|
127
132
|
}
|
|
128
133
|
public async dispose(): Promise<void> {
|
|
129
|
-
|
|
130
134
|
if (this.#mDNSBrowser) {
|
|
131
135
|
this.#mDNSBrowser.stop();
|
|
132
|
-
this.#mDNSBrowser = undefined
|
|
136
|
+
this.#mDNSBrowser = undefined;
|
|
133
137
|
}
|
|
134
138
|
await new Promise<void>((resolve) => {
|
|
135
139
|
this.#bonjour.unpublishAll(() => {
|
|
136
140
|
this.#bonjour.destroy(() => {
|
|
137
141
|
resolve();
|
|
138
142
|
});
|
|
139
|
-
})
|
|
143
|
+
});
|
|
140
144
|
});
|
|
141
145
|
registry.unregister(this);
|
|
142
146
|
await new Promise<void>((resolve) => setTimeout(resolve, 100));
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* @module node-opcua-server-discovery
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
import os from "node:os";
|
|
7
6
|
import path from "node:path";
|
|
8
7
|
import { URL } from "node:url";
|
|
@@ -24,7 +23,7 @@ import {
|
|
|
24
23
|
import {
|
|
25
24
|
type AddStandardEndpointDescriptionsParam,
|
|
26
25
|
OPCUABaseServer,
|
|
27
|
-
OPCUABaseServerEvents,
|
|
26
|
+
type OPCUABaseServerEvents,
|
|
28
27
|
type OPCUABaseServerOptions,
|
|
29
28
|
OPCUAServerEndPoint
|
|
30
29
|
} from "node-opcua-server";
|
|
@@ -73,11 +72,16 @@ export interface OPCUADiscoveryServerOptions extends OPCUABaseServerOptions {
|
|
|
73
72
|
interface RegisteredServerExtended extends RegisteredServer {
|
|
74
73
|
bonjourHolder: BonjourHolder;
|
|
75
74
|
serverInfo: ApplicationDescriptionOptions;
|
|
76
|
-
discoveryConfiguration?:
|
|
75
|
+
discoveryConfiguration?: MdnsDiscoveryConfigurationExtended[];
|
|
77
76
|
}
|
|
78
77
|
|
|
79
|
-
|
|
78
|
+
// each discoveryConfiguration entry gets its own BonjourHolder stashed on it for
|
|
79
|
+
// the lifetime of the mDNS announcement (see #announcedOnMulticastSubnet)
|
|
80
|
+
interface MdnsDiscoveryConfigurationExtended extends MdnsDiscoveryConfiguration {
|
|
81
|
+
bonjourHolder?: BonjourHolder;
|
|
82
|
+
}
|
|
80
83
|
|
|
84
|
+
type RegisterServerMap = Map<string, RegisteredServerExtended>;
|
|
81
85
|
|
|
82
86
|
const defaultProductUri = "NodeOPCUA-LocalDiscoveryServer";
|
|
83
87
|
const defaultApplicationUri = makeApplicationUrn(os.hostname(), defaultProductUri);
|
|
@@ -134,7 +138,6 @@ export class OPCUADiscoveryServer extends OPCUABaseServer<OPCUADiscoveryServerEv
|
|
|
134
138
|
|
|
135
139
|
super(options);
|
|
136
140
|
|
|
137
|
-
|
|
138
141
|
// see OPC UA Spec 1.2 part 6 : 7.4 Well Known Addresses
|
|
139
142
|
// opc.tcp://localhost:4840/UADiscovery
|
|
140
143
|
const port = options.port || 4840;
|
|
@@ -181,12 +184,10 @@ export class OPCUADiscoveryServer extends OPCUABaseServer<OPCUADiscoveryServerEv
|
|
|
181
184
|
assert(Array.isArray(this.capabilitiesForMDNS));
|
|
182
185
|
|
|
183
186
|
this._preInitTask.push(async () => {
|
|
184
|
-
await this._delayInit
|
|
187
|
+
await this._delayInit?.();
|
|
185
188
|
});
|
|
186
189
|
|
|
187
|
-
await new Promise<void>((resolve, reject) =>
|
|
188
|
-
super.start((err?: Error | null) =>
|
|
189
|
-
err ? reject(err) : resolve()));
|
|
190
|
+
await new Promise<void>((resolve, reject) => super.start((err?: Error | null) => (err ? reject(err) : resolve())));
|
|
190
191
|
|
|
191
192
|
const endpointUri = this.getEndpointUrl();
|
|
192
193
|
const { hostname } = new URL(endpointUri);
|
|
@@ -195,50 +196,50 @@ export class OPCUADiscoveryServer extends OPCUABaseServer<OPCUADiscoveryServerEv
|
|
|
195
196
|
|
|
196
197
|
this.mDnsLDSAnnouncer = new BonjourHolder();
|
|
197
198
|
|
|
198
|
-
await this.mDnsLDSAnnouncer.announcedOnMulticastSubnet(
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
});
|
|
199
|
+
await this.mDnsLDSAnnouncer.announcedOnMulticastSubnet({
|
|
200
|
+
capabilities: this.capabilitiesForMDNS,
|
|
201
|
+
name: this.serverInfo.applicationUri || "",
|
|
202
|
+
path: "/DiscoveryServer",
|
|
203
|
+
host: hostname || "",
|
|
204
|
+
port: this.endpoints[0].port
|
|
205
|
+
});
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
|
|
209
208
|
#shutting_down = false;
|
|
210
209
|
public async shutdown(): Promise<void> {
|
|
211
210
|
if (this.#shutting_down) return;
|
|
212
211
|
this.#shutting_down = true;
|
|
213
212
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
debugLog("stopping announcement of LDS on mDNS");
|
|
218
|
-
//
|
|
213
|
+
// c8 ignore next
|
|
214
|
+
doDebug && debugLog("stopping announcement of LDS on mDNS");
|
|
215
|
+
//
|
|
219
216
|
for (const registeredServer of this.registeredServers.values()) {
|
|
220
|
-
|
|
217
|
+
// c8 ignore next
|
|
218
|
+
doDebug && debugLog("LDS is shutting down and is forcefuly unregistering server", registeredServer.serverUri);
|
|
221
219
|
await this.#internalRegisterServerOffline(registeredServer, true);
|
|
222
|
-
}
|
|
223
|
-
|
|
220
|
+
}
|
|
221
|
+
|
|
224
222
|
if (this.mDnsResponder) {
|
|
225
|
-
|
|
223
|
+
// c8 ignore next
|
|
224
|
+
doDebug && debugLog("disposing mDnsResponder");
|
|
226
225
|
await this.mDnsResponder.dispose();
|
|
227
226
|
this.mDnsResponder = undefined;
|
|
228
|
-
|
|
227
|
+
// c8 ignore next
|
|
228
|
+
doDebug && debugLog(" mDnsResponder disposed");
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
if (this.mDnsLDSAnnouncer) {
|
|
232
|
-
|
|
232
|
+
// c8 ignore next
|
|
233
|
+
doDebug && debugLog("disposing mDnsLDSAnnouncer of this LDS to the mDNS");
|
|
233
234
|
await this.mDnsLDSAnnouncer.stopAnnouncedOnMulticastSubnet();
|
|
234
235
|
this.mDnsLDSAnnouncer = undefined;
|
|
235
236
|
}
|
|
236
237
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
debugLog("stopping announcement of LDS on mDNS - DONE");
|
|
238
|
+
// c8 ignore next
|
|
239
|
+
doDebug && debugLog("Shutting down Discovery Server");
|
|
240
|
+
await new Promise<void>((resolve, reject) => super.shutdown((err) => (err ? reject(err) : resolve())));
|
|
241
|
+
// c8 ignore next
|
|
242
|
+
doDebug && debugLog("stopping announcement of LDS on mDNS - DONE");
|
|
242
243
|
// add a extra delay to ensure that the port is really closed
|
|
243
244
|
// and registered server propagated the fact that LDS is not here anymore
|
|
244
245
|
await new Promise<void>((resolve) => setTimeout(resolve, 1000));
|
|
@@ -274,25 +275,24 @@ export class OPCUADiscoveryServer extends OPCUABaseServer<OPCUADiscoveryServerEv
|
|
|
274
275
|
this.#internalRegisterServer(
|
|
275
276
|
RegisterServer2Response,
|
|
276
277
|
request.server,
|
|
277
|
-
request.discoveryConfiguration as
|
|
278
|
-
)
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
additional_messages
|
|
288
|
-
|
|
278
|
+
request.discoveryConfiguration as MdnsDiscoveryConfigurationExtended[]
|
|
279
|
+
)
|
|
280
|
+
.then((response: Response) => {
|
|
281
|
+
channel.send_response("MSG", response, message);
|
|
282
|
+
})
|
|
283
|
+
.catch((err: Error) => {
|
|
284
|
+
errorLog("What shall I do ?", err.message);
|
|
285
|
+
errorLog(err);
|
|
286
|
+
let additional_messages = [];
|
|
287
|
+
additional_messages.push(`EXCEPTION CAUGHT WHILE PROCESSING REQUEST !!! ${request.schema.name}`);
|
|
288
|
+
additional_messages.push(err.message);
|
|
289
|
+
if (err.stack) {
|
|
290
|
+
additional_messages = additional_messages.concat(err.stack.split("\n"));
|
|
291
|
+
}
|
|
289
292
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
);
|
|
294
|
-
channel.send_response("MSG", response, message);
|
|
295
|
-
});
|
|
293
|
+
const response = OPCUADiscoveryServer.makeServiceFault(StatusCodes.BadInternalError, additional_messages);
|
|
294
|
+
channel.send_response("MSG", response, message);
|
|
295
|
+
});
|
|
296
296
|
// c8 ignore next
|
|
297
297
|
}
|
|
298
298
|
|
|
@@ -300,24 +300,18 @@ export class OPCUADiscoveryServer extends OPCUABaseServer<OPCUADiscoveryServerEv
|
|
|
300
300
|
assert(message.request instanceof RegisterServerRequest);
|
|
301
301
|
const request = message.request as RegisterServerRequest;
|
|
302
302
|
assert(request.schema.name === "RegisterServerRequest");
|
|
303
|
-
this.#internalRegisterServer(
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
channel.send_response("MSG", response!, message);
|
|
309
|
-
|
|
310
|
-
}).catch((err: Error) => {
|
|
303
|
+
this.#internalRegisterServer(RegisterServerResponse, request.server, undefined)
|
|
304
|
+
.then((response) => {
|
|
305
|
+
channel.send_response("MSG", response, message);
|
|
306
|
+
})
|
|
307
|
+
.catch((err: Error) => {
|
|
311
308
|
let additional_messages = [];
|
|
312
|
-
additional_messages.push(
|
|
309
|
+
additional_messages.push(`EXCEPTION CAUGHT WHILE PROCESSING REQUEST !!! ${request.schema.name}`);
|
|
313
310
|
additional_messages.push(err.message);
|
|
314
311
|
if (err.stack) {
|
|
315
312
|
additional_messages = additional_messages.concat(err.stack.split("\n"));
|
|
316
313
|
}
|
|
317
|
-
const response = OPCUADiscoveryServer.makeServiceFault(
|
|
318
|
-
StatusCodes.BadInternalError,
|
|
319
|
-
additional_messages
|
|
320
|
-
);
|
|
314
|
+
const response = OPCUADiscoveryServer.makeServiceFault(StatusCodes.BadInternalError, additional_messages);
|
|
321
315
|
channel.send_response("MSG", response, message);
|
|
322
316
|
});
|
|
323
317
|
}
|
|
@@ -349,9 +343,10 @@ export class OPCUADiscoveryServer extends OPCUABaseServer<OPCUADiscoveryServerEv
|
|
|
349
343
|
function sendError(statusCode: StatusCode) {
|
|
350
344
|
const response1 = new FindServersOnNetworkResponse({ responseHeader: { serviceResult: statusCode } });
|
|
351
345
|
return channel.send_response("MSG", response1, message);
|
|
352
|
-
}
|
|
346
|
+
}
|
|
347
|
+
sendError;
|
|
353
348
|
|
|
354
|
-
if(this.#shutting_down) {
|
|
349
|
+
if (this.#shutting_down) {
|
|
355
350
|
return sendError(StatusCodes.BadShutdown);
|
|
356
351
|
}
|
|
357
352
|
|
|
@@ -378,15 +373,17 @@ export class OPCUADiscoveryServer extends OPCUABaseServer<OPCUADiscoveryServerEv
|
|
|
378
373
|
|
|
379
374
|
request.serverCapabilityFilter = request.serverCapabilityFilter || [];
|
|
380
375
|
const serverCapabilityFilter: string = request.serverCapabilityFilter
|
|
381
|
-
.map((x: UAString) => x
|
|
376
|
+
.map((x: UAString) => x?.toUpperCase())
|
|
382
377
|
.sort()
|
|
383
378
|
.join(" ");
|
|
384
379
|
|
|
385
|
-
|
|
380
|
+
// c8 ignore next
|
|
381
|
+
doDebug && debugLog(" startingRecordId = ", request.startingRecordId);
|
|
386
382
|
|
|
387
383
|
if (this.mDnsResponder) {
|
|
388
384
|
for (const serverOnNetwork of this.mDnsResponder.registeredServers) {
|
|
389
|
-
|
|
385
|
+
// c8 ignore next
|
|
386
|
+
doDebug && debugLog("Exploring server ", serverOnNetwork.serverName);
|
|
390
387
|
|
|
391
388
|
if (serverOnNetwork.recordId <= request.startingRecordId) {
|
|
392
389
|
continue;
|
|
@@ -404,10 +401,12 @@ export class OPCUADiscoveryServer extends OPCUABaseServer<OPCUADiscoveryServerEv
|
|
|
404
401
|
}
|
|
405
402
|
continue;
|
|
406
403
|
}
|
|
407
|
-
|
|
404
|
+
// c8 ignore next
|
|
405
|
+
doDebug && debugLog(" server ", serverOnNetwork.serverName, " found");
|
|
408
406
|
servers.push(serverOnNetwork);
|
|
409
407
|
if (servers.length === request.maxRecordsToReturn) {
|
|
410
|
-
|
|
408
|
+
// c8 ignore next
|
|
409
|
+
doDebug && debugLog("max records to return reached", request.maxRecordsToReturn);
|
|
411
410
|
break;
|
|
412
411
|
}
|
|
413
412
|
}
|
|
@@ -419,20 +418,23 @@ export class OPCUADiscoveryServer extends OPCUABaseServer<OPCUADiscoveryServerEv
|
|
|
419
418
|
channel.send_response("MSG", response, message);
|
|
420
419
|
}
|
|
421
420
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
421
|
+
async #stopAnnouncedOnMulticastSubnet(conf: MdnsDiscoveryConfigurationExtended): Promise<void> {
|
|
422
|
+
const b = conf.bonjourHolder;
|
|
423
|
+
if (!b) {
|
|
424
|
+
throw new Error("#stopAnnouncedOnMulticastSubnet: conf has no bonjourHolder");
|
|
425
|
+
}
|
|
425
426
|
await b.stopAnnouncedOnMulticastSubnet();
|
|
426
|
-
|
|
427
|
+
conf.bonjourHolder = undefined;
|
|
427
428
|
}
|
|
428
429
|
|
|
429
|
-
async #announcedOnMulticastSubnet(conf:
|
|
430
|
+
async #announcedOnMulticastSubnet(conf: MdnsDiscoveryConfigurationExtended, announcement: Announcement): Promise<void> {
|
|
430
431
|
const serviceConfig = announcementToServiceConfig(announcement);
|
|
431
432
|
|
|
432
|
-
let b =
|
|
433
|
-
if (b
|
|
433
|
+
let b = conf.bonjourHolder;
|
|
434
|
+
if (b?.serviceConfig) {
|
|
434
435
|
if (isSameService(b.serviceConfig, serviceConfig)) {
|
|
435
|
-
|
|
436
|
+
// c8 ignore next
|
|
437
|
+
doDebug && debugLog("Configuration ", conf.mdnsServerName, " has not changed !");
|
|
436
438
|
// nothing to do
|
|
437
439
|
return;
|
|
438
440
|
} else {
|
|
@@ -446,24 +448,24 @@ export class OPCUADiscoveryServer extends OPCUABaseServer<OPCUADiscoveryServerEv
|
|
|
446
448
|
await this.#stopAnnouncedOnMulticastSubnet(conf);
|
|
447
449
|
}
|
|
448
450
|
b = new BonjourHolder();
|
|
449
|
-
|
|
451
|
+
conf.bonjourHolder = b;
|
|
450
452
|
await b.announcedOnMulticastSubnet(announcement);
|
|
451
453
|
}
|
|
452
454
|
async #dealWithDiscoveryConfiguration(
|
|
453
|
-
previousConfMap: Map<string,
|
|
455
|
+
previousConfMap: Map<string, MdnsDiscoveryConfigurationExtended>,
|
|
454
456
|
server1: RegisteredServer,
|
|
455
457
|
serverInfo: ApplicationDescriptionOptions,
|
|
456
|
-
discoveryConfiguration:
|
|
458
|
+
discoveryConfiguration: MdnsDiscoveryConfigurationExtended
|
|
457
459
|
): Promise<StatusCode> {
|
|
458
460
|
// mdnsServerName String The name of the Server when it is announced via mDNS.
|
|
459
|
-
// See Part 12 for the details about mDNS. This string shall be
|
|
461
|
+
// See Part 12 for the details about mDNS. This string shall be
|
|
460
462
|
// less than 64 bytes.
|
|
461
|
-
// If not specified the first element of the serverNames array
|
|
463
|
+
// If not specified the first element of the serverNames array
|
|
462
464
|
// is used (truncated to 63 bytes if necessary).
|
|
463
465
|
// serverCapabilities [] String The set of Server capabilities supported by the Server.
|
|
464
466
|
// A Server capability is a short identifier for a feature
|
|
465
467
|
// The set of allowed Server capabilities are defined in Part 12.
|
|
466
|
-
discoveryConfiguration.mdnsServerName ??= server1.serverNames
|
|
468
|
+
discoveryConfiguration.mdnsServerName ??= server1.serverNames?.[0].text || null;
|
|
467
469
|
|
|
468
470
|
serverInfo.discoveryUrls ??= [];
|
|
469
471
|
|
|
@@ -481,10 +483,11 @@ export class OPCUADiscoveryServer extends OPCUABaseServer<OPCUADiscoveryServerEv
|
|
|
481
483
|
|
|
482
484
|
if (previousConfMap.has(discoveryConfiguration.mdnsServerName || "")) {
|
|
483
485
|
// configuration already exists
|
|
484
|
-
|
|
486
|
+
// c8 ignore next
|
|
487
|
+
doDebug && debugLog("Configuration ", discoveryConfiguration.mdnsServerName, " already exists !");
|
|
485
488
|
const prevConf = previousConfMap.get(discoveryConfiguration.mdnsServerName || "");
|
|
486
489
|
previousConfMap.delete(discoveryConfiguration.mdnsServerName || "");
|
|
487
|
-
|
|
490
|
+
discoveryConfiguration.bonjourHolder = prevConf?.bonjourHolder;
|
|
488
491
|
}
|
|
489
492
|
|
|
490
493
|
// let's announce the server on the multicast DNS
|
|
@@ -492,16 +495,14 @@ export class OPCUADiscoveryServer extends OPCUABaseServer<OPCUADiscoveryServerEv
|
|
|
492
495
|
return StatusCodes.Good;
|
|
493
496
|
}
|
|
494
497
|
|
|
495
|
-
|
|
496
498
|
/**
|
|
497
|
-
*
|
|
498
|
-
* @param server
|
|
499
|
+
*
|
|
500
|
+
* @param server
|
|
499
501
|
* @param forced true :indicated if the LDS is forcing the Server to be seen as unregistered, false
|
|
500
502
|
* when the offline comes from the server it self.
|
|
501
|
-
* @returns
|
|
503
|
+
* @returns
|
|
502
504
|
*/
|
|
503
|
-
async #internalRegisterServerOffline(server: RegisteredServerExtended,
|
|
504
|
-
|
|
505
|
+
async #internalRegisterServerOffline(server: RegisteredServerExtended, forced: boolean) {
|
|
505
506
|
if (!server.serverUri) {
|
|
506
507
|
throw new Error("serverUri is required");
|
|
507
508
|
}
|
|
@@ -514,7 +515,8 @@ export class OPCUADiscoveryServer extends OPCUABaseServer<OPCUADiscoveryServerEv
|
|
|
514
515
|
if (!serverToUnregister) {
|
|
515
516
|
throw new Error("internal error");
|
|
516
517
|
}
|
|
517
|
-
|
|
518
|
+
// c8 ignore next
|
|
519
|
+
doDebug && debugLog(chalk.cyan("unregistering server : "), chalk.yellow(serverToUnregister?.serverUri));
|
|
518
520
|
configurationResults = [];
|
|
519
521
|
|
|
520
522
|
const discoveryConfigurations = serverToUnregister?.discoveryConfiguration || [];
|
|
@@ -524,27 +526,30 @@ export class OPCUADiscoveryServer extends OPCUABaseServer<OPCUADiscoveryServerEv
|
|
|
524
526
|
configurationResults.push(StatusCodes.Good);
|
|
525
527
|
}
|
|
526
528
|
this.registeredServers.delete(key);
|
|
527
|
-
serverToUnregister.isOnline= false;
|
|
529
|
+
serverToUnregister.isOnline = false;
|
|
528
530
|
this.emit("onUnregisterServer", serverToUnregister, forced);
|
|
529
531
|
}
|
|
530
532
|
return configurationResults;
|
|
531
|
-
|
|
532
533
|
}
|
|
533
534
|
async #internalRegisterServerOnline(
|
|
534
535
|
server: RegisteredServerExtended,
|
|
535
|
-
discoveryConfigurations:
|
|
536
|
+
discoveryConfigurations: MdnsDiscoveryConfigurationExtended[]
|
|
536
537
|
) {
|
|
537
538
|
assert(discoveryConfigurations);
|
|
538
539
|
|
|
539
|
-
|
|
540
|
+
if (!server.serverUri) {
|
|
541
|
+
throw new Error("#internalRegisterServerOnline: server.serverUri is required");
|
|
542
|
+
}
|
|
543
|
+
const key = server.serverUri;
|
|
540
544
|
|
|
541
545
|
let configurationResults: StatusCode[] | null = null;
|
|
542
546
|
|
|
543
|
-
|
|
547
|
+
// c8 ignore next
|
|
548
|
+
doDebug && debugLog(chalk.cyan(" registering server : "), chalk.yellow(server.serverUri));
|
|
544
549
|
|
|
545
550
|
// prepare serverInfo which will be used by FindServers
|
|
546
551
|
const serverInfo: ApplicationDescriptionOptions = {
|
|
547
|
-
applicationName: server.serverNames
|
|
552
|
+
applicationName: server.serverNames?.[0], // which one shall we use ?
|
|
548
553
|
applicationType: server.serverType,
|
|
549
554
|
applicationUri: server.serverUri,
|
|
550
555
|
discoveryUrls: server.discoveryUrls,
|
|
@@ -553,15 +558,17 @@ export class OPCUADiscoveryServer extends OPCUABaseServer<OPCUADiscoveryServerEv
|
|
|
553
558
|
// XXX ?????? serverInfo.discoveryProfileUri = serverInfo.discoveryProfileUri;
|
|
554
559
|
};
|
|
555
560
|
|
|
556
|
-
const previousConfMap: Map<string,
|
|
561
|
+
const previousConfMap: Map<string, MdnsDiscoveryConfigurationExtended> = new Map();
|
|
557
562
|
|
|
558
|
-
// let check in the server has already been registed on this LDS
|
|
563
|
+
// let check in the server has already been registed on this LDS
|
|
559
564
|
let firstTimeRegistration = true;
|
|
560
|
-
|
|
565
|
+
const previousServer = this.registeredServers.get(key);
|
|
566
|
+
if (previousServer) {
|
|
561
567
|
// server already exists and must only be updated
|
|
562
|
-
const previousServer
|
|
563
|
-
|
|
564
|
-
|
|
568
|
+
for (const conf of previousServer.discoveryConfiguration || []) {
|
|
569
|
+
if (conf.mdnsServerName) {
|
|
570
|
+
previousConfMap.set(conf.mdnsServerName, conf);
|
|
571
|
+
}
|
|
565
572
|
}
|
|
566
573
|
firstTimeRegistration = false;
|
|
567
574
|
}
|
|
@@ -575,35 +582,27 @@ export class OPCUADiscoveryServer extends OPCUABaseServer<OPCUADiscoveryServerEv
|
|
|
575
582
|
server.serverInfo = serverInfo;
|
|
576
583
|
server.discoveryConfiguration = discoveryConfigurations;
|
|
577
584
|
|
|
578
|
-
|
|
579
585
|
configurationResults = [];
|
|
580
586
|
for (const conf of discoveryConfigurations) {
|
|
581
|
-
const statusCode = await this.#dealWithDiscoveryConfiguration(
|
|
582
|
-
previousConfMap,
|
|
583
|
-
server,
|
|
584
|
-
serverInfo,
|
|
585
|
-
conf
|
|
586
|
-
);
|
|
587
|
+
const statusCode = await this.#dealWithDiscoveryConfiguration(previousConfMap, server, serverInfo, conf);
|
|
587
588
|
configurationResults.push(statusCode);
|
|
588
589
|
}
|
|
589
590
|
// now also unregister unprocessed
|
|
590
591
|
if (previousConfMap.size !== 0) {
|
|
591
|
-
|
|
592
|
+
// c8 ignore next
|
|
593
|
+
doDebug && debugLog(" Warning some conf need to be removed !");
|
|
592
594
|
}
|
|
593
595
|
return configurationResults;
|
|
594
|
-
|
|
595
596
|
}
|
|
596
|
-
// eslint-disable-next-line max-statements
|
|
597
597
|
async #internalRegisterServer(
|
|
598
|
-
RegisterServerXResponse:
|
|
598
|
+
RegisterServerXResponse: typeof RegisterServer2Response | typeof RegisterServerResponse,
|
|
599
599
|
rawServer: RegisteredServer,
|
|
600
|
-
discoveryConfigurations?:
|
|
600
|
+
discoveryConfigurations?: MdnsDiscoveryConfigurationExtended[]
|
|
601
601
|
): Promise<Response> {
|
|
602
|
-
|
|
603
|
-
|
|
604
602
|
// #region check parameter validity
|
|
605
603
|
function sendError(statusCode: StatusCode): Response {
|
|
606
|
-
|
|
604
|
+
// c8 ignore next
|
|
605
|
+
doDebug && debugLog(chalk.red("_on_RegisterServer(2)Request error"), statusCode.toString());
|
|
607
606
|
const response1 = new ServiceFault({
|
|
608
607
|
responseHeader: { serviceResult: statusCode }
|
|
609
608
|
});
|
|
@@ -614,15 +613,17 @@ export class OPCUADiscoveryServer extends OPCUABaseServer<OPCUADiscoveryServerEv
|
|
|
614
613
|
return sendError(StatusCodes.BadShutdown);
|
|
615
614
|
}
|
|
616
615
|
|
|
617
|
-
const server = rawServer as
|
|
616
|
+
const server = rawServer as unknown as RegisteredServerExtended;
|
|
618
617
|
|
|
619
618
|
// check serverType is valid
|
|
620
619
|
if (!_isValidServerType(server.serverType)) {
|
|
621
|
-
|
|
620
|
+
// c8 ignore next
|
|
621
|
+
doDebug && debugLog("Invalid server Type", ApplicationType[server.serverType]);
|
|
622
622
|
return sendError(StatusCodes.BadInvalidArgument);
|
|
623
623
|
}
|
|
624
624
|
if (!server.serverUri) {
|
|
625
|
-
|
|
625
|
+
// c8 ignore next
|
|
626
|
+
doDebug && debugLog("Missing serverURI");
|
|
626
627
|
return sendError(StatusCodes.BadInvalidArgument);
|
|
627
628
|
}
|
|
628
629
|
server.serverNames = server.serverNames || [];
|
|
@@ -636,7 +637,6 @@ export class OPCUADiscoveryServer extends OPCUABaseServer<OPCUADiscoveryServerEv
|
|
|
636
637
|
return sendError(StatusCodes.BadDiscoveryUrlMissing);
|
|
637
638
|
}
|
|
638
639
|
|
|
639
|
-
|
|
640
640
|
// BadServerUriInvalid
|
|
641
641
|
// TODO
|
|
642
642
|
// #endregion
|
|
@@ -650,14 +650,11 @@ export class OPCUADiscoveryServer extends OPCUABaseServer<OPCUADiscoveryServerEv
|
|
|
650
650
|
];
|
|
651
651
|
}
|
|
652
652
|
|
|
653
|
-
const configurationResults = server?.isOnline
|
|
654
|
-
|
|
655
|
-
await this.#
|
|
656
|
-
await this.#internalRegisterServerOffline(server, false);
|
|
653
|
+
const configurationResults = server?.isOnline
|
|
654
|
+
? await this.#internalRegisterServerOnline(server, discoveryConfigurations)
|
|
655
|
+
: await this.#internalRegisterServerOffline(server, false);
|
|
657
656
|
|
|
658
|
-
|
|
659
|
-
const response = new RegisterServerXResponse({
|
|
660
|
-
});
|
|
657
|
+
const response = new RegisterServerXResponse({});
|
|
661
658
|
if (response instanceof RegisterServer2Response) {
|
|
662
659
|
response.configurationResults = configurationResults;
|
|
663
660
|
}
|
|
@@ -682,4 +679,3 @@ function _isValidServerType(serverType: ApplicationType): boolean {
|
|
|
682
679
|
}
|
|
683
680
|
return false;
|
|
684
681
|
}
|
|
685
|
-
|