import * as mqtt5_packet from '../../common/mqtt5_packet'; import * as mqtt5_common from "../../common/mqtt5"; import * as mqtt_shared from "../../common/mqtt_shared"; import * as model from "./model"; /** * This module contains three validation suites needed by the client implementation: * * 1. Validation of user-submitted outbound packets at submission time. This checks all public fields for valid * types, values, and ranges. * 2. Validation of internal outbound packets prior to encoding. This checks constraints on internally managed fields * like packetId. It also checks constraints that can change across separate connection (maximum qos, for example). * 3. Protocol-error validation of inbound packets from the server. This primarily checks protocol constraints * and enumerated values. We don't validate against negotiated settings because the server breaking that contract * isn't really a fatal flaw. In that case, it's better to be forgiving. * * Validation differs slightly based on what protocol level is being used (primarily reason codes). It is not * considered a validation error to have 5-only fields set while operating in 311; the additional fields are just * ignored. * * Validation failure is indicated by throwing a CrtError. * * There are a few validation checks that are done outside this module. Validation of binary properties that * are lost on decoding (certain bits not set) is done in the decoder. Validation of maximum packet size constraints * is done in the encoder (NYI though). * * We also skip validation of certain fields that are not relevant in the particular use case. For example, we don't * validate subscription identifiers on outbound publishes because that field is ignored when converting the * submitted packet into the internal model. */ export declare function validateInitialOutboundPacket(packet: mqtt5_packet.IPacket, mode: mqtt_shared.ProtocolMode): void; export declare function validateBinaryOutboundPacket(packet: model.IPacketBinary, mode: mqtt_shared.ProtocolMode, settings: mqtt5_common.NegotiatedSettings): void; export declare function validateInboundPacket(packet: mqtt5_packet.IPacket, mode: mqtt_shared.ProtocolMode): void; export declare function validateU16(value: number, fieldName: string): void; export declare function validateOptionalU32(value: number | undefined, fieldName: string): void; export declare function validateUnsignedInteger(value: number, fieldName: string): void; export declare function validateOptionalUnsignedInteger(value: number | undefined, fieldName: string): void; export declare function validateOptionalPositiveU32(value: number | undefined, fieldName: string): void; export declare function validateOptionalString(value: string | undefined, fieldName: string): void; export declare function validateUserProperties(userProperties: Array | undefined): void; export declare function validateOptionalBinaryData(value: mqtt5_packet.BinaryData | undefined, fieldName: string): void;