///
///
import { SmartBuffer } from 'smart-buffer';
import type { UpdateType } from './Constants';
import type { ProtocolRequest, ProtocolResponse, ProtocolUpdate } from './events/ProtocolEvent';
export declare class ProtocolUtil {
/**
* Load json data onto an event, and mark it as successful
*/
loadJson(event: {
data: any;
success: boolean;
}, data: any): void;
/**
* Helper function for buffer loading.
* Handles things like try/catch, setting buffer read offset, etc
*/
bufferLoaderHelper(event: {
success: boolean;
readOffset: number;
data?: {
packetLength?: number;
};
}, buffer: Buffer, minByteLength: number, processor: (buffer: SmartBuffer) => boolean | void): {
success: boolean;
readOffset: number;
data?: {
packetLength?: number;
};
};
/**
* Load the common DebuggerRequest fields
*/
loadCommonRequestFields(request: ProtocolRequest, smartBuffer: SmartBuffer): void;
/**
* Load the common DebuggerResponse
*/
loadCommonResponseFields(response: ProtocolResponse, smartBuffer: SmartBuffer): void;
loadCommonUpdateFields(update: ProtocolUpdate, smartBuffer: SmartBuffer, updateType: UpdateType): boolean;
/**
* Inserts the common command fields to the beginning of the buffer, and computes
* the correct `packet_length` value.
*/
insertCommonRequestFields(request: ProtocolRequest, smartBuffer: SmartBuffer): SmartBuffer;
insertCommonResponseFields(response: ProtocolResponse, smartBuffer: SmartBuffer): SmartBuffer;
/**
* Inserts the common response fields to the beginning of the buffer, and computes
* the correct `packet_length` value.
*/
insertCommonUpdateFields(update: ProtocolUpdate, smartBuffer: SmartBuffer): SmartBuffer;
/**
* Tries to read a string from the buffer and will throw an error if there is no null terminator.
* @param {SmartBuffer} bufferReader
*/
readStringNT(bufferReader: SmartBuffer): string;
}
export declare const protocolUtil: ProtocolUtil;