import type { CodecOpts } from "./types.ts"; import type { ConnectPacket } from "./connect.ts"; import type { ConnackPacket } from "./connack.ts"; import type { PublishPacket } from "./publish.ts"; import type { PubackPacket, PubcompPacket, PubrecPacket, PubrelPacket } from "./pubblishAcks.ts"; import type { SubscribePacket } from "./subscribe.ts"; import type { SubackPacket } from "./suback.ts"; import type { UnsubscribePacket } from "./unsubscribe.ts"; import type { UnsubackPacket } from "./unsuback.ts"; import type { PingreqPacket } from "./pingreq.ts"; import type { PingresPacket } from "./pingres.ts"; import type { DisconnectPacket } from "./disconnect.ts"; import type { AuthPacket } from "./auth.ts"; /** * this can be any possible MQTT packet */ export type AnyPacket = ConnectPacket | ConnackPacket | PublishPacket | PubackPacket | PubrecPacket | PubrelPacket | PubcompPacket | SubscribePacket | SubackPacket | UnsubscribePacket | UnsubackPacket | PingreqPacket | PingresPacket | DisconnectPacket | AuthPacket; /** * @function encode * @description Encodes an MQTT packet object into a binary Uint8Array format * @param {AnyPacket} packet - The MQTT packet object to encode * @param {CodecOpts} codecOpts - options to use during encoding * @returns {Uint8Array} The encoded packet as a binary buffer * @throws {Error} If packet encoding fails */ export declare function encode(packet: AnyPacket, codecOpts: CodecOpts): Uint8Array; /** * @function decodePayload * @description Decodes a packet payload from binary format into an MQTT packet object * @param {number} firstByte - The first byte of the MQTT packet containing type and flags * @param {Uint8Array} buffer - The binary buffer containing the packet payload * @param {CodecOpts} codecOpts - options to use during encoding * @returns {AnyPacket} The decoded MQTT packet object * @throws {DecoderError} If packet decoding fails */ export declare function decodePayload(firstByte: number, buffer: Uint8Array, codecOpts: CodecOpts): AnyPacket; /** * @function decode * @description Decodes a complete MQTT packet from binary format into a packet object, * its basically a wrapper around decodePayload * * @param {Uint8Array} buffer - The binary buffer containing the complete MQTT packet * @param {CodecOpts} codecOpts - the options for the decoder * @returns {AnyPacket} The decoded MQTT packet object * @throws {DecoderError} If packet decoding fails due to invalid format or insufficient data */ export declare function decode(buffer: Uint8Array, codecOpts: CodecOpts): AnyPacket; //# sourceMappingURL=codec.d.ts.map