@mdf.js/openc2
Version:
MMS - API - Observability
87 lines • 2.97 kB
TypeScript
/**
* Copyright 2024 Mytra Control S.L. All rights reserved.
*
* Use of this source code is governed by an MIT-style license that can be found in the LICENSE file
* or at https://opensource.org/licenses/MIT.
*/
import { Control } from '@mdf.js/openc2-core';
import { EventEmitter } from 'stream';
import { AdapterOptions } from '../types';
export declare class Adapter extends EventEmitter {
protected readonly adapterOptions: AdapterOptions;
private readonly type;
/** Component identification */
readonly componentId: string;
/** Channel scope separator */
protected readonly separator: string;
/** Array of topics through which the adapter will listen for commands/responses */
protected readonly subscriptions: string[];
/**
* Create a new OpenC2 adapter for Redis
* @param adapterOptions - Adapter configuration options
* @param type - component type
*/
constructor(adapterOptions: AdapterOptions, type: 'producer' | 'consumer');
/** Component name */
get name(): string;
/**
* Manage the error in the adapter interface
* @param error - error to be processed
*/
protected onErrorHandler(error: unknown): void;
/**
* Returns an array of topics through which the message will be sent
* @param message - message to be sent
* @returns
*/
protected defineTopics(message: Control.Message): string[];
/**
* Returns an array of topics through which the adapter will listen for commands/responses
* @param type - component type
* @param id - instance identification
* @param actuators - actuators
*/
private defineSubscriptions;
/**
* Returns an array of topics through which the message will be sent
* @param to - Desired destinations of the message
* @returns
*/
private defineTopicsForResponse;
/**
* Returns an array of topics through which the message will be sent
* @param to - Desired destinations of the message
* @param actuators - Actuators
* @returns
*/
private defineTopicsForCommands;
/**
* Returns the OpenC2 topic used to send responses for all nodes
* @returns
*/
private getGeneralResponseTopic;
/**
* Returns the OpenC2 topic used to send responses to a concrete producer
* @param producer - producer
* @returns
*/
private getProducerResponseTopic;
/**
* Returns the OpenC2 topic used to receive commands for all nodes
* @returns
*/
private getGeneralCommandTopic;
/**
* Returns the OpenC2 topic used to receive commands for a concrete actuator
* @param actuator - Actuator
* @returns
*/
private getActuatorCommandTopic;
/**
* Returns the OpenC2 topic used to receive commands for a concrete device
* @param actuator - Actuator
* @returns
*/
private getDeviceCommandTopic;
}
//# sourceMappingURL=Adapter.d.ts.map