/** * MAC address to VLAN mapping */ export interface IMacVlanMapping { /** MAC address (full) or OUI pattern (e.g., "00:11:22" for vendor prefix) */ mac: string; /** VLAN ID to assign */ vlan: number; /** Optional description */ description?: string; /** Whether this mapping is enabled */ enabled: boolean; /** Creation timestamp */ createdAt: number; /** Last update timestamp */ updatedAt: number; } /** * VLAN assignment result */ export interface IVlanAssignmentResult { /** Whether a VLAN was successfully assigned */ assigned: boolean; /** The assigned VLAN ID (or default if not matched) */ vlan: number; /** The matching rule (if any) */ matchedRule?: IMacVlanMapping; /** Whether default VLAN was used */ isDefault: boolean; } /** * VlanManager configuration */ export interface IVlanManagerConfig { /** Default VLAN for unknown MACs */ defaultVlan?: number; /** Whether to allow unknown MACs (assign default VLAN) or reject */ allowUnknownMacs?: boolean; } /** * Manages MAC address to VLAN mappings with support for: * - Exact MAC address matching * - OUI (vendor prefix) pattern matching * - Wildcard patterns * - Default VLAN for unknown devices */ export declare class VlanManager { private mappings; private config; private normalizedMacCache; constructor(config?: IVlanManagerConfig); /** * Initialize the VLAN manager and load persisted mappings */ initialize(): Promise; /** * Normalize a MAC address to lowercase with colons * Accepts formats: 00:11:22:33:44:55, 00-11-22-33-44-55, 001122334455 */ normalizeMac(mac: string): string; /** * Check if a MAC address matches a pattern * Supports: * - Exact match: "00:11:22:33:44:55" * - OUI match: "00:11:22" (matches any device with this vendor prefix) * - Wildcard: "*" (matches all) */ macMatchesPattern(mac: string, pattern: string): boolean; /** * Add or update a MAC to VLAN mapping */ addMapping(mapping: Omit): Promise; /** * Remove a MAC to VLAN mapping */ removeMapping(mac: string): Promise; /** * Get a specific mapping by MAC */ getMapping(mac: string): IMacVlanMapping | undefined; /** * Get all mappings */ getAllMappings(): IMacVlanMapping[]; /** * Determine VLAN assignment for a MAC address * Returns the most specific matching rule (exact > OUI > wildcard > default) */ assignVlan(mac: string): IVlanAssignmentResult; /** * Bulk import mappings */ importMappings(mappings: Array>): Promise; /** * Export all mappings */ exportMappings(): IMacVlanMapping[]; /** * Update configuration */ updateConfig(config: Partial): void; /** * Get current configuration */ getConfig(): Required; /** * Get statistics */ getStats(): { totalMappings: number; enabledMappings: number; exactMatches: number; ouiPatterns: number; wildcardPatterns: number; }; /** * Load mappings from database */ private loadMappings; /** * Save mappings to database */ private saveMappings; }