/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { MatterError } from "#general";
export declare class DuplicateMessageError extends MatterError {
}
export declare abstract class MessageReceptionState {
    abstract updateMessageCounter(messageCounter: number): void;
}
/**
 * Implements a message reception state for encrypted messages without rollover.
 * A counter in the range [(max_message_counter + 1) to (2^31 - 1)] SHALL be considered new, and cause the
 * max_message_counter value to be updated.
 * Message counters within the range of the bitmap SHALL be considered duplicate if the corresponding bit
 * offset is set to true. All other message counters SHALL be considered duplicate.
 */
export declare class MessageReceptionStateEncryptedWithoutRollover extends MessageReceptionState {
    protected maximumMessageCounter: number | undefined;
    private messageCounterBitmap;
    constructor(messageCounter?: number);
    /** Initialize the message counter state. */
    private initialize;
    /**
     * Calculate plain diff without rollover.
     * This method is mainly overridden for other counter types and follow the following semantic
     * Return number is:
     * * negative if the new message counter is smaller than the current maximum. Smaller values within the Window size
     *   are check separately within the window. Other smaller values are considered DUPLICATE
     * * positive if the new message counter is larger than the current maximum and are always NEW
     */
    protected calculateDiff(messageCounter: number): number;
    /** Update or move the message counter window. */
    private calculateMessageCounterBitmap;
    /** Update the message counter and window. */
    private updateMessageCounterAndBitmap;
    /** Check if the message counter is known in the bitmap. */
    private isCounterKnownInBitmap;
    /**
     * Returns true if the message counter is a duplicate.
     */
    updateMessageCounter(messageCounter: number): void;
}
/**
 * Implements a message reception state for encrypted messages with rollover.
 * A message counter with rollover is a free running message counter that monotonically increases, but rolls
 * over to zero when it exceeds the maximum value of the counter (32-bits). If the difference is below 2^31 then it is
 * considered a rollover and not a smaller value
 */
export declare class MessageReceptionStateEncryptedWithRollover extends MessageReceptionStateEncryptedWithoutRollover {
    protected calculateDiff(messageCounter: number): number;
}
/**
 * Implements a message reception state for unencrypted messages without rollover.
 * Any message counter equal to max_message_counter or within the message counter window, where the corresponding bit
 * is set to true SHALL be considered duplicate. All other message counters, whether behind the window or ahead of
 * max_message_counter, are considered new and SHALL update max_message_counter and shift the window accordingly.
 * Messages with a counter behind the window are likely caused by a node rebooting and are thus processed as rolling
 * back the window to the current location.
 */
export declare class MessageReceptionStateUnencryptedWithRollover extends MessageReceptionStateEncryptedWithoutRollover {
    protected calculateDiff(messageCounter: number): number;
}
//# sourceMappingURL=MessageReceptionState.d.ts.map