/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { ServerSubscriptionConfig } from "#node/server/ServerSubscription.js"; import { DeepPartial, Duration } from "@matter/general"; import { NetworkProfiles, PeerTimingParameters } from "@matter/protocol"; import { DiscoveryCapabilitiesBitmap, TypeFromPartialBitSchema } from "@matter/types"; import { NetworkBehavior } from "./NetworkBehavior.js"; import type { ServerNetworkRuntime } from "./ServerNetworkRuntime.js"; /** * Server implementation of {@link NetworkBehavior}. * * This behavior mostly deals with configuration and events. {@link ServerNetworkRuntime} provides the actual network * implementation. */ export declare class NetworkServer extends NetworkBehavior { #private; readonly state: NetworkServer.State; internal: NetworkServer.Internal; initialize(): import("@matter/general").MaybePromise; } export declare namespace NetworkServer { export class Internal extends NetworkBehavior.Internal { runtime: ServerNetworkRuntime; } export class KickRestartCooldownConfig implements Partial { addressChange?: Duration; connect?: Duration; } export class AddressChangeProbeCooldownConfig implements Partial { minimum?: Duration; maximum?: Duration; } export class TimingConfig implements DeepPartial { defaultConnectionTimeout?: Duration; maxDelayBetweenInitialContactRetries?: Duration; delayBeforeNextAddress?: Duration; delayAfterNetworkError?: Duration; delayAfterPeerError?: Duration; delayAfterUnhandledError?: Duration; kickThrottleInterval?: Duration; kickMinRetransmissions?: number; kickMinRestartSaving?: Duration; kickRestartCooldown?: KickRestartCooldownConfig; addressChangeStabilizationDelay?: Duration; addressChangeProbeCooldown?: AddressChangeProbeCooldownConfig; } export class ConcreteLimitsConfig implements Partial { exchanges?: number; delay?: Duration; timeout?: Duration; additionalMrpDelay?: Duration; } export class LimitsConfig extends ConcreteLimitsConfig { bdxAdditionalMrpDelay?: Duration; connect?: ConcreteLimitsConfig; probeAddress?: ConcreteLimitsConfig; } export class ProfilesConfig implements NetworkProfiles.PartialOptions { fast?: LimitsConfig; wifi?: LimitsConfig; thread?: LimitsConfig; conservative?: LimitsConfig; unknown?: LimitsConfig; unlimited?: LimitsConfig; icdLit?: LimitsConfig; } type Mismatched = Exclude | Exclude; type SameFields<_Mismatched extends never> = unknown; /** * The config classes above restate their source's fields because {@link field} needs real property declarations, * and `implements Partial` catches neither a field they fail to declare nor one the source has dropped. * This does: either divergence breaks the build here, naming the offending field. */ export type ConfigMatchesItsSource = [ SameFields>, SameFields>, SameFields>, SameFields>, SameFields>, SameFields> ]; export class State extends NetworkBehavior.State { listeningAddressIpv4?: string; listeningAddressIpv6?: string; ipv4: boolean; ble?: boolean; discoveryCapabilities: TypeFromPartialBitSchema; subscriptionOptions?: ServerSubscriptionConfig; /** * Enable TCP transport. `true` enables both incoming (server) and outgoing (client). * Fine-grained control via `{ incoming?: boolean; outgoing?: boolean }`. * Disabled by default. * * `maxMessageSize` is the largest TCP message in bytes, without the 4-byte length header, that the node accepts. * The node announces it to peers as MAX_TCP_MESSAGE_SIZE. It must be a whole number from * {@link MAX_UDP_MESSAGE_SIZE} to the uint32 maximum; the default is {@link DEFAULT_MAX_TCP_MESSAGE_SIZE}. * * @see {@link MatterSpecification.v161.Core} § 4.13.1 */ tcp?: boolean | NetworkServer.TcpConfig; /** * Preferred transport for outgoing connections. Defaults to UDP when not set. */ transportPreference?: "tcp" | "udp"; /** * Controller-level connection policy for commissioned peers. * * When true (default), the node auto-connects every commissioned, non-disabled peer as it goes online — the * right choice for a headless controller or bridge that wants all peers live. * * When false, no peer is connected on online and the consumer starts peers on demand (`ClientNode.start()` / * `ClientNode.enable()`). Use this for interactive or debug controllers that manage connections themselves * (e.g. the nodejs shell). This is orthogonal to per-node `ClientNode.disable()`: this flag is a controller * policy that leaves peers enabled, whereas disabling a peer is a persisted per-node "this node is off" state * (a seasonal device, say) that the bulk connect skips regardless of this flag. */ autoStartCommissionedPeers: boolean; /** * Network profile describing our own (local) network — the sender-side MRP additive-delay * axis. Defaults to "fast"; set to "thread" on a Thread device. */ ownNetworkProfileId: keyof NetworkProfiles.Templates; timing?: TimingConfig; profiles?: ProfilesConfig; /** * Interval at which dirty client cache data is flushed to storage. Defaults to the write-coalescing interval * the storage driver asks for. Set to `Instant` to disable buffering and persist every change immediately. */ clientCacheFlushInterval?: Duration; } export interface TcpConfig { incoming?: boolean; outgoing?: boolean; maxMessageSize?: number; } /** * Resolve the tcp shorthand to explicit incoming/outgoing booleans and the effective maximum message size. * * @throws ImplementationError when TCP is enabled with a `maxMessageSize` that * {@link SessionParameters.assertMaxTcpMessageSize} rejects */ export function resolveTcpConfig(tcp?: boolean | TcpConfig): Required; export {}; } //# sourceMappingURL=NetworkServer.d.ts.map