node-opcua-server 2.53.0 → 2.54.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/LICENSE CHANGED
@@ -1,20 +1,20 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2014-2021 Etienne Rossignon
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the "Software"), to deal in
7
- the Software without restriction, including without limitation the rights to
8
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software is furnished to do so,
10
- subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014-2021 Etienne Rossignon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-opcua-server",
3
- "version": "2.53.0",
3
+ "version": "2.54.0",
4
4
  "description": "pure nodejs OPCUA SDK - module -server",
5
5
  "scripts": {
6
6
  "build": "tsc -b",
@@ -18,54 +18,54 @@
18
18
  "browser-process-hrtime": "^1.0.0",
19
19
  "dequeue": "^1.0.5",
20
20
  "lodash": "4.17.21",
21
- "node-opcua-address-space": "2.53.0",
21
+ "node-opcua-address-space": "2.54.0",
22
22
  "node-opcua-assert": "2.52.0",
23
- "node-opcua-basic-types": "2.53.0",
24
- "node-opcua-certificate-manager": "2.53.0",
25
- "node-opcua-client": "2.53.0",
26
- "node-opcua-client-dynamic-extension-object": "2.53.0",
27
- "node-opcua-common": "2.53.0",
23
+ "node-opcua-basic-types": "2.54.0",
24
+ "node-opcua-certificate-manager": "2.54.0",
25
+ "node-opcua-client": "2.54.0",
26
+ "node-opcua-client-dynamic-extension-object": "2.54.0",
27
+ "node-opcua-common": "2.54.0",
28
28
  "node-opcua-constants": "2.52.0",
29
29
  "node-opcua-crypto": "^1.7.4",
30
- "node-opcua-data-model": "2.53.0",
31
- "node-opcua-data-value": "2.53.0",
30
+ "node-opcua-data-model": "2.54.0",
31
+ "node-opcua-data-value": "2.54.0",
32
32
  "node-opcua-date-time": "2.52.0",
33
33
  "node-opcua-debug": "2.52.0",
34
34
  "node-opcua-enum": "2.52.0",
35
- "node-opcua-extension-object": "2.53.0",
36
- "node-opcua-factory": "2.53.0",
35
+ "node-opcua-extension-object": "2.54.0",
36
+ "node-opcua-factory": "2.54.0",
37
37
  "node-opcua-hostname": "2.52.0",
38
- "node-opcua-nodeid": "2.53.0",
38
+ "node-opcua-nodeid": "2.54.0",
39
39
  "node-opcua-nodesets": "2.51.0",
40
- "node-opcua-numeric-range": "2.53.0",
40
+ "node-opcua-numeric-range": "2.54.0",
41
41
  "node-opcua-object-registry": "2.52.0",
42
42
  "node-opcua-pki": "^2.12.0",
43
- "node-opcua-secure-channel": "2.53.0",
44
- "node-opcua-service-browse": "2.53.0",
45
- "node-opcua-service-call": "2.53.0",
46
- "node-opcua-service-discovery": "2.53.0",
47
- "node-opcua-service-endpoints": "2.53.0",
48
- "node-opcua-service-filter": "2.53.0",
49
- "node-opcua-service-history": "2.53.0",
50
- "node-opcua-service-node-management": "2.53.0",
51
- "node-opcua-service-query": "2.53.0",
52
- "node-opcua-service-read": "2.53.0",
53
- "node-opcua-service-register-node": "2.53.0",
54
- "node-opcua-service-secure-channel": "2.53.0",
55
- "node-opcua-service-session": "2.53.0",
56
- "node-opcua-service-subscription": "2.53.0",
57
- "node-opcua-service-translate-browse-path": "2.53.0",
58
- "node-opcua-service-write": "2.53.0",
43
+ "node-opcua-secure-channel": "2.54.0",
44
+ "node-opcua-service-browse": "2.54.0",
45
+ "node-opcua-service-call": "2.54.0",
46
+ "node-opcua-service-discovery": "2.54.0",
47
+ "node-opcua-service-endpoints": "2.54.0",
48
+ "node-opcua-service-filter": "2.54.0",
49
+ "node-opcua-service-history": "2.54.0",
50
+ "node-opcua-service-node-management": "2.54.0",
51
+ "node-opcua-service-query": "2.54.0",
52
+ "node-opcua-service-read": "2.54.0",
53
+ "node-opcua-service-register-node": "2.54.0",
54
+ "node-opcua-service-secure-channel": "2.54.0",
55
+ "node-opcua-service-session": "2.54.0",
56
+ "node-opcua-service-subscription": "2.54.0",
57
+ "node-opcua-service-translate-browse-path": "2.54.0",
58
+ "node-opcua-service-write": "2.54.0",
59
59
  "node-opcua-status-code": "2.52.0",
60
- "node-opcua-types": "2.53.0",
61
- "node-opcua-utils": "2.52.0",
62
- "node-opcua-variant": "2.53.0"
60
+ "node-opcua-types": "2.54.0",
61
+ "node-opcua-utils": "2.54.0",
62
+ "node-opcua-variant": "2.54.0"
63
63
  },
64
64
  "devDependencies": {
65
- "node-opcua-data-access": "2.53.0",
65
+ "node-opcua-data-access": "2.54.0",
66
66
  "node-opcua-leak-detector": "2.52.0",
67
67
  "node-opcua-test-helpers": "2.42.0",
68
- "node-opcua-transport": "2.53.0",
68
+ "node-opcua-transport": "2.54.0",
69
69
  "should": "^13.2.3",
70
70
  "sinon": "^11.1.2"
71
71
  },
@@ -84,5 +84,5 @@
84
84
  "internet of things"
85
85
  ],
86
86
  "homepage": "http://node-opcua.github.io/",
87
- "gitHead": "f7da55bc8e581496b85970a6cee1a1e707f76c29"
87
+ "gitHead": "d3093f76a2c8f574444fd59e98e7d53f34b83d8b"
88
88
  }
