node-opcua-server 2.97.0 → 2.98.1

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.
Files changed (69) hide show
  1. package/dist/base_server.d.ts +110 -110
  2. package/dist/base_server.js +490 -490
  3. package/dist/base_server.js.map +1 -1
  4. package/dist/factory.d.ts +12 -12
  5. package/dist/factory.js +23 -23
  6. package/dist/filter/check_where_clause_on_address_space.d.ts +3 -3
  7. package/dist/filter/check_where_clause_on_address_space.js +22 -22
  8. package/dist/filter/extract_event_fields.d.ts +10 -10
  9. package/dist/filter/extract_event_fields.js +17 -17
  10. package/dist/helper.d.ts +10 -10
  11. package/dist/helper.js +75 -75
  12. package/dist/history_server_capabilities.d.ts +35 -35
  13. package/dist/history_server_capabilities.js +43 -43
  14. package/dist/i_channel_data.d.ts +13 -13
  15. package/dist/i_channel_data.js +2 -2
  16. package/dist/i_register_server_manager.d.ts +16 -16
  17. package/dist/i_register_server_manager.js +2 -2
  18. package/dist/i_server_side_publish_engine.d.ts +36 -36
  19. package/dist/i_server_side_publish_engine.js +49 -49
  20. package/dist/i_socket_data.d.ts +11 -11
  21. package/dist/i_socket_data.js +2 -2
  22. package/dist/index.d.ts +16 -16
  23. package/dist/index.js +32 -32
  24. package/dist/monitored_item.d.ts +188 -188
  25. package/dist/monitored_item.js +1112 -1112
  26. package/dist/monitored_item.js.map +1 -1
  27. package/dist/node_sampler.d.ts +3 -3
  28. package/dist/node_sampler.js +79 -79
  29. package/dist/opcua_server.d.ts +747 -747
  30. package/dist/opcua_server.js +2428 -2428
  31. package/dist/opcua_server.js.map +1 -1
  32. package/dist/queue.d.ts +11 -11
  33. package/dist/queue.js +71 -71
  34. package/dist/register_server_manager.d.ts +96 -96
  35. package/dist/register_server_manager.js +584 -584
  36. package/dist/register_server_manager_hidden.d.ts +17 -17
  37. package/dist/register_server_manager_hidden.js +27 -27
  38. package/dist/register_server_manager_mdns_only.d.ts +22 -22
  39. package/dist/register_server_manager_mdns_only.js +55 -55
  40. package/dist/sampling_func.d.ts +3 -3
  41. package/dist/sampling_func.js +2 -2
  42. package/dist/server_capabilities.d.ts +148 -148
  43. package/dist/server_capabilities.js +101 -101
  44. package/dist/server_end_point.d.ts +185 -185
  45. package/dist/server_end_point.js +840 -840
  46. package/dist/server_engine.d.ts +318 -318
  47. package/dist/server_engine.js +1774 -1774
  48. package/dist/server_engine.js.map +1 -1
  49. package/dist/server_publish_engine.d.ts +113 -113
  50. package/dist/server_publish_engine.js +541 -541
  51. package/dist/server_publish_engine.js.map +1 -1
  52. package/dist/server_publish_engine_for_orphan_subscriptions.d.ts +16 -16
  53. package/dist/server_publish_engine_for_orphan_subscriptions.js +51 -51
  54. package/dist/server_session.d.ts +185 -185
  55. package/dist/server_session.js +757 -757
  56. package/dist/server_session.js.map +1 -1
  57. package/dist/server_subscription.d.ts +421 -421
  58. package/dist/server_subscription.js +1347 -1347
  59. package/dist/server_subscription.js.map +1 -1
  60. package/dist/sessions_compatible_for_transfer.d.ts +2 -2
  61. package/dist/sessions_compatible_for_transfer.js +39 -39
  62. package/dist/user_manager.d.ts +32 -32
  63. package/dist/user_manager.js +98 -98
  64. package/dist/user_manager_ua.d.ts +3 -3
  65. package/dist/user_manager_ua.js +39 -39
  66. package/dist/validate_filter.d.ts +5 -5
  67. package/dist/validate_filter.js +81 -81
  68. package/package.json +52 -48
  69. package/test_helpers/create_certificates.js +0 -1
