How to use the node-opcua-object-registry.ObjectRegistry function in node-opcua-object-registry

To help you get started, we’ve selected a few node-opcua-object-registry examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-opcua / node-opcua / packages / node-opcua-secure-channel / source / server / server_secure_channel_layer.ts View on Github external
const description = "Sender Certificate Error";
                console.log(chalk.cyan(description), chalk.bgRed.yellow(statusCode!.toString()));
                // OPCUA specification v1.02 part 6 page 42 $6.7.4
                // If an error occurs after the  Server  has verified  Message  security  it  shall  return a  ServiceFault  instead
                // of a OpenSecureChannel  response. The  ServiceFault  Message  is described in  Part  4,   7.28.
                return this._send_error(statusCode!, "", message, callback);
            }

            this._handle_OpenSecureChannelRequest(message, callback);
        });
    }
}

import { ObjectRegistry } from "node-opcua-object-registry";
import { NodeClass } from "../../../node-opcua-data-model/dist";
ServerSecureChannelLayer.registry = new ObjectRegistry({});

(ServerSecureChannelLayer as any).prototype.checkCertificateCallback =
    callbackify((ServerSecureChannelLayer as any).prototype.checkCertificate);
github node-opcua / node-opcua / packages / node-opcua-server / src / server_subscription.js View on Github external
subscription.timerId = null;
    subscription._start_timer();

}

util.inherits(Subscription, EventEmitter);


Subscription.minimumPublishingInterval = 50;  // fastest possible
Subscription.defaultPublishingInterval = 1000; // one second
Subscription.maximumPublishingInterval = 1000 * 60 * 60 * 24 * 15; // 15 days
assert(Subscription.maximumPublishingInterval < 2147483647, "maximumPublishingInterval cannot exceed (2**31-1) ms ");


const ObjectRegistry = require("node-opcua-object-registry").ObjectRegistry;
Subscription.registry = new ObjectRegistry();

Subscription.prototype.getSessionId = function () {
    const subscription = this;
    return subscription.sessionId;
};

Subscription.prototype.toString = function () {

    const subscription = this;
    let str = "Subscription:\n";
    str += "  subscriptionId          " + subscription.id + "\n";
    str += "  sessionId          " + subscription.getSessionId().toString() + "\n";

    str += "  publishingEnabled  " + subscription.publishingEnabled + "\n";
    str += "  maxKeepAliveCount  " + subscription.maxKeepAliveCount + "\n";
    str += "  publishingInterval " + subscription.publishingInterval + "\n";
github node-opcua / node-opcua / packages / node-opcua-server / src / monitored_item.js View on Github external
self._node = null;
    self._semantic_version = 0;

    if (doDebug) {
        debugLog("Monitoring ", options.itemToMonitor.toString());
    }

    self._on_node_disposed = null;

    MonitoredItem.registry.register(self);
}

util.inherits(MonitoredItem, EventEmitter);

const ObjectRegistry = require("node-opcua-object-registry").ObjectRegistry;
MonitoredItem.registry = new ObjectRegistry();

MonitoredItem.minimumSamplingInterval = 50;              // 50 ms as a minimum sampling interval
MonitoredItem.defaultSamplingInterval = 1500;            // 1500 ms as a default sampling interval
MonitoredItem.maximumSamplingInterval = 1000 * 60 * 60;  // 1 hour !

function _validate_parameters(monitoringParameters) {
    //xx assert(options instanceof MonitoringParameters);
    assert(monitoringParameters.hasOwnProperty("clientHandle"));
    assert(monitoringParameters.hasOwnProperty("samplingInterval"));
    assert(_.isFinite(monitoringParameters.clientHandle));
    assert(_.isFinite(monitoringParameters.samplingInterval));
    assert(_.isBoolean(monitoringParameters.discardOldest));
    assert(_.isFinite(monitoringParameters.queueSize));
    assert(monitoringParameters.queueSize >= 0);
}
github node-opcua / node-opcua / packages / node-opcua-server / src / server_engine.js View on Github external
engine.addressSpace = null;

    engine._shutdownTask = [];

    engine._applicationUri = options.applicationUri || "";

    options.serverDiagnosticsEnabled = options.hasOwnProperty("serverDiagnosticsEnable")
                                            ? options.serverDiagnosticsEnabled : true;
    engine.serverDiagnosticsEnabled = options.serverDiagnosticsEnabled;

}

