/**
 * SMTP Command Handler
 * Responsible for parsing and handling SMTP commands
 */
import * as plugins from '../../../plugins.js';
import type { ISmtpSession } from './interfaces.js';
import type { ICommandHandler, ISmtpServer } from './interfaces.js';
import { SmtpCommand } from './constants.js';
/**
 * Handles SMTP commands and responses
 */
export declare class CommandHandler implements ICommandHandler {
    /**
     * Reference to the SMTP server instance
     */
    private smtpServer;
    /**
     * Creates a new command handler
     * @param smtpServer - SMTP server instance
     */
    constructor(smtpServer: ISmtpServer);
    /**
     * Process a command from the client
     * @param socket - Client socket
     * @param commandLine - Command line from client
     */
    processCommand(socket: plugins.net.Socket | plugins.tls.TLSSocket, commandLine: string): Promise<void>;
    /**
     * Send a response to the client
     * @param socket - Client socket
     * @param response - Response to send
     */
    sendResponse(socket: plugins.net.Socket | plugins.tls.TLSSocket, response: string): void;
    /**
     * Check if a socket error is potentially recoverable
     * @param error - The error that occurred
     * @returns Whether the error is potentially recoverable
     */
    private isRecoverableSocketError;
    /**
     * Handle recoverable socket errors with retry logic
     * @param socket - Client socket
     * @param error - The error that occurred
     * @param response - The response that failed to send
     */
    private handleSocketError;
    /**
     * Handle EHLO command
     * @param socket - Client socket
     * @param clientHostname - Client hostname from EHLO command
     */
    handleEhlo(socket: plugins.net.Socket | plugins.tls.TLSSocket, clientHostname: string): void;
    /**
     * Handle MAIL FROM command
     * @param socket - Client socket
     * @param args - Command arguments
     */
    handleMailFrom(socket: plugins.net.Socket | plugins.tls.TLSSocket, args: string): void;
    /**
     * Handle RCPT TO command
     * @param socket - Client socket
     * @param args - Command arguments
     */
    handleRcptTo(socket: plugins.net.Socket | plugins.tls.TLSSocket, args: string): void;
    /**
     * Handle DATA command
     * @param socket - Client socket
     */
    handleData(socket: plugins.net.Socket | plugins.tls.TLSSocket): void;
    /**
     * Handle RSET command
     * @param socket - Client socket
     */
    handleRset(socket: plugins.net.Socket | plugins.tls.TLSSocket): void;
    /**
     * Handle NOOP command
     * @param socket - Client socket
     */
    handleNoop(socket: plugins.net.Socket | plugins.tls.TLSSocket): void;
    /**
     * Handle QUIT command
     * @param socket - Client socket
     */
    handleQuit(socket: plugins.net.Socket | plugins.tls.TLSSocket, args?: string): void;
    /**
     * Handle AUTH command
     * @param socket - Client socket
     * @param args - Command arguments
     */
    private handleAuth;
    /**
     * Handle AUTH PLAIN authentication
     * @param socket - Client socket
     * @param session - Session
     * @param initialResponse - Optional initial response
     */
    private handleAuthPlain;
    /**
     * Handle AUTH LOGIN authentication
     * @param socket - Client socket
     * @param session - Session
     * @param initialResponse - Optional initial response
     */
    private handleAuthLogin;
    /**
     * Handle AUTH LOGIN response
     * @param socket - Client socket
     * @param session - Session
     * @param response - Response from client
     */
    private handleAuthLoginResponse;
    /**
     * Handle HELP command
     * @param socket - Client socket
     * @param args - Command arguments
     */
    private handleHelp;
    /**
     * Handle VRFY command (Verify user/mailbox)
     * RFC 5321 Section 3.5.1: Server MAY respond with 252 to avoid disclosing sensitive information
     * @param socket - Client socket
     * @param args - Command arguments (username to verify)
     */
    private handleVrfy;
    /**
     * Handle EXPN command (Expand mailing list)
     * RFC 5321 Section 3.5.2: Server MAY disable this for security
     * @param socket - Client socket
     * @param args - Command arguments (mailing list to expand)
     */
    private handleExpn;
    /**
     * Reset session to after-EHLO state
     * @param session - SMTP session to reset
     */
    private resetSession;
    /**
     * Validate command sequence based on current state
     * @param command - Command to validate
     * @param session - Current session
     * @returns Whether the command is valid in the current state
     */
    private validateCommandSequence;
    /**
     * Handle an SMTP command (interface requirement)
     */
    handleCommand(socket: plugins.net.Socket | plugins.tls.TLSSocket, command: SmtpCommand, args: string, session: ISmtpSession): Promise<void>;
    /**
     * Get supported commands for current session state (interface requirement)
     */
    getSupportedCommands(session: ISmtpSession): SmtpCommand[];
    /**
     * Clean up resources
     */
    destroy(): void;
}