@@ -1,102 +1,102 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ServerCapabilities = exports.defaultServerCapabilities = exports.OperationLimits = void 0;
4
- const node_opcua_binary_stream_1 = require("node-opcua-binary-stream");
5
- const node_opcua_debug_1 = require("node-opcua-debug");
6
- const warningLog = (0, node_opcua_debug_1.make_warningLog)(__filename);
7
- class OperationLimits {
8
- constructor(options) {
9
- this.maxNodesPerRead = options.maxNodesPerRead || 0;
10
- this.maxNodesPerWrite = options.maxNodesPerWrite || 0;
11
- this.maxNodesPerMethodCall = options.maxNodesPerMethodCall || 0;
12
- this.maxNodesPerBrowse = options.maxNodesPerBrowse || 0;
13
- this.maxNodesPerRegisterNodes = options.maxNodesPerRegisterNodes || 0;
14
- this.maxNodesPerNodeManagement = options.maxNodesPerNodeManagement || 0;
15
- this.maxMonitoredItemsPerCall = options.maxMonitoredItemsPerCall || 0;
16
- this.maxNodesPerHistoryReadData = options.maxNodesPerHistoryReadData || 0;
17
- this.maxNodesPerHistoryReadEvents = options.maxNodesPerHistoryReadEvents || 0;
18
- this.maxNodesPerHistoryUpdateData = options.maxNodesPerHistoryUpdateData || 0;
19
- this.maxNodesPerHistoryUpdateEvents = options.maxNodesPerHistoryUpdateEvents || 0;
20
- this.maxNodesPerTranslateBrowsePathsToNodeIds = options.maxNodesPerTranslateBrowsePathsToNodeIds || 0;
21
- }
22
- }
23
- exports.OperationLimits = OperationLimits;
24
- exports.defaultServerCapabilities = {
25
- maxBrowseContinuationPoints: 0,
26
- maxHistoryContinuationPoints: 0,
27
- maxStringLength: 16 * 1024 * 1024,
28
- maxArrayLength: 1024 * 1024,
29
- maxByteStringLength: 16 * 1024 * 1024,
30
- maxQueryContinuationPoints: 0,
31
- minSupportedSampleRate: 100,
32
- operationLimits: {
33
- maxNodesPerBrowse: 0,
34
- maxNodesPerHistoryReadData: 0,
35
- maxNodesPerHistoryReadEvents: 0,
36
- maxNodesPerHistoryUpdateData: 0,
37
- maxNodesPerHistoryUpdateEvents: 0,
38
- maxNodesPerMethodCall: 0,
39
- maxNodesPerNodeManagement: 0,
40
- maxNodesPerRead: 0,
41
- maxNodesPerRegisterNodes: 0,
42
- maxNodesPerWrite: 0,
43
- maxNodesPerTranslateBrowsePathsToNodeIds: 0,
44
- maxMonitoredItemsPerCall: 0
45
- },
46
- serverProfileArray: [],
47
- localeIdArray: [],
48
- softwareCertificates: [],
49
- maxSessions: 10,
50
- maxSubscriptions: 100,
51
- maxMonitoredItems: 1000000,
52
- maxSubscriptionsPerSession: 10,
53
- maxMonitoredItemsPerSubscription: 100000,
54
- maxSelectClauseParameters: 100,
55
- maxWhereClauseParameters: 100,
56
- maxMonitoredItemsQueueSize: 60000,
57
- conformanceUnits: []
58
- };
59
- /**
60
- */
61
- class ServerCapabilities {
62
- // eslint-disable-next-line complexity
63
- constructor(options) {
64
- options = options || {};
65
- options.operationLimits = options.operationLimits || {};
66
- this.serverProfileArray = options.serverProfileArray || [];
67
- this.localeIdArray = options.localeIdArray || [];
68
- this.softwareCertificates = options.softwareCertificates || [];
69
- this.maxArrayLength = options.maxArrayLength || exports.defaultServerCapabilities.maxArrayLength;
70
- this.maxStringLength = options.maxStringLength || exports.defaultServerCapabilities.maxStringLength;
71
- this.maxByteStringLength = options.maxByteStringLength || exports.defaultServerCapabilities.maxByteStringLength;
72
- if (node_opcua_binary_stream_1.BinaryStream.maxStringLength < this.maxStringLength) {
73
- warningLog(`ServerCapabilities.maxStringLength ${this.maxStringLength} is greater that the allowed limite BinaryStream.maxStringLength = ${node_opcua_binary_stream_1.BinaryStream.maxStringLength}\nPlease adjust the value.`);
74
- }
75
- if (node_opcua_binary_stream_1.BinaryStream.maxByteStringLength < this.maxByteStringLength) {
76
- warningLog(`ServerCapabilities.maxByteStringLength ${this.maxByteStringLength} is greater that the allowed limite BinaryStream.maxByteStringLength = ${node_opcua_binary_stream_1.BinaryStream.maxByteStringLength}\nPlease adjust the value.`);
77
- }
78
- this.maxBrowseContinuationPoints =
79
- options.maxBrowseContinuationPoints || exports.defaultServerCapabilities.maxBrowseContinuationPoints;
80
- this.maxQueryContinuationPoints =
81
- options.maxQueryContinuationPoints || exports.defaultServerCapabilities.maxQueryContinuationPoints;
82
- this.maxHistoryContinuationPoints =
83
- options.maxHistoryContinuationPoints || exports.defaultServerCapabilities.maxHistoryContinuationPoints;
84
- this.operationLimits = new OperationLimits(options.operationLimits);
85
- this.minSupportedSampleRate = options.minSupportedSampleRate || exports.defaultServerCapabilities.minSupportedSampleRate; // to do adjust me
86
- // new in 1.05
87
- this.maxSessions = options.maxSessions || exports.defaultServerCapabilities.maxSessions;
88
- this.maxSubscriptionsPerSession =
89
- options.maxSubscriptionsPerSession || exports.defaultServerCapabilities.maxSubscriptionsPerSession;
90
- this.maxSubscriptions = options.maxSubscriptions || exports.defaultServerCapabilities.maxSubscriptions;
91
- this.maxMonitoredItems = options.maxMonitoredItems || exports.defaultServerCapabilities.maxMonitoredItems;
92
- this.maxMonitoredItemsPerSubscription =
93
- options.maxMonitoredItemsPerSubscription || exports.defaultServerCapabilities.maxMonitoredItemsPerSubscription;
94
- this.maxSelectClauseParameters = options.maxSelectClauseParameters || exports.defaultServerCapabilities.maxSelectClauseParameters;
95
- this.maxWhereClauseParameters = options.maxWhereClauseParameters || exports.defaultServerCapabilities.maxWhereClauseParameters;
96
- this.maxMonitoredItemsQueueSize =
97
- options.maxMonitoredItemsQueueSize || exports.defaultServerCapabilities.maxMonitoredItemsQueueSize;
98
- this.conformanceUnits = options.conformanceUnits || exports.defaultServerCapabilities.conformanceUnits;
99
- }
100
- }
101
- exports.ServerCapabilities = ServerCapabilities;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ServerCapabilities = exports.defaultServerCapabilities = exports.OperationLimits = void 0;
4
+ const node_opcua_binary_stream_1 = require("node-opcua-binary-stream");
5
+ const node_opcua_debug_1 = require("node-opcua-debug");
6
+ const warningLog = (0, node_opcua_debug_1.make_warningLog)(__filename);
7
+ class OperationLimits {
8
+ constructor(options) {
9
+ this.maxNodesPerRead = options.maxNodesPerRead || 0;
10
+ this.maxNodesPerWrite = options.maxNodesPerWrite || 0;
11
+ this.maxNodesPerMethodCall = options.maxNodesPerMethodCall || 0;
12
+ this.maxNodesPerBrowse = options.maxNodesPerBrowse || 0;
13
+ this.maxNodesPerRegisterNodes = options.maxNodesPerRegisterNodes || 0;
14
+ this.maxNodesPerNodeManagement = options.maxNodesPerNodeManagement || 0;
15
+ this.maxMonitoredItemsPerCall = options.maxMonitoredItemsPerCall || 0;
16
+ this.maxNodesPerHistoryReadData = options.maxNodesPerHistoryReadData || 0;
17
+ this.maxNodesPerHistoryReadEvents = options.maxNodesPerHistoryReadEvents || 0;
18
+ this.maxNodesPerHistoryUpdateData = options.maxNodesPerHistoryUpdateData || 0;
19
+ this.maxNodesPerHistoryUpdateEvents = options.maxNodesPerHistoryUpdateEvents || 0;
20
+ this.maxNodesPerTranslateBrowsePathsToNodeIds = options.maxNodesPerTranslateBrowsePathsToNodeIds || 0;
21
+ }
22
+ }
23
+ exports.OperationLimits = OperationLimits;
24
+ exports.defaultServerCapabilities = {
25
+ maxBrowseContinuationPoints: 0,
26
+ maxHistoryContinuationPoints: 0,
27
+ maxStringLength: 16 * 1024 * 1024,
28
+ maxArrayLength: 1024 * 1024,
29
+ maxByteStringLength: 16 * 1024 * 1024,
30
+ maxQueryContinuationPoints: 0,
31
+ minSupportedSampleRate: 100,
32
+ operationLimits: {
33
+ maxNodesPerBrowse: 0,
34
+ maxNodesPerHistoryReadData: 0,
35
+ maxNodesPerHistoryReadEvents: 0,
36
+ maxNodesPerHistoryUpdateData: 0,
37
+ maxNodesPerHistoryUpdateEvents: 0,
38
+ maxNodesPerMethodCall: 0,
39
+ maxNodesPerNodeManagement: 0,
40
+ maxNodesPerRead: 0,
41
+ maxNodesPerRegisterNodes: 0,
42
+ maxNodesPerWrite: 0,
43
+ maxNodesPerTranslateBrowsePathsToNodeIds: 0,
44
+ maxMonitoredItemsPerCall: 0
45
+ },
46
+ serverProfileArray: [],
47
+ localeIdArray: [],
48
+ softwareCertificates: [],
49
+ maxSessions: 10,
50
+ maxSubscriptions: 100,
51
+ maxMonitoredItems: 1000000,
52
+ maxSubscriptionsPerSession: 10,
53
+ maxMonitoredItemsPerSubscription: 100000,
54
+ maxSelectClauseParameters: 100,
55
+ maxWhereClauseParameters: 100,
56
+ maxMonitoredItemsQueueSize: 60000,
57
+ conformanceUnits: []
58
+ };
59
+ /**
60
+ */
61
+ class ServerCapabilities {
62
+ // eslint-disable-next-line complexity
63
+ constructor(options) {
64
+ options = options || {};
65
+ options.operationLimits = options.operationLimits || {};
66
+ this.serverProfileArray = options.serverProfileArray || [];
67
+ this.localeIdArray = options.localeIdArray || [];
68
+ this.softwareCertificates = options.softwareCertificates || [];
69
+ this.maxArrayLength = options.maxArrayLength || exports.defaultServerCapabilities.maxArrayLength;
70
+ this.maxStringLength = options.maxStringLength || exports.defaultServerCapabilities.maxStringLength;
71
+ this.maxByteStringLength = options.maxByteStringLength || exports.defaultServerCapabilities.maxByteStringLength;
72
+ if (node_opcua_binary_stream_1.BinaryStream.maxStringLength < this.maxStringLength) {
73
+ warningLog(`ServerCapabilities.maxStringLength ${this.maxStringLength} is greater that the allowed limite BinaryStream.maxStringLength = ${node_opcua_binary_stream_1.BinaryStream.maxStringLength}\nPlease adjust the value.`);
74
+ }
75
+ if (node_opcua_binary_stream_1.BinaryStream.maxByteStringLength < this.maxByteStringLength) {
76
+ warningLog(`ServerCapabilities.maxByteStringLength ${this.maxByteStringLength} is greater that the allowed limite BinaryStream.maxByteStringLength = ${node_opcua_binary_stream_1.BinaryStream.maxByteStringLength}\nPlease adjust the value.`);
77
+ }
78
+ this.maxBrowseContinuationPoints =
79
+ options.maxBrowseContinuationPoints || exports.defaultServerCapabilities.maxBrowseContinuationPoints;
80
+ this.maxQueryContinuationPoints =
81
+ options.maxQueryContinuationPoints || exports.defaultServerCapabilities.maxQueryContinuationPoints;
82
+ this.maxHistoryContinuationPoints =
83
+ options.maxHistoryContinuationPoints || exports.defaultServerCapabilities.maxHistoryContinuationPoints;
84
+ this.operationLimits = new OperationLimits(options.operationLimits);
85
+ this.minSupportedSampleRate = options.minSupportedSampleRate || exports.defaultServerCapabilities.minSupportedSampleRate; // to do adjust me
86
+ // new in 1.05
87
+ this.maxSessions = options.maxSessions || exports.defaultServerCapabilities.maxSessions;
88
+ this.maxSubscriptionsPerSession =
89
+ options.maxSubscriptionsPerSession || exports.defaultServerCapabilities.maxSubscriptionsPerSession;
90
+ this.maxSubscriptions = options.maxSubscriptions || exports.defaultServerCapabilities.maxSubscriptions;
91
+ this.maxMonitoredItems = options.maxMonitoredItems || exports.defaultServerCapabilities.maxMonitoredItems;
92
+ this.maxMonitoredItemsPerSubscription =
93
+ options.maxMonitoredItemsPerSubscription || exports.defaultServerCapabilities.maxMonitoredItemsPerSubscription;
94
+ this.maxSelectClauseParameters = options.maxSelectClauseParameters || exports.defaultServerCapabilities.maxSelectClauseParameters;
95
+ this.maxWhereClauseParameters = options.maxWhereClauseParameters || exports.defaultServerCapabilities.maxWhereClauseParameters;
96
+ this.maxMonitoredItemsQueueSize =
97
+ options.maxMonitoredItemsQueueSize || exports.defaultServerCapabilities.maxMonitoredItemsQueueSize;
98
+ this.conformanceUnits = options.conformanceUnits || exports.defaultServerCapabilities.conformanceUnits;
99
+ }
100
+ }
101
+ exports.ServerCapabilities = ServerCapabilities;
102
102
  //# sourceMappingURL=server_capabilities.js.map