@@ -0,0 +1,3 @@
1
+ [0926/232040.183:ERROR:registration_protocol_win.cc(103)] CreateFile: Le fichier sp�cifi� est introuvable. (0x2)
2
+ [0926/232103.877:ERROR:registration_protocol_win.cc(103)] CreateFile: Le fichier sp�cifi� est introuvable. (0x2)
3
+ [0926/232105.450:ERROR:registration_protocol_win.cc(103)] CreateFile: Le fichier sp�cifi� est introuvable. (0x2)
package/source/factory.ts CHANGED
@@ -1,25 +1,25 @@
1
- /**
2
- * @module node-opcua-server
3
- */
4
-
5
- import { assert } from "node-opcua-assert";
6
- import { ExtensionObject } from "node-opcua-extension-object";
7
- import { constructObject } from "node-opcua-factory";
8
- import { ExpandedNodeId } from "node-opcua-nodeid";
9
-
10
- export class Factory {
11
- public engine: any;
12
-
13
- constructor(engine: any) {
14
- assert(engine !== null && typeof engine === "object");
15
- this.engine = engine;
16
- }
17
-
18
- public constructObject(id: ExpandedNodeId): ExtensionObject {
19
- const obj = constructObject(id);
20
- if (!(obj instanceof ExtensionObject)) {
21
- throw new Error("Internal Error constructObject");
22
- }
23
- return obj as ExtensionObject;
24
- }
25
- }
1
+ /**
2
+ * @module node-opcua-server
3
+ */
4
+
5
+ import { assert } from "node-opcua-assert";
6
+ import { ExtensionObject } from "node-opcua-extension-object";
7
+ import { constructObject } from "node-opcua-factory";
8
+ import { ExpandedNodeId } from "node-opcua-nodeid";
9
+
10
+ export class Factory {
11
+ public engine: any;
12
+
13
+ constructor(engine: any) {
14
+ assert(engine !== null && typeof engine === "object");
15
+ this.engine = engine;
16
+ }
17
+
18
+ public constructObject(id: ExpandedNodeId): ExtensionObject {
19
+ const obj = constructObject(id);
20
+ if (!(obj instanceof ExtensionObject)) {
21
+ throw new Error("Internal Error constructObject");
22
+ }
23
+ return obj as ExtensionObject;
24
+ }
25
+ }
@@ -1,75 +1,75 @@
1
- /**
2
- * @module node-opcua-server
3
- */
4
- import { assert } from "node-opcua-assert";
5
-
6
- export interface HistoryServerCapabilitiesOptions {
7
- accessHistoryDataCapability?: boolean;
8
- accessHistoryEventsCapability?: boolean;
9
- maxReturnDataValues?: number;
10
- maxReturnEventValues?: number;
11
- insertDataCapability?: boolean;
12
- replaceDataCapability?: boolean;
13
- updateDataCapability?: boolean;
14
- deleteRawCapability ?: boolean;
15
- deleteAtTimeCapability?: boolean;
16
- insertEventCapability?: boolean;
17
- replaceEventCapability?: boolean;
18
- updateEventCapability?: boolean;
19
- deleteEventCapability?: boolean;
20
- insertAnnotationCapability?: boolean;
21
- }
22
- /**
23
- */
24
- export class HistoryServerCapabilities {
25
-
26
- public accessHistoryDataCapability: boolean;
27
- public accessHistoryEventsCapability: boolean;
28
- public maxReturnDataValues: number;
29
- public maxReturnEventValues: number;
30
- public insertDataCapability: boolean;
31
- public replaceDataCapability: boolean;
32
- public updateDataCapability: boolean;
33
- public deleteRawCapability: boolean;
34
- public deleteAtTimeCapability: boolean;
35
- public insertEventCapability: boolean;
36
- public replaceEventCapability: boolean;
37
- public updateEventCapability: boolean;
38
- public deleteEventCapability: boolean;
39
- public insertAnnotationCapability: boolean;
40
-
41
- constructor(options?: HistoryServerCapabilitiesOptions) {
42
- options = options || {};
43
-
44
- function coerceBool(value: boolean | undefined , defaultValue: boolean): boolean {
45
- if (undefined === value) {
46
- return defaultValue;
47
- }
48
- assert(typeof value === "boolean");
49
- return value as boolean;
50
- }
51
-
52
- function coerceUInt32(value: number| undefined, defaultValue: number): number {
53
- if (undefined === value) {
54
- return defaultValue;
55
- }
56
- assert(typeof value === "number");
57
- return value;
58
- }
59
-
60
- this.accessHistoryDataCapability = coerceBool(options.accessHistoryDataCapability, false);
61
- this.accessHistoryEventsCapability = coerceBool(options.accessHistoryEventsCapability, false);
62
- this.maxReturnDataValues = coerceUInt32(options.maxReturnDataValues, 0);
63
- this.maxReturnEventValues = coerceUInt32(options.maxReturnEventValues, 0);
64
- this.insertDataCapability = coerceBool(options.insertDataCapability, false);
65
- this.replaceDataCapability = coerceBool(options.replaceDataCapability, false);
66
- this.updateDataCapability = coerceBool(options.updateDataCapability, false);
67
- this.deleteRawCapability = coerceBool(options.deleteRawCapability, false);
68
- this.deleteAtTimeCapability = coerceBool(options.deleteAtTimeCapability, false);
69
- this.insertEventCapability = coerceBool(options.insertEventCapability, false);
70
- this.replaceEventCapability = coerceBool(options.replaceEventCapability, false);
71
- this.updateEventCapability = coerceBool(options.updateEventCapability, false);
72
- this.deleteEventCapability = coerceBool(options.deleteEventCapability, false);
73
- this.insertAnnotationCapability = coerceBool(options.insertAnnotationCapability, false);
74
- }
75
- }
1
+ /**
2
+ * @module node-opcua-server
3
+ */
4
+ import { assert } from "node-opcua-assert";
5
+
6
+ export interface HistoryServerCapabilitiesOptions {
7
+ accessHistoryDataCapability?: boolean;
8
+ accessHistoryEventsCapability?: boolean;
9
+ maxReturnDataValues?: number;
10
+ maxReturnEventValues?: number;
11
+ insertDataCapability?: boolean;
12
+ replaceDataCapability?: boolean;
13
+ updateDataCapability?: boolean;
14
+ deleteRawCapability ?: boolean;
15
+ deleteAtTimeCapability?: boolean;
16
+ insertEventCapability?: boolean;
17
+ replaceEventCapability?: boolean;
18
+ updateEventCapability?: boolean;
19
+ deleteEventCapability?: boolean;
20
+ insertAnnotationCapability?: boolean;
21
+ }
22
+ /**
23
+ */
24
+ export class HistoryServerCapabilities {
25
+
26
+ public accessHistoryDataCapability: boolean;
27
+ public accessHistoryEventsCapability: boolean;
28
+ public maxReturnDataValues: number;
29
+ public maxReturnEventValues: number;
30
+ public insertDataCapability: boolean;
31
+ public replaceDataCapability: boolean;
32
+ public updateDataCapability: boolean;
33
+ public deleteRawCapability: boolean;
34
+ public deleteAtTimeCapability: boolean;
35
+ public insertEventCapability: boolean;
36
+ public replaceEventCapability: boolean;
37
+ public updateEventCapability: boolean;
38
+ public deleteEventCapability: boolean;
39
+ public insertAnnotationCapability: boolean;
40
+
41
+ constructor(options?: HistoryServerCapabilitiesOptions) {
42
+ options = options || {};
43
+
44
+ function coerceBool(value: boolean | undefined , defaultValue: boolean): boolean {
45
+ if (undefined === value) {
46
+ return defaultValue;
47
+ }
48
+ assert(typeof value === "boolean");
49
+ return value as boolean;
50
+ }
51
+
52
+ function coerceUInt32(value: number| undefined, defaultValue: number): number {
53
+ if (undefined === value) {
54
+ return defaultValue;
55
+ }
56
+ assert(typeof value === "number");
57
+ return value;
58
+ }
59
+
60
+ this.accessHistoryDataCapability = coerceBool(options.accessHistoryDataCapability, false);
61
+ this.accessHistoryEventsCapability = coerceBool(options.accessHistoryEventsCapability, false);
62
+ this.maxReturnDataValues = coerceUInt32(options.maxReturnDataValues, 0);
63
+ this.maxReturnEventValues = coerceUInt32(options.maxReturnEventValues, 0);
64
+ this.insertDataCapability = coerceBool(options.insertDataCapability, false);
65
+ this.replaceDataCapability = coerceBool(options.replaceDataCapability, false);
66
+ this.updateDataCapability = coerceBool(options.updateDataCapability, false);
67
+ this.deleteRawCapability = coerceBool(options.deleteRawCapability, false);
68
+ this.deleteAtTimeCapability = coerceBool(options.deleteAtTimeCapability, false);
69
+ this.insertEventCapability = coerceBool(options.insertEventCapability, false);
70
+ this.replaceEventCapability = coerceBool(options.replaceEventCapability, false);
71
+ this.updateEventCapability = coerceBool(options.updateEventCapability, false);
72
+ this.deleteEventCapability = coerceBool(options.deleteEventCapability, false);
73
+ this.insertAnnotationCapability = coerceBool(options.insertAnnotationCapability, false);
74
+ }
75
+ }
@@ -1,17 +1,17 @@
1
- import {
2
- AsymmetricAlgorithmSecurityHeader,
3
- MessageSecurityMode,
4
- SecurityPolicy
5
- } from "node-opcua-secure-channel";
6
-
7
- export interface IChannelData {
8
- channelId: number| null;
9
- clientCertificate: Buffer | null;
10
- clientNonce: Buffer |null,
11
- clientSecurityHeader: any;
12
- securityHeader: AsymmetricAlgorithmSecurityHeader |null;
13
- securityMode: MessageSecurityMode;
14
- securityPolicy: SecurityPolicy;
15
- timeout: number;
16
- transactionsCount: number;
17
- }
1
+ import {
2
+ AsymmetricAlgorithmSecurityHeader,
3
+ MessageSecurityMode,
4
+ SecurityPolicy
5
+ } from "node-opcua-secure-channel";
6
+
7
+ export interface IChannelData {
8
+ channelId: number| null;
9
+ clientCertificate: Buffer | null;
10
+ clientNonce: Buffer |null,
11
+ clientSecurityHeader: any;
12
+ securityHeader: AsymmetricAlgorithmSecurityHeader |null;
13
+ securityMode: MessageSecurityMode;
14
+ securityPolicy: SecurityPolicy;
15
+ timeout: number;
16
+ transactionsCount: number;
17
+ }
@@ -1,24 +1,24 @@
1
- /**
2
- * @module node-opcua-server
3
- */
4
- import { EventEmitter } from "events";
5
- import { ErrorCallback } from "node-opcua-status-code";
6
-
7
-
8
- export interface IRegisterServerManager extends EventEmitter {
9
-
10
- discoveryServerEndpointUrl: string;
11
-
12
- start(callback: ErrorCallback): void;
13
-
14
- stop(callback: ErrorCallback): void;
15
-
16
- dispose(): void;
17
-
18
- // tslint:disable:unified-signatures
19
- on(eventName: "serverRegistrationPending", eventHandler: () => void): this;
20
- on(eventName: "serverRegistered", eventHandler: () => void): this;
21
- on(eventName: "serverRegistrationRenewed", eventHandler: () => void): this;
22
- on(eventName: "serverUnregistered", eventHandler: () => void): this;
23
-
24
- }
1
+ /**
2
+ * @module node-opcua-server
3
+ */
4
+ import { EventEmitter } from "events";
5
+ import { ErrorCallback } from "node-opcua-status-code";
6
+
7
+
8
+ export interface IRegisterServerManager extends EventEmitter {
9
+
10
+ discoveryServerEndpointUrl: string;
11
+
12
+ start(callback: ErrorCallback): void;
13
+
14
+ stop(callback: ErrorCallback): void;
15
+
16
+ dispose(): void;
17
+
18
+ // tslint:disable:unified-signatures
19
+ on(eventName: "serverRegistrationPending", eventHandler: () => void): this;
20
+ on(eventName: "serverRegistered", eventHandler: () => void): this;
21
+ on(eventName: "serverRegistrationRenewed", eventHandler: () => void): this;
22
+ on(eventName: "serverUnregistered", eventHandler: () => void): this;
23
+
24
+ }
package/source/index.ts CHANGED
@@ -1,14 +1,14 @@
1
- /**
2
- * @module node-opcua-server
3
- */
4
- export * from "./base_server";
5
- export * from "./server_end_point";
6
- export * from "./register_server_manager";
7
- export * from "./register_server_manager_mdns_only";
8
- export * from "./server_publish_engine";
9
- export * from "./server_subscription";
10
- export * from "./server_session";
11
- export * from "./server_capabilities";
12
- export * from "./server_engine";
13
- export * from "./opcua_server";
14
- export * from "./monitored_item";
1
+ /**
2
+ * @module node-opcua-server
3
+ */
4
+ export * from "./base_server";
5
+ export * from "./server_end_point";
6
+ export * from "./register_server_manager";
7
+ export * from "./register_server_manager_mdns_only";
8
+ export * from "./server_publish_engine";
9
+ export * from "./server_subscription";
10
+ export * from "./server_session";
11
+ export * from "./server_capabilities";
12
+ export * from "./server_engine";
13
+ export * from "./opcua_server";
14
+ export * from "./monitored_item";
@@ -1,33 +1,33 @@
1
- /**
2
- * @module node-opcua-server
3
- */
4
- import { EventEmitter } from "events";
5
- import { IRegisterServerManager } from "./i_register_server_manager";
6
-
7
- /**
8
- * a IRegisterServerManager that hides the server from any local discover server
9
- *
10
- */
11
- export class RegisterServerManagerHidden
12
- extends EventEmitter
13
- implements IRegisterServerManager {
14
-
15
- public discoveryServerEndpointUrl: string = "";
16
-
17
- constructor(options?: any) {
18
- super();
19
- }
20
-
21
- public stop(callback: () => void) {
22
- setImmediate(callback);
23
- }
24
-
25
- public start(callback: () => void) {
26
- setImmediate(callback);
27
- }
28
-
29
- public dispose() {
30
- //
31
- }
32
-
33
- }
1
+ /**
2
+ * @module node-opcua-server
3
+ */
4
+ import { EventEmitter } from "events";
5
+ import { IRegisterServerManager } from "./i_register_server_manager";
6
+
7
+ /**
8
+ * a IRegisterServerManager that hides the server from any local discover server
9
+ *
10
+ */
11
+ export class RegisterServerManagerHidden
12
+ extends EventEmitter
13
+ implements IRegisterServerManager {
14
+
15
+ public discoveryServerEndpointUrl: string = "";
16
+
17
+ constructor(options?: any) {
18
+ super();
19
+ }
20
+
21
+ public stop(callback: () => void) {
22
+ setImmediate(callback);
23
+ }
24
+
25
+ public start(callback: () => void) {
26
+ setImmediate(callback);
27
+ }
28
+
29
+ public dispose() {
30
+ //
31
+ }
32
+
33
+ }
@@ -1,177 +1,177 @@
1
- /**
2
- * @module node-opcua-server
3
- */
4
- // tslint:disable:max-classes-per-file
5
- import { Certificate } from "node-opcua-crypto";
6
- import { SignedSoftwareCertificate } from "node-opcua-types";
7
-
8
- /**
9
- */
10
- export interface OperationLimitsOptions {
11
- maxNodesPerRead?: number;
12
- maxNodesPerBrowse?: number;
13
- maxNodesPerWrite?: number;
14
- maxNodesPerMethodCall?: number;
15
- maxNodesPerRegisterNodes?: number;
16
- maxNodesPerNodeManagement?: number;
17
- maxMonitoredItemsPerCall?: number;
18
- maxNodesPerHistoryReadData?: number;
19
- maxNodesPerHistoryReadEvents?: number;
20
- maxNodesPerHistoryUpdateData?: number;
21
- maxNodesPerHistoryUpdateEvents?: number;
22
- maxNodesPerTranslateBrowsePathsToNodeIds?: number;
23
- }
24
-
25
- export class OperationLimits {
26
-
27
- public maxNodesPerRead: number;
28
- public maxNodesPerBrowse: number;
29
- public maxNodesPerWrite: number;
30
- public maxNodesPerMethodCall: number;
31
- public maxNodesPerRegisterNodes: number;
32
- public maxNodesPerNodeManagement: number;
33
- public maxMonitoredItemsPerCall: number;
34
- public maxNodesPerHistoryReadData: number;
35
- public maxNodesPerHistoryReadEvents: number;
36
- public maxNodesPerHistoryUpdateData: number;
37
- public maxNodesPerHistoryUpdateEvents: number;
38
- public maxNodesPerTranslateBrowsePathsToNodeIds: number;
39
-
40
- constructor(options: OperationLimitsOptions) {
41
-
42
- /**
43
- * @property maxNodesPerRead
44
- * @default 0
45
- */
46
- this.maxNodesPerRead = options.maxNodesPerRead || 0;
47
- /**
48
- * @property maxNodesPerWrite
49
- * @default 0
50
- */
51
- this.maxNodesPerWrite = options.maxNodesPerWrite || 0;
52
- /**
53
- * @property maxNodesPerMethodCall
54
- * @default 0
55
- */
56
- this.maxNodesPerMethodCall = options.maxNodesPerMethodCall || 0;
57
- /**
58
- * @property maxNodesPerBrowse
59
- * @default 0
60
- */
61
- this.maxNodesPerBrowse = options.maxNodesPerBrowse || 0;
62
- /**
63
- * @property maxNodesPerRegisterNodes
64
- * @default 0
65
- */
66
- this.maxNodesPerRegisterNodes = options.maxNodesPerRegisterNodes || 0;
67
- /**
68
- * @property maxNodesPerNodeManagement
69
- * @default 0
70
- */
71
- this.maxNodesPerNodeManagement = options.maxNodesPerNodeManagement || 0;
72
- /**
73
- * @property maxMonitoredItemsPerCall
74
- * @default 0
75
- */
76
- this.maxMonitoredItemsPerCall = options.maxMonitoredItemsPerCall || 0;
77
- /**
78
- * @property maxNodesPerHistoryReadData
79
- */
80
- this.maxNodesPerHistoryReadData = options.maxNodesPerHistoryReadData || 0;
81
- /**
82
- * @property maxNodesPerHistoryReadEvents
83
- * @default 0
84
- */
85
- this.maxNodesPerHistoryReadEvents = options.maxNodesPerHistoryReadEvents || 0;
86
- /**
87
- * @property maxNodesPerHistoryUpdateData
88
- * @default 0
89
- */
90
- this.maxNodesPerHistoryUpdateData = options.maxNodesPerHistoryUpdateData || 0;
91
- /**
92
- * @property maxNodesPerHistoryUpdateEvents
93
- * @default 0
94
- */
95
- this.maxNodesPerHistoryUpdateEvents = options.maxNodesPerHistoryUpdateEvents || 0;
96
- /**
97
- * @property maxNodesPerTranslateBrowsePathsToNodeIds
98
- * @default 0
99
- */
100
- this.maxNodesPerTranslateBrowsePathsToNodeIds = options.maxNodesPerTranslateBrowsePathsToNodeIds || 0;
101
-
102
- }
103
- }
104
-
105
- export interface ServerCapabilitiesOptions {
106
- maxBrowseContinuationPoints?: number;
107
- maxHistoryContinuationPoints?: number;
108
- maxStringLength?: number;
109
- maxArrayLength?: number;
110
- maxByteStringLength?: number;
111
- maxQueryContinuationPoints?: number;
112
- minSupportedSampleRate?: number;
113
- operationLimits?: OperationLimitsOptions;
114
-
115
- serverProfileArray?: string[];
116
- localeIdArray?: string[];
117
- softwareCertificates?: SignedSoftwareCertificate[];
118
- }
119
-
120
- /**
121
- */
122
- export class ServerCapabilities {
123
-
124
- public maxBrowseContinuationPoints: number;
125
- public maxHistoryContinuationPoints: number;
126
- public maxStringLength: number;
127
- public maxArrayLength: number;
128
- public maxByteStringLength: number;
129
- public maxQueryContinuationPoints: number;
130
- public minSupportedSampleRate: number;
131
- public operationLimits: OperationLimits;
132
-
133
- public serverProfileArray: string[];
134
- public localeIdArray: string[];
135
- public softwareCertificates: SignedSoftwareCertificate[];
136
-
137
- constructor(options: ServerCapabilitiesOptions) {
138
-
139
- options = options || {};
140
- options.operationLimits = options.operationLimits || {};
141
-
142
- this.serverProfileArray = options.serverProfileArray || [];
143
- this.localeIdArray = options.localeIdArray || [];
144
- this.softwareCertificates = options.softwareCertificates || [];
145
- /**
146
- * @property maxArrayLength
147
- */
148
- this.maxArrayLength = options.maxArrayLength || 0;
149
- /**
150
- * @property maxStringLength
151
- */
152
- this.maxStringLength = options.maxStringLength || 0;
153
- /**
154
- * @property maxByteStringLength
155
- */
156
- this.maxByteStringLength = options.maxByteStringLength || 0;
157
- /**
158
- * @property maxBrowseContinuationPoints
159
- */
160
- this.maxBrowseContinuationPoints = options.maxBrowseContinuationPoints || 0;
161
- /**
162
- * @property maxQueryContinuationPoints
163
- */
164
- this.maxQueryContinuationPoints = options.maxQueryContinuationPoints || 0;
165
- /**
166
- * @property maxHistoryContinuationPoints
167
- */
168
- this.maxHistoryContinuationPoints = options.maxHistoryContinuationPoints || 0;
169
-
170
- /**
171
- * @property operationLimits
172
- */
173
- this.operationLimits = new OperationLimits(options.operationLimits);
174
-
175
- this.minSupportedSampleRate = 100; // to do adjust me
176
- }
177
- }
1
+ /**
2
+ * @module node-opcua-server
3
+ */
4
+ // tslint:disable:max-classes-per-file
5
+ import { Certificate } from "node-opcua-crypto";
6
+ import { SignedSoftwareCertificate } from "node-opcua-types";
7
+
8
+ /**
9
+ */
10
+ export interface OperationLimitsOptions {
11
+ maxNodesPerRead?: number;
12
+ maxNodesPerBrowse?: number;
13
+ maxNodesPerWrite?: number;
14
+ maxNodesPerMethodCall?: number;
15
+ maxNodesPerRegisterNodes?: number;
16
+ maxNodesPerNodeManagement?: number;
17
+ maxMonitoredItemsPerCall?: number;
18
+ maxNodesPerHistoryReadData?: number;
19
+ maxNodesPerHistoryReadEvents?: number;
20
+ maxNodesPerHistoryUpdateData?: number;
21
+ maxNodesPerHistoryUpdateEvents?: number;
22
+ maxNodesPerTranslateBrowsePathsToNodeIds?: number;
23
+ }
24
+
25
+ export class OperationLimits {
26
+
27
+ public maxNodesPerRead: number;
28
+ public maxNodesPerBrowse: number;
29
+ public maxNodesPerWrite: number;
30
+ public maxNodesPerMethodCall: number;
31
+ public maxNodesPerRegisterNodes: number;
32
+ public maxNodesPerNodeManagement: number;
33
+ public maxMonitoredItemsPerCall: number;
34
+ public maxNodesPerHistoryReadData: number;
35
+ public maxNodesPerHistoryReadEvents: number;
36
+ public maxNodesPerHistoryUpdateData: number;
37
+ public maxNodesPerHistoryUpdateEvents: number;
38
+ public maxNodesPerTranslateBrowsePathsToNodeIds: number;
39
+
40
+ constructor(options: OperationLimitsOptions) {
41
+
42
+ /**
43
+ * @property maxNodesPerRead
44
+ * @default 0
45
+ */
46
+ this.maxNodesPerRead = options.maxNodesPerRead || 0;
47
+ /**
48
+ * @property maxNodesPerWrite
49
+ * @default 0
50
+ */
51
+ this.maxNodesPerWrite = options.maxNodesPerWrite || 0;
52
+ /**
53
+ * @property maxNodesPerMethodCall
54
+ * @default 0
55
+ */
56
+ this.maxNodesPerMethodCall = options.maxNodesPerMethodCall || 0;
57
+ /**
58
+ * @property maxNodesPerBrowse
59
+ * @default 0
60
+ */
61
+ this.maxNodesPerBrowse = options.maxNodesPerBrowse || 0;
62
+ /**
63
+ * @property maxNodesPerRegisterNodes
64
+ * @default 0
65
+ */
66
+ this.maxNodesPerRegisterNodes = options.maxNodesPerRegisterNodes || 0;
67
+ /**
68
+ * @property maxNodesPerNodeManagement
69
+ * @default 0
70
+ */
71
+ this.maxNodesPerNodeManagement = options.maxNodesPerNodeManagement || 0;
72
+ /**
73
+ * @property maxMonitoredItemsPerCall
74
+ * @default 0
75
+ */
76
+ this.maxMonitoredItemsPerCall = options.maxMonitoredItemsPerCall || 0;
77
+ /**
78
+ * @property maxNodesPerHistoryReadData
79
+ */
80
+ this.maxNodesPerHistoryReadData = options.maxNodesPerHistoryReadData || 0;
81
+ /**
82
+ * @property maxNodesPerHistoryReadEvents
83
+ * @default 0
84
+ */
85
+ this.maxNodesPerHistoryReadEvents = options.maxNodesPerHistoryReadEvents || 0;
86
+ /**
87
+ * @property maxNodesPerHistoryUpdateData
88
+ * @default 0
89
+ */
90
+ this.maxNodesPerHistoryUpdateData = options.maxNodesPerHistoryUpdateData || 0;
91
+ /**
92
+ * @property maxNodesPerHistoryUpdateEvents
93
+ * @default 0
94
+ */
95
+ this.maxNodesPerHistoryUpdateEvents = options.maxNodesPerHistoryUpdateEvents || 0;
96
+ /**
97
+ * @property maxNodesPerTranslateBrowsePathsToNodeIds
98
+ * @default 0
99
+ */
100
+ this.maxNodesPerTranslateBrowsePathsToNodeIds = options.maxNodesPerTranslateBrowsePathsToNodeIds || 0;
101
+
102
+ }
103
+ }
104
+
105
+ export interface ServerCapabilitiesOptions {
106
+ maxBrowseContinuationPoints?: number;
107
+ maxHistoryContinuationPoints?: number;
108
+ maxStringLength?: number;
109
+ maxArrayLength?: number;
110
+ maxByteStringLength?: number;
111
+ maxQueryContinuationPoints?: number;
112
+ minSupportedSampleRate?: number;
113
+ operationLimits?: OperationLimitsOptions;
114
+
115
+ serverProfileArray?: string[];
116
+ localeIdArray?: string[];
117
+ softwareCertificates?: SignedSoftwareCertificate[];
118
+ }
119
+
120
+ /**
121
+ */
122
+ export class ServerCapabilities {
123
+
124
+ public maxBrowseContinuationPoints: number;
125
+ public maxHistoryContinuationPoints: number;
126
+ public maxStringLength: number;
127
+ public maxArrayLength: number;
128
+ public maxByteStringLength: number;
129
+ public maxQueryContinuationPoints: number;
130
+ public minSupportedSampleRate: number;
131
+ public operationLimits: OperationLimits;
132
+
133
+ public serverProfileArray: string[];
134
+ public localeIdArray: string[];
135
+ public softwareCertificates: SignedSoftwareCertificate[];
136
+
137
+ constructor(options: ServerCapabilitiesOptions) {
138
+
139
+ options = options || {};
140
+ options.operationLimits = options.operationLimits || {};
141
+
142
+ this.serverProfileArray = options.serverProfileArray || [];
143
+ this.localeIdArray = options.localeIdArray || [];
144
+ this.softwareCertificates = options.softwareCertificates || [];
145
+ /**
146
+ * @property maxArrayLength
147
+ */
148
+ this.maxArrayLength = options.maxArrayLength || 0;
149
+ /**
150
+ * @property maxStringLength
151
+ */
152
+ this.maxStringLength = options.maxStringLength || 0;
153
+ /**
154
+ * @property maxByteStringLength
155
+ */
156
+ this.maxByteStringLength = options.maxByteStringLength || 0;
157
+ /**
158
+ * @property maxBrowseContinuationPoints
159
+ */
160
+ this.maxBrowseContinuationPoints = options.maxBrowseContinuationPoints || 0;
161
+ /**
162
+ * @property maxQueryContinuationPoints
163
+ */
164
+ this.maxQueryContinuationPoints = options.maxQueryContinuationPoints || 0;
165
+ /**
166
+ * @property maxHistoryContinuationPoints
167
+ */
168
+ this.maxHistoryContinuationPoints = options.maxHistoryContinuationPoints || 0;
169
+
170
+ /**
171
+ * @property operationLimits
172
+ */
173
+ this.operationLimits = new OperationLimits(options.operationLimits);
174
+
175
+ this.minSupportedSampleRate = 100; // to do adjust me
176
+ }
177
+ }
@@ -1,52 +1,52 @@
1
- /**
2
- * @module node-opcua-server
3
- */
4
- // tslint:disable:no-console
5
- import * as chalk from "chalk";
6
-
7
- import { checkDebugFlag, make_debugLog } from "node-opcua-debug";
8
-
9
- import { ServerSidePublishEngine } from "./server_publish_engine";
10
- import { Subscription } from "./server_subscription";
11
-
12
- const debugLog = make_debugLog(__filename);
13
- const doDebug = checkDebugFlag(__filename);
14
-
15
- /**
16
- * the ServerSidePublishEngineForOrphanSubscription is keeping track of
17
- * live subscription that have been detached from timed out session.
18
- * It takes care of providing back those subscription to any session that
19
- * will claim them again with transferSubscription service
20
- * It also make sure that subscription are properly disposed when they expire.
21
- *
22
- * @internal
23
- */
24
- export class ServerSidePublishEngineForOrphanSubscription extends ServerSidePublishEngine {
25
- constructor(options: any) {
26
- super(options);
27
- }
28
-
29
- public add_subscription(subscription: Subscription): Subscription {
30
- debugLog(chalk.bgCyan.yellow.bold(" adding live subscription with id="), subscription.id, " to orphan");
31
- super.add_subscription(subscription);
32
- // also add an event handler to detected when the subscription has ended
33
- // so we can automatically remove it from the orphan table
34
- (subscription as any)._expired_func = function (this: Subscription) {
35
- debugLog(chalk.bgCyan.yellow(" Removing expired subscription with id="), this.id, " from orphan");
36
- // make sure all monitored item have been deleted
37
- // Xx subscription.terminate();
38
- // xx publish_engine.detach_subscription(subscription);
39
- // Xx subscription.dispose();
40
- };
41
- subscription.on("expired", (subscription as any)._expired_func);
42
- return subscription;
43
- }
44
-
45
- public detach_subscription(subscription: Subscription) {
46
- // un set the event handler
47
- super.detach_subscription(subscription);
48
- subscription.removeListener("expired", (subscription as any)._expired_func);
49
- (subscription as any)._expired_func = null;
50
- return subscription;
51
- }
52
- }
1
+ /**
2
+ * @module node-opcua-server
3
+ */
4
+ // tslint:disable:no-console
5
+ import * as chalk from "chalk";
6
+
7
+ import { checkDebugFlag, make_debugLog } from "node-opcua-debug";
8
+
9
+ import { ServerSidePublishEngine } from "./server_publish_engine";
10
+ import { Subscription } from "./server_subscription";
11
+
12
+ const debugLog = make_debugLog(__filename);
13
+ const doDebug = checkDebugFlag(__filename);
14
+
15
+ /**
16
+ * the ServerSidePublishEngineForOrphanSubscription is keeping track of
17
+ * live subscription that have been detached from timed out session.
18
+ * It takes care of providing back those subscription to any session that
19
+ * will claim them again with transferSubscription service
20
+ * It also make sure that subscription are properly disposed when they expire.
21
+ *
22
+ * @internal
23
+ */
24
+ export class ServerSidePublishEngineForOrphanSubscription extends ServerSidePublishEngine {
25
+ constructor(options: any) {
26
+ super(options);
27
+ }
28
+
29
+ public add_subscription(subscription: Subscription): Subscription {
30
+ debugLog(chalk.bgCyan.yellow.bold(" adding live subscription with id="), subscription.id, " to orphan");
31
+ super.add_subscription(subscription);
32
+ // also add an event handler to detected when the subscription has ended
33
+ // so we can automatically remove it from the orphan table
34
+ (subscription as any)._expired_func = function (this: Subscription) {
35
+ debugLog(chalk.bgCyan.yellow(" Removing expired subscription with id="), this.id, " from orphan");
36
+ // make sure all monitored item have been deleted
37
+ // Xx subscription.terminate();
38
+ // xx publish_engine.detach_subscription(subscription);
39
+ // Xx subscription.dispose();
40
+ };
41
+ subscription.on("expired", (subscription as any)._expired_func);
42
+ return subscription;
43
+ }
44
+
45
+ public detach_subscription(subscription: Subscription) {
46
+ // un set the event handler
47
+ super.detach_subscription(subscription);
48
+ subscription.removeListener("expired", (subscription as any)._expired_func);
49
+ (subscription as any)._expired_func = null;
50
+ return subscription;
51
+ }
52
+ }
@@ -1,33 +1,33 @@
1
- import { ServerSession } from "./server_session";
2
- import { assert } from "node-opcua-assert";
3
- import { UserIdentityToken, AnonymousIdentityToken, UserNameIdentityToken, X509IdentityToken } from "node-opcua-types";
4
-
5
- export function sessionsCompatibleForTransfer(sessionSrc: ServerSession, sessionDest: ServerSession): boolean {
6
- assert(sessionDest);
7
- assert(sessionSrc);
8
- if (!sessionSrc.userIdentityToken && !sessionDest.userIdentityToken) {
9
- return true;
10
- }
11
- if (sessionSrc.userIdentityToken instanceof AnonymousIdentityToken) {
12
- if (!(sessionDest.userIdentityToken instanceof AnonymousIdentityToken)) {
13
- return false;
14
- }
15
- return true;
16
- } else if (sessionSrc.userIdentityToken instanceof UserNameIdentityToken) {
17
- if (!(sessionDest.userIdentityToken instanceof UserNameIdentityToken)) {
18
- return false;
19
- }
20
- return sessionSrc.userIdentityToken.userName === sessionDest.userIdentityToken.userName;
21
- }
22
- // istanbul ignore else
23
- else if (sessionSrc.userIdentityToken instanceof X509IdentityToken) {
24
- if (!(sessionDest.userIdentityToken instanceof X509IdentityToken)) {
25
- return false;
26
- }
27
- return (
28
- sessionSrc.userIdentityToken.certificateData.toString("hex") === sessionDest.userIdentityToken.certificateData.toString("hex")
29
- );
30
- } else {
31
- throw new Error("Unsupported Identity token");
32
- }
33
- }
1
+ import { ServerSession } from "./server_session";
2
+ import { assert } from "node-opcua-assert";
3
+ import { UserIdentityToken, AnonymousIdentityToken, UserNameIdentityToken, X509IdentityToken } from "node-opcua-types";
4
+
5
+ export function sessionsCompatibleForTransfer(sessionSrc: ServerSession, sessionDest: ServerSession): boolean {
6
+ assert(sessionDest);
7
+ assert(sessionSrc);
8
+ if (!sessionSrc.userIdentityToken && !sessionDest.userIdentityToken) {
9
+ return true;
10
+ }
11
+ if (sessionSrc.userIdentityToken instanceof AnonymousIdentityToken) {
12
+ if (!(sessionDest.userIdentityToken instanceof AnonymousIdentityToken)) {
13
+ return false;
14
+ }
15
+ return true;
16
+ } else if (sessionSrc.userIdentityToken instanceof UserNameIdentityToken) {
17
+ if (!(sessionDest.userIdentityToken instanceof UserNameIdentityToken)) {
18
+ return false;
19
+ }
20
+ return sessionSrc.userIdentityToken.userName === sessionDest.userIdentityToken.userName;
21
+ }
22
+ // istanbul ignore else
23
+ else if (sessionSrc.userIdentityToken instanceof X509IdentityToken) {
24
+ if (!(sessionDest.userIdentityToken instanceof X509IdentityToken)) {
25
+ return false;
26
+ }
27
+ return (
28
+ sessionSrc.userIdentityToken.certificateData.toString("hex") === sessionDest.userIdentityToken.certificateData.toString("hex")
29
+ );
30
+ } else {
31
+ throw new Error("Unsupported Identity token");
32
+ }
33
+ }
@@ -1,86 +1,86 @@
1
- /**
2
- * @module node-opcua-server
3
- */
4
- import { assert } from "node-opcua-assert";
5
-
6
- import {BaseNode, UAVariable} from "node-opcua-address-space";
7
- import { AttributeIds } from "node-opcua-data-model";
8
- import { NodeClass } from "node-opcua-data-model";
9
- import { ExtensionObject } from "node-opcua-extension-object";
10
- import { NodeId } from "node-opcua-nodeid";
11
- import { DataChangeFilter, EventFilter } from "node-opcua-service-filter";
12
- import { DeadbandType } from "node-opcua-service-subscription";
13
- import { StatusCode, StatusCodes } from "node-opcua-status-code";
14
- import {ReadValueIdOptions} from "node-opcua-types";
15
- import {BaseNode2} from "./monitored_item";
16
-
17
- function __validateDataChangeFilter(
18
- filter: DataChangeFilter,
19
- itemToMonitor: ReadValueIdOptions,
20
- node: UAVariable
21
- ): StatusCode {
22
-
23
- assert(itemToMonitor.attributeId === AttributeIds.Value);
24
-
25
- if ((node.nodeClass !== NodeClass.Variable)) {
26
- return StatusCodes.BadNodeIdInvalid;
27
- }
28
-
29
- assert(node.nodeClass === NodeClass.Variable);
30
-
31
- // if node is not Numerical=> DataChangeFilter
32
- assert(node.dataType instanceof NodeId);
33
- const dataType = node.addressSpace.findDataType(node.dataType)!;
34
-
35
- const dataTypeNumber = node.addressSpace.findDataType("Number")!;
36
- if (filter.deadbandType !== DeadbandType.None) {
37
- if (!dataType.isSupertypeOf(dataTypeNumber)) {
38
- return StatusCodes.BadFilterNotAllowed;
39
- }
40
- }
41
-
42
- if (filter.deadbandType === DeadbandType.Percent) {
43
- if (filter.deadbandValue < 0 || filter.deadbandValue > 100) {
44
- return StatusCodes.BadDeadbandFilterInvalid;
45
- }
46
-
47
- // node must also have a valid euRange
48
- if (!(node as any).euRange) {
49
- // tslint:disable:no-console
50
- console.log(" node has no euRange ! Dead band Percent cannot be used on node " + node.nodeId.toString());
51
- return StatusCodes.BadMonitoredItemFilterUnsupported;
52
- }
53
- }
54
- return StatusCodes.Good;
55
- }
56
-
57
- export function validateFilter(
58
- filter: ExtensionObject | null,
59
- itemToMonitor: ReadValueIdOptions,
60
- node: BaseNode
61
- ) {
62
-
63
- // handle filter information
64
- if (filter && filter instanceof EventFilter
65
- && itemToMonitor.attributeId !== AttributeIds.EventNotifier) {
66
- // invalid filter on Event
67
- return StatusCodes.BadFilterNotAllowed;
68
- }
69
-
70
- if (filter && filter instanceof DataChangeFilter
71
- && itemToMonitor.attributeId !== AttributeIds.Value) {
72
- // invalid DataChange filter on non Value Attribute
73
- return StatusCodes.BadFilterNotAllowed;
74
- }
75
-
76
- if (filter && itemToMonitor.attributeId !== AttributeIds.EventNotifier
77
- && itemToMonitor.attributeId !== AttributeIds.Value) {
78
- return StatusCodes.BadFilterNotAllowed;
79
- }
80
-
81
- if (filter instanceof DataChangeFilter) {
82
- return __validateDataChangeFilter(filter, itemToMonitor, node as UAVariable);
83
- }
84
-
85
- return StatusCodes.Good;
86
- }
1
+ /**
2
+ * @module node-opcua-server
3
+ */
4
+ import { assert } from "node-opcua-assert";
5
+
6
+ import {BaseNode, UAVariable} from "node-opcua-address-space";
7
+ import { AttributeIds } from "node-opcua-data-model";
8
+ import { NodeClass } from "node-opcua-data-model";
9
+ import { ExtensionObject } from "node-opcua-extension-object";
10
+ import { NodeId } from "node-opcua-nodeid";
11
+ import { DataChangeFilter, EventFilter } from "node-opcua-service-filter";
12
+ import { DeadbandType } from "node-opcua-service-subscription";
13
+ import { StatusCode, StatusCodes } from "node-opcua-status-code";
14
+ import {ReadValueIdOptions} from "node-opcua-types";
15
+ import {BaseNode2} from "./monitored_item";
16
+
17
+ function __validateDataChangeFilter(
18
+ filter: DataChangeFilter,
19
+ itemToMonitor: ReadValueIdOptions,
20
+ node: UAVariable
21
+ ): StatusCode {
22
+
23
+ assert(itemToMonitor.attributeId === AttributeIds.Value);
24
+
25
+ if ((node.nodeClass !== NodeClass.Variable)) {
26
+ return StatusCodes.BadNodeIdInvalid;
27
+ }
28
+
29
+ assert(node.nodeClass === NodeClass.Variable);
30
+
31
+ // if node is not Numerical=> DataChangeFilter
32
+ assert(node.dataType instanceof NodeId);
33
+ const dataType = node.addressSpace.findDataType(node.dataType)!;
34
+
35
+ const dataTypeNumber = node.addressSpace.findDataType("Number")!;
36
+ if (filter.deadbandType !== DeadbandType.None) {
37
+ if (!dataType.isSupertypeOf(dataTypeNumber)) {
38
+ return StatusCodes.BadFilterNotAllowed;
39
+ }
40
+ }
41
+
42
+ if (filter.deadbandType === DeadbandType.Percent) {
43
+ if (filter.deadbandValue < 0 || filter.deadbandValue > 100) {
44
+ return StatusCodes.BadDeadbandFilterInvalid;
45
+ }
46
+
47
+ // node must also have a valid euRange
48
+ if (!(node as any).euRange) {
49
+ // tslint:disable:no-console
50
+ console.log(" node has no euRange ! Dead band Percent cannot be used on node " + node.nodeId.toString());
51
+ return StatusCodes.BadMonitoredItemFilterUnsupported;
52
+ }
53
+ }
54
+ return StatusCodes.Good;
55
+ }
56
+
57
+ export function validateFilter(
58
+ filter: ExtensionObject | null,
59
+ itemToMonitor: ReadValueIdOptions,
60
+ node: BaseNode
61
+ ) {
62
+
63
+ // handle filter information
64
+ if (filter && filter instanceof EventFilter
65
+ && itemToMonitor.attributeId !== AttributeIds.EventNotifier) {
66
+ // invalid filter on Event
67
+ return StatusCodes.BadFilterNotAllowed;
68
+ }
69
+
70
+ if (filter && filter instanceof DataChangeFilter
71
+ && itemToMonitor.attributeId !== AttributeIds.Value) {
72
+ // invalid DataChange filter on non Value Attribute
73
+ return StatusCodes.BadFilterNotAllowed;
74
+ }
75
+
76
+ if (filter && itemToMonitor.attributeId !== AttributeIds.EventNotifier
77
+ && itemToMonitor.attributeId !== AttributeIds.Value) {
78
+ return StatusCodes.BadFilterNotAllowed;
79
+ }
80
+
81
+ if (filter instanceof DataChangeFilter) {
82
+ return __validateDataChangeFilter(filter, itemToMonitor, node as UAVariable);
83
+ }
84
+
85
+ return StatusCodes.Good;
86
+ }
@@ -1 +1 @@
1
- require("node-opcua-pki/bin/crypto_create_CA");
1
+ require("node-opcua-pki/bin/crypto_create_CA");