import { Datagram, Request, Response } from "../Independents/Datagram/datagram-types.js"; import { Either } from "../Independents/util/Either.js"; import { Gateway, SpawningError } from "./Gateway.js"; import { Machine } from "../Independents/Machine.js"; import { HostName, HostNameTemplate } from "../Independents/DNS/HostName.js"; import { RequestResponse } from "./GatewayProxy.js"; import { Resolve } from "../Independents/DNS/Resolve.js"; import { Subscription } from "../Independents/util/Subscription.js"; import { FocusedObject } from "functional"; import { THost, THostOwnershipRecord } from "../Independents/DNS/datagram-router.js"; import { CBurpastateWrapper, TBurpaState } from "./burpastate.js"; export declare type NamingFn = (components: number, origin?: string) => string; export declare class HostExtension { machine: Machine; pendingSentRequests: { [reqno: number]: RequestResponse; }; constructor(state: CBurpastateWrapper, burpaport: string[]); } export interface IHost { get aliases2(): string[]; get machine(): Machine; set machine(machine: Machine); get childHosts(): { [key: string]: CHostOwnershipRecord; }; addChild(name: string, secret: string, registred: boolean, gateway: string): CHostOwnershipRecord; allocateChildName(hostTemplate: HostNameTemplate, secret: string): Either; onReceiveDatagram(datagram: Datagram): Promise; } export declare const HostExtensions: { [hostid: string]: HostExtension; }; /** * Burpa hosts and burpa gateways are trees of named nodes. * Each node has a set of children with unique names amongst their siblings. * The naming function is different for gateways and hosts. Gateways have are using * person names, potentially followed by a number if there are many siblings. Hosts * have single, dual or tripple word names, potentially followed by a number. */ export declare abstract class Host extends FocusedObject implements IHost { _wrapper: CBurpastateWrapper | null; get hostId(): string; get state(): CBurpastateWrapper; /** * Eeach request datagram is marked with a request number, unique * to the Transport. By providing the same request number in the response * datagram, requests and responses can be paired. */ get nextReqno(): number; set nextReqno(val: number); get childHosts(): { [key: string]: CHostOwnershipRecord; }; get extension(): HostExtension; get machine(): Machine; set machine(machine: Machine); get pendingSentRequests(): { [reqno: number]: RequestResponse; }; set pendingSentRequests(p: { [reqno: number]: RequestResponse; }); abstract addChild(name: string, secret: string, registred: boolean, gateway: string): CHostOwnershipRecord; hasAlias(name: string): boolean; getInfo(): any; onReceiveDatagram(datagram: Datagram): Promise; getGateway(): Gateway; sendRequest(request: Request): Subscription; sendDatagram(datagram: Datagram): void; getResponse(reqno: number): Subscription; reportSentDatagram(datagram: Datagram): void; reportSentRequest(request: Request): Subscription; get publicAlias(): HostName | null; get alias(): HostName; get aliases2(): string[]; allocateChildName(hostTemplate: HostNameTemplate, secret: string): Either; getNamingFunction(): NamingFn; allocateGeneratedChildName(hostTemplate: HostNameTemplate, secret: string): string; collectGarbage(): void; canUseName(host: string, secret: string): boolean; getOwnershipRecord(host: string): CHostOwnershipRecord | null; addToInbox(type: "vagrant" | "gateway", datagram: Datagram): void; _addChild(type: "vagrant" | "gateway", name: string, secret: string, registred: boolean, gateway?: string): CHostOwnershipRecord; } /** * The master record for a host or a gateway. This is the source of truth * for all hosts and gateways including the roots. */ export declare class CHostOwnershipRecord extends FocusedObject { get state(): CBurpastateWrapper; getInfo(): any; getPublicInfo(): { type: import("../Independents/DNS/datagram-router.js").THostType; name: string; }; getResolve(): Resolve; emptyInbox(): void; } export declare class TemporaryHost extends Host { action: string; addChild(name: string, secret: string, registred: boolean, gateway: string): CHostOwnershipRecord; onReceiveDatagram(datagram: Datagram): Promise; getNamingFunction(): NamingFn; } export declare class Vagrant extends Host { addChild(name: string, secret: string, registred: boolean, gateway: string): CHostOwnershipRecord; }