node-opcua-server 2.70.3 → 2.71.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.
Files changed (53) hide show
  1. package/dist/base_server.d.ts +110 -110
  2. package/dist/base_server.js +473 -473
  3. package/dist/factory.d.ts +12 -12
  4. package/dist/factory.js +23 -23
  5. package/dist/history_server_capabilities.d.ts +35 -35
  6. package/dist/history_server_capabilities.js +43 -43
  7. package/dist/i_channel_data.d.ts +13 -13
  8. package/dist/i_channel_data.js +2 -2
  9. package/dist/i_register_server_manager.d.ts +16 -16
  10. package/dist/i_register_server_manager.js +2 -2
  11. package/dist/i_server_side_publish_engine.d.ts +36 -36
  12. package/dist/i_server_side_publish_engine.js +49 -49
  13. package/dist/i_socket_data.d.ts +11 -11
  14. package/dist/i_socket_data.js +2 -2
  15. package/dist/index.d.ts +15 -15
  16. package/dist/index.js +31 -31
  17. package/dist/monitored_item.d.ts +177 -177
  18. package/dist/monitored_item.js +998 -998
  19. package/dist/node_sampler.d.ts +3 -3
  20. package/dist/node_sampler.js +75 -75
  21. package/dist/opcua_server.d.ts +647 -647
  22. package/dist/opcua_server.js +2385 -2385
  23. package/dist/queue.d.ts +11 -11
  24. package/dist/queue.js +71 -71
  25. package/dist/register_server_manager.d.ts +96 -96
  26. package/dist/register_server_manager.js +584 -584
  27. package/dist/register_server_manager_hidden.d.ts +17 -17
  28. package/dist/register_server_manager_hidden.js +27 -27
  29. package/dist/register_server_manager_mdns_only.d.ts +22 -22
  30. package/dist/register_server_manager_mdns_only.js +55 -55
  31. package/dist/server_capabilities.d.ts +61 -61
  32. package/dist/server_capabilities.js +108 -108
  33. package/dist/server_end_point.d.ts +183 -183
  34. package/dist/server_end_point.js +816 -816
  35. package/dist/server_engine.d.ts +316 -316
  36. package/dist/server_engine.js +1688 -1688
  37. package/dist/server_publish_engine.d.ts +112 -112
  38. package/dist/server_publish_engine.js +530 -530
  39. package/dist/server_publish_engine_for_orphan_subscriptions.d.ts +16 -16
  40. package/dist/server_publish_engine_for_orphan_subscriptions.js +49 -49
  41. package/dist/server_session.d.ts +181 -181
  42. package/dist/server_session.js +738 -738
  43. package/dist/server_subscription.d.ts +395 -395
  44. package/dist/server_subscription.js +1316 -1316
  45. package/dist/sessions_compatible_for_transfer.d.ts +2 -2
  46. package/dist/sessions_compatible_for_transfer.js +36 -36
  47. package/dist/user_manager.d.ts +32 -32
  48. package/dist/user_manager.js +74 -74
  49. package/dist/user_manager_ua.d.ts +3 -3
  50. package/dist/user_manager_ua.js +39 -39
  51. package/dist/validate_filter.d.ts +5 -5
  52. package/dist/validate_filter.js +60 -60
  53. package/package.json +46 -46
