import type { BasicPacketHeader, SelectiveAckHeader } from './PacketHeader.js'; import type { Packet } from './index.js'; import type { NetworkId } from '../../../networks/types.js'; import type { Debugger } from 'debug'; export declare const BUFFER_SIZE = 512; export declare enum PacketType { ST_DATA = 0, ST_FIN = 1, ST_STATE = 2, ST_RESET = 3, ST_SYN = 4 } export type SynPacket = Packet; export type StatePacket = Packet; export type ResetPacket = Packet; export type FinPacket = Packet; export type DataPacket = Packet; export declare enum UtpSocketType { READ = "read", WRITE = "write" } export declare enum HeaderExtension { none = 0, selectiveAck = 1 } interface IHeaderInput { pType: PacketType; version: Uint8; connectionId: Uint16; timestampMicroseconds: MicroSeconds; timestampDifferenceMicroseconds: MicroSeconds; wndSize: Uint32; seqNr: Uint16; ackNr: Uint16; } interface IBasicHeaderInput extends IHeaderInput { pType: PacketType; extension: HeaderExtension.none; connectionId: Uint16; } export interface ISelectiveAckHeaderInput extends IHeaderInput { pType: PacketType.ST_STATE; extension: HeaderExtension.selectiveAck; bitmask: Uint8Array; connectionId: Uint16; } export type HeaderInput = IBasicHeaderInput | ISelectiveAckHeaderInput; interface IBasicPacketOptions { header: HeaderInput; payload?: Uint8Array; } interface IDataPacketOptions extends IBasicPacketOptions { header: HeaderInput; payload: Uint8Array; } export type PacketOptions = IBasicPacketOptions | IDataPacketOptions; interface IPacketInput { header: HeaderInput; } interface BasicPacketInput extends IPacketInput { payload?: Uint8Array; } interface DataPacketInput extends IPacketInput { payload: Uint8Array; } export type PacketInput = BasicPacketInput | DataPacketInput; export type PacketHeader = BasicPacketHeader | SelectiveAckHeader; export interface IPacket { pType: T; seqNr: number; ackNr: number; connectionId: number; payload?: Uint8Array; } export interface IBasic extends IPacket { pType: T; extension: HeaderExtension.none; connectionId: number; } export interface ISelectiveAck extends IPacket { pType: PacketType.ST_STATE; extension: HeaderExtension.selectiveAck; bitmask: Uint8Array; connectionId: number; } export interface IData extends IPacket { pType: PacketType.ST_DATA; extension: HeaderExtension.none; payload: Uint8Array; connectionId: number; } export type ICreate = IBasic | ISelectiveAck | IData; export interface UtpSocketOptions { networkId: NetworkId; remoteAddress: string; sndId: number; rcvId: number; seqNr: number; ackNr: number; type: UtpSocketType; logger: Debugger; content?: Uint8Array; } interface ICreatePacket { pType: T; connectionId?: number; } interface ICreateSelectiveAck extends ICreatePacket { bitmask: Uint8Array; } export interface ICreateData extends ICreatePacket { payload: Uint8Array; } export type ICreatePacketOpts = ICreatePacket | ICreateData | ICreateSelectiveAck; export type Uint8 = number; export type Uint16 = number; export type Uint32 = number; export type MicroSeconds = Uint32; export type PacketHeaderType = { pType: PacketType; version: Uint8; extension: Uint8; connectionId: Uint16; timestampMicroseconds: MicroSeconds; timestampDifferenceMicroseconds: MicroSeconds; wndSize: Uint32; seqNr: Uint16; ackNr: Uint16; extensions?: Uint8Array; }; export {}; //# sourceMappingURL=PacketTyping.d.ts.map