import type { MacAddress } from '@homebridge/hap-nodejs'; import type { HomebridgeConfig } from './bridgeService.js'; import type { ChildBridgeFork } from './childBridgeFork.js'; export interface ExternalPortsConfiguration { start: number; end: number; } /** * Collect the HAP ports the config gives to the main bridge and to each child * bridge. A child bridge port inside `ports` is easy to end up with (older UI * versions picked them from there), and handing the same port to an external * accessory makes whichever binds second fail with EADDRINUSE. * @param config - the Homebridge config */ export declare function collectConfiguredHapPorts(config: HomebridgeConfig): number[]; /** * Allocates ports from the user defined `config.ports` and `config.matterPorts` options * This service is used to allocate ports for external accessories on the main bridge, and child bridges. * HAP ports and Matter ports are managed separately with their own ranges. */ export declare class ExternalPortService { private externalPorts?; private nextExternalPort?; private allocatedPorts; private readonly matterPortAllocator; private readonly configuredHapPorts; constructor(externalPorts?: ExternalPortsConfiguration | undefined, matterPorts?: ExternalPortsConfiguration, configuredMatterPorts?: number[], configuredHapPorts?: number[]); /** * Returns the next available HAP port in the external port config. * If the external port is not configured by the user it will return undefined. * If the port range has been exhausted it will return undefined. */ requestPort(username: MacAddress): Promise; /** * Returns the next available Matter port in the Matter port config. * Delegates to MatterPortAllocator to keep Matter code in Matter module. * * @param uuid - Unique identifier for the Matter accessory (can be accessory UUID or other unique string) */ requestMatterPort(uuid: string): Promise; /** * Release a Matter port previously obtained via {@link requestMatterPort}. * Call when an external Matter accessory is unregistered or fails to * publish — otherwise the pool accumulates dead allocations and * eventually exhausts on long-running installs. */ releaseMatterPort(uuid: string): boolean; private getNextFreePort; } /** * This is the child bridge version of the port allocation service. * It requests free ports from the main bridge's port service via IPC. */ export declare class ChildBridgeExternalPortService extends ExternalPortService { private childBridge; constructor(childBridge: ChildBridgeFork); requestPort(username: MacAddress): Promise; requestMatterPort(uniqueId: string): Promise; releaseMatterPort(uniqueId: string): boolean; } //# sourceMappingURL=externalPortService.d.ts.map