node-opcua-server 2.71.0 → 2.72.2
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/base_server.d.ts +110 -110
- package/dist/base_server.js +473 -473
- package/dist/factory.d.ts +12 -12
- package/dist/factory.js +23 -23
- package/dist/history_server_capabilities.d.ts +35 -35
- package/dist/history_server_capabilities.js +43 -43
- package/dist/i_channel_data.d.ts +13 -13
- package/dist/i_channel_data.js +2 -2
- package/dist/i_register_server_manager.d.ts +16 -16
- package/dist/i_register_server_manager.js +2 -2
- package/dist/i_server_side_publish_engine.d.ts +36 -36
- package/dist/i_server_side_publish_engine.js +49 -49
- package/dist/i_socket_data.d.ts +11 -11
- package/dist/i_socket_data.js +2 -2
- package/dist/index.d.ts +15 -15
- package/dist/index.js +31 -31
- package/dist/monitored_item.d.ts +177 -177
- package/dist/monitored_item.js +998 -998
- package/dist/node_sampler.d.ts +3 -3
- package/dist/node_sampler.js +75 -75
- package/dist/opcua_server.d.ts +650 -647
- package/dist/opcua_server.js +2392 -2385
- package/dist/opcua_server.js.map +1 -1
- package/dist/queue.d.ts +11 -11
- package/dist/queue.js +71 -71
- package/dist/register_server_manager.d.ts +96 -96
- package/dist/register_server_manager.js +584 -584
- package/dist/register_server_manager_hidden.d.ts +17 -17
- package/dist/register_server_manager_hidden.js +27 -27
- package/dist/register_server_manager_mdns_only.d.ts +22 -22
- package/dist/register_server_manager_mdns_only.js +55 -55
- package/dist/server_capabilities.d.ts +148 -61
- package/dist/server_capabilities.js +91 -108
- package/dist/server_capabilities.js.map +1 -1
- package/dist/server_end_point.d.ts +183 -183
- package/dist/server_end_point.js +817 -816
- package/dist/server_end_point.js.map +1 -1
- package/dist/server_engine.d.ts +317 -316
- package/dist/server_engine.js +1716 -1688
- package/dist/server_engine.js.map +1 -1
- package/dist/server_publish_engine.d.ts +112 -112
- package/dist/server_publish_engine.js +530 -530
- package/dist/server_publish_engine_for_orphan_subscriptions.d.ts +16 -16
- package/dist/server_publish_engine_for_orphan_subscriptions.js +49 -49
- package/dist/server_session.d.ts +181 -181
- package/dist/server_session.js +738 -738
- package/dist/server_session.js.map +1 -1
- package/dist/server_subscription.d.ts +415 -395
- package/dist/server_subscription.js +1334 -1316
- package/dist/server_subscription.js.map +1 -1
- package/dist/sessions_compatible_for_transfer.d.ts +2 -2
- package/dist/sessions_compatible_for_transfer.js +36 -36
- package/dist/user_manager.d.ts +32 -32
- package/dist/user_manager.js +74 -74
- package/dist/user_manager_ua.d.ts +3 -3
- package/dist/user_manager_ua.js +39 -39
- package/dist/validate_filter.d.ts +5 -5
- package/dist/validate_filter.js +60 -60
- package/package.json +34 -34
- package/source/opcua_server.ts +27 -16
- package/source/server_capabilities.ts +178 -91
- package/source/server_end_point.ts +9 -8
- package/source/server_engine.ts +30 -1
- package/source/server_session.ts +1 -0
- package/source/server_subscription.ts +46 -5
package/dist/validate_filter.js
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateFilter = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @module node-opcua-server
|
|
6
|
-
*/
|
|
7
|
-
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
8
|
-
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
9
|
-
const node_opcua_data_model_2 = require("node-opcua-data-model");
|
|
10
|
-
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
11
|
-
const node_opcua_service_filter_1 = require("node-opcua-service-filter");
|
|
12
|
-
const node_opcua_service_subscription_1 = require("node-opcua-service-subscription");
|
|
13
|
-
const node_opcua_status_code_1 = require("node-opcua-status-code");
|
|
14
|
-
function __validateDataChangeFilter(filter, itemToMonitor, node) {
|
|
15
|
-
(0, node_opcua_assert_1.assert)(itemToMonitor.attributeId === node_opcua_data_model_1.AttributeIds.Value);
|
|
16
|
-
if (node.nodeClass !== node_opcua_data_model_2.NodeClass.Variable) {
|
|
17
|
-
return node_opcua_status_code_1.StatusCodes.BadNodeIdInvalid;
|
|
18
|
-
}
|
|
19
|
-
(0, node_opcua_assert_1.assert)(node.nodeClass === node_opcua_data_model_2.NodeClass.Variable);
|
|
20
|
-
// if node is not Numerical=> DataChangeFilter
|
|
21
|
-
(0, node_opcua_assert_1.assert)(node.dataType instanceof node_opcua_nodeid_1.NodeId);
|
|
22
|
-
const dataType = node.addressSpace.findDataType(node.dataType);
|
|
23
|
-
const dataTypeNumber = node.addressSpace.findDataType("Number");
|
|
24
|
-
if (filter.deadbandType !== node_opcua_service_subscription_1.DeadbandType.None) {
|
|
25
|
-
if (!dataType.isSupertypeOf(dataTypeNumber)) {
|
|
26
|
-
return node_opcua_status_code_1.StatusCodes.BadFilterNotAllowed;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
if (filter.deadbandType === node_opcua_service_subscription_1.DeadbandType.Percent) {
|
|
30
|
-
if (filter.deadbandValue < 0 || filter.deadbandValue > 100) {
|
|
31
|
-
return node_opcua_status_code_1.StatusCodes.BadDeadbandFilterInvalid;
|
|
32
|
-
}
|
|
33
|
-
// node must also have a valid euRange
|
|
34
|
-
if (!node.euRange) {
|
|
35
|
-
// tslint:disable:no-console
|
|
36
|
-
console.log(" node has no euRange ! Dead band Percent cannot be used on node " + node.nodeId.toString());
|
|
37
|
-
return node_opcua_status_code_1.StatusCodes.BadMonitoredItemFilterUnsupported;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return node_opcua_status_code_1.StatusCodes.Good;
|
|
41
|
-
}
|
|
42
|
-
function validateFilter(filter, itemToMonitor, node) {
|
|
43
|
-
// handle filter information
|
|
44
|
-
if (filter && filter instanceof node_opcua_service_filter_1.EventFilter && itemToMonitor.attributeId !== node_opcua_data_model_1.AttributeIds.EventNotifier) {
|
|
45
|
-
// invalid filter on Event
|
|
46
|
-
return node_opcua_status_code_1.StatusCodes.BadFilterNotAllowed;
|
|
47
|
-
}
|
|
48
|
-
if (filter && filter instanceof node_opcua_service_filter_1.DataChangeFilter && itemToMonitor.attributeId !== node_opcua_data_model_1.AttributeIds.Value) {
|
|
49
|
-
// invalid DataChange filter on non Value Attribute
|
|
50
|
-
return node_opcua_status_code_1.StatusCodes.BadFilterNotAllowed;
|
|
51
|
-
}
|
|
52
|
-
if (filter && itemToMonitor.attributeId !== node_opcua_data_model_1.AttributeIds.EventNotifier && itemToMonitor.attributeId !== node_opcua_data_model_1.AttributeIds.Value) {
|
|
53
|
-
return node_opcua_status_code_1.StatusCodes.BadFilterNotAllowed;
|
|
54
|
-
}
|
|
55
|
-
if (filter instanceof node_opcua_service_filter_1.DataChangeFilter) {
|
|
56
|
-
return __validateDataChangeFilter(filter, itemToMonitor, node);
|
|
57
|
-
}
|
|
58
|
-
return node_opcua_status_code_1.StatusCodes.Good;
|
|
59
|
-
}
|
|
60
|
-
exports.validateFilter = validateFilter;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateFilter = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @module node-opcua-server
|
|
6
|
+
*/
|
|
7
|
+
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
8
|
+
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
9
|
+
const node_opcua_data_model_2 = require("node-opcua-data-model");
|
|
10
|
+
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
11
|
+
const node_opcua_service_filter_1 = require("node-opcua-service-filter");
|
|
12
|
+
const node_opcua_service_subscription_1 = require("node-opcua-service-subscription");
|
|
13
|
+
const node_opcua_status_code_1 = require("node-opcua-status-code");
|
|
14
|
+
function __validateDataChangeFilter(filter, itemToMonitor, node) {
|
|
15
|
+
(0, node_opcua_assert_1.assert)(itemToMonitor.attributeId === node_opcua_data_model_1.AttributeIds.Value);
|
|
16
|
+
if (node.nodeClass !== node_opcua_data_model_2.NodeClass.Variable) {
|
|
17
|
+
return node_opcua_status_code_1.StatusCodes.BadNodeIdInvalid;
|
|
18
|
+
}
|
|
19
|
+
(0, node_opcua_assert_1.assert)(node.nodeClass === node_opcua_data_model_2.NodeClass.Variable);
|
|
20
|
+
// if node is not Numerical=> DataChangeFilter
|
|
21
|
+
(0, node_opcua_assert_1.assert)(node.dataType instanceof node_opcua_nodeid_1.NodeId);
|
|
22
|
+
const dataType = node.addressSpace.findDataType(node.dataType);
|
|
23
|
+
const dataTypeNumber = node.addressSpace.findDataType("Number");
|
|
24
|
+
if (filter.deadbandType !== node_opcua_service_subscription_1.DeadbandType.None) {
|
|
25
|
+
if (!dataType.isSupertypeOf(dataTypeNumber)) {
|
|
26
|
+
return node_opcua_status_code_1.StatusCodes.BadFilterNotAllowed;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (filter.deadbandType === node_opcua_service_subscription_1.DeadbandType.Percent) {
|
|
30
|
+
if (filter.deadbandValue < 0 || filter.deadbandValue > 100) {
|
|
31
|
+
return node_opcua_status_code_1.StatusCodes.BadDeadbandFilterInvalid;
|
|
32
|
+
}
|
|
33
|
+
// node must also have a valid euRange
|
|
34
|
+
if (!node.euRange) {
|
|
35
|
+
// tslint:disable:no-console
|
|
36
|
+
console.log(" node has no euRange ! Dead band Percent cannot be used on node " + node.nodeId.toString());
|
|
37
|
+
return node_opcua_status_code_1.StatusCodes.BadMonitoredItemFilterUnsupported;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return node_opcua_status_code_1.StatusCodes.Good;
|
|
41
|
+
}
|
|
42
|
+
function validateFilter(filter, itemToMonitor, node) {
|
|
43
|
+
// handle filter information
|
|
44
|
+
if (filter && filter instanceof node_opcua_service_filter_1.EventFilter && itemToMonitor.attributeId !== node_opcua_data_model_1.AttributeIds.EventNotifier) {
|
|
45
|
+
// invalid filter on Event
|
|
46
|
+
return node_opcua_status_code_1.StatusCodes.BadFilterNotAllowed;
|
|
47
|
+
}
|
|
48
|
+
if (filter && filter instanceof node_opcua_service_filter_1.DataChangeFilter && itemToMonitor.attributeId !== node_opcua_data_model_1.AttributeIds.Value) {
|
|
49
|
+
// invalid DataChange filter on non Value Attribute
|
|
50
|
+
return node_opcua_status_code_1.StatusCodes.BadFilterNotAllowed;
|
|
51
|
+
}
|
|
52
|
+
if (filter && itemToMonitor.attributeId !== node_opcua_data_model_1.AttributeIds.EventNotifier && itemToMonitor.attributeId !== node_opcua_data_model_1.AttributeIds.Value) {
|
|
53
|
+
return node_opcua_status_code_1.StatusCodes.BadFilterNotAllowed;
|
|
54
|
+
}
|
|
55
|
+
if (filter instanceof node_opcua_service_filter_1.DataChangeFilter) {
|
|
56
|
+
return __validateDataChangeFilter(filter, itemToMonitor, node);
|
|
57
|
+
}
|
|
58
|
+
return node_opcua_status_code_1.StatusCodes.Good;
|
|
59
|
+
}
|
|
60
|
+
exports.validateFilter = validateFilter;
|
|
61
61
|
//# sourceMappingURL=validate_filter.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.72.2",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module -server",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc -b",
|
|
@@ -17,51 +17,51 @@
|
|
|
17
17
|
"async": "^3.2.4",
|
|
18
18
|
"dequeue": "^1.0.5",
|
|
19
19
|
"lodash": "4.17.21",
|
|
20
|
-
"node-opcua-address-space": "2.
|
|
20
|
+
"node-opcua-address-space": "2.72.2",
|
|
21
21
|
"node-opcua-assert": "2.66.0",
|
|
22
|
-
"node-opcua-basic-types": "2.
|
|
23
|
-
"node-opcua-certificate-manager": "2.
|
|
24
|
-
"node-opcua-client": "2.
|
|
25
|
-
"node-opcua-client-dynamic-extension-object": "2.
|
|
26
|
-
"node-opcua-common": "2.
|
|
22
|
+
"node-opcua-basic-types": "2.72.1",
|
|
23
|
+
"node-opcua-certificate-manager": "2.72.1",
|
|
24
|
+
"node-opcua-client": "2.72.2",
|
|
25
|
+
"node-opcua-client-dynamic-extension-object": "2.72.2",
|
|
26
|
+
"node-opcua-common": "2.72.2",
|
|
27
27
|
"node-opcua-constants": "2.70.0",
|
|
28
28
|
"node-opcua-crypto": "^1.11.0",
|
|
29
|
-
"node-opcua-data-access": "2.
|
|
30
|
-
"node-opcua-data-model": "2.
|
|
31
|
-
"node-opcua-data-value": "2.
|
|
29
|
+
"node-opcua-data-access": "2.72.2",
|
|
30
|
+
"node-opcua-data-model": "2.72.1",
|
|
31
|
+
"node-opcua-data-value": "2.72.2",
|
|
32
32
|
"node-opcua-date-time": "2.71.0",
|
|
33
33
|
"node-opcua-debug": "2.71.0",
|
|
34
34
|
"node-opcua-enum": "2.71.0",
|
|
35
|
-
"node-opcua-extension-object": "2.
|
|
36
|
-
"node-opcua-factory": "2.
|
|
35
|
+
"node-opcua-extension-object": "2.72.1",
|
|
36
|
+
"node-opcua-factory": "2.72.1",
|
|
37
37
|
"node-opcua-hostname": "2.67.0",
|
|
38
38
|
"node-opcua-nodeid": "2.71.0",
|
|
39
|
-
"node-opcua-nodeset-ua": "2.
|
|
39
|
+
"node-opcua-nodeset-ua": "2.72.2",
|
|
40
40
|
"node-opcua-nodesets": "2.71.0",
|
|
41
|
-
"node-opcua-numeric-range": "2.
|
|
41
|
+
"node-opcua-numeric-range": "2.72.2",
|
|
42
42
|
"node-opcua-object-registry": "2.71.0",
|
|
43
43
|
"node-opcua-pki": "^2.17.0",
|
|
44
|
-
"node-opcua-secure-channel": "2.
|
|
45
|
-
"node-opcua-service-browse": "2.
|
|
46
|
-
"node-opcua-service-call": "2.
|
|
47
|
-
"node-opcua-service-discovery": "2.
|
|
48
|
-
"node-opcua-service-endpoints": "2.
|
|
49
|
-
"node-opcua-service-filter": "2.
|
|
50
|
-
"node-opcua-service-history": "2.
|
|
51
|
-
"node-opcua-service-node-management": "2.
|
|
52
|
-
"node-opcua-service-query": "2.
|
|
53
|
-
"node-opcua-service-read": "2.
|
|
54
|
-
"node-opcua-service-register-node": "2.
|
|
55
|
-
"node-opcua-service-secure-channel": "2.
|
|
56
|
-
"node-opcua-service-session": "2.
|
|
57
|
-
"node-opcua-service-subscription": "2.
|
|
58
|
-
"node-opcua-service-translate-browse-path": "2.
|
|
59
|
-
"node-opcua-service-write": "2.
|
|
44
|
+
"node-opcua-secure-channel": "2.72.2",
|
|
45
|
+
"node-opcua-service-browse": "2.72.2",
|
|
46
|
+
"node-opcua-service-call": "2.72.2",
|
|
47
|
+
"node-opcua-service-discovery": "2.72.2",
|
|
48
|
+
"node-opcua-service-endpoints": "2.72.2",
|
|
49
|
+
"node-opcua-service-filter": "2.72.2",
|
|
50
|
+
"node-opcua-service-history": "2.72.2",
|
|
51
|
+
"node-opcua-service-node-management": "2.72.2",
|
|
52
|
+
"node-opcua-service-query": "2.72.2",
|
|
53
|
+
"node-opcua-service-read": "2.72.2",
|
|
54
|
+
"node-opcua-service-register-node": "2.72.2",
|
|
55
|
+
"node-opcua-service-secure-channel": "2.72.2",
|
|
56
|
+
"node-opcua-service-session": "2.72.2",
|
|
57
|
+
"node-opcua-service-subscription": "2.72.2",
|
|
58
|
+
"node-opcua-service-translate-browse-path": "2.72.2",
|
|
59
|
+
"node-opcua-service-write": "2.72.2",
|
|
60
60
|
"node-opcua-status-code": "2.71.0",
|
|
61
|
-
"node-opcua-transport": "2.
|
|
62
|
-
"node-opcua-types": "2.
|
|
61
|
+
"node-opcua-transport": "2.72.2",
|
|
62
|
+
"node-opcua-types": "2.72.2",
|
|
63
63
|
"node-opcua-utils": "2.71.0",
|
|
64
|
-
"node-opcua-variant": "2.
|
|
64
|
+
"node-opcua-variant": "2.72.2"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"node-opcua-leak-detector": "2.71.0",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"internet of things"
|
|
85
85
|
],
|
|
86
86
|
"homepage": "http://node-opcua.github.io/",
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "07dcdd8e8c7f2b55544c6e23023093e35674829c"
|
|
88
88
|
}
|
package/source/opcua_server.ts
CHANGED
|
@@ -181,7 +181,6 @@ const debugLog = make_debugLog(__filename);
|
|
|
181
181
|
const errorLog = make_errorLog(__filename);
|
|
182
182
|
const warningLog = make_warningLog(__filename);
|
|
183
183
|
|
|
184
|
-
const default_maxAllowedSessionNumber = 10;
|
|
185
184
|
const default_maxConnectionsPerEndpoint = 10;
|
|
186
185
|
|
|
187
186
|
function g_sendError(channel: ServerSecureChannelLayer, message: Message, ResponseClass: any, statusCode: StatusCode): void {
|
|
@@ -605,7 +604,8 @@ function validate_applicationUri(channel: ServerSecureChannelLayer, request: Cre
|
|
|
605
604
|
}
|
|
606
605
|
const e = exploreCertificate(clientCertificate);
|
|
607
606
|
const uniformResourceIdentifier = e.tbsCertificate.extensions!.subjectAltName?.uniformResourceIdentifier ?? null;
|
|
608
|
-
const applicationUriFromCert =
|
|
607
|
+
const applicationUriFromCert =
|
|
608
|
+
uniformResourceIdentifier && uniformResourceIdentifier.length > 0 ? uniformResourceIdentifier[0] : null;
|
|
609
609
|
|
|
610
610
|
/* istanbul ignore next */
|
|
611
611
|
if (applicationUriFromCert !== applicationUri) {
|
|
@@ -776,6 +776,8 @@ export interface OPCUAServerOptions extends OPCUABaseServerOptions, OPCUAServerE
|
|
|
776
776
|
/**
|
|
777
777
|
* the maximum number of simultaneous sessions allowed.
|
|
778
778
|
* @default 10
|
|
779
|
+
* @deprecated use serverCapabilities: { maxSessions: } instead
|
|
780
|
+
|
|
779
781
|
*/
|
|
780
782
|
maxAllowedSessionNumber?: number;
|
|
781
783
|
|
|
@@ -1035,12 +1037,17 @@ export class OPCUAServer extends OPCUABaseServer {
|
|
|
1035
1037
|
public static fallbackSessionName = "Client didn't provide a meaningful sessionName ...";
|
|
1036
1038
|
/**
|
|
1037
1039
|
* the maximum number of subscription that can be created per server
|
|
1040
|
+
* @deprecated
|
|
1038
1041
|
*/
|
|
1039
|
-
public static
|
|
1042
|
+
public static deprectated_MAX_SUBSCRIPTION = 50;
|
|
1043
|
+
|
|
1040
1044
|
/**
|
|
1041
1045
|
* the maximum number of concurrent sessions allowed on the server
|
|
1042
1046
|
*/
|
|
1043
|
-
public maxAllowedSessionNumber: number
|
|
1047
|
+
public get maxAllowedSessionNumber(): number {
|
|
1048
|
+
return this.engine.serverCapabilities.maxSessions;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1044
1051
|
/**
|
|
1045
1052
|
* the maximum number for concurrent connection per end point
|
|
1046
1053
|
*/
|
|
@@ -1070,10 +1077,14 @@ export class OPCUAServer extends OPCUABaseServer {
|
|
|
1070
1077
|
|
|
1071
1078
|
this.options = options;
|
|
1072
1079
|
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1080
|
+
if (options.maxAllowedSessionNumber !== undefined) {
|
|
1081
|
+
warningLog(
|
|
1082
|
+
"[NODE-OPCUA-W21] maxAllowedSessionNumber property is now deprecated , please use serverCapabilities.maxSessions instead"
|
|
1083
|
+
);
|
|
1084
|
+
options.serverCapabilities = options.serverCapabilities || {};
|
|
1085
|
+
options.serverCapabilities.maxSessions = options.maxAllowedSessionNumber;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1077
1088
|
/**
|
|
1078
1089
|
* @property maxConnectionsPerEndpoint
|
|
1079
1090
|
*/
|
|
@@ -1698,12 +1709,12 @@ export class OPCUAServer extends OPCUABaseServer {
|
|
|
1698
1709
|
// A Server application should limit the number of Sessions. To protect against misbehaving Clients and denial
|
|
1699
1710
|
// of service attacks, the Server shall close the oldest Session that is not activated before reaching the
|
|
1700
1711
|
// maximum number of supported Sessions
|
|
1701
|
-
if (this.currentSessionCount >= this.
|
|
1712
|
+
if (this.currentSessionCount >= this.engine.serverCapabilities.maxSessions) {
|
|
1702
1713
|
await _attempt_to_close_some_old_unactivated_session(this);
|
|
1703
1714
|
}
|
|
1704
1715
|
|
|
1705
1716
|
// check if session count hasn't reach the maximum allowed sessions
|
|
1706
|
-
if (this.currentSessionCount >= this.
|
|
1717
|
+
if (this.currentSessionCount >= this.engine.serverCapabilities.maxSessions) {
|
|
1707
1718
|
return rejectConnection(this, StatusCodes.BadTooManySessions);
|
|
1708
1719
|
}
|
|
1709
1720
|
|
|
@@ -2357,10 +2368,6 @@ export class OPCUAServer extends OPCUABaseServer {
|
|
|
2357
2368
|
return sendError(StatusCodes.BadNothingToDo);
|
|
2358
2369
|
}
|
|
2359
2370
|
|
|
2360
|
-
// if (request.subscriptionIds.length > OPCUAServer.MAX_SUBSCRIPTION) {
|
|
2361
|
-
// return sendError(StatusCodes.BadTooManyOperations);
|
|
2362
|
-
// }
|
|
2363
|
-
|
|
2364
2371
|
const results: any[] = subscriptionIds.map((subscriptionId: number) => actionToPerform(session, subscriptionId));
|
|
2365
2372
|
|
|
2366
2373
|
// resolve potential pending promises ....
|
|
@@ -2373,7 +2380,7 @@ export class OPCUAServer extends OPCUABaseServer {
|
|
|
2373
2380
|
const response = new ResponseClass({
|
|
2374
2381
|
responseHeader: {
|
|
2375
2382
|
serviceResult:
|
|
2376
|
-
request.subscriptionIds.length >
|
|
2383
|
+
request.subscriptionIds.length > this.engine.serverCapabilities.maxSubscriptionsPerSession
|
|
2377
2384
|
? StatusCodes.BadTooManyOperations
|
|
2378
2385
|
: StatusCodes.Good
|
|
2379
2386
|
},
|
|
@@ -2821,7 +2828,11 @@ export class OPCUAServer extends OPCUABaseServer {
|
|
|
2821
2828
|
(session: ServerSession, sendResponse: (response: Response) => void, sendError: (statusCode: StatusCode) => void) => {
|
|
2822
2829
|
const context = new SessionContext({ session, server: this });
|
|
2823
2830
|
|
|
2824
|
-
if (session.currentSubscriptionCount >=
|
|
2831
|
+
if (session.currentSubscriptionCount >= this.engine.serverCapabilities.maxSubscriptionsPerSession) {
|
|
2832
|
+
return sendError(StatusCodes.BadTooManySubscriptions);
|
|
2833
|
+
}
|
|
2834
|
+
|
|
2835
|
+
if (this.currentSubscriptionCount >= this.engine.serverCapabilities.maxSubscriptions) {
|
|
2825
2836
|
return sendError(StatusCodes.BadTooManySubscriptions);
|
|
2826
2837
|
}
|
|
2827
2838
|
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
* @module node-opcua-server
|
|
3
3
|
*/
|
|
4
4
|
// tslint:disable:max-classes-per-file
|
|
5
|
-
import {
|
|
5
|
+
import { UInt32 } from "node-opcua-basic-types";
|
|
6
|
+
import { QualifiedName } from "node-opcua-data-model";
|
|
6
7
|
import { SignedSoftwareCertificate } from "node-opcua-types";
|
|
8
|
+
import { OPCUAServer } from "./opcua_server";
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
*/
|
|
@@ -37,86 +39,162 @@ export class OperationLimits {
|
|
|
37
39
|
public maxNodesPerTranslateBrowsePathsToNodeIds: number;
|
|
38
40
|
|
|
39
41
|
constructor(options: OperationLimitsOptions) {
|
|
40
|
-
/**
|
|
41
|
-
* @property maxNodesPerRead
|
|
42
|
-
* @default 0
|
|
43
|
-
*/
|
|
44
42
|
this.maxNodesPerRead = options.maxNodesPerRead || 0;
|
|
45
|
-
/**
|
|
46
|
-
* @property maxNodesPerWrite
|
|
47
|
-
* @default 0
|
|
48
|
-
*/
|
|
49
43
|
this.maxNodesPerWrite = options.maxNodesPerWrite || 0;
|
|
50
|
-
/**
|
|
51
|
-
* @property maxNodesPerMethodCall
|
|
52
|
-
* @default 0
|
|
53
|
-
*/
|
|
54
44
|
this.maxNodesPerMethodCall = options.maxNodesPerMethodCall || 0;
|
|
55
|
-
/**
|
|
56
|
-
* @property maxNodesPerBrowse
|
|
57
|
-
* @default 0
|
|
58
|
-
*/
|
|
59
45
|
this.maxNodesPerBrowse = options.maxNodesPerBrowse || 0;
|
|
60
|
-
/**
|
|
61
|
-
* @property maxNodesPerRegisterNodes
|
|
62
|
-
* @default 0
|
|
63
|
-
*/
|
|
64
46
|
this.maxNodesPerRegisterNodes = options.maxNodesPerRegisterNodes || 0;
|
|
65
|
-
/**
|
|
66
|
-
* @property maxNodesPerNodeManagement
|
|
67
|
-
* @default 0
|
|
68
|
-
*/
|
|
69
47
|
this.maxNodesPerNodeManagement = options.maxNodesPerNodeManagement || 0;
|
|
70
|
-
/**
|
|
71
|
-
* @property maxMonitoredItemsPerCall
|
|
72
|
-
* @default 0
|
|
73
|
-
*/
|
|
74
48
|
this.maxMonitoredItemsPerCall = options.maxMonitoredItemsPerCall || 0;
|
|
75
|
-
/**
|
|
76
|
-
* @property maxNodesPerHistoryReadData
|
|
77
|
-
*/
|
|
78
49
|
this.maxNodesPerHistoryReadData = options.maxNodesPerHistoryReadData || 0;
|
|
79
|
-
/**
|
|
80
|
-
* @property maxNodesPerHistoryReadEvents
|
|
81
|
-
* @default 0
|
|
82
|
-
*/
|
|
83
50
|
this.maxNodesPerHistoryReadEvents = options.maxNodesPerHistoryReadEvents || 0;
|
|
84
|
-
/**
|
|
85
|
-
* @property maxNodesPerHistoryUpdateData
|
|
86
|
-
* @default 0
|
|
87
|
-
*/
|
|
88
51
|
this.maxNodesPerHistoryUpdateData = options.maxNodesPerHistoryUpdateData || 0;
|
|
89
|
-
/**
|
|
90
|
-
* @property maxNodesPerHistoryUpdateEvents
|
|
91
|
-
* @default 0
|
|
92
|
-
*/
|
|
93
52
|
this.maxNodesPerHistoryUpdateEvents = options.maxNodesPerHistoryUpdateEvents || 0;
|
|
94
|
-
/**
|
|
95
|
-
* @property maxNodesPerTranslateBrowsePathsToNodeIds
|
|
96
|
-
* @default 0
|
|
97
|
-
*/
|
|
98
53
|
this.maxNodesPerTranslateBrowsePathsToNodeIds = options.maxNodesPerTranslateBrowsePathsToNodeIds || 0;
|
|
99
54
|
}
|
|
100
55
|
}
|
|
101
56
|
|
|
102
|
-
export interface
|
|
103
|
-
maxBrowseContinuationPoints
|
|
104
|
-
maxHistoryContinuationPoints
|
|
105
|
-
maxStringLength
|
|
106
|
-
maxArrayLength
|
|
107
|
-
maxByteStringLength
|
|
108
|
-
maxQueryContinuationPoints
|
|
109
|
-
minSupportedSampleRate
|
|
110
|
-
operationLimits
|
|
111
|
-
|
|
112
|
-
serverProfileArray
|
|
113
|
-
localeIdArray
|
|
114
|
-
softwareCertificates
|
|
57
|
+
export interface IServerCapabilities {
|
|
58
|
+
maxBrowseContinuationPoints: number;
|
|
59
|
+
maxHistoryContinuationPoints: number;
|
|
60
|
+
maxStringLength: number;
|
|
61
|
+
maxArrayLength: number;
|
|
62
|
+
maxByteStringLength: number;
|
|
63
|
+
maxQueryContinuationPoints: number;
|
|
64
|
+
minSupportedSampleRate: number;
|
|
65
|
+
operationLimits: OperationLimitsOptions;
|
|
66
|
+
|
|
67
|
+
serverProfileArray: string[];
|
|
68
|
+
localeIdArray: string[];
|
|
69
|
+
softwareCertificates: SignedSoftwareCertificate[];
|
|
70
|
+
|
|
71
|
+
// new in 1.05
|
|
72
|
+
/**
|
|
73
|
+
* MaxSessions is an integer specifying the maximum number of concurrent
|
|
74
|
+
* Sessions the Server can support. The value specifies the
|
|
75
|
+
* maximum the Server can support under normal circumstances,
|
|
76
|
+
* therefore there is no guarantee the Server can always support
|
|
77
|
+
* the maximum.
|
|
78
|
+
*/
|
|
79
|
+
maxSessions: UInt32;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* MaxSubscriptions is an integer specifying the maximum number of
|
|
83
|
+
* Subscriptions the Server can support. The value specifies the
|
|
84
|
+
* maximum the Server can support under normal circumstances,
|
|
85
|
+
* therefore there is no guarantee the Server can always support
|
|
86
|
+
* the maximum.
|
|
87
|
+
*/
|
|
88
|
+
maxSubscriptions: UInt32;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* MaxMonitoredItems is an integer specifying the maximum number of
|
|
92
|
+
* MonitoredItems the Server can support. The value specifies the
|
|
93
|
+
* maximum the Server can support under normal circumstances,
|
|
94
|
+
* therefore there is no guarantee the Server can always support
|
|
95
|
+
* the maximum.
|
|
96
|
+
*/
|
|
97
|
+
maxMonitoredItems: UInt32;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* MaxSubscriptionsPerSession is an integer specifying the maximum number of
|
|
101
|
+
* Subscriptions per Session the Server can support. The value specifies the
|
|
102
|
+
* maximum the Server can support under normal circumstances,
|
|
103
|
+
* therefore there is no guarantee the Server can always support
|
|
104
|
+
* the maximum.
|
|
105
|
+
*/
|
|
106
|
+
maxSubscriptionsPerSession: UInt32;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* MaxMonitoredItemsPerSubscription is an integer specifying the maximum number of
|
|
110
|
+
* MonitoredItems per Subscription the Server can support. The value specifies the
|
|
111
|
+
* maximum the Server can support under normal circumstances,
|
|
112
|
+
* therefore there is no guarantee the Server can always support
|
|
113
|
+
* the maximum
|
|
114
|
+
*/
|
|
115
|
+
maxMonitoredItemsPerSubscription: UInt32;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* MaxSelectClauseParameters is an integer specifying the maximum number of
|
|
119
|
+
* EventField SelectClause Parameters the Server can support for an EventFilter.
|
|
120
|
+
* The value specifies the maximum the Server can support under normal circumstances,
|
|
121
|
+
* therefore there is no guarantee the Server can always support
|
|
122
|
+
* the maximum.
|
|
123
|
+
*/
|
|
124
|
+
maxSelectClauseParameters: UInt32;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* MaxWhereClauseParameters is an integer specifying the maximum number of
|
|
128
|
+
* EventField WhereClause Parameters the Server can support for an EventFilter.
|
|
129
|
+
* The value specifies the maximum the Server can support under normal circumstances,
|
|
130
|
+
* therefore there is no guarantee the Server can always support the maximum
|
|
131
|
+
*/
|
|
132
|
+
maxWhereClauseParameters: UInt32;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* (draft)
|
|
136
|
+
* MaxMonitoredItemsQueueSize is an integer specifying the maximum size of MonitoredItem
|
|
137
|
+
* queues. The value specifies the maximum the Server can support under normal circumstances,
|
|
138
|
+
* therefore there is no guarantee the Server can always support the maximum.
|
|
139
|
+
*
|
|
140
|
+
*/
|
|
141
|
+
maxMonitoredItemsQueueSize: UInt32;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
*
|
|
145
|
+
* ConformanceUnits is a QualifiedName array specifying the set of conformance units
|
|
146
|
+
* the Server supports. This list should be limited to the ConformanceUnits the Server
|
|
147
|
+
* supports in its current configuration.
|
|
148
|
+
*
|
|
149
|
+
*/
|
|
150
|
+
conformanceUnits: QualifiedName[];
|
|
115
151
|
}
|
|
152
|
+
export type ServerCapabilitiesOptions = Partial<IServerCapabilities>;
|
|
153
|
+
|
|
154
|
+
export const defaultServerCapabilities: IServerCapabilities = {
|
|
155
|
+
maxBrowseContinuationPoints: 0,
|
|
156
|
+
maxHistoryContinuationPoints: 0,
|
|
157
|
+
maxStringLength: 65535,
|
|
158
|
+
maxArrayLength: 65535,
|
|
159
|
+
maxByteStringLength: 65535,
|
|
160
|
+
maxQueryContinuationPoints: 0,
|
|
161
|
+
|
|
162
|
+
minSupportedSampleRate: 100,
|
|
163
|
+
|
|
164
|
+
operationLimits: {
|
|
165
|
+
maxNodesPerBrowse: 0,
|
|
166
|
+
maxNodesPerHistoryReadData: 0,
|
|
167
|
+
maxNodesPerHistoryReadEvents: 0,
|
|
168
|
+
maxNodesPerHistoryUpdateData: 0,
|
|
169
|
+
maxNodesPerHistoryUpdateEvents: 0,
|
|
170
|
+
maxNodesPerMethodCall: 0,
|
|
171
|
+
maxNodesPerNodeManagement: 0,
|
|
172
|
+
maxNodesPerRead: 0,
|
|
173
|
+
maxNodesPerRegisterNodes: 0,
|
|
174
|
+
maxNodesPerWrite: 0,
|
|
175
|
+
maxNodesPerTranslateBrowsePathsToNodeIds: 0,
|
|
176
|
+
maxMonitoredItemsPerCall: 0
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
serverProfileArray: [],
|
|
180
|
+
localeIdArray: [],
|
|
181
|
+
softwareCertificates: [],
|
|
182
|
+
|
|
183
|
+
maxSessions: 10,
|
|
184
|
+
maxSubscriptions: 100,
|
|
185
|
+
maxMonitoredItems: 1000000, // 1 million
|
|
186
|
+
maxSubscriptionsPerSession: 10,
|
|
187
|
+
maxMonitoredItemsPerSubscription: 100000, // one hundred thousand
|
|
188
|
+
maxSelectClauseParameters: 100,
|
|
189
|
+
maxWhereClauseParameters: 100,
|
|
190
|
+
maxMonitoredItemsQueueSize: 60000,
|
|
191
|
+
|
|
192
|
+
conformanceUnits: []
|
|
193
|
+
};
|
|
116
194
|
|
|
117
195
|
/**
|
|
118
196
|
*/
|
|
119
|
-
export class ServerCapabilities {
|
|
197
|
+
export class ServerCapabilities implements IServerCapabilities {
|
|
120
198
|
public maxBrowseContinuationPoints: number;
|
|
121
199
|
public maxHistoryContinuationPoints: number;
|
|
122
200
|
public maxStringLength: number;
|
|
@@ -130,6 +208,18 @@ export class ServerCapabilities {
|
|
|
130
208
|
public localeIdArray: string[];
|
|
131
209
|
public softwareCertificates: SignedSoftwareCertificate[];
|
|
132
210
|
|
|
211
|
+
// new in 1.05
|
|
212
|
+
public maxSessions: UInt32;
|
|
213
|
+
public maxSubscriptions: UInt32;
|
|
214
|
+
public maxMonitoredItems: UInt32;
|
|
215
|
+
public maxSubscriptionsPerSession: UInt32;
|
|
216
|
+
public maxMonitoredItemsPerSubscription: UInt32;
|
|
217
|
+
public maxSelectClauseParameters: UInt32;
|
|
218
|
+
public maxWhereClauseParameters: UInt32;
|
|
219
|
+
public maxMonitoredItemsQueueSize: UInt32;
|
|
220
|
+
public conformanceUnits: QualifiedName[];
|
|
221
|
+
|
|
222
|
+
// eslint-disable-next-line complexity
|
|
133
223
|
constructor(options: ServerCapabilitiesOptions) {
|
|
134
224
|
options = options || {};
|
|
135
225
|
options.operationLimits = options.operationLimits || {};
|
|
@@ -137,36 +227,33 @@ export class ServerCapabilities {
|
|
|
137
227
|
this.serverProfileArray = options.serverProfileArray || [];
|
|
138
228
|
this.localeIdArray = options.localeIdArray || [];
|
|
139
229
|
this.softwareCertificates = options.softwareCertificates || [];
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
this.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
this.maxByteStringLength = options.maxByteStringLength || 0;
|
|
152
|
-
/**
|
|
153
|
-
* @property maxBrowseContinuationPoints
|
|
154
|
-
*/
|
|
155
|
-
this.maxBrowseContinuationPoints = options.maxBrowseContinuationPoints || 0;
|
|
156
|
-
/**
|
|
157
|
-
* @property maxQueryContinuationPoints
|
|
158
|
-
*/
|
|
159
|
-
this.maxQueryContinuationPoints = options.maxQueryContinuationPoints || 0;
|
|
160
|
-
/**
|
|
161
|
-
* @property maxHistoryContinuationPoints
|
|
162
|
-
*/
|
|
163
|
-
this.maxHistoryContinuationPoints = options.maxHistoryContinuationPoints || 0;
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* @property operationLimits
|
|
167
|
-
*/
|
|
230
|
+
|
|
231
|
+
this.maxArrayLength = options.maxArrayLength || defaultServerCapabilities.maxArrayLength;
|
|
232
|
+
this.maxStringLength = options.maxStringLength || defaultServerCapabilities.maxStringLength;
|
|
233
|
+
this.maxByteStringLength = options.maxByteStringLength || defaultServerCapabilities.maxByteStringLength;
|
|
234
|
+
this.maxBrowseContinuationPoints =
|
|
235
|
+
options.maxBrowseContinuationPoints || defaultServerCapabilities.maxBrowseContinuationPoints;
|
|
236
|
+
this.maxQueryContinuationPoints =
|
|
237
|
+
options.maxQueryContinuationPoints || defaultServerCapabilities.maxQueryContinuationPoints;
|
|
238
|
+
this.maxHistoryContinuationPoints =
|
|
239
|
+
options.maxHistoryContinuationPoints || defaultServerCapabilities.maxHistoryContinuationPoints;
|
|
240
|
+
|
|
168
241
|
this.operationLimits = new OperationLimits(options.operationLimits);
|
|
169
242
|
|
|
170
|
-
this.minSupportedSampleRate =
|
|
243
|
+
this.minSupportedSampleRate = options.minSupportedSampleRate || defaultServerCapabilities.minSupportedSampleRate; // to do adjust me
|
|
244
|
+
|
|
245
|
+
// new in 1.05
|
|
246
|
+
this.maxSessions = options.maxSessions || defaultServerCapabilities.maxSessions;
|
|
247
|
+
|
|
248
|
+
this.maxSubscriptionsPerSession = options.maxSubscriptionsPerSession || defaultServerCapabilities.maxSubscriptionsPerSession;
|
|
249
|
+
this.maxSubscriptions = options.maxSubscriptions || defaultServerCapabilities.maxSubscriptions;
|
|
250
|
+
this.maxMonitoredItems = options.maxMonitoredItems || defaultServerCapabilities.maxMonitoredItems;
|
|
251
|
+
this.maxMonitoredItemsPerSubscription =
|
|
252
|
+
options.maxMonitoredItemsPerSubscription || defaultServerCapabilities.maxMonitoredItemsPerSubscription;
|
|
253
|
+
this.maxSelectClauseParameters = options.maxSelectClauseParameters || defaultServerCapabilities.maxSelectClauseParameters;
|
|
254
|
+
this.maxWhereClauseParameters = options.maxWhereClauseParameters || defaultServerCapabilities.maxWhereClauseParameters;
|
|
255
|
+
this.maxMonitoredItemsQueueSize =
|
|
256
|
+
options.maxMonitoredItemsQueueSize || defaultServerCapabilities.maxMonitoredItemsQueueSize;
|
|
257
|
+
this.conformanceUnits = options.conformanceUnits || defaultServerCapabilities.conformanceUnits;
|
|
171
258
|
}
|
|
172
259
|
}
|