util.inherits(ServerEngine, EventEmitter);
const ObjectRegistry = require("node-opcua-object-registry").ObjectRegistry;
ServerEngine.registry = new ObjectRegistry();

ServerEngine.prototype.dispose = function () {

    const engine = this;
    engine.addresSpaec = null;

    assert(Object.keys(engine._sessions).length === 0, "ServerEngine#_sessions not empty");
    engine._sessions = {};

    // todo fix me
    engine._closedSessions = {};
    assert(Object.keys(engine._closedSessions).length === 0, "ServerEngine#_closedSessions not empty");
    engine._closedSessions = {};

    if (engine._orphanPublishEngine) {
        engine._orphanPublishEngine.dispose();
github node-opcua / node-opcua / packages / node-opcua-server / src / server_publish_engine.js View on Github external
// have  expired but that still need to send some pending notification
    // to the client.
    // Once publish requests will be received from the  client
    // the notifications of those subscriptions will be processed so that
    // they can be properly disposed.
    self._closed_subscriptions = [];

    self.maxPublishRequestInQueue = options.maxPublishRequestInQueue || 100;

    self.isSessionClosed = false;

}

util.inherits(ServerSidePublishEngine, EventEmitter);
const ObjectRegistry = require("node-opcua-object-registry").ObjectRegistry;
ServerSidePublishEngine.registry = new ObjectRegistry();


ServerSidePublishEngine.prototype.dispose = function () {

    debugLog("ServerSidePublishEngine#dispose");
    const self = this;

    // force deletion of publish response not sent
    self._publish_response_queue = [];

    assert(self._publish_response_queue.length === 0, "self._publish_response_queue !=0");
    self._publish_response_queue = null;

    assert(Object.keys(self._subscriptions).length === 0, "self._subscriptions count!=0");
    self._subscriptions = {};
github node-opcua / node-opcua / packages / node-opcua-secure-channel / src / server / server_secure_channel_layer.js View on Github external
if (self.messageChunker) {
        self.messageChunker.dispose();
        self.messageChunker = null;
    }

    self.secureChannelId = 0xdeadbeef;

    self.timeoutId = null;

    self.sessionTokens = null;

    self.removeAllListeners();
};

const ObjectRegistry = require("node-opcua-object-registry").ObjectRegistry;
ServerSecureChannelLayer.registry = new ObjectRegistry();
/**
 * the endpoint associated with this secure channel
 * @property endpoints
 * @type {OPCUAServerEndPoint}
 *
 */
ServerSecureChannelLayer.prototype.__defineGetter__("endpoints", function() {
    return this.parent;
});

ServerSecureChannelLayer.prototype.setSecurity = function(securityMode, securityPolicy) {
    const self = this;
    // TODO verify that the endpoint really supports this mode

    self.messageBuilder.setSecurity(securityMode, securityPolicy);
};
github node-opcua / node-opcua / packages / node-opcua-client / src / client_base.js View on Github external
/***
     * @property keepPendingSessionsOnDisconnect²
     * @type {boolean}
     */
    this.keepPendingSessionsOnDisconnect = options.keepPendingSessionsOnDisconnect || false;
}

util.inherits(OPCUAClientBase, EventEmitter);

OPCUAClientBase.prototype.getPrivateKey = OPCUASecureObject.prototype.getPrivateKey;
OPCUAClientBase.prototype.getCertificate = OPCUASecureObject.prototype.getCertificate;
OPCUAClientBase.prototype.getCertificateChain = OPCUASecureObject.prototype.getCertificateChain;