@@ -1,647 +1,647 @@
1
- /**
2
- * @module node-opcua-server
3
- */
4
- /// <reference types="node" />
5
- import { EventEmitter } from "events";
6
- import { PseudoVariantBoolean, PseudoVariantByteString, PseudoVariantDateTime, PseudoVariantDuration, PseudoVariantExtensionObject, PseudoVariantExtensionObjectArray, PseudoVariantLocalizedText, PseudoVariantNodeId, PseudoVariantString, RaiseEventData } from "node-opcua-address-space";
7
- import { OPCUACertificateManager } from "node-opcua-certificate-manager";
8
- import { Certificate, Nonce } from "node-opcua-crypto";
9
- import { NodeId } from "node-opcua-nodeid";
10
- import { ObjectRegistry } from "node-opcua-object-registry";
11
- import { Message, MessageSecurityMode, Request, Response, SecurityPolicy, ServerSecureChannelLayer, SignatureData } from "node-opcua-secure-channel";
12
- import { BrowseNextResponse, BrowseResponse } from "node-opcua-service-browse";
13
- import { CallResponse } from "node-opcua-service-call";
14
- import { HistoryReadResponse } from "node-opcua-service-history";
15
- import { ReadResponse } from "node-opcua-service-read";
16
- import { RegisterNodesResponse, UnregisterNodesResponse } from "node-opcua-service-register-node";
17
- import { UserNameIdentityToken, X509IdentityToken } from "node-opcua-service-session";
18
- import { CreateMonitoredItemsResponse, CreateSubscriptionResponse, DeleteSubscriptionsResponse, ModifyMonitoredItemsResponse, ModifySubscriptionResponse, RepublishResponse, SetPublishingModeResponse, SetTriggeringResponse, TransferSubscriptionsResponse } from "node-opcua-service-subscription";
19
- import { TranslateBrowsePathsToNodeIdsResponse } from "node-opcua-service-translate-browse-path";
20
- import { WriteResponse } from "node-opcua-service-write";
21
- import { StatusCode } from "node-opcua-status-code";
22
- import { ApplicationDescriptionOptions, BuildInfo, EndpointDescription, UserIdentityToken, UserTokenPolicy } from "node-opcua-types";
23
- import { OPCUABaseServer, OPCUABaseServerOptions } from "./base_server";
24
- import { IRegisterServerManager } from "./i_register_server_manager";
25
- import { ServerCapabilitiesOptions } from "./server_capabilities";
26
- import { OPCUAServerEndPoint } from "./server_end_point";
27
- import { CreateSessionOption, ServerEngine } from "./server_engine";
28
- import { ServerSession } from "./server_session";
29
- import { CreateMonitoredItemHook, DeleteMonitoredItemHook, Subscription } from "./server_subscription";
30
- import { ISocketData } from "./i_socket_data";
31
- import { IChannelData } from "./i_channel_data";
32
- import { UAUserManagerBase, UserManagerOptions } from "./user_manager";
33
- declare type ResponseClassType = typeof BrowseResponse | typeof BrowseNextResponse | typeof CallResponse | typeof CreateMonitoredItemsResponse | typeof CreateSubscriptionResponse | typeof DeleteSubscriptionsResponse | typeof HistoryReadResponse | typeof ModifyMonitoredItemsResponse | typeof ModifySubscriptionResponse | typeof ReadResponse | typeof RegisterNodesResponse | typeof RepublishResponse | typeof SetPublishingModeResponse | typeof SetTriggeringResponse | typeof TransferSubscriptionsResponse | typeof TranslateBrowsePathsToNodeIdsResponse | typeof UnregisterNodesResponse | typeof WriteResponse;
34
- export declare function filterDiagnosticInfo(returnDiagnostics: number, response: CallResponse): void;
35
- export declare enum RegisterServerMethod {
36
- HIDDEN = 1,
37
- MDNS = 2,
38
- LDS = 3
39
- }
40
- export interface OPCUAServerEndpointOptions {
41
- /**
42
- * the primary hostname of the endpoint.
43
- * @default getFullyQualifiedDomainName()
44
- */
45
- hostname?: string;
46
- /**
47
- * the TCP port to listen to.
48
- * @default 26543
49
- */
50
- port?: number;
51
- /**
52
- * the possible security policies that the server will expose
53
- * @default [SecurityPolicy.None, SecurityPolicy.Basic128Rsa15, SecurityPolicy.Basic256Sha256, SecurityPolicy.Aes128_Sha256_RsaOaep, SecurityPolicy.Aes256_Sha256_RsaPss ]
54
- */
55
- securityPolicies?: SecurityPolicy[];
56
- /**
57
- * the possible security mode that the server will expose
58
- * @default [MessageSecurityMode.None, MessageSecurityMode.Sign, MessageSecurityMode.SignAndEncrypt]
59
- */
60
- securityModes?: MessageSecurityMode[];
61
- /**
62
- * tells if the server default endpoints should allow anonymous connection.
63
- * @default true
64
- */
65
- allowAnonymous?: boolean;
66
- /** alternate hostname or IP to use */
67
- alternateHostname?: string | string[];
68
- /**
69
- * true, if discovery service on secure channel shall be disabled
70
- */
71
- disableDiscovery?: boolean;
72
- }
73
- export interface OPCUAServerOptions extends OPCUABaseServerOptions, OPCUAServerEndpointOptions {
74
- alternateEndpoints?: OPCUAServerEndpointOptions[];
75
- /**
76
- * the server certificate full path filename
77
- *
78
- * the certificate should be in PEM format
79
- */
80
- certificateFile?: string;
81
- /**
82
- * the server private key full path filename
83
- *
84
- * This file should contains the private key that has been used to generate
85
- * the server certificate file.
86
- *
87
- * the private key should be in PEM format
88
- *
89
- */
90
- privateKeyFile?: string;
91
- /**
92
- * the default secure token life time in ms.
93
- */
94
- defaultSecureTokenLifetime?: number;
95
- /**
96
- * the HEL/ACK transaction timeout in ms.
97
- *
98
- * Use a large value ( i.e 15000 ms) for slow connections or embedded devices.
99
- * @default 10000
100
- */
101
- timeout?: number;
102
- /**
103
- * the maximum number of simultaneous sessions allowed.
104
- * @default 10
105
- */
106
- maxAllowedSessionNumber?: number;
107
- /**
108
- * the maximum number authorized simultaneous connections per endpoint
109
- * @default 10
110
- */
111
- maxConnectionsPerEndpoint?: number;
112
- /**
113
- * the nodeset.xml file(s) to load
114
- *
115
- * node-opcua comes with pre-installed node-set files that can be used
116
- *
117
- * example:
118
- *
119
- * ``` javascript
120
- *
121
- * ```
122
- */
123
- nodeset_filename?: string[] | string;
124
- /**
125
- * the server Info
126
- *
127
- * this object contains the value that will populate the
128
- * Root/ObjectS/Server/ServerInfo OPCUA object in the address space.
129
- */
130
- serverInfo?: ApplicationDescriptionOptions;
131
- buildInfo?: {
132
- productName?: string;
133
- productUri?: string | null;
134
- manufacturerName?: string;
135
- softwareVersion?: string;
136
- buildNumber?: string;
137
- buildDate?: Date;
138
- };
139
- /**
140
- * an object that implements user authentication methods
141
- */
142
- userManager?: UserManagerOptions;
143
- /** resource Path is a string added at the end of the url such as "/UA/Server" */
144
- resourcePath?: string;
145
- /**
146
- *
147
- */
148
- serverCapabilities?: ServerCapabilitiesOptions;
149
- /**
150
- * if server shall raise AuditingEvent
151
- * @default true
152
- */
153
- isAuditing?: boolean;
154
- /**
155
- * strategy used by the server to declare itself to a discovery server
156
- *
157
- * - HIDDEN: the server doesn't expose itself to the external world
158
- * - MDNS: the server publish itself to the mDNS Multicast network directly
159
- * - LDS: the server registers itself to the LDS or LDS-ME (Local Discovery Server)
160
- *
161
- * @default .HIDDEN - by default the server
162
- * will not register itself to the local discovery server
163
- *
164
- */
165
- registerServerMethod?: RegisterServerMethod;
166
- /**
167
- *
168
- * @default "opc.tcp://localhost:4840"]
169
- */
170
- discoveryServerEndpointUrl?: string;
171
- /**
172
- *
173
- * supported server capabilities for the Multicast (mDNS)
174
- * @default ["NA"]
175
- * the possible values are any of node-opcua-discovery.serverCapabilities)
176
- *
177
- */
178
- capabilitiesForMDNS?: string[];
179
- /**
180
- * user Certificate Manager
181
- * this certificate manager holds the X509 certificates used
182
- * by client that uses X509 certificate token to impersonate a user
183
- */
184
- userCertificateManager?: OPCUACertificateManager;
185
- /**
186
- * Server Certificate Manager
187
- *
188
- * this certificate manager will be used by the server to access
189
- * and store certificates from the connecting clients
190
- */
191
- serverCertificateManager?: OPCUACertificateManager;
192
- /**
193
- *
194
- */
195
- onCreateMonitoredItem?: CreateMonitoredItemHook;
196
- onDeleteMonitoredItem?: DeleteMonitoredItemHook;
197
- }
198
- export interface OPCUAServer {
199
- /**
200
- *
201
- */
202
- engine: ServerEngine;
203
- /**
204
- *
205
- */
206
- registerServerMethod: RegisterServerMethod;
207
- /**
208
- *
209
- */
210
- discoveryServerEndpointUrl: string;
211
- /**
212
- *
213
- */
214
- registerServerManager?: IRegisterServerManager;
215
- /**
216
- *
217
- */
218
- capabilitiesForMDNS: string[];
219
- /**
220
- *
221
- */
222
- userCertificateManager: OPCUACertificateManager;
223
- }
224
- /**
225
- *
226
- */
227
- export declare class OPCUAServer extends OPCUABaseServer {
228
- static defaultShutdownTimeout: number;
229
- /**
230
- * if requestExactEndpointUrl is set to true the server will only accept createSession that have a endpointUrl that strictly matches
231
- * one of the provided endpoint.
232
- * This mean that if the server expose a endpoint with url such as opc.tcp://MYHOSTNAME:1234, client will not be able to reach the server
233
- * with the ip address of the server.
234
- * requestExactEndpointUrl = true => emulates the Prosys Server behavior
235
- * requestExactEndpointUrl = false => emulates the Unified Automation behavior.
236
- */
237
- static requestExactEndpointUrl: boolean;
238
- /**
239
- * total number of bytes written by the server since startup
240
- */
241
- get bytesWritten(): number;
242
- /**
243
- * total number of bytes read by the server since startup
244
- */
245
- get bytesRead(): number;
246
- /**
247
- * Number of transactions processed by the server since startup
248
- */
249
- get transactionsCount(): number;
250
- /**
251
- * The server build info
252
- */
253
- get buildInfo(): BuildInfo;
254
- /**
255
- * the number of connected channel on all existing end points
256
- */
257
- get currentChannelCount(): number;
258
- /**
259
- * The number of active subscriptions from all sessions
260
- */
261
- get currentSubscriptionCount(): number;
262
- /**
263
- * the number of session activation requests that have been rejected
264
- */
265
- get rejectedSessionCount(): number;
266
- /**
267
- * the number of request that have been rejected
268
- */
269
- get rejectedRequestsCount(): number;
270
- /**
271
- * the number of sessions that have been aborted
272
- */
273
- get sessionAbortCount(): number;
274
- /**
275
- * the publishing interval count
276
- */
277
- get publishingIntervalCount(): number;
278
- /**
279
- * the number of sessions currently active
280
- */
281
- get currentSessionCount(): number;
282
- /**
283
- * true if the server has been initialized
284
- *
285
- */
286
- get initialized(): boolean;
287
- /**
288
- * is the server auditing ?
289
- */
290
- get isAuditing(): boolean;
291
- static registry: ObjectRegistry;
292
- static fallbackSessionName: string;
293
- /**
294
- * the maximum number of subscription that can be created per server
295
- */
296
- static MAX_SUBSCRIPTION: number;
297
- /**
298
- * the maximum number of concurrent sessions allowed on the server
299
- */
300
- maxAllowedSessionNumber: number;
301
- /**
302
- * the maximum number for concurrent connection per end point
303
- */
304
- maxConnectionsPerEndpoint: number;
305
- /**
306
- * false if anonymous connection are not allowed
307
- */
308
- allowAnonymous: boolean;
309
- /**
310
- * the user manager
311
- */
312
- userManager: UAUserManagerBase;
313
- readonly options: OPCUAServerOptions;
314
- private objectFactory?;
315
- private _delayInit?;
316
- constructor(options?: OPCUAServerOptions);
317
- /**
318
- * Initialize the server by installing default node set.
319
- *
320
- * and instruct the server to listen to its endpoints.
321
- *
322
- * ```javascript
323
- * const server = new OPCUAServer();
324
- * await server.initialize();
325
- *
326
- * // default server namespace is now initialized
327
- * // it is a good time to create life instance objects
328
- * const namespace = server.engine.addressSpace.getOwnNamespace();
329
- * namespace.addObject({
330
- * browseName: "SomeObject",
331
- * organizedBy: server.engine.addressSpace.rootFolder.objects
332
- * });
333
- *
334
- * // the addressSpace is now complete
335
- * // let's now start listening to clients
336
- * await server.start();
337
- * ```
338
- */
339
- initialize(): Promise<void>;
340
- initialize(done: () => void): void;
341
- /**
342
- * Initiate the server by starting all its endpoints
343
- * @async
344
- */
345
- start(): Promise<void>;
346
- start(done: () => void): void;
347
- /**
348
- * shutdown all server endpoints
349
- * @method shutdown
350
- * @async
351
- * @param timeout the timeout (in ms) before the server is actually shutdown
352
- *
353
- * @example
354
- *
355
- * ```javascript
356
- * // shutdown immediately
357
- * server.shutdown(function(err) {
358
- * });
359
- * ```
360
- * ```ts
361
- * // in typescript with promises
362
- * server.shutdown(10000).then(()=>{
363
- * console.log("Server has shutdown");
364
- * });
365
- * ```
366
- * ```javascript
367
- * // shutdown within 10 seconds
368
- * server.engine.shutdownReason = coerceLocalizedText("Shutdown for maintenance");
369
- * server.shutdown(10000,function(err) {
370
- * });
371
- * ```
372
- */
373
- shutdown(timeout?: number): Promise<void>;
374
- shutdown(callback: (err?: Error) => void): void;
375
- shutdown(timeout: number, callback: (err?: Error) => void): void;
376
- dispose(): void;
377
- /**
378
- * create and register a new session
379
- * @internal
380
- */
381
- protected createSession(options: CreateSessionOption): ServerSession;
382
- /**
383
- * retrieve a session by authentication token
384
- * @internal
385
- */
386
- protected getSession(authenticationToken: NodeId, activeOnly?: boolean): ServerSession | null;
387
- /**
388
- *
389
- * @param channel
390
- * @param clientCertificate
391
- * @param clientNonce
392
- * @internal
393
- */
394
- protected computeServerSignature(channel: ServerSecureChannelLayer, clientCertificate: Certificate, clientNonce: Nonce): SignatureData | undefined;
395
- /**
396
- *
397
- * @param session
398
- * @param channel
399
- * @param clientSignature
400
- * @internal
401
- */
402
- protected verifyClientSignature(session: ServerSession, channel: ServerSecureChannelLayer, clientSignature: SignatureData): boolean;
403
- protected isValidUserNameIdentityToken(channel: ServerSecureChannelLayer, session: ServerSession, userTokenPolicy: UserTokenPolicy, userIdentityToken: UserNameIdentityToken, userTokenSignature: SignatureData, callback: (err: Error | null, statusCode?: StatusCode) => void): void;
404
- protected isValidX509IdentityToken(channel: ServerSecureChannelLayer, session: ServerSession, userTokenPolicy: UserTokenPolicy, userIdentityToken: X509IdentityToken, userTokenSignature: SignatureData, callback: (err: Error | null, statusCode?: StatusCode) => void): void;
405
- /**
406
- * @internal
407
- */
408
- protected userNameIdentityTokenAuthenticateUser(channel: ServerSecureChannelLayer, session: ServerSession, userTokenPolicy: UserTokenPolicy, userIdentityToken: UserNameIdentityToken, callback: (err: Error | null, isAuthorized?: boolean) => void): void;
409
- /**
410
- * @internal
411
- */
412
- protected isValidUserIdentityToken(channel: ServerSecureChannelLayer, session: ServerSession, userIdentityToken: UserIdentityToken, userTokenSignature: SignatureData, endpointDescription: EndpointDescription, callback: (err: Error | null, statusCode?: StatusCode) => void): void;
413
- /**
414
- *
415
- * @internal
416
- * @param channel
417
- * @param session
418
- * @param userIdentityToken
419
- * @param callback
420
- * @returns {*}
421
- */
422
- protected isUserAuthorized(channel: ServerSecureChannelLayer, session: ServerSession, userIdentityToken: UserIdentityToken, callback: (err: Error | null, isAuthorized?: boolean) => void): void;
423
- protected makeServerNonce(): Nonce;
424
- protected _on_CreateSessionRequest(message: Message, channel: ServerSecureChannelLayer): Promise<void>;
425
- /**
426
- *
427
- * @method _on_ActivateSessionRequest
428
- * @private
429
- *
430
- *
431
- */
432
- protected _on_ActivateSessionRequest(message: Message, channel: ServerSecureChannelLayer): void;
433
- protected prepare(message: Message, channel: ServerSecureChannelLayer): void;
434
- /**
435
- * ensure that action is performed on a valid session object,
436
- * @method _apply_on_SessionObject
437
- * @param ResponseClass the constructor of the response Class
438
- * @param message
439
- * @param channel
440
- * @param actionToPerform
441
- * @param actionToPerform.session {ServerSession}
442
- * @param actionToPerform.sendResponse
443
- * @param actionToPerform.sendResponse.response
444
- * @param actionToPerform.sendError
445
- * @param actionToPerform.sendError.statusCode
446
- * @param actionToPerform.sendError.diagnostics
447
- *
448
- * @private
449
- */
450
- protected _apply_on_SessionObject(ResponseClass: ResponseClassType, message: Message, channel: ServerSecureChannelLayer, actionToPerform: (session: ServerSession, sendResponse: (response: Response) => void, sendError: (statusCode: StatusCode) => void) => void | Promise<void>): Promise<void>;
451
- protected _apply_on_Subscription(ResponseClass: ResponseClassType, message: Message, channel: ServerSecureChannelLayer, actionToPerform: (session: ServerSession, subscription: Subscription, sendResponse: (response: Response) => void, sendError: (statusCode: StatusCode) => void) => Promise<void>): Promise<void>;
452
- protected _apply_on_SubscriptionIds<T>(ResponseClass: typeof SetPublishingModeResponse | typeof TransferSubscriptionsResponse | typeof DeleteSubscriptionsResponse, message: Message, channel: ServerSecureChannelLayer, actionToPerform: (session: ServerSession, subscriptionId: number) => Promise<T>): void;
453
- protected _apply_on_Subscriptions(ResponseClass: typeof SetPublishingModeResponse | typeof TransferSubscriptionsResponse | typeof DeleteSubscriptionsResponse, message: Message, channel: ServerSecureChannelLayer, actionToPerform: (session: ServerSession, subscription: Subscription) => Promise<StatusCode>): void;
454
- private _closeSession;
455
- /**
456
- * @method _on_CloseSessionRequest
457
- * @param message
458
- * @param channel
459
- * @private
460
- */
461
- protected _on_CloseSessionRequest(message: Message, channel: ServerSecureChannelLayer): void;
462
- /**
463
- * @method _on_BrowseRequest
464
- * @param message
465
- * @param channel
466
- * @private
467
- */
468
- protected _on_BrowseRequest(message: Message, channel: ServerSecureChannelLayer): void;
469
- /**
470
- * @method _on_BrowseNextRequest
471
- * @param message
472
- * @param channel
473
- * @private
474
- */
475
- protected _on_BrowseNextRequest(message: Message, channel: ServerSecureChannelLayer): void;
476
- protected _on_ReadRequest(message: Message, channel: ServerSecureChannelLayer): void;
477
- protected _on_HistoryReadRequest(message: Message, channel: ServerSecureChannelLayer): void;
478
- protected _on_WriteRequest(message: Message, channel: ServerSecureChannelLayer): void;
479
- protected _on_CreateSubscriptionRequest(message: Message, channel: ServerSecureChannelLayer): void;
480
- protected _on_DeleteSubscriptionsRequest(message: Message, channel: ServerSecureChannelLayer): void;
481
- protected _on_TransferSubscriptionsRequest(message: Message, channel: ServerSecureChannelLayer): void;
482
- protected _on_CreateMonitoredItemsRequest(message: Message, channel: ServerSecureChannelLayer): void;
483
- protected _on_ModifySubscriptionRequest(message: Message, channel: ServerSecureChannelLayer): void;
484
- protected _on_ModifyMonitoredItemsRequest(message: Message, channel: ServerSecureChannelLayer): void;
485
- protected _on_PublishRequest(message: Message, channel: ServerSecureChannelLayer): void;
486
- protected _on_SetPublishingModeRequest(message: Message, channel: ServerSecureChannelLayer): void;
487
- protected _on_DeleteMonitoredItemsRequest(message: Message, channel: ServerSecureChannelLayer): void;
488
- protected _on_SetTriggeringRequest(message: Message, channel: ServerSecureChannelLayer): void;
489
- protected _beforeDeleteSubscription(subscription: Subscription): Promise<void>;
490
- protected _on_RepublishRequest(message: Message, channel: ServerSecureChannelLayer): void;
491
- protected _on_SetMonitoringModeRequest(message: Message, channel: ServerSecureChannelLayer): void;
492
- protected _on_TranslateBrowsePathsToNodeIdsRequest(message: Message, channel: ServerSecureChannelLayer): void;
493
- protected _on_CallRequest(message: Message, channel: ServerSecureChannelLayer): void;
494
- protected _on_RegisterNodesRequest(message: Message, channel: ServerSecureChannelLayer): void;
495
- protected _on_UnregisterNodesRequest(message: Message, channel: ServerSecureChannelLayer): void;
496
- protected _on_Cancel(message: Message, channel: ServerSecureChannelLayer): void;
497
- protected _on_AddNodes(message: Message, channel: ServerSecureChannelLayer): void;
498
- protected _on_AddReferences(message: Message, channel: ServerSecureChannelLayer): void;
499
- protected _on_DeleteNodes(message: Message, channel: ServerSecureChannelLayer): void;
500
- protected _on_DeleteReferences(message: Message, channel: ServerSecureChannelLayer): void;
501
- protected _on_QueryFirst(message: Message, channel: ServerSecureChannelLayer): void;
502
- protected _on_QueryNext(message: Message, channel: ServerSecureChannelLayer): void;
503
- protected _on_HistoryUpdate(message: Message, channel: ServerSecureChannelLayer): void;
504
- private createEndpoint;
505
- private createEndpointDescriptions;
506
- initializeCM(): Promise<void>;
507
- }
508
- export interface RaiseEventAuditEventData extends RaiseEventData {
509
- actionTimeStamp: PseudoVariantDateTime;
510
- status: PseudoVariantBoolean;
511
- serverId: PseudoVariantString;
512
- /**
513
- * ClientAuditEntryId contains the human-readable AuditEntryId defined in Part 3.
514
- */
515
- clientAuditEntryId: PseudoVariantString;
516
- /**
517
- * The ClientUserId identifies the user of the client requesting an action. The ClientUserId can be
518
- * obtained from the UserIdentityToken passed in the ActivateSession call.
519
- */
520
- clientUserId: PseudoVariantString;
521
- sourceName: PseudoVariantString;
522
- }
523
- export interface RaiseEventAuditUpdateMethodEventData extends RaiseEventAuditEventData {
524
- methodId: PseudoVariantNodeId;
525
- inputArguments: any;
526
- }
527
- export interface RaiseEventAuditConditionCommentEventData extends RaiseEventAuditUpdateMethodEventData {
528
- eventId: PseudoVariantByteString;
529
- comment: PseudoVariantLocalizedText;
530
- }
531
- export interface RaiseEventAuditSessionEventData extends RaiseEventAuditEventData {
532
- /**
533
- * part 5 - 6.4.7 AuditSessionEventType
534
- */
535
- sessionId: PseudoVariantNodeId;
536
- }
537
- export interface RaiseEventAuditCreateSessionEventData extends RaiseEventAuditSessionEventData {
538
- /**
539
- * part 5 - 6.4.8 AuditCreateSessionEventType
540
- * SecureChannelId shall uniquely identify the SecureChannel.
541
- * The application shall use the same identifier in
542
- * all AuditEvents related to the Session Service Set (AuditCreateSessionEventType, AuditActivateSessionEventType
543
- * and their subtypes) and the SecureChannel Service Set (AuditChannelEventType and its subtype
544
- */
545
- secureChannelId: PseudoVariantString;
546
- revisedSessionTimeout: PseudoVariantDuration;
547
- clientCertificate: PseudoVariantByteString;
548
- clientCertificateThumbprint: PseudoVariantString;
549
- }
550
- export interface RaiseEventAuditActivateSessionEventData extends RaiseEventAuditSessionEventData {
551
- /**
552
- * part 5 - 6.4.10 AuditActivateSessionEventType
553
- */
554
- clientSoftwareCertificates: PseudoVariantExtensionObjectArray;
555
- /**
556
- * UserIdentityToken reflects the userIdentityToken parameter of the ActivateSession Service call.
557
- * For Username/Password tokens the password should NOT be included.
558
- */
559
- userIdentityToken: PseudoVariantExtensionObject;
560
- /**
561
- * SecureChannelId shall uniquely identify the SecureChannel. The application shall use the same identifier
562
- * in all AuditEvents related to the Session Service Set (AuditCreateSessionEventType,
563
- * AuditActivateSessionEventType and their subtypes) and the SecureChannel Service Set
564
- * (AuditChannelEventType and its subtypes).
565
- */
566
- secureChannelId: PseudoVariantString;
567
- }
568
- export interface RaiseEventTransitionEventData extends RaiseEventData {
569
- }
570
- export interface RaiseEventAuditUrlMismatchEventTypeData extends RaiseEventData {
571
- endpointUrl: PseudoVariantString;
572
- }
573
- export interface OPCUAServer {
574
- /**
575
- * @internal
576
- * @param eventType
577
- * @param options
578
- */
579
- raiseEvent(eventType: "AuditSessionEventType", options: RaiseEventAuditSessionEventData): void;
580
- raiseEvent(eventType: "AuditCreateSessionEventType", options: RaiseEventAuditCreateSessionEventData): void;
581
- raiseEvent(eventType: "AuditActivateSessionEventType", options: RaiseEventAuditActivateSessionEventData): void;
582
- raiseEvent(eventType: "AuditCreateSessionEventType", options: RaiseEventData): void;
583
- raiseEvent(eventType: "AuditConditionCommentEventType", options: RaiseEventAuditConditionCommentEventData): void;
584
- raiseEvent(eventType: "AuditUrlMismatchEventType", options: RaiseEventAuditUrlMismatchEventTypeData): void;
585
- raiseEvent(eventType: "TransitionEventType", options: RaiseEventTransitionEventData): void;
586
- }
587
- export interface OPCUAServer extends EventEmitter {
588
- on(event: "create_session", eventHandler: (session: ServerSession) => void): this;
589
- on(event: "session_activated", eventHandler: (session: ServerSession) => void): this;
590
- on(event: "session_closed", eventHandler: (session: ServerSession, reason: string) => void): this;
591
- on(event: "post_initialize", eventHandler: () => void): this;
592
- /**
593
- * emitted when the server is trying to registered the LDS
594
- * but when the connection to the lds has failed
595
- * serverRegistrationPending is sent when the backoff signal of the
596
- * connection process is raised
597
- * @event serverRegistrationPending
598
- */
599
- on(event: "serverRegistrationPending", eventHandler: () => void): this;
600
- /**
601
- * event raised when server has been successfully registered on the local discovery server
602
- * @event serverRegistered
603
- */
604
- on(event: "serverRegistered", eventHandler: () => void): this;
605
- /**
606
- * event raised when server registration has been successfully renewed on the local discovery server
607
- * @event serverRegistered
608
- */
609
- on(event: "serverRegistrationRenewed", eventHandler: () => void): this;
610
- /**
611
- * event raised when server has been successfully unregistered from the local discovery server
612
- * @event serverUnregistered
613
- */
614
- on(event: "serverUnregistered", eventHandler: () => void): this;
615
- /**
616
- * event raised after the server has raised an OPCUA event toward a client
617
- */
618
- on(event: "event", eventHandler: (eventData: any) => void): this;
619
- /**
620
- * event raised when the server received a request from one of its connected client.
621
- * useful for trace purpose.
622
- */
623
- on(event: "request", eventHandler: (request: Request, channel: ServerSecureChannelLayer) => void): this;
624
- /**
625
- * event raised when the server send an response to a request to one of its connected client.
626
- * useful for trace purpose.
627
- */
628
- on(event: "response", eventHandler: (request: Response, channel: ServerSecureChannelLayer) => void): this;
629
- /**
630
- * event raised when a new secure channel is opened
631
- */
632
- on(event: "newChannel", eventHandler: (channel: ServerSecureChannelLayer, endpoint: OPCUAServerEndPoint) => void): this;
633
- /**
634
- * event raised when a new secure channel is closed
635
- */
636
- on(event: "closeChannel", eventHandler: (channel: ServerSecureChannelLayer, endpoint: OPCUAServerEndPoint) => void): this;
637
- /**
638
- * event raised when the server refused a tcp connection from a client. ( for instance because too any connections)
639
- */
640
- on(event: "connectionRefused", eventHandler: (socketData: ISocketData, endpoint: OPCUAServerEndPoint) => void): this;
641
- /**
642
- * event raised when a OpenSecureChannel has failed, it could be a invalid certificate or malformed message
643
- */
644
- on(event: "openSecureChannelFailure", eventHandler: (socketData: ISocketData, channelData: IChannelData, endpoint: OPCUAServerEndPoint) => void): this;
645
- on(event: string, eventHandler: (...args: [any?, ...any[]]) => void): this;
646
- }
647
- export {};
1
+ /**
2
+ * @module node-opcua-server
3
+ */
4
+ /// <reference types="node" />
5
+ import { EventEmitter } from "events";
6
+ import { PseudoVariantBoolean, PseudoVariantByteString, PseudoVariantDateTime, PseudoVariantDuration, PseudoVariantExtensionObject, PseudoVariantExtensionObjectArray, PseudoVariantLocalizedText, PseudoVariantNodeId, PseudoVariantString, RaiseEventData } from "node-opcua-address-space";
7
+ import { OPCUACertificateManager } from "node-opcua-certificate-manager";
8
+ import { Certificate, Nonce } from "node-opcua-crypto";
9
+ import { NodeId } from "node-opcua-nodeid";
10
+ import { ObjectRegistry } from "node-opcua-object-registry";
11
+ import { Message, MessageSecurityMode, Request, Response, SecurityPolicy, ServerSecureChannelLayer, SignatureData } from "node-opcua-secure-channel";
12
+ import { BrowseNextResponse, BrowseResponse } from "node-opcua-service-browse";
13
+ import { CallResponse } from "node-opcua-service-call";
14
+ import { HistoryReadResponse } from "node-opcua-service-history";
15
+ import { ReadResponse } from "node-opcua-service-read";
16
+ import { RegisterNodesResponse, UnregisterNodesResponse } from "node-opcua-service-register-node";
17
+ import { UserNameIdentityToken, X509IdentityToken } from "node-opcua-service-session";
18
+ import { CreateMonitoredItemsResponse, CreateSubscriptionResponse, DeleteSubscriptionsResponse, ModifyMonitoredItemsResponse, ModifySubscriptionResponse, RepublishResponse, SetPublishingModeResponse, SetTriggeringResponse, TransferSubscriptionsResponse } from "node-opcua-service-subscription";
19
+ import { TranslateBrowsePathsToNodeIdsResponse } from "node-opcua-service-translate-browse-path";
20
+ import { WriteResponse } from "node-opcua-service-write";
21
+ import { StatusCode } from "node-opcua-status-code";
22
+ import { ApplicationDescriptionOptions, BuildInfo, EndpointDescription, UserIdentityToken, UserTokenPolicy } from "node-opcua-types";
23
+ import { OPCUABaseServer, OPCUABaseServerOptions } from "./base_server";
24
+ import { IRegisterServerManager } from "./i_register_server_manager";
25
+ import { ServerCapabilitiesOptions } from "./server_capabilities";
26
+ import { OPCUAServerEndPoint } from "./server_end_point";
27
+ import { CreateSessionOption, ServerEngine } from "./server_engine";
28
+ import { ServerSession } from "./server_session";
29
+ import { CreateMonitoredItemHook, DeleteMonitoredItemHook, Subscription } from "./server_subscription";
30
+ import { ISocketData } from "./i_socket_data";
31
+ import { IChannelData } from "./i_channel_data";
32
+ import { UAUserManagerBase, UserManagerOptions } from "./user_manager";
33
+ declare type ResponseClassType = typeof BrowseResponse | typeof BrowseNextResponse | typeof CallResponse | typeof CreateMonitoredItemsResponse | typeof CreateSubscriptionResponse | typeof DeleteSubscriptionsResponse | typeof HistoryReadResponse | typeof ModifyMonitoredItemsResponse | typeof ModifySubscriptionResponse | typeof ReadResponse | typeof RegisterNodesResponse | typeof RepublishResponse | typeof SetPublishingModeResponse | typeof SetTriggeringResponse | typeof TransferSubscriptionsResponse | typeof TranslateBrowsePathsToNodeIdsResponse | typeof UnregisterNodesResponse | typeof WriteResponse;
34
+ export declare function filterDiagnosticInfo(returnDiagnostics: number, response: CallResponse): void;
35
+ export declare enum RegisterServerMethod {
36
+ HIDDEN = 1,
37
+ MDNS = 2,
38
+ LDS = 3
39
+ }
40
+ export interface OPCUAServerEndpointOptions {
41
+ /**
42
+ * the primary hostname of the endpoint.
43
+ * @default getFullyQualifiedDomainName()
44
+ */
45
+ hostname?: string;
46
+ /**
47
+ * the TCP port to listen to.
48
+ * @default 26543
49
+ */
50
+ port?: number;
51
+ /**
52
+ * the possible security policies that the server will expose
53
+ * @default [SecurityPolicy.None, SecurityPolicy.Basic128Rsa15, SecurityPolicy.Basic256Sha256, SecurityPolicy.Aes128_Sha256_RsaOaep, SecurityPolicy.Aes256_Sha256_RsaPss ]
54
+ */
55
+ securityPolicies?: SecurityPolicy[];
56
+ /**
57
+ * the possible security mode that the server will expose
58
+ * @default [MessageSecurityMode.None, MessageSecurityMode.Sign, MessageSecurityMode.SignAndEncrypt]
59
+ */
60
+ securityModes?: MessageSecurityMode[];
61
+ /**
62
+ * tells if the server default endpoints should allow anonymous connection.
63
+ * @default true
64
+ */
65
+ allowAnonymous?: boolean;
66
+ /** alternate hostname or IP to use */
67
+ alternateHostname?: string | string[];
68
+ /**
69
+ * true, if discovery service on secure channel shall be disabled
70
+ */
71
+ disableDiscovery?: boolean;
72
+ }
73
+ export interface OPCUAServerOptions extends OPCUABaseServerOptions, OPCUAServerEndpointOptions {
74
+ alternateEndpoints?: OPCUAServerEndpointOptions[];
75
+ /**
76
+ * the server certificate full path filename
77
+ *
78
+ * the certificate should be in PEM format
79
+ */
80
+ certificateFile?: string;
81
+ /**
82
+ * the server private key full path filename
83
+ *
84
+ * This file should contains the private key that has been used to generate
85
+ * the server certificate file.
86
+ *
87
+ * the private key should be in PEM format
88
+ *
89
+ */
90
+ privateKeyFile?: string;
91
+ /**
92
+ * the default secure token life time in ms.
93
+ */
94
+ defaultSecureTokenLifetime?: number;
95
+ /**
96
+ * the HEL/ACK transaction timeout in ms.
97
+ *
98
+ * Use a large value ( i.e 15000 ms) for slow connections or embedded devices.
99
+ * @default 10000
100
+ */
101
+ timeout?: number;
102
+ /**
103
+ * the maximum number of simultaneous sessions allowed.
104
+ * @default 10
105
+ */
106
+ maxAllowedSessionNumber?: number;
107
+ /**
108
+ * the maximum number authorized simultaneous connections per endpoint
109
+ * @default 10
110
+ */
111
+ maxConnectionsPerEndpoint?: number;
112
+ /**
113
+ * the nodeset.xml file(s) to load
114
+ *
115
+ * node-opcua comes with pre-installed node-set files that can be used
116
+ *
117
+ * example:
118
+ *
119
+ * ``` javascript
120
+ *
121
+ * ```
122
+ */
123
+ nodeset_filename?: string[] | string;
124
+ /**
125
+ * the server Info
126
+ *
127
+ * this object contains the value that will populate the
128
+ * Root/ObjectS/Server/ServerInfo OPCUA object in the address space.
129
+ */
130
+ serverInfo?: ApplicationDescriptionOptions;
131
+ buildInfo?: {
132
+ productName?: string;
133
+ productUri?: string | null;
134
+ manufacturerName?: string;
135
+ softwareVersion?: string;
136
+ buildNumber?: string;
137
+ buildDate?: Date;
138
+ };
139
+ /**
140
+ * an object that implements user authentication methods
141
+ */
142
+ userManager?: UserManagerOptions;
143
+ /** resource Path is a string added at the end of the url such as "/UA/Server" */
144
+ resourcePath?: string;
145
+ /**
146
+ *
147
+ */
148
+ serverCapabilities?: ServerCapabilitiesOptions;
149
+ /**
150
+ * if server shall raise AuditingEvent
151
+ * @default true
152
+ */
153
+ isAuditing?: boolean;
154
+ /**
155
+ * strategy used by the server to declare itself to a discovery server
156
+ *
157
+ * - HIDDEN: the server doesn't expose itself to the external world
158
+ * - MDNS: the server publish itself to the mDNS Multicast network directly
159
+ * - LDS: the server registers itself to the LDS or LDS-ME (Local Discovery Server)
160
+ *
161
+ * @default .HIDDEN - by default the server
162
+ * will not register itself to the local discovery server
163
+ *
164
+ */
165
+ registerServerMethod?: RegisterServerMethod;
166
+ /**
167
+ *
168
+ * @default "opc.tcp://localhost:4840"]
169
+ */
170
+ discoveryServerEndpointUrl?: string;
171
+ /**
172
+ *
173
+ * supported server capabilities for the Multicast (mDNS)
174
+ * @default ["NA"]
175
+ * the possible values are any of node-opcua-discovery.serverCapabilities)
176
+ *
177
+ */
178
+ capabilitiesForMDNS?: string[];
179
+ /**
180
+ * user Certificate Manager
181
+ * this certificate manager holds the X509 certificates used
182
+ * by client that uses X509 certificate token to impersonate a user
183
+ */
184
+ userCertificateManager?: OPCUACertificateManager;
185
+ /**
186
+ * Server Certificate Manager
187
+ *
188
+ * this certificate manager will be used by the server to access
189
+ * and store certificates from the connecting clients
190
+ */
191
+ serverCertificateManager?: OPCUACertificateManager;
192
+ /**
193
+ *
194
+ */
195
+ onCreateMonitoredItem?: CreateMonitoredItemHook;
196
+ onDeleteMonitoredItem?: DeleteMonitoredItemHook;
197
+ }
198
+ export interface OPCUAServer {
199
+ /**
200
+ *
201
+ */
202
+ engine: ServerEngine;
203
+ /**
204
+ *
205
+ */
206
+ registerServerMethod: RegisterServerMethod;
207
+ /**
208
+ *
209
+ */
210
+ discoveryServerEndpointUrl: string;
211
+ /**
212
+ *
213
+ */
214
+ registerServerManager?: IRegisterServerManager;
215
+ /**
216
+ *
217
+ */
218
+ capabilitiesForMDNS: string[];
219
+ /**
220
+ *
221
+ */
222
+ userCertificateManager: OPCUACertificateManager;
223
+ }
224
+ /**
225
+ *
226
+ */
227
+ export declare class OPCUAServer extends OPCUABaseServer {
228
+ static defaultShutdownTimeout: number;
229
+ /**
230
+ * if requestExactEndpointUrl is set to true the server will only accept createSession that have a endpointUrl that strictly matches
231
+ * one of the provided endpoint.
232
+ * This mean that if the server expose a endpoint with url such as opc.tcp://MYHOSTNAME:1234, client will not be able to reach the server
233
+ * with the ip address of the server.
234
+ * requestExactEndpointUrl = true => emulates the Prosys Server behavior
235
+ * requestExactEndpointUrl = false => emulates the Unified Automation behavior.
236
+ */
237
+ static requestExactEndpointUrl: boolean;
238
+ /**
239
+ * total number of bytes written by the server since startup
240
+ */
241
+ get bytesWritten(): number;
242
+ /**
243
+ * total number of bytes read by the server since startup
244
+ */
245
+ get bytesRead(): number;
246
+ /**
247
+ * Number of transactions processed by the server since startup
248
+ */
249
+ get transactionsCount(): number;
250
+ /**
251
+ * The server build info
252
+ */
253
+ get buildInfo(): BuildInfo;
254
+ /**
255
+ * the number of connected channel on all existing end points
256
+ */
257
+ get currentChannelCount(): number;
258
+ /**
259
+ * The number of active subscriptions from all sessions
260
+ */
261
+ get currentSubscriptionCount(): number;
262
+ /**
263
+ * the number of session activation requests that have been rejected
264
+ */
265
+ get rejectedSessionCount(): number;
266
+ /**
267
+ * the number of request that have been rejected
268
+ */
269
+ get rejectedRequestsCount(): number;
270
+ /**
271
+ * the number of sessions that have been aborted
272
+ */
273
+ get sessionAbortCount(): number;
274
+ /**
275
+ * the publishing interval count
276
+ */
277
+ get publishingIntervalCount(): number;
278
+ /**
279
+ * the number of sessions currently active
280
+ */
281
+ get currentSessionCount(): number;
282
+ /**
283
+ * true if the server has been initialized
284
+ *
285
+ */
286
+ get initialized(): boolean;
287
+ /**
288
+ * is the server auditing ?
289
+ */
290
+ get isAuditing(): boolean;
291
+ static registry: ObjectRegistry;
292
+ static fallbackSessionName: string;
293
+ /**
294
+ * the maximum number of subscription that can be created per server
295
+ */
296
+ static MAX_SUBSCRIPTION: number;
297
+ /**
298
+ * the maximum number of concurrent sessions allowed on the server
299
+ */
300
+ maxAllowedSessionNumber: number;
301
+ /**
302
+ * the maximum number for concurrent connection per end point
303
+ */
304
+ maxConnectionsPerEndpoint: number;
305
+ /**
306
+ * false if anonymous connection are not allowed
307
+ */
308
+ allowAnonymous: boolean;
309
+ /**
310
+ * the user manager
311
+ */
312
+ userManager: UAUserManagerBase;
313
+ readonly options: OPCUAServerOptions;
314
+ private objectFactory?;
315
+ private _delayInit?;
316
+ constructor(options?: OPCUAServerOptions);
317
+ /**
318
+ * Initialize the server by installing default node set.
319
+ *
320
+ * and instruct the server to listen to its endpoints.
321
+ *
322
+ * ```javascript
323
+ * const server = new OPCUAServer();
324
+ * await server.initialize();
325
+ *
326
+ * // default server namespace is now initialized
327
+ * // it is a good time to create life instance objects
328
+ * const namespace = server.engine.addressSpace.getOwnNamespace();
329
+ * namespace.addObject({
330
+ * browseName: "SomeObject",
331
+ * organizedBy: server.engine.addressSpace.rootFolder.objects
332
+ * });
333
+ *
334
+ * // the addressSpace is now complete
335
+ * // let's now start listening to clients
336
+ * await server.start();
337
+ * ```
338
+ */
339
+ initialize(): Promise<void>;
340
+ initialize(done: () => void): void;
341
+ /**
342
+ * Initiate the server by starting all its endpoints
343
+ * @async
344
+ */
345
+ start(): Promise<void>;
346
+ start(done: () => void): void;
347
+ /**
348
+ * shutdown all server endpoints
349
+ * @method shutdown
350
+ * @async
351
+ * @param timeout the timeout (in ms) before the server is actually shutdown
352
+ *
353
+ * @example
354
+ *
355
+ * ```javascript
356
+ * // shutdown immediately
357
+ * server.shutdown(function(err) {
358
+ * });
359
+ * ```
360
+ * ```ts
361
+ * // in typescript with promises
362
+ * server.shutdown(10000).then(()=>{
363
+ * console.log("Server has shutdown");
364
+ * });
365
+ * ```
366
+ * ```javascript
367
+ * // shutdown within 10 seconds
368
+ * server.engine.shutdownReason = coerceLocalizedText("Shutdown for maintenance");
369
+ * server.shutdown(10000,function(err) {
370
+ * });
371
+ * ```
372
+ */
373
+ shutdown(timeout?: number): Promise<void>;
374
+ shutdown(callback: (err?: Error) => void): void;
375
+ shutdown(timeout: number, callback: (err?: Error) => void): void;
376
+ dispose(): void;
377
+ /**
378
+ * create and register a new session
379
+ * @internal
380
+ */
381
+ protected createSession(options: CreateSessionOption): ServerSession;
382
+ /**
383
+ * retrieve a session by authentication token
384
+ * @internal
385
+ */
386
+ protected getSession(authenticationToken: NodeId, activeOnly?: boolean): ServerSession | null;
387
+ /**
388
+ *
389
+ * @param channel
390
+ * @param clientCertificate
391
+ * @param clientNonce
392
+ * @internal
393
+ */
394
+ protected computeServerSignature(channel: ServerSecureChannelLayer, clientCertificate: Certificate, clientNonce: Nonce): SignatureData | undefined;
395
+ /**
396
+ *
397
+ * @param session
398
+ * @param channel
399
+ * @param clientSignature
400
+ * @internal
401
+ */
402
+ protected verifyClientSignature(session: ServerSession, channel: ServerSecureChannelLayer, clientSignature: SignatureData): boolean;
403
+ protected isValidUserNameIdentityToken(channel: ServerSecureChannelLayer, session: ServerSession, userTokenPolicy: UserTokenPolicy, userIdentityToken: UserNameIdentityToken, userTokenSignature: SignatureData, callback: (err: Error | null, statusCode?: StatusCode) => void): void;
404
+ protected isValidX509IdentityToken(channel: ServerSecureChannelLayer, session: ServerSession, userTokenPolicy: UserTokenPolicy, userIdentityToken: X509IdentityToken, userTokenSignature: SignatureData, callback: (err: Error | null, statusCode?: StatusCode) => void): void;
405
+ /**
406
+ * @internal
407
+ */
408
+ protected userNameIdentityTokenAuthenticateUser(channel: ServerSecureChannelLayer, session: ServerSession, userTokenPolicy: UserTokenPolicy, userIdentityToken: UserNameIdentityToken, callback: (err: Error | null, isAuthorized?: boolean) => void): void;
409
+ /**
410
+ * @internal
411
+ */
412
+ protected isValidUserIdentityToken(channel: ServerSecureChannelLayer, session: ServerSession, userIdentityToken: UserIdentityToken, userTokenSignature: SignatureData, endpointDescription: EndpointDescription, callback: (err: Error | null, statusCode?: StatusCode) => void): void;
413
+ /**
414
+ *
415
+ * @internal
416
+ * @param channel
417
+ * @param session
418
+ * @param userIdentityToken
419
+ * @param callback
420
+ * @returns {*}
421
+ */
422
+ protected isUserAuthorized(channel: ServerSecureChannelLayer, session: ServerSession, userIdentityToken: UserIdentityToken, callback: (err: Error | null, isAuthorized?: boolean) => void): void;
423
+ protected makeServerNonce(): Nonce;
424
+ protected _on_CreateSessionRequest(message: Message, channel: ServerSecureChannelLayer): Promise<void>;
425
+ /**
426
+ *
427
+ * @method _on_ActivateSessionRequest
428
+ * @private
429
+ *
430
+ *
431
+ */
432
+ protected _on_ActivateSessionRequest(message: Message, channel: ServerSecureChannelLayer): void;
433
+ protected prepare(message: Message, channel: ServerSecureChannelLayer): void;
434
+ /**
435
+ * ensure that action is performed on a valid session object,
436
+ * @method _apply_on_SessionObject
437
+ * @param ResponseClass the constructor of the response Class
438
+ * @param message
439
+ * @param channel
440
+ * @param actionToPerform
441
+ * @param actionToPerform.session {ServerSession}
442
+ * @param actionToPerform.sendResponse
443
+ * @param actionToPerform.sendResponse.response
444
+ * @param actionToPerform.sendError
445
+ * @param actionToPerform.sendError.statusCode
446
+ * @param actionToPerform.sendError.diagnostics
447
+ *
448
+ * @private
449
+ */
450
+ protected _apply_on_SessionObject(ResponseClass: ResponseClassType, message: Message, channel: ServerSecureChannelLayer, actionToPerform: (session: ServerSession, sendResponse: (response: Response) => void, sendError: (statusCode: StatusCode) => void) => void | Promise<void>): Promise<void>;
451
+ protected _apply_on_Subscription(ResponseClass: ResponseClassType, message: Message, channel: ServerSecureChannelLayer, actionToPerform: (session: ServerSession, subscription: Subscription, sendResponse: (response: Response) => void, sendError: (statusCode: StatusCode) => void) => Promise<void>): Promise<void>;
452
+ protected _apply_on_SubscriptionIds<T>(ResponseClass: typeof SetPublishingModeResponse | typeof TransferSubscriptionsResponse | typeof DeleteSubscriptionsResponse, message: Message, channel: ServerSecureChannelLayer, actionToPerform: (session: ServerSession, subscriptionId: number) => Promise<T>): void;
453
+ protected _apply_on_Subscriptions(ResponseClass: typeof SetPublishingModeResponse | typeof TransferSubscriptionsResponse | typeof DeleteSubscriptionsResponse, message: Message, channel: ServerSecureChannelLayer, actionToPerform: (session: ServerSession, subscription: Subscription) => Promise<StatusCode>): void;
454
+ private _closeSession;
455
+ /**
456
+ * @method _on_CloseSessionRequest
457
+ * @param message
458
+ * @param channel
459
+ * @private
460
+ */
461
+ protected _on_CloseSessionRequest(message: Message, channel: ServerSecureChannelLayer): void;
462
+ /**
463
+ * @method _on_BrowseRequest
464
+ * @param message
465
+ * @param channel
466
+ * @private
467
+ */
468
+ protected _on_BrowseRequest(message: Message, channel: ServerSecureChannelLayer): void;
469
+ /**
470
+ * @method _on_BrowseNextRequest
471
+ * @param message
472
+ * @param channel
473
+ * @private
474
+ */
475
+ protected _on_BrowseNextRequest(message: Message, channel: ServerSecureChannelLayer): void;
476
+ protected _on_ReadRequest(message: Message, channel: ServerSecureChannelLayer): void;
477
+ protected _on_HistoryReadRequest(message: Message, channel: ServerSecureChannelLayer): void;
478
+ protected _on_WriteRequest(message: Message, channel: ServerSecureChannelLayer): void;
479
+ protected _on_CreateSubscriptionRequest(message: Message, channel: ServerSecureChannelLayer): void;
480
+ protected _on_DeleteSubscriptionsRequest(message: Message, channel: ServerSecureChannelLayer): void;
481
+ protected _on_TransferSubscriptionsRequest(message: Message, channel: ServerSecureChannelLayer): void;
482
+ protected _on_CreateMonitoredItemsRequest(message: Message, channel: ServerSecureChannelLayer): void;
483
+ protected _on_ModifySubscriptionRequest(message: Message, channel: ServerSecureChannelLayer): void;
484
+ protected _on_ModifyMonitoredItemsRequest(message: Message, channel: ServerSecureChannelLayer): void;
485
+ protected _on_PublishRequest(message: Message, channel: ServerSecureChannelLayer): void;
486
+ protected _on_SetPublishingModeRequest(message: Message, channel: ServerSecureChannelLayer): void;
487
+ protected _on_DeleteMonitoredItemsRequest(message: Message, channel: ServerSecureChannelLayer): void;
488
+ protected _on_SetTriggeringRequest(message: Message, channel: ServerSecureChannelLayer): void;
489
+ protected _beforeDeleteSubscription(subscription: Subscription): Promise<void>;
490
+ protected _on_RepublishRequest(message: Message, channel: ServerSecureChannelLayer): void;
491
+ protected _on_SetMonitoringModeRequest(message: Message, channel: ServerSecureChannelLayer): void;
492
+ protected _on_TranslateBrowsePathsToNodeIdsRequest(message: Message, channel: ServerSecureChannelLayer): void;
493
+ protected _on_CallRequest(message: Message, channel: ServerSecureChannelLayer): void;
494
+ protected _on_RegisterNodesRequest(message: Message, channel: ServerSecureChannelLayer): void;
495
+ protected _on_UnregisterNodesRequest(message: Message, channel: ServerSecureChannelLayer): void;
496
+ protected _on_Cancel(message: Message, channel: ServerSecureChannelLayer): void;
497
+ protected _on_AddNodes(message: Message, channel: ServerSecureChannelLayer): void;
498
+ protected _on_AddReferences(message: Message, channel: ServerSecureChannelLayer): void;
499
+ protected _on_DeleteNodes(message: Message, channel: ServerSecureChannelLayer): void;
500
+ protected _on_DeleteReferences(message: Message, channel: ServerSecureChannelLayer): void;
501
+ protected _on_QueryFirst(message: Message, channel: ServerSecureChannelLayer): void;
502
+ protected _on_QueryNext(message: Message, channel: ServerSecureChannelLayer): void;
503
+ protected _on_HistoryUpdate(message: Message, channel: ServerSecureChannelLayer): void;
504
+ private createEndpoint;
505
+ private createEndpointDescriptions;
506
+ initializeCM(): Promise<void>;
507
+ }
508
+ export interface RaiseEventAuditEventData extends RaiseEventData {
509
+ actionTimeStamp: PseudoVariantDateTime;
510
+ status: PseudoVariantBoolean;
511
+ serverId: PseudoVariantString;
512
+ /**
513
+ * ClientAuditEntryId contains the human-readable AuditEntryId defined in Part 3.
514
+ */
515
+ clientAuditEntryId: PseudoVariantString;
516
+ /**
517
+ * The ClientUserId identifies the user of the client requesting an action. The ClientUserId can be
518
+ * obtained from the UserIdentityToken passed in the ActivateSession call.
519
+ */
520
+ clientUserId: PseudoVariantString;
521
+ sourceName: PseudoVariantString;
522
+ }
523
+ export interface RaiseEventAuditUpdateMethodEventData extends RaiseEventAuditEventData {
524
+ methodId: PseudoVariantNodeId;
525
+ inputArguments: any;
526
+ }
527
+ export interface RaiseEventAuditConditionCommentEventData extends RaiseEventAuditUpdateMethodEventData {
528
+ eventId: PseudoVariantByteString;
529
+ comment: PseudoVariantLocalizedText;
530
+ }
531
+ export interface RaiseEventAuditSessionEventData extends RaiseEventAuditEventData {
532
+ /**
533
+ * part 5 - 6.4.7 AuditSessionEventType
534
+ */
535
+ sessionId: PseudoVariantNodeId;
536
+ }
537
+ export interface RaiseEventAuditCreateSessionEventData extends RaiseEventAuditSessionEventData {
538
+ /**
539
+ * part 5 - 6.4.8 AuditCreateSessionEventType
540
+ * SecureChannelId shall uniquely identify the SecureChannel.
541
+ * The application shall use the same identifier in
542
+ * all AuditEvents related to the Session Service Set (AuditCreateSessionEventType, AuditActivateSessionEventType
543
+ * and their subtypes) and the SecureChannel Service Set (AuditChannelEventType and its subtype
544
+ */
545
+ secureChannelId: PseudoVariantString;
546
+ revisedSessionTimeout: PseudoVariantDuration;
547
+ clientCertificate: PseudoVariantByteString;
548
+ clientCertificateThumbprint: PseudoVariantString;
549
+ }
550
+ export interface RaiseEventAuditActivateSessionEventData extends RaiseEventAuditSessionEventData {
551
+ /**
552
+ * part 5 - 6.4.10 AuditActivateSessionEventType
553
+ */
554
+ clientSoftwareCertificates: PseudoVariantExtensionObjectArray;
555
+ /**
556
+ * UserIdentityToken reflects the userIdentityToken parameter of the ActivateSession Service call.
557
+ * For Username/Password tokens the password should NOT be included.
558
+ */
559
+ userIdentityToken: PseudoVariantExtensionObject;
560
+ /**
561
+ * SecureChannelId shall uniquely identify the SecureChannel. The application shall use the same identifier
562
+ * in all AuditEvents related to the Session Service Set (AuditCreateSessionEventType,
563
+ * AuditActivateSessionEventType and their subtypes) and the SecureChannel Service Set
564
+ * (AuditChannelEventType and its subtypes).
565
+ */
566
+ secureChannelId: PseudoVariantString;
567
+ }
568
+ export interface RaiseEventTransitionEventData extends RaiseEventData {
569
+ }
570
+ export interface RaiseEventAuditUrlMismatchEventTypeData extends RaiseEventData {
571
+ endpointUrl: PseudoVariantString;
572
+ }
573
+ export interface OPCUAServer {
574
+ /**
575
+ * @internal
576
+ * @param eventType
577
+ * @param options
578
+ */
579
+ raiseEvent(eventType: "AuditSessionEventType", options: RaiseEventAuditSessionEventData): void;
580
+ raiseEvent(eventType: "AuditCreateSessionEventType", options: RaiseEventAuditCreateSessionEventData): void;
581
+ raiseEvent(eventType: "AuditActivateSessionEventType", options: RaiseEventAuditActivateSessionEventData): void;
582
+ raiseEvent(eventType: "AuditCreateSessionEventType", options: RaiseEventData): void;
583
+ raiseEvent(eventType: "AuditConditionCommentEventType", options: RaiseEventAuditConditionCommentEventData): void;
584
+ raiseEvent(eventType: "AuditUrlMismatchEventType", options: RaiseEventAuditUrlMismatchEventTypeData): void;
585
+ raiseEvent(eventType: "TransitionEventType", options: RaiseEventTransitionEventData): void;
586
+ }
587
+ export interface OPCUAServer extends EventEmitter {
588
+ on(event: "create_session", eventHandler: (session: ServerSession) => void): this;
589
+ on(event: "session_activated", eventHandler: (session: ServerSession) => void): this;
590
+ on(event: "session_closed", eventHandler: (session: ServerSession, reason: string) => void): this;
591
+ on(event: "post_initialize", eventHandler: () => void): this;
592
+ /**
593
+ * emitted when the server is trying to registered the LDS
594
+ * but when the connection to the lds has failed
595
+ * serverRegistrationPending is sent when the backoff signal of the
596
+ * connection process is raised
597
+ * @event serverRegistrationPending
598
+ */
599
+ on(event: "serverRegistrationPending", eventHandler: () => void): this;
600
+ /**
601
+ * event raised when server has been successfully registered on the local discovery server
602
+ * @event serverRegistered
603
+ */
604
+ on(event: "serverRegistered", eventHandler: () => void): this;
605
+ /**
606
+ * event raised when server registration has been successfully renewed on the local discovery server
607
+ * @event serverRegistered
608
+ */
609
+ on(event: "serverRegistrationRenewed", eventHandler: () => void): this;
610
+ /**
611
+ * event raised when server has been successfully unregistered from the local discovery server
612
+ * @event serverUnregistered
613
+ */
614
+ on(event: "serverUnregistered", eventHandler: () => void): this;
615
+ /**
616
+ * event raised after the server has raised an OPCUA event toward a client
617
+ */
618
+ on(event: "event", eventHandler: (eventData: any) => void): this;
619
+ /**
620
+ * event raised when the server received a request from one of its connected client.
621
+ * useful for trace purpose.
622
+ */
623
+ on(event: "request", eventHandler: (request: Request, channel: ServerSecureChannelLayer) => void): this;
624
+ /**
625
+ * event raised when the server send an response to a request to one of its connected client.
626
+ * useful for trace purpose.
627
+ */
628
+ on(event: "response", eventHandler: (request: Response, channel: ServerSecureChannelLayer) => void): this;
629
+ /**
630
+ * event raised when a new secure channel is opened
631
+ */
632
+ on(event: "newChannel", eventHandler: (channel: ServerSecureChannelLayer, endpoint: OPCUAServerEndPoint) => void): this;
633
+ /**
634
+ * event raised when a new secure channel is closed
635
+ */
636
+ on(event: "closeChannel", eventHandler: (channel: ServerSecureChannelLayer, endpoint: OPCUAServerEndPoint) => void): this;
637
+ /**
638
+ * event raised when the server refused a tcp connection from a client. ( for instance because too any connections)
639
+ */
640
+ on(event: "connectionRefused", eventHandler: (socketData: ISocketData, endpoint: OPCUAServerEndPoint) => void): this;
641
+ /**
642
+ * event raised when a OpenSecureChannel has failed, it could be a invalid certificate or malformed message
643
+ */
644
+ on(event: "openSecureChannelFailure", eventHandler: (socketData: ISocketData, channelData: IChannelData, endpoint: OPCUAServerEndPoint) => void): this;
645
+ on(event: string, eventHandler: (...args: [any?, ...any[]]) => void): this;
646
+ }
647
+ export {};