Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
serverInfo.productUri = serverInfo.productUri || "SampleDiscoveryServer";
serverInfo.applicationName = serverInfo.applicationName || {text: "SampleDiscoveryServer", locale: null};
serverInfo.gatewayServerUri = serverInfo.gatewayServerUri || "";
serverInfo.discoveryProfileUri = serverInfo.discoveryProfileUri || "";
serverInfo.discoveryUrls = serverInfo.discoveryUrls || [];
this.serverInfo = serverInfo;
const port = options.port || 4840;
this.capabilitiesForMDNS = ["LDS"];
this.registered_servers = {};
// see OPC UA Spec 1.2 part 6 : 7.4 Well Known Addresses
// opc.tcp://localhost:4840/UADiscovery
const endPoint = new OPCUAServerEndPoint({
port: port,
certificateChain: this.getCertificateChain(),
privateKey: this.getPrivateKey(),
serverInfo: this.serverInfo
});
endPoint.addStandardEndpointDescriptions();
this.endpoints.push(endPoint);
endPoint.on("message", (message, channel) => {
this.on_request(message, channel);
});
this.mDnsResponder = null;
}
module.exports.perform_findServers = require("node-opcua-client").perform_findServers;
module.exports.perform_findServersOnNetwork = require("node-opcua-client").perform_findServersOnNetwork;
module.exports.readHistoryServerCapabilities = require("node-opcua-client").readHistoryServerCapabilities;
module.exports.callConditionRefresh = require("node-opcua-client/src/alarms_and_conditions/client_tools").callConditionRefresh;
module.exports.parseEndpointUrl = require("node-opcua-transport").parseEndpointUrl;
//----------------------------------------------------------------------------------------------------------------------
// Server services
//----------------------------------------------------------------------------------------------------------------------
module.exports.OPCUAServer = require("node-opcua-server").OPCUAServer;
module.exports.RegisterServerMethod = require("node-opcua-server").RegisterServerMethod;
module.exports.ServerEngine = require("node-opcua-server").ServerEngine;
module.exports.MonitoredItem = require("node-opcua-server").MonitoredItem;
module.exports.ServerSession = require("node-opcua-server").ServerSession;
module.exports.Subscription = require("node-opcua-server").Subscription;
module.exports.MonitoredItem = require("node-opcua-server").MonitoredItem;
module.exports.generate_address_space = require("node-opcua-address-space").generate_address_space;
module.exports.AddressSpace = require("node-opcua-address-space").AddressSpace;
module.exports.Namespace = require("node-opcua-address-space").Namespace;
module.exports.SessionContext = require("node-opcua-address-space").SessionContext;
// basic opcua NodeClass
module.exports.UAObject = require("node-opcua-address-space").UAObject;
module.exports.UAMethod = require("node-opcua-address-space").UAMethod;
module.exports.UAVariable = require("node-opcua-address-space").UAVariable;
module.exports.UADataType = require("node-opcua-address-space").UADataType;
module.exports.getAddressSpaceFixture = require("node-opcua-address-space/test_helpers/get_address_space_fixture").getAddressSpaceFixture;
module.exports.ClientSubscription = require("node-opcua-client").ClientSubscription;
module.exports.ClientSession = require("node-opcua-client").ClientSession;
module.exports.client_utils = require("node-opcua-client/src/client_utils");
module.exports.perform_findServers = require("node-opcua-client").perform_findServers;
module.exports.perform_findServersOnNetwork = require("node-opcua-client").perform_findServersOnNetwork;
module.exports.readHistoryServerCapabilities = require("node-opcua-client").readHistoryServerCapabilities;
module.exports.callConditionRefresh = require("node-opcua-client/src/alarms_and_conditions/client_tools").callConditionRefresh;
module.exports.parseEndpointUrl = require("node-opcua-transport").parseEndpointUrl;
//----------------------------------------------------------------------------------------------------------------------
// Server services
//----------------------------------------------------------------------------------------------------------------------
module.exports.OPCUAServer = require("node-opcua-server").OPCUAServer;
module.exports.RegisterServerMethod = require("node-opcua-server").RegisterServerMethod;
module.exports.ServerEngine = require("node-opcua-server").ServerEngine;
module.exports.MonitoredItem = require("node-opcua-server").MonitoredItem;
module.exports.ServerSession = require("node-opcua-server").ServerSession;
module.exports.Subscription = require("node-opcua-server").Subscription;
module.exports.MonitoredItem = require("node-opcua-server").MonitoredItem;
module.exports.generate_address_space = require("node-opcua-address-space").generate_address_space;
module.exports.AddressSpace = require("node-opcua-address-space").AddressSpace;
module.exports.Namespace = require("node-opcua-address-space").Namespace;
module.exports.SessionContext = require("node-opcua-address-space").SessionContext;
// basic opcua NodeClass
module.exports.UAObject = require("node-opcua-address-space").UAObject;
module.exports.UAMethod = require("node-opcua-address-space").UAMethod;
module.exports.ClientSession = require("node-opcua-client").ClientSession;
module.exports.client_utils = require("node-opcua-client/src/client_utils");
module.exports.perform_findServers = require("node-opcua-client").perform_findServers;
module.exports.perform_findServersOnNetwork = require("node-opcua-client").perform_findServersOnNetwork;
module.exports.readHistoryServerCapabilities = require("node-opcua-client").readHistoryServerCapabilities;
module.exports.callConditionRefresh = require("node-opcua-client/src/alarms_and_conditions/client_tools").callConditionRefresh;
module.exports.parseEndpointUrl = require("node-opcua-transport").parseEndpointUrl;
//----------------------------------------------------------------------------------------------------------------------
// Server services
//----------------------------------------------------------------------------------------------------------------------
module.exports.OPCUAServer = require("node-opcua-server").OPCUAServer;
module.exports.RegisterServerMethod = require("node-opcua-server").RegisterServerMethod;
module.exports.ServerEngine = require("node-opcua-server").ServerEngine;
module.exports.MonitoredItem = require("node-opcua-server").MonitoredItem;
module.exports.ServerSession = require("node-opcua-server").ServerSession;
module.exports.Subscription = require("node-opcua-server").Subscription;
module.exports.MonitoredItem = require("node-opcua-server").MonitoredItem;
module.exports.generate_address_space = require("node-opcua-address-space").generate_address_space;
module.exports.AddressSpace = require("node-opcua-address-space").AddressSpace;
module.exports.Namespace = require("node-opcua-address-space").Namespace;
module.exports.SessionContext = require("node-opcua-address-space").SessionContext;
// basic opcua NodeClass
module.exports.UAObject = require("node-opcua-address-space").UAObject;
module.exports.UAMethod = require("node-opcua-address-space").UAMethod;
module.exports.UAVariable = require("node-opcua-address-space").UAVariable;
module.exports.client_utils = require("node-opcua-client/src/client_utils");
module.exports.perform_findServers = require("node-opcua-client").perform_findServers;
module.exports.perform_findServersOnNetwork = require("node-opcua-client").perform_findServersOnNetwork;
module.exports.readHistoryServerCapabilities = require("node-opcua-client").readHistoryServerCapabilities;
module.exports.callConditionRefresh = require("node-opcua-client/src/alarms_and_conditions/client_tools").callConditionRefresh;
module.exports.parseEndpointUrl = require("node-opcua-transport").parseEndpointUrl;
//----------------------------------------------------------------------------------------------------------------------
// Server services
//----------------------------------------------------------------------------------------------------------------------
module.exports.OPCUAServer = require("node-opcua-server").OPCUAServer;
module.exports.RegisterServerMethod = require("node-opcua-server").RegisterServerMethod;
module.exports.ServerEngine = require("node-opcua-server").ServerEngine;
module.exports.MonitoredItem = require("node-opcua-server").MonitoredItem;
module.exports.ServerSession = require("node-opcua-server").ServerSession;
module.exports.Subscription = require("node-opcua-server").Subscription;
module.exports.MonitoredItem = require("node-opcua-server").MonitoredItem;
module.exports.generate_address_space = require("node-opcua-address-space").generate_address_space;
module.exports.AddressSpace = require("node-opcua-address-space").AddressSpace;
module.exports.Namespace = require("node-opcua-address-space").Namespace;
module.exports.SessionContext = require("node-opcua-address-space").SessionContext;
// basic opcua NodeClass
module.exports.UAObject = require("node-opcua-address-space").UAObject;
module.exports.UAMethod = require("node-opcua-address-space").UAMethod;
module.exports.UAVariable = require("node-opcua-address-space").UAVariable;
module.exports.UADataType = require("node-opcua-address-space").UADataType;
module.exports.perform_findServersOnNetwork = require("node-opcua-client").perform_findServersOnNetwork;
module.exports.readHistoryServerCapabilities = require("node-opcua-client").readHistoryServerCapabilities;
module.exports.callConditionRefresh = require("node-opcua-client/src/alarms_and_conditions/client_tools").callConditionRefresh;
module.exports.parseEndpointUrl = require("node-opcua-transport").parseEndpointUrl;
//----------------------------------------------------------------------------------------------------------------------
// Server services
//----------------------------------------------------------------------------------------------------------------------
module.exports.OPCUAServer = require("node-opcua-server").OPCUAServer;
module.exports.RegisterServerMethod = require("node-opcua-server").RegisterServerMethod;
module.exports.ServerEngine = require("node-opcua-server").ServerEngine;
module.exports.MonitoredItem = require("node-opcua-server").MonitoredItem;
module.exports.ServerSession = require("node-opcua-server").ServerSession;
module.exports.Subscription = require("node-opcua-server").Subscription;
module.exports.MonitoredItem = require("node-opcua-server").MonitoredItem;
module.exports.generate_address_space = require("node-opcua-address-space").generate_address_space;
module.exports.AddressSpace = require("node-opcua-address-space").AddressSpace;
module.exports.Namespace = require("node-opcua-address-space").Namespace;
module.exports.SessionContext = require("node-opcua-address-space").SessionContext;
// basic opcua NodeClass
module.exports.UAObject = require("node-opcua-address-space").UAObject;
module.exports.UAMethod = require("node-opcua-address-space").UAMethod;
module.exports.UAVariable = require("node-opcua-address-space").UAVariable;
module.exports.UADataType = require("node-opcua-address-space").UADataType;
module.exports.getAddressSpaceFixture = require("node-opcua-address-space/test_helpers/get_address_space_fixture").getAddressSpaceFixture;
module.exports.OPCUADiscoveryServer = require("node-opcua-server-discovery").OPCUADiscoveryServer;
module.exports.readHistoryServerCapabilities = require("node-opcua-client").readHistoryServerCapabilities;
module.exports.callConditionRefresh = require("node-opcua-client/src/alarms_and_conditions/client_tools").callConditionRefresh;
module.exports.parseEndpointUrl = require("node-opcua-transport").parseEndpointUrl;
//----------------------------------------------------------------------------------------------------------------------
// Server services
//----------------------------------------------------------------------------------------------------------------------
module.exports.OPCUAServer = require("node-opcua-server").OPCUAServer;
module.exports.RegisterServerMethod = require("node-opcua-server").RegisterServerMethod;
module.exports.ServerEngine = require("node-opcua-server").ServerEngine;
module.exports.MonitoredItem = require("node-opcua-server").MonitoredItem;
module.exports.ServerSession = require("node-opcua-server").ServerSession;
module.exports.Subscription = require("node-opcua-server").Subscription;
module.exports.MonitoredItem = require("node-opcua-server").MonitoredItem;
module.exports.generate_address_space = require("node-opcua-address-space").generate_address_space;
module.exports.AddressSpace = require("node-opcua-address-space").AddressSpace;
module.exports.Namespace = require("node-opcua-address-space").Namespace;
module.exports.SessionContext = require("node-opcua-address-space").SessionContext;
// basic opcua NodeClass
module.exports.UAObject = require("node-opcua-address-space").UAObject;
module.exports.UAMethod = require("node-opcua-address-space").UAMethod;
module.exports.UAVariable = require("node-opcua-address-space").UAVariable;
module.exports.UADataType = require("node-opcua-address-space").UADataType;
module.exports.getAddressSpaceFixture = require("node-opcua-address-space/test_helpers/get_address_space_fixture").getAddressSpaceFixture;
module.exports.OPCUADiscoveryServer = require("node-opcua-server-discovery").OPCUADiscoveryServer;
this._delayInit = () => {
const endPoint = new OPCUAServerEndPoint({
port,
certificateChain: this.getCertificateChain(),
certificateManager: this.serverCertificateManager,
privateKey: this.getPrivateKey(),
serverInfo: this.serverInfo
});
endPoint.addStandardEndpointDescriptions();
this.endpoints.push(endPoint);
endPoint.on("message", (message: Message, channel: ServerSecureChannelLayer) => {
if (doDebug) {
debugLog(" RECEIVE MESSAGE", message.request.constructor.name);
"use strict";
const chalk = require("chalk");
const util = require("util");
const _ = require("underscore");
const assert = require("node-opcua-assert").assert;
const path = require("path");
const fs = require("fs");
const url = require("url");
const OPCUABaseServer = require("node-opcua-server").OPCUABaseServer;
const OPCUAServerEndPoint = require("node-opcua-server").OPCUAServerEndPoint;
const StatusCodes = require("node-opcua-status-code").StatusCodes;
const discovery_service = require("node-opcua-service-discovery");
const RegisterServerRequest = discovery_service.RegisterServerRequest;
const RegisterServerResponse = discovery_service.RegisterServerResponse;
const RegisterServer2Request = discovery_service.RegisterServer2Request;
const RegisterServer2Response = discovery_service.RegisterServer2Response;
const FindServersOnNetworkRequest = discovery_service.FindServersOnNetworkRequest;
const FindServersOnNetworkResponse = discovery_service.FindServersOnNetworkResponse;
const endpoints_service = require("node-opcua-service-endpoints");
const ApplicationType = endpoints_service.ApplicationType;
const get_fully_qualified_domain_name = require("node-opcua-hostname").get_fully_qualified_domain_name;