node-opcua-server 2.116.0 → 2.118.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base_server.js +14 -37
- package/dist/base_server.js.map +1 -1
- package/dist/helper.js +4 -24
- package/dist/helper.js.map +1 -1
- package/dist/opcua_server.d.ts +4 -0
- package/dist/opcua_server.js +43 -43
- package/dist/opcua_server.js.map +1 -1
- package/dist/register_server_manager.js +3 -26
- package/dist/register_server_manager.js.map +1 -1
- package/dist/server_end_point.js +41 -42
- package/dist/server_end_point.js.map +1 -1
- package/dist/server_engine.d.ts +25 -1
- package/dist/server_engine.js +24 -25
- package/dist/server_engine.js.map +1 -1
- package/package.json +46 -46
- package/source/base_server.ts +4 -4
- package/source/helper.ts +1 -1
- package/source/opcua_server.ts +51 -16
- package/source/register_server_manager.ts +1 -1
- package/source/server_end_point.ts +39 -19
- package/source/server_engine.ts +80 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.118.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module server",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc -b",
|
|
@@ -13,60 +13,60 @@
|
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@ster5/global-mutex": "^2.0.0",
|
|
16
|
-
"async": "^3.2.
|
|
16
|
+
"async": "^3.2.5",
|
|
17
17
|
"chalk": "4.1.2",
|
|
18
18
|
"dequeue": "^1.0.5",
|
|
19
19
|
"lodash": "4.17.21",
|
|
20
|
-
"node-opcua-address-space": "2.
|
|
21
|
-
"node-opcua-address-space-base": "2.
|
|
20
|
+
"node-opcua-address-space": "2.118.0",
|
|
21
|
+
"node-opcua-address-space-base": "2.118.0",
|
|
22
22
|
"node-opcua-assert": "2.105.0",
|
|
23
|
-
"node-opcua-basic-types": "2.
|
|
24
|
-
"node-opcua-binary-stream": "2.
|
|
25
|
-
"node-opcua-certificate-manager": "2.
|
|
26
|
-
"node-opcua-client": "2.
|
|
27
|
-
"node-opcua-client-dynamic-extension-object": "2.
|
|
28
|
-
"node-opcua-common": "2.
|
|
23
|
+
"node-opcua-basic-types": "2.118.0",
|
|
24
|
+
"node-opcua-binary-stream": "2.117.0",
|
|
25
|
+
"node-opcua-certificate-manager": "2.118.0",
|
|
26
|
+
"node-opcua-client": "2.118.0",
|
|
27
|
+
"node-opcua-client-dynamic-extension-object": "2.118.0",
|
|
28
|
+
"node-opcua-common": "2.118.0",
|
|
29
29
|
"node-opcua-constants": "2.114.0",
|
|
30
|
-
"node-opcua-crypto": "4.
|
|
31
|
-
"node-opcua-data-model": "2.
|
|
32
|
-
"node-opcua-data-value": "2.
|
|
33
|
-
"node-opcua-date-time": "2.
|
|
34
|
-
"node-opcua-debug": "2.
|
|
35
|
-
"node-opcua-extension-object": "2.
|
|
36
|
-
"node-opcua-factory": "2.
|
|
37
|
-
"node-opcua-hostname": "2.
|
|
38
|
-
"node-opcua-nodeid": "2.
|
|
39
|
-
"node-opcua-nodesets": "2.
|
|
40
|
-
"node-opcua-numeric-range": "2.
|
|
41
|
-
"node-opcua-object-registry": "2.
|
|
42
|
-
"node-opcua-secure-channel": "2.
|
|
43
|
-
"node-opcua-service-browse": "2.
|
|
44
|
-
"node-opcua-service-call": "2.
|
|
45
|
-
"node-opcua-service-discovery": "2.
|
|
46
|
-
"node-opcua-service-endpoints": "2.
|
|
47
|
-
"node-opcua-service-filter": "2.
|
|
48
|
-
"node-opcua-service-history": "2.
|
|
49
|
-
"node-opcua-service-node-management": "2.
|
|
50
|
-
"node-opcua-service-query": "2.
|
|
51
|
-
"node-opcua-service-read": "2.
|
|
52
|
-
"node-opcua-service-register-node": "2.
|
|
53
|
-
"node-opcua-service-secure-channel": "2.
|
|
54
|
-
"node-opcua-service-session": "2.
|
|
55
|
-
"node-opcua-service-subscription": "2.
|
|
56
|
-
"node-opcua-service-translate-browse-path": "2.
|
|
57
|
-
"node-opcua-service-write": "2.
|
|
58
|
-
"node-opcua-status-code": "2.
|
|
59
|
-
"node-opcua-types": "2.
|
|
60
|
-
"node-opcua-utils": "2.
|
|
61
|
-
"node-opcua-variant": "2.
|
|
30
|
+
"node-opcua-crypto": "4.6.2",
|
|
31
|
+
"node-opcua-data-model": "2.118.0",
|
|
32
|
+
"node-opcua-data-value": "2.118.0",
|
|
33
|
+
"node-opcua-date-time": "2.118.0",
|
|
34
|
+
"node-opcua-debug": "2.118.0",
|
|
35
|
+
"node-opcua-extension-object": "2.118.0",
|
|
36
|
+
"node-opcua-factory": "2.118.0",
|
|
37
|
+
"node-opcua-hostname": "2.118.0",
|
|
38
|
+
"node-opcua-nodeid": "2.118.0",
|
|
39
|
+
"node-opcua-nodesets": "2.118.0",
|
|
40
|
+
"node-opcua-numeric-range": "2.118.0",
|
|
41
|
+
"node-opcua-object-registry": "2.118.0",
|
|
42
|
+
"node-opcua-secure-channel": "2.118.0",
|
|
43
|
+
"node-opcua-service-browse": "2.118.0",
|
|
44
|
+
"node-opcua-service-call": "2.118.0",
|
|
45
|
+
"node-opcua-service-discovery": "2.118.0",
|
|
46
|
+
"node-opcua-service-endpoints": "2.118.0",
|
|
47
|
+
"node-opcua-service-filter": "2.118.0",
|
|
48
|
+
"node-opcua-service-history": "2.118.0",
|
|
49
|
+
"node-opcua-service-node-management": "2.118.0",
|
|
50
|
+
"node-opcua-service-query": "2.118.0",
|
|
51
|
+
"node-opcua-service-read": "2.118.0",
|
|
52
|
+
"node-opcua-service-register-node": "2.118.0",
|
|
53
|
+
"node-opcua-service-secure-channel": "2.118.0",
|
|
54
|
+
"node-opcua-service-session": "2.118.0",
|
|
55
|
+
"node-opcua-service-subscription": "2.118.0",
|
|
56
|
+
"node-opcua-service-translate-browse-path": "2.118.0",
|
|
57
|
+
"node-opcua-service-write": "2.118.0",
|
|
58
|
+
"node-opcua-status-code": "2.117.0",
|
|
59
|
+
"node-opcua-types": "2.118.0",
|
|
60
|
+
"node-opcua-utils": "2.117.0",
|
|
61
|
+
"node-opcua-variant": "2.118.0",
|
|
62
62
|
"thenify": "^3.3.1"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"node-opcua-data-access": "2.
|
|
66
|
-
"node-opcua-leak-detector": "2.
|
|
65
|
+
"node-opcua-data-access": "2.118.0",
|
|
66
|
+
"node-opcua-leak-detector": "2.118.0",
|
|
67
67
|
"node-opcua-test-helpers": "2.113.0",
|
|
68
68
|
"should": "^13.2.3",
|
|
69
|
-
"sinon": "^
|
|
69
|
+
"sinon": "^17.0.1",
|
|
70
70
|
"underscore": "^1.13.6"
|
|
71
71
|
},
|
|
72
72
|
"author": "Etienne Rossignon",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"internet of things"
|
|
85
85
|
],
|
|
86
86
|
"homepage": "http://node-opcua.github.io/",
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "6210aaa97b43554e3982113041963b2720e50a95",
|
|
88
88
|
"files": [
|
|
89
89
|
"dist",
|
|
90
90
|
"source"
|
package/source/base_server.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* @module node-opcua-server
|
|
3
3
|
*/
|
|
4
4
|
// tslint:disable:no-console
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
5
|
+
import fs from "fs";
|
|
6
|
+
import path from "path";
|
|
7
|
+
import os from "os";
|
|
8
8
|
import { types } from "util";
|
|
9
|
-
import
|
|
9
|
+
import async from "async";
|
|
10
10
|
import chalk from "chalk";
|
|
11
11
|
import { assert } from "node-opcua-assert";
|
|
12
12
|
import { withLock } from "@ster5/global-mutex";
|
package/source/helper.ts
CHANGED
package/source/opcua_server.ts
CHANGED
|
@@ -10,13 +10,13 @@ import { randomBytes } from "crypto";
|
|
|
10
10
|
import { EventEmitter } from "events";
|
|
11
11
|
import { callbackify, types } from "util";
|
|
12
12
|
|
|
13
|
-
import
|
|
13
|
+
import async from "async";
|
|
14
14
|
import chalk from "chalk";
|
|
15
15
|
|
|
16
16
|
import { extractFullyQualifiedDomainName, getFullyQualifiedDomainName } from "node-opcua-hostname";
|
|
17
17
|
|
|
18
18
|
import { assert } from "node-opcua-assert";
|
|
19
|
-
import
|
|
19
|
+
import { isNullOrUndefined } from "node-opcua-utils";
|
|
20
20
|
|
|
21
21
|
import {
|
|
22
22
|
AddressSpace,
|
|
@@ -752,7 +752,11 @@ export interface OPCUAServerEndpointOptions {
|
|
|
752
752
|
}
|
|
753
753
|
|
|
754
754
|
export interface OPCUAServerOptions extends OPCUABaseServerOptions, OPCUAServerEndpointOptions {
|
|
755
|
+
/**
|
|
756
|
+
* @deprecated
|
|
757
|
+
*/
|
|
755
758
|
alternateEndpoints?: OPCUAServerEndpointOptions[];
|
|
759
|
+
endpoints?: OPCUAServerEndpointOptions[];
|
|
756
760
|
|
|
757
761
|
/**
|
|
758
762
|
* the server certificate full path filename
|
|
@@ -1139,7 +1143,9 @@ export class OPCUAServer extends OPCUABaseServer {
|
|
|
1139
1143
|
this.discoveryServerEndpointUrl = options.discoveryServerEndpointUrl || "opc.tcp://%FQDN%:4840";
|
|
1140
1144
|
assert(typeof this.discoveryServerEndpointUrl === "string");
|
|
1141
1145
|
|
|
1142
|
-
this.serverInfo.applicationType =
|
|
1146
|
+
this.serverInfo.applicationType =
|
|
1147
|
+
options.serverInfo?.applicationType === undefined ? ApplicationType.Server : options.serverInfo.applicationType;
|
|
1148
|
+
|
|
1143
1149
|
this.capabilitiesForMDNS = options.capabilitiesForMDNS || ["NA"];
|
|
1144
1150
|
this.registerServerMethod = options.registerServerMethod || RegisterServerMethod.HIDDEN;
|
|
1145
1151
|
_installRegisterServerManager(this);
|
|
@@ -1164,23 +1170,46 @@ export class OPCUAServer extends OPCUABaseServer {
|
|
|
1164
1170
|
applicationUri: () => this.serverInfo.applicationUri!,
|
|
1165
1171
|
buildInfo,
|
|
1166
1172
|
isAuditing: options.isAuditing,
|
|
1167
|
-
serverCapabilities: options.serverCapabilities
|
|
1173
|
+
serverCapabilities: options.serverCapabilities,
|
|
1174
|
+
|
|
1175
|
+
serverConfiguration: {
|
|
1176
|
+
serverCapabilities: () => {
|
|
1177
|
+
return this.capabilitiesForMDNS || ["NA"];
|
|
1178
|
+
},
|
|
1179
|
+
supportedPrivateKeyFormat: ["PEM"],
|
|
1180
|
+
applicationType: () => this.serverInfo.applicationType,
|
|
1181
|
+
applicationUri: () => this.serverInfo.applicationUri || "",
|
|
1182
|
+
productUri: () => this.serverInfo.productUri || "",
|
|
1183
|
+
// hasSecureElement: () => false,
|
|
1184
|
+
multicastDnsEnabled: () => this.registerServerMethod === RegisterServerMethod.MDNS
|
|
1185
|
+
}
|
|
1168
1186
|
});
|
|
1187
|
+
|
|
1169
1188
|
this.objectFactory = new Factory(this.engine);
|
|
1170
1189
|
|
|
1171
|
-
const endpointDefinitions: OPCUAServerEndpointOptions[] =
|
|
1190
|
+
const endpointDefinitions: OPCUAServerEndpointOptions[] = [
|
|
1191
|
+
...(options.endpoints || []),
|
|
1192
|
+
...(options.alternateEndpoints || [])
|
|
1193
|
+
];
|
|
1194
|
+
|
|
1172
1195
|
const hostname = getFullyQualifiedDomainName();
|
|
1196
|
+
endpointDefinitions.forEach((endpointDefinition) => {
|
|
1197
|
+
endpointDefinition.port = endpointDefinition.port === undefined ? 26543 : endpointDefinition.port;
|
|
1198
|
+
endpointDefinition.hostname = endpointDefinition.hostname || hostname;
|
|
1199
|
+
});
|
|
1173
1200
|
|
|
1174
|
-
|
|
1175
|
-
|
|
1201
|
+
if (!options.endpoints) {
|
|
1202
|
+
endpointDefinitions.push({
|
|
1203
|
+
port: options.port === undefined ? 26543 : options.port,
|
|
1204
|
+
hostname: options.hostname || hostname,
|
|
1176
1205
|
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
}
|
|
1206
|
+
allowAnonymous: options.allowAnonymous,
|
|
1207
|
+
alternateHostname: options.alternateHostname,
|
|
1208
|
+
disableDiscovery: options.disableDiscovery,
|
|
1209
|
+
securityModes: options.securityModes,
|
|
1210
|
+
securityPolicies: options.securityPolicies
|
|
1211
|
+
});
|
|
1212
|
+
}
|
|
1184
1213
|
// todo should self.serverInfo.productUri match self.engine.buildInfo.productUri ?
|
|
1185
1214
|
for (const endpointOptions of endpointDefinitions) {
|
|
1186
1215
|
const endPoint = this.createEndpointDescriptions(options!, endpointOptions);
|
|
@@ -1807,7 +1836,7 @@ export class OPCUAServer extends OPCUABaseServer {
|
|
|
1807
1836
|
// unique for the instance of the Client.
|
|
1808
1837
|
// If this parameter is not specified the Server shall assign a value.
|
|
1809
1838
|
|
|
1810
|
-
if (
|
|
1839
|
+
if (isNullOrUndefined(request.sessionName)) {
|
|
1811
1840
|
// see also #198
|
|
1812
1841
|
// let's the server assign a sessionName for this lazy client.
|
|
1813
1842
|
|
|
@@ -3547,7 +3576,9 @@ export class OPCUAServer extends OPCUABaseServer {
|
|
|
3547
3576
|
!isFinite(endpointOptions.port!) ||
|
|
3548
3577
|
typeof endpointOptions.port !== "number"
|
|
3549
3578
|
) {
|
|
3550
|
-
throw new Error(
|
|
3579
|
+
throw new Error(
|
|
3580
|
+
"expecting a valid port (number) when specified. alternatively you can specify port:0 and node-opcua will choose the first available port"
|
|
3581
|
+
);
|
|
3551
3582
|
}
|
|
3552
3583
|
|
|
3553
3584
|
const port = Number(endpointOptions.port || 0);
|
|
@@ -3573,6 +3604,10 @@ export class OPCUAServer extends OPCUABaseServer {
|
|
|
3573
3604
|
disableDiscovery: !!endpointOptions.disableDiscovery,
|
|
3574
3605
|
// xx hostname,
|
|
3575
3606
|
resourcePath: serverOption.resourcePath || ""
|
|
3607
|
+
|
|
3608
|
+
// TODO userTokenTypes: endpointOptions.userTokenTypes || undefined,
|
|
3609
|
+
|
|
3610
|
+
// TODO allowUnsecurePassword: endpointOptions.allowUnsecurePassword || false
|
|
3576
3611
|
});
|
|
3577
3612
|
return endPoint;
|
|
3578
3613
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
/* eslint-disable max-statements */
|
|
1
2
|
/**
|
|
2
3
|
* @module node-opcua-server
|
|
3
4
|
*/
|
|
4
5
|
// tslint:disable:no-console
|
|
5
6
|
import { EventEmitter } from "events";
|
|
6
|
-
import
|
|
7
|
+
import net from "net";
|
|
7
8
|
import { Server, Socket } from "net";
|
|
8
9
|
import chalk from "chalk";
|
|
9
|
-
import
|
|
10
|
+
import async from "async";
|
|
10
11
|
|
|
11
12
|
import { assert } from "node-opcua-assert";
|
|
12
13
|
import { OPCUACertificateManager } from "node-opcua-certificate-manager";
|
|
@@ -294,9 +295,8 @@ export class OPCUAServerEndPoint extends EventEmitter implements ServerSecureCha
|
|
|
294
295
|
}
|
|
295
296
|
|
|
296
297
|
public toString(): string {
|
|
298
|
+
const privateKeyThumpPrint = makePrivateKeyThumbPrint(this.getPrivateKey());
|
|
297
299
|
|
|
298
|
-
const privateKeyThumpPrint = makePrivateKeyThumbPrint(this.getPrivateKey())
|
|
299
|
-
|
|
300
300
|
const txt =
|
|
301
301
|
" end point" +
|
|
302
302
|
this._counter +
|
|
@@ -1111,22 +1111,42 @@ function _makeEndpointDescription(options: MakeEndpointDescriptionOptions, paren
|
|
|
1111
1111
|
// when channel session security is not "None",
|
|
1112
1112
|
// userIdentityTokens can be left to null.
|
|
1113
1113
|
// in this case this mean that secure policy will be the same as connection security policy
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1114
|
+
// istanbul ignore next
|
|
1115
|
+
if (process.env.NODEOPCUA_SERVER_EMULATE_SIEMENS) {
|
|
1116
|
+
// However, for some reason SIEMENS plc requires that password get encrypted even though
|
|
1117
|
+
// the secure channel is also encrypted ....
|
|
1118
|
+
// you can set the NODEOPCUA_SERVER_EMULATE_SIEMENS env variable to simulate this behavior
|
|
1119
|
+
const registerIdentity3 = (tokenType: UserTokenType, securityPolicy: SecurityPolicy, name: string) => {
|
|
1120
|
+
const identity = {
|
|
1121
|
+
policyId: u(name),
|
|
1122
|
+
tokenType,
|
|
1123
|
+
issuedTokenType: null,
|
|
1124
|
+
issuerEndpointUrl: null,
|
|
1125
|
+
securityPolicyUri: securityPolicy
|
|
1126
|
+
};
|
|
1127
|
+
userIdentityTokens.push(identity);
|
|
1128
|
+
};
|
|
1129
|
+
registerIdentity3(UserTokenType.UserName, SecurityPolicy.Basic256, "username_basic256");
|
|
1130
|
+
registerIdentity3(UserTokenType.UserName, SecurityPolicy.Basic128Rsa15, "username_basic128Rsa15");
|
|
1131
|
+
registerIdentity3(UserTokenType.UserName, SecurityPolicy.Basic256Sha256, "username_basic256Sha256");
|
|
1132
|
+
} else {
|
|
1133
|
+
registerIdentity({
|
|
1134
|
+
policyId: u("usernamePassword"),
|
|
1135
|
+
tokenType: UserTokenType.UserName,
|
|
1136
|
+
issuedTokenType: null,
|
|
1137
|
+
issuerEndpointUrl: null,
|
|
1138
|
+
securityPolicyUri: null
|
|
1139
|
+
});
|
|
1121
1140
|
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1141
|
+
registerIdentity({
|
|
1142
|
+
policyId: u("certificateX509"),
|
|
1143
|
+
tokenType: UserTokenType.Certificate,
|
|
1125
1144
|
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1145
|
+
issuedTokenType: null,
|
|
1146
|
+
issuerEndpointUrl: null,
|
|
1147
|
+
securityPolicyUri: null
|
|
1148
|
+
});
|
|
1149
|
+
}
|
|
1130
1150
|
}
|
|
1131
1151
|
|
|
1132
1152
|
registerIdentity({
|
|
@@ -1155,7 +1175,7 @@ function _makeEndpointDescription(options: MakeEndpointDescriptionOptions, paren
|
|
|
1155
1175
|
endpoint._parent = parent;
|
|
1156
1176
|
|
|
1157
1177
|
// endpointUrl is dynamic as port number may be adjusted
|
|
1158
|
-
// when the tcp
|
|
1178
|
+
// when the tcp socket start listening
|
|
1159
1179
|
(endpoint as any).__defineGetter__("endpointUrl", () => {
|
|
1160
1180
|
const port = endpoint._parent.port;
|
|
1161
1181
|
const resourcePath = options.resourcePath || "";
|
package/source/server_engine.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { EventEmitter } from "events";
|
|
5
5
|
import { types } from "util";
|
|
6
|
-
import
|
|
6
|
+
import async from "async";
|
|
7
7
|
import chalk from "chalk";
|
|
8
8
|
import { assert } from "node-opcua-assert";
|
|
9
9
|
import { BinaryStream } from "node-opcua-binary-stream";
|
|
@@ -65,7 +65,8 @@ import {
|
|
|
65
65
|
CallMethodResultOptions,
|
|
66
66
|
ReadRequestOptions,
|
|
67
67
|
BrowseDescriptionOptions,
|
|
68
|
-
CallMethodRequest
|
|
68
|
+
CallMethodRequest,
|
|
69
|
+
ApplicationType
|
|
69
70
|
} from "node-opcua-types";
|
|
70
71
|
import { DataType, isValidVariant, Variant, VariantArrayType } from "node-opcua-variant";
|
|
71
72
|
|
|
@@ -287,7 +288,39 @@ function _get_next_subscriptionId() {
|
|
|
287
288
|
}
|
|
288
289
|
|
|
289
290
|
export type StringGetter = () => string;
|
|
291
|
+
export type StringArrayGetter = () => string[];
|
|
292
|
+
export type ApplicationTypeGetter = () => ApplicationType;
|
|
293
|
+
export type BooleanGetter = () => boolean;
|
|
290
294
|
|
|
295
|
+
export interface ServerConfigurationOptions {
|
|
296
|
+
applicationUri?: string | StringGetter;
|
|
297
|
+
applicationType?: ApplicationType | ApplicationTypeGetter; // default "Server"
|
|
298
|
+
|
|
299
|
+
hasSecureElement?: boolean | BooleanGetter; // default true
|
|
300
|
+
|
|
301
|
+
multicastDnsEnabled?: boolean | BooleanGetter; // default true
|
|
302
|
+
|
|
303
|
+
productUri?: string | StringGetter;
|
|
304
|
+
|
|
305
|
+
// /** @restricted only in professional version */
|
|
306
|
+
// resetToServerDefaults: () => Promise<void>;
|
|
307
|
+
// /** @restricted only in professional version */
|
|
308
|
+
// setAdminPassword?: (password: string) => Promise<void>;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* The SupportedPrivateKeyFormats specifies the PrivateKey formats supported by the Server.
|
|
312
|
+
* Possible values include “PEM” (see RFC 5958) or “PFX” (see PKCS #12).
|
|
313
|
+
* @default ["PEM"]
|
|
314
|
+
*/
|
|
315
|
+
supportedPrivateKeyFormat: string[] | StringArrayGetter;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* The ServerCapabilities Property specifies the capabilities from Annex D
|
|
319
|
+
* ( see https://reference.opcfoundation.org/GDS/v104/docs/D) which the Server supports. The value is
|
|
320
|
+
* the same as the value reported to the LocalDiscoveryServer when the Server calls the RegisterServer2 Service.
|
|
321
|
+
*/
|
|
322
|
+
serverCapabilities?: string[] | StringArrayGetter; // default|"N/A"]
|
|
323
|
+
}
|
|
291
324
|
export interface ServerEngineOptions {
|
|
292
325
|
applicationUri: string | StringGetter;
|
|
293
326
|
|
|
@@ -299,6 +332,7 @@ export interface ServerEngineOptions {
|
|
|
299
332
|
serverDiagnosticsEnabled?: boolean;
|
|
300
333
|
serverCapabilities?: ServerCapabilitiesOptions;
|
|
301
334
|
historyServerCapabilities?: HistoryServerCapabilitiesOptions;
|
|
335
|
+
serverConfiguration?: ServerConfigurationOptions;
|
|
302
336
|
}
|
|
303
337
|
|
|
304
338
|
export interface CreateSessionOption {
|
|
@@ -322,6 +356,7 @@ export class ServerEngine extends EventEmitter implements IAddressSpaceAccessor
|
|
|
322
356
|
public serverDiagnosticsEnabled: boolean;
|
|
323
357
|
public serverCapabilities: ServerCapabilities;
|
|
324
358
|
public historyServerCapabilities: HistoryServerCapabilities;
|
|
359
|
+
public serverConfiguration: ServerConfigurationOptions;
|
|
325
360
|
public clientDescription?: ApplicationDescription;
|
|
326
361
|
|
|
327
362
|
public addressSpace: AddressSpace | null;
|
|
@@ -367,6 +402,10 @@ export class ServerEngine extends EventEmitter implements IAddressSpaceAccessor
|
|
|
367
402
|
// --------------------------------------------------- ServerCapabilities
|
|
368
403
|
options.serverCapabilities = options.serverCapabilities || {};
|
|
369
404
|
|
|
405
|
+
options.serverConfiguration = options.serverConfiguration || {
|
|
406
|
+
supportedPrivateKeyFormat: ["PEM"]
|
|
407
|
+
};
|
|
408
|
+
|
|
370
409
|
// https://profiles.opcfoundation.org/profile
|
|
371
410
|
options.serverCapabilities.serverProfileArray = options.serverCapabilities.serverProfileArray || [
|
|
372
411
|
"http://opcfoundation.org/UA-Profile/Server/Standard", // Standard UA Server Profile",
|
|
@@ -405,6 +444,8 @@ export class ServerEngine extends EventEmitter implements IAddressSpaceAccessor
|
|
|
405
444
|
return MonitoredItem.minimumSamplingInterval;
|
|
406
445
|
});
|
|
407
446
|
|
|
447
|
+
this.serverConfiguration = options.serverConfiguration;
|
|
448
|
+
|
|
408
449
|
this.historyServerCapabilities = new HistoryServerCapabilities(options.historyServerCapabilities);
|
|
409
450
|
|
|
410
451
|
// --------------------------------------------------- serverDiagnosticsSummary extension Object
|
|
@@ -1133,12 +1174,49 @@ export class ServerEngine extends EventEmitter implements IAddressSpaceAccessor
|
|
|
1133
1174
|
});
|
|
1134
1175
|
};
|
|
1135
1176
|
|
|
1177
|
+
type Getter<T> = () => T;
|
|
1178
|
+
function r<T>(a: undefined | T | Getter<T>, defaultValue: T): T {
|
|
1179
|
+
if (a === undefined) return defaultValue;
|
|
1180
|
+
if (typeof a === "function") {
|
|
1181
|
+
return (a as any)();
|
|
1182
|
+
}
|
|
1183
|
+
return a;
|
|
1184
|
+
}
|
|
1185
|
+
const bindServerConfigurationBasic = () => {
|
|
1186
|
+
bindStandardArray(VariableIds.ServerConfiguration_ServerCapabilities, DataType.String, DataType.String, () =>
|
|
1187
|
+
r(this.serverConfiguration.serverCapabilities, ["NA"])
|
|
1188
|
+
);
|
|
1189
|
+
bindStandardScalar(VariableIds.ServerConfiguration_ApplicationType, DataType.Int32, () =>
|
|
1190
|
+
r(this.serverConfiguration.applicationType, ApplicationType.Server)
|
|
1191
|
+
);
|
|
1192
|
+
bindStandardScalar(VariableIds.ServerConfiguration_ApplicationUri, DataType.String, () =>
|
|
1193
|
+
r(this.serverConfiguration.applicationUri, "")
|
|
1194
|
+
);
|
|
1195
|
+
bindStandardScalar(VariableIds.ServerConfiguration_ProductUri, DataType.String, () =>
|
|
1196
|
+
r(this.serverConfiguration.productUri, "")
|
|
1197
|
+
);
|
|
1198
|
+
bindStandardScalar(VariableIds.ServerConfiguration_HasSecureElement, DataType.Boolean, () =>
|
|
1199
|
+
r(this.serverConfiguration.hasSecureElement, false)
|
|
1200
|
+
);
|
|
1201
|
+
bindStandardScalar(VariableIds.ServerConfiguration_MulticastDnsEnabled, DataType.Boolean, () =>
|
|
1202
|
+
r(this.serverConfiguration.multicastDnsEnabled, false)
|
|
1203
|
+
);
|
|
1204
|
+
bindStandardArray(
|
|
1205
|
+
VariableIds.ServerConfiguration_SupportedPrivateKeyFormats,
|
|
1206
|
+
DataType.String,
|
|
1207
|
+
DataType.String,
|
|
1208
|
+
() => r(this.serverConfiguration.supportedPrivateKeyFormat, ["PEM"])
|
|
1209
|
+
);
|
|
1210
|
+
};
|
|
1211
|
+
|
|
1136
1212
|
bindServerDiagnostics();
|
|
1137
1213
|
|
|
1138
1214
|
bindServerStatus();
|
|
1139
1215
|
|
|
1140
1216
|
bindServerCapabilities();
|
|
1141
1217
|
|
|
1218
|
+
bindServerConfigurationBasic();
|
|
1219
|
+
|
|
1142
1220
|
bindHistoryServerCapabilities();
|
|
1143
1221
|
|
|
1144
1222
|
const bindExtraStuff = () => {
|