const ObjectRegistry = require("node-opcua-object-registry").ObjectRegistry;
OPCUAClientBase.registry = new ObjectRegistry();

/**
 * is true when the client has already requested the server end points.
 * @property knowsServerEndpoint
 * @type boolean
 */
OPCUAClientBase.prototype.__defineGetter__("knowsServerEndpoint", function () {
    const self = this;
    return (self._server_endpoints && self._server_endpoints.length > 0);
});

OPCUAClientBase.prototype._destroy_secure_channel = function () {


    const self = this;
    if (self._secureChannel) {
github node-opcua / node-opcua / packages / node-opcua-server / src / opcua_server.js View on Github external
if (!_.isFunction(self.userManager.isValidUser)) {
        self.userManager.isValidUser = function (/*userName,password*/) {
            return false;
        };
    }

    self.discoveryServerEndpointUrl = options.discoveryServerEndpointUrl || "opc.tcp://localhost:4840";
    assert(typeof self.discoveryServerEndpointUrl === "string");
    self.capabilitiesForMDNS = options.capabilitiesForMDNS || [ "NA" ];
    self.registerServerMethod = options.registerServerMethod || RegisterServerMethod.HIDDEN;
    _installRegisterServerManager(self);
}
util.inherits(OPCUAServer, OPCUABaseServer);

const ObjectRegistry = require("node-opcua-object-registry").ObjectRegistry;
OPCUAServer.registry = new ObjectRegistry();


/**
 * total number of bytes written  by the server since startup
 * @property bytesWritten
 * @type {Number}
 */
OPCUAServer.prototype.__defineGetter__("bytesWritten", function () {
    return this.endpoints.reduce(function (accumulated, endpoint) {
        return accumulated + endpoint.bytesWritten;
    }, 0);
});

/**
 * total number of bytes read  by the server since startup
 * @property bytesRead
github node-opcua / node-opcua / packages / node-opcua-address-space / src / address_space.js View on Github external
*     const addressSpace = new AddressSpace();
 *
 *
 * @class AddressSpace
 * @constructor
 */
function AddressSpace() {

    const self = this;
    self._private_namespaceIndex = 1;
    self._constructNamespaceArray();
    AddressSpace.registry.register(self);
}

const ObjectRegistry = require("node-opcua-object-registry").ObjectRegistry;
AddressSpace.registry  = new ObjectRegistry();


AddressSpace.prototype._constructNamespaceArray = function () {
    this._namespaceArray = [];
    if (this._namespaceArray.length === 0) {
        this.registerNamespace("http://opcfoundation.org/UA/");
    }
};

AddressSpace.prototype.getNamespaceUri = function (namespaceIndex) {
    assert(namespaceIndex >= 0 && namespaceIndex < this._namespaceArray.length);
    return this._namespaceArray[namespaceIndex].namespaceUri;
};

AddressSpace.prototype.getNamespace = function (namespaceIndexOrName) {
   const self = this;
github node-opcua / node-opcua / packages / node-opcua-server / src / server_session.js View on Github external
/**
     * @property creationDate
     * @type {Date}
     */
    session.creationDate = new Date();


    session._registeredNodesCounter = 0;
    session._registeredNodes    = {};
    session._registeredNodesInv = {};
}

util.inherits(ServerSession, EventEmitter);

const ObjectRegistry = require("node-opcua-object-registry").ObjectRegistry;
ServerSession.registry = new ObjectRegistry();

ServerSession.prototype.dispose = function() {

    debugLog("ServerSession#dispose()");

    const self = this;

    assert(!self.sessionObject," sessionObject has not been cleared !");

    self.parent = null;
    self.authenticationToken = null;

    if (self.publishEngine) {
        self.publishEngine.dispose();
        self.publishEngine = null;
    }

node-opcua-object-registry

pure nodejs OPCUA SDK - module object-registry

MIT
Latest version published 2 months ago

Package Health Score

81 / 100
Full package analysis