@@ -1,185 +1,185 @@
1
- /// <reference types="node" />
2
- /**
3
- * @module node-opcua-server
4
- */
5
- import { EventEmitter } from "events";
6
- import { OPCUACertificateManager } from "node-opcua-certificate-manager";
7
- import { Certificate, PrivateKey } from "node-opcua-crypto";
8
- import { MessageSecurityMode, SecurityPolicy, ServerSecureChannelLayer, ServerSecureChannelParent } from "node-opcua-secure-channel";
9
- import { UserTokenType } from "node-opcua-service-endpoints";
10
- import { EndpointDescription } from "node-opcua-service-endpoints";
11
- import { ApplicationDescription } from "node-opcua-service-endpoints";
12
- export interface OPCUAServerEndPointOptions {
13
- /**
14
- * the tcp port
15
- */
16
- port: number;
17
- /**
18
- * the DER certificate chain
19
- */
20
- certificateChain: Certificate;
21
- /**
22
- * privateKey
23
- */
24
- privateKey: PrivateKey;
25
- certificateManager: OPCUACertificateManager;
26
- /**
27
- * the default secureToken lifetime @default=60000
28
- */
29
- defaultSecureTokenLifetime?: number;
30
- /**
31
- * the maximum number of connection allowed on the TCP server socket
32
- * @default 20
33
- */
34
- maxConnections?: number;
35
- /**
36
- * the timeout for the TCP HEL/ACK transaction (in ms)
37
- * @default 30000
38
- */
39
- timeout?: number;
40
- serverInfo: ApplicationDescription;
41
- objectFactory?: any;
42
- }
43
- export interface EndpointDescriptionParams {
44
- restricted?: boolean;
45
- allowUnsecurePassword?: boolean;
46
- resourcePath?: string;
47
- alternateHostname?: string[];
48
- hostname: string;
49
- securityPolicies: SecurityPolicy[];
50
- userTokenTypes: UserTokenType[];
51
- }
52
- export interface AddStandardEndpointDescriptionsParam {
53
- allowAnonymous?: boolean;
54
- disableDiscovery?: boolean;
55
- securityModes?: MessageSecurityMode[];
56
- restricted?: boolean;
57
- allowUnsecurePassword?: boolean;
58
- resourcePath?: string;
59
- alternateHostname?: string[];
60
- hostname?: string;
61
- securityPolicies?: SecurityPolicy[];
62
- userTokenTypes?: UserTokenType[];
63
- }
64
- /**
65
- * OPCUAServerEndPoint a Server EndPoint.
66
- * A sever end point is listening to one port
67
- * note:
68
- * see OPCUA Release 1.03 part 4 page 108 7.1 ApplicationDescription
69
- */
70
- export declare class OPCUAServerEndPoint extends EventEmitter implements ServerSecureChannelParent {
71
- /**
72
- * the tcp port
73
- */
74
- port: number;
75
- certificateManager: OPCUACertificateManager;
76
- defaultSecureTokenLifetime: number;
77
- maxConnections: number;
78
- timeout: number;
79
- bytesWrittenInOldChannels: number;
80
- bytesReadInOldChannels: number;
81
- transactionsCountOldChannels: number;
82
- securityTokenCountOldChannels: number;
83
- serverInfo: ApplicationDescription;
84
- objectFactory: any;
85
- _on_new_channel?: (channel: ServerSecureChannelLayer) => void;
86
- _on_close_channel?: (channel: ServerSecureChannelLayer) => void;
87
- _on_connectionRefused?: (socketData: any) => void;
88
- _on_openSecureChannelFailure?: (socketData: any, channelData: any) => void;
89
- private _certificateChain;
90
- private _privateKey;
91
- private _channels;
92
- private _server?;
93
- private _endpoints;
94
- private _listen_callback?;
95
- private _started;
96
- private _counter;
97
- private _policy_deduplicator;
98
- constructor(options: OPCUAServerEndPointOptions);
99
- dispose(): void;
100
- toString(): string;
101
- getChannels(): ServerSecureChannelLayer[];
102
- /**
103
- * Returns the X509 DER form of the server certificate
104
- */
105
- getCertificate(): Certificate;
106
- /**
107
- * Returns the X509 DER form of the server certificate
108
- */
109
- getCertificateChain(): Certificate;
110
- /**
111
- * the private key
112
- */
113
- getPrivateKey(): PrivateKey;
114
- /**
115
- * The number of active channel on this end point.
116
- */
117
- get currentChannelCount(): number;
118
- /**
119
- * @method getEndpointDescription
120
- * @param securityMode
121
- * @param securityPolicy
122
- * @return endpoint_description {EndpointDescription|null}
123
- */
124
- getEndpointDescription(securityMode: MessageSecurityMode, securityPolicy: SecurityPolicy, endpointUrl: string | null): EndpointDescription | null;
125
- addEndpointDescription(securityMode: MessageSecurityMode, securityPolicy: SecurityPolicy, options: EndpointDescriptionParams): void;
126
- addRestrictedEndpointDescription(options: EndpointDescriptionParams): void;
127
- addStandardEndpointDescriptions(options?: AddStandardEndpointDescriptionsParam): void;
128
- /**
129
- * returns the list of end point descriptions.
130
- */
131
- endpointDescriptions(): EndpointDescription[];
132
- /**
133
- * @method listen
134
- * @async
135
- */
136
- listen(callback: (err?: Error) => void): void;
137
- killClientSockets(callback: (err?: Error) => void): void;
138
- suspendConnection(callback: (err?: Error) => void): void;
139
- restoreConnection(callback: (err?: Error) => void): void;
140
- abruptlyInterruptChannels(): void;
141
- /**
142
- * @method shutdown
143
- * @async
144
- */
145
- shutdown(callback: (err?: Error) => void): void;
146
- /**
147
- * @method start
148
- * @async
149
- * @param callback
150
- */
151
- start(callback: (err?: Error) => void): void;
152
- get bytesWritten(): number;
153
- get bytesRead(): number;
154
- get transactionsCount(): number;
155
- get securityTokenCount(): number;
156
- get activeChannelCount(): number;
157
- private _dump_statistics;
158
- private _setup_server;
159
- private _on_client_connection;
160
- private _preregisterChannel;
161
- private _un_pre_registerChannel;
162
- /**
163
- * @method _registerChannel
164
- * @param channel
165
- * @private
166
- */
167
- private _registerChannel;
168
- /**
169
- * @method _unregisterChannel
170
- * @param channel
171
- * @private
172
- */
173
- private _unregisterChannel;
174
- private _end_listen;
175
- /**
176
- * shutdown_channel
177
- * @param channel
178
- * @param inner_callback
179
- */
180
- private shutdown_channel;
181
- /**
182
- * @private
183
- */
184
- private _prevent_DDOS_Attack;
185
- }
1
+ /// <reference types="node" />
2
+ /**
3
+ * @module node-opcua-server
4
+ */
5
+ import { EventEmitter } from "events";
6
+ import { OPCUACertificateManager } from "node-opcua-certificate-manager";
7
+ import { Certificate, PrivateKey } from "node-opcua-crypto";
8
+ import { MessageSecurityMode, SecurityPolicy, ServerSecureChannelLayer, ServerSecureChannelParent } from "node-opcua-secure-channel";
9
+ import { UserTokenType } from "node-opcua-service-endpoints";
10
+ import { EndpointDescription } from "node-opcua-service-endpoints";
11
+ import { ApplicationDescription } from "node-opcua-service-endpoints";
12
+ export interface OPCUAServerEndPointOptions {
13
+ /**
14
+ * the tcp port
15
+ */
16
+ port: number;
17
+ /**
18
+ * the DER certificate chain
19
+ */
20
+ certificateChain: Certificate;
21
+ /**
22
+ * privateKey
23
+ */
24
+ privateKey: PrivateKey;
25
+ certificateManager: OPCUACertificateManager;
26
+ /**
27
+ * the default secureToken lifetime @default=60000
28
+ */
29
+ defaultSecureTokenLifetime?: number;
30
+ /**
31
+ * the maximum number of connection allowed on the TCP server socket
32
+ * @default 20
33
+ */
34
+ maxConnections?: number;
35
+ /**
36
+ * the timeout for the TCP HEL/ACK transaction (in ms)
37
+ * @default 30000
38
+ */
39
+ timeout?: number;
40
+ serverInfo: ApplicationDescription;
41
+ objectFactory?: any;
42
+ }
43
+ export interface EndpointDescriptionParams {
44
+ restricted?: boolean;
45
+ allowUnsecurePassword?: boolean;
46
+ resourcePath?: string;
47
+ alternateHostname?: string[];
48
+ hostname: string;
49
+ securityPolicies: SecurityPolicy[];
50
+ userTokenTypes: UserTokenType[];
51
+ }
52
+ export interface AddStandardEndpointDescriptionsParam {
53
+ allowAnonymous?: boolean;
54
+ disableDiscovery?: boolean;
55
+ securityModes?: MessageSecurityMode[];
56
+ restricted?: boolean;
57
+ allowUnsecurePassword?: boolean;
58
+ resourcePath?: string;
59
+ alternateHostname?: string[];
60
+ hostname?: string;
61
+ securityPolicies?: SecurityPolicy[];
62
+ userTokenTypes?: UserTokenType[];
63
+ }
64
+ /**
65
+ * OPCUAServerEndPoint a Server EndPoint.
66
+ * A sever end point is listening to one port
67
+ * note:
68
+ * see OPCUA Release 1.03 part 4 page 108 7.1 ApplicationDescription
69
+ */
70
+ export declare class OPCUAServerEndPoint extends EventEmitter implements ServerSecureChannelParent {
71
+ /**
72
+ * the tcp port
73
+ */
74
+ port: number;
75
+ certificateManager: OPCUACertificateManager;
76
+ defaultSecureTokenLifetime: number;
77
+ maxConnections: number;
78
+ timeout: number;
79
+ bytesWrittenInOldChannels: number;
80
+ bytesReadInOldChannels: number;
81
+ transactionsCountOldChannels: number;
82
+ securityTokenCountOldChannels: number;
83
+ serverInfo: ApplicationDescription;
84
+ objectFactory: any;
85
+ _on_new_channel?: (channel: ServerSecureChannelLayer) => void;
86
+ _on_close_channel?: (channel: ServerSecureChannelLayer) => void;
87
+ _on_connectionRefused?: (socketData: any) => void;
88
+ _on_openSecureChannelFailure?: (socketData: any, channelData: any) => void;
89
+ private _certificateChain;
90
+ private _privateKey;
91
+ private _channels;
92
+ private _server?;
93
+ private _endpoints;
94
+ private _listen_callback?;
95
+ private _started;
96
+ private _counter;
97
+ private _policy_deduplicator;
98
+ constructor(options: OPCUAServerEndPointOptions);
99
+ dispose(): void;
100
+ toString(): string;
101
+ getChannels(): ServerSecureChannelLayer[];
102
+ /**
103
+ * Returns the X509 DER form of the server certificate
104
+ */
105
+ getCertificate(): Certificate;
106
+ /**
107
+ * Returns the X509 DER form of the server certificate
108
+ */
109
+ getCertificateChain(): Certificate;
110
+ /**
111
+ * the private key
112
+ */
113
+ getPrivateKey(): PrivateKey;
114
+ /**
115
+ * The number of active channel on this end point.
116
+ */
117
+ get currentChannelCount(): number;
118
+ /**
119
+ * @method getEndpointDescription
120
+ * @param securityMode
121
+ * @param securityPolicy
122
+ * @return endpoint_description {EndpointDescription|null}
123
+ */
124
+ getEndpointDescription(securityMode: MessageSecurityMode, securityPolicy: SecurityPolicy, endpointUrl: string | null): EndpointDescription | null;
125
+ addEndpointDescription(securityMode: MessageSecurityMode, securityPolicy: SecurityPolicy, options: EndpointDescriptionParams): void;
126
+ addRestrictedEndpointDescription(options: EndpointDescriptionParams): void;
127
+ addStandardEndpointDescriptions(options?: AddStandardEndpointDescriptionsParam): void;
128
+ /**
129
+ * returns the list of end point descriptions.
130
+ */
131
+ endpointDescriptions(): EndpointDescription[];
132
+ /**
133
+ * @method listen
134
+ * @async
135
+ */
136
+ listen(callback: (err?: Error) => void): void;
137
+ killClientSockets(callback: (err?: Error) => void): void;
138
+ suspendConnection(callback: (err?: Error) => void): void;
139
+ restoreConnection(callback: (err?: Error) => void): void;
140
+ abruptlyInterruptChannels(): void;
141
+ /**
142
+ * @method shutdown
143
+ * @async
144
+ */
145
+ shutdown(callback: (err?: Error) => void): void;
146
+ /**
147
+ * @method start
148
+ * @async
149
+ * @param callback
150
+ */
151
+ start(callback: (err?: Error) => void): void;
152
+ get bytesWritten(): number;
153
+ get bytesRead(): number;
154
+ get transactionsCount(): number;
155
+ get securityTokenCount(): number;
156
+ get activeChannelCount(): number;
157
+ private _dump_statistics;
158
+ private _setup_server;
159
+ private _on_client_connection;
160
+ private _preregisterChannel;
161
+ private _un_pre_registerChannel;
162
+ /**
163
+ * @method _registerChannel
164
+ * @param channel
165
+ * @private
166
+ */
167
+ private _registerChannel;
168
+ /**
169
+ * @method _unregisterChannel
170
+ * @param channel
171
+ * @private
172
+ */
173
+ private _unregisterChannel;
174
+ private _end_listen;
175
+ /**
176
+ * shutdown_channel
177
+ * @param channel
178
+ * @param inner_callback
179
+ */
180
+ private shutdown_channel;
181
+ /**
182
+ * @private
183
+ */
184
+ private _prevent_DDOS_Attack;
185
+ }