dmi_encoder_peek

Synopsis

#include <opendmi/encoder.h>

bool dmi_encoder_peek(const dmi_encoder_t *encoder, void *ptr, size_t length);

Description

The dmi_encoder_peek function copies length bytes the source data holds at the current position into ptr, without advancing.

This is what the bits a field shares with the ones the specification reserves are read with, so that the reserved ones are written back as the structure has been decoded with them.

Parameters

encoder

Encoder to read from.

ptr

Bytes the source holds at the position.

length

Number of the bytes to read.

Return value

true if the source holds the bytes, false if it has none, e.g. in the canonical mode, or ends before them, or on error.

Errors

DMI_ERROR_ARGUMENT_NULL

ptr is nullptr, while length is not zero and the encoder has a source to look at.