/** * @module node-opcua-transport */ import { EventEmitter } from "node:events"; import { BinaryStream } from "node-opcua-binary-stream"; import { SequenceHeader } from "node-opcua-chunkmanager"; import { type MessageHeader, type PacketInfo } from "node-opcua-packet-assembler"; import type { StatusCode } from "node-opcua-status-code"; export declare function readRawMessageHeader(data: Buffer): PacketInfo; export interface MessageBuilderBaseOptions { signatureLength?: number; maxMessageSize?: number; maxChunkCount?: number; maxChunkSize?: number; } export interface MessageBuilderBaseEvents { /** * notify the observers that a new message is being built * @event startChunk */ startChunk: [info: PacketInfo, data: Buffer]; /** * notify the observers that new message chunk has been received * @event chunk */ chunk: [chunk: Buffer]; /** * notify the observers that an error has occurred * @event error */ error: [err: Error, statusCode: StatusCode, requestId: number | null]; /** * notify the observers that a full message has been received * @event full_message_body */ full_message_body: [fullMessageBody: Buffer]; /** * notify the observers that a request has been abandoned * @event abandon */ abandon: [requestId: number]; } /** * */ export declare class MessageBuilderBase extends EventEmitter { #private; static defaultMaxChunkCount: number; static defaultMaxMessageSize: number; static defaultMaxChunkSize: number; readonly signatureLength: number; readonly maxMessageSize: number; readonly maxChunkCount: number; readonly maxChunkSize: number; readonly options: MessageBuilderBaseOptions; channelId: number; totalMessageSize: number; sequenceHeader: SequenceHeader | null; _tick0: number; _tick1: number; protected id: string; protected totalBodySize: number; protected messageChunks: Buffer[]; protected messageHeader?: MessageHeader; constructor(options?: MessageBuilderBaseOptions); dispose(): void; /** * Feed message builder with some data * @param data */ feed(data: Buffer): void; protected _decodeMessageBody(_fullMessageBody: Buffer): boolean; protected _read_headers(binaryStream: BinaryStream): boolean; /** * The possibly-asynchronous seam over {@link _read_headers}: a subclass * whose header processing may need to await something (an OPN chunk * decrypted by a remote key-operations provider) overrides THIS method * and returns a promise for that one case; every synchronous case keeps * returning a plain boolean, and the surrounding chunk processing stays * fully synchronous for it. While a returned promise is pending, later * chunks queue in arrival order (see the chunk pump), so ordering is * preserved. * @internal node-opcua plumbing: may change in a minor release. */ protected _read_headersEx(binaryStream: BinaryStream): boolean | Promise; protected _report_abandon(_channelId: number, _tokenId: number, sequenceHeader: SequenceHeader): false; protected _report_error(statusCode: StatusCode, errorMessage: string): false; } //# sourceMappingURL=message_builder_base.d.ts.map