/* Copyright (C) 2016-2020, Dirk Krause SPDX-License-Identifier: BSD-3-Clause */ /* WARNING: This file was generated by the dkct program (see http://dktools.sourceforge.net/ for details). Changes you make here will be lost if dkct is run again! You should modify the original source and run dkct on it. Original source: dk4strmu.ctr */ #ifndef DK4STRMU_H_INCLUDED /** Avoid multiple inclusions. */ #define DK4STRMU_H_INCLUDED 1 #line 8 "dk4strmu.ctr" /** @file dk4strmu.h Unserialize data from stream. */ #ifndef DK4CONF_H_INCLUDED #if DK4_BUILDING_DKTOOLS4 #include "dk4conf.h" #else #include #endif #endif #ifndef DK4TYPES_H_INCLUDED #if DK4_BUILDING_DKTOOLS4 #include "dk4types.h" #else #include #endif #endif #ifndef DK4ERROR_H_INCLUDED #if DK4_BUILDING_DKTOOLS4 #include "dk4error.h" #else #include #endif #endif #ifndef DK4STRM_H_INCLUDED #if DK4_BUILDING_DKTOOLS4 #include "dk4strm.h" #else #include #endif #endif #ifdef __cplusplus extern "C" { #endif /** Retrieve 32 bit unsigned value from stream. @param ptr Address of result variable. @param strm Data stream to read from. @param erp Error report, may be NULL. @return 1 on success, 0 on error. Error codes: - DK4_E_INVALID_ARGUMENTS
if ptr is NULL or strm is NULL or not opened for reading, - DK4_E_SYNTAX
if the end of data stream was reached before reading 4 bytes, - DK4_E_NOT_FOUND
if not further data was found (EOF reached), - DK4_E_READ_FAILED
if a read attempt failed for other reasons. */ int dk4stream_unser_u32(uint32_t *ptr, dk4_stream_t *strm, dk4_er_t *erp); /** Retrieve 32 bit signed value from stream. @param ptr Address of result variable. @param strm Data stream to read from. @param erp Error report, may be NULL. @return 1 on success, 0 on error. Error codes: - DK4_E_INVALID_ARGUMENTS
if ptr is NULL or strm is NULL or not opened for reading, - DK4_E_SYNTAX
if the end of data stream was reached before reading 4 bytes, - DK4_E_NOT_FOUND
if not further data was found (EOF reached), - DK4_E_READ_FAILED
if a read attempt failed for other reasons. */ int dk4stream_unser_i32(int32_t *ptr, dk4_stream_t *strm, dk4_er_t *erp); /** Retrieve 16 bit unsigned value from stream. @param ptr Address of result variable. @param strm Data stream to read from. @param erp Error report, may be NULL. @return 1 on success, 0 on error. Error codes: - DK4_E_INVALID_ARGUMENTS
if ptr is NULL or strm is NULL or not opened for reading, - DK4_E_SYNTAX
if the end of data stream was reached before reading 2 bytes, - DK4_E_NOT_FOUND
if not further data was found (EOF reached), - DK4_E_READ_FAILED
if a read attempt failed for other reasons. */ int dk4stream_unser_u16(uint16_t *ptr, dk4_stream_t *strm, dk4_er_t *erp); /** Retrieve 16 bit signed value from stream. @param ptr Address of result variable. @param strm Data stream to read from. @param erp Error report, may be NULL. @return 1 on success, 0 on error. Error codes: - DK4_E_INVALID_ARGUMENTS
if ptr is NULL or strm is NULL or not opened for reading, - DK4_E_SYNTAX
if the end of data stream was reached before reading 2 bytes, - DK4_E_NOT_FOUND
if not further data was found (EOF reached), - DK4_E_READ_FAILED
if a read attempt failed for other reasons. */ int dk4stream_unser_i16(int16_t *ptr, dk4_stream_t *strm, dk4_er_t *erp); /** Retrieve 8 bit unsigned value from stream. @param ptr Address of result variable. @param strm Data stream to read from. @param erp Error report, may be NULL. @return 1 on success, 0 on error. Error codes: - DK4_E_INVALID_ARGUMENTS
if ptr is NULL or strm is NULL or not opened for reading, - DK4_E_SYNTAX
if the end of data stream was reached before reading 1 byte, - DK4_E_NOT_FOUND
if not further data was found (EOF reached), - DK4_E_READ_FAILED
if a read attempt failed for other reasons. */ int dk4stream_unser_u8(uint8_t *ptr, dk4_stream_t *strm, dk4_er_t *erp); /** Retrieve 8 bit signed value from stream. @param ptr Address of result variable. @param strm Data stream to read from. @param erp Error report, may be NULL. @return 1 on success, 0 on error. Error codes: - DK4_E_INVALID_ARGUMENTS
if ptr is NULL or strm is NULL or not opened for reading, - DK4_E_SYNTAX
if the end of data stream was reached before reading 1 byte, - DK4_E_NOT_FOUND
if not further data was found (EOF reached), - DK4_E_READ_FAILED
if a read attempt failed for other reasons. */ int dk4stream_unser_i8(int8_t *ptr, dk4_stream_t *strm, dk4_er_t *erp); /** Retrieve string from stream. The variable strptr points to should be initialized to NULL. On success (string found) this variable is set to dynamically allocated memory. Use dk4mem_release() or dk4mem_free() to release that memory after use. The function sets the destination pointer variable to NULL and reports success if a leading string length 0 was found. @param strptr Address of pointer variable. @param strm Data stream to read from. @param erp Error report, may be NULL. @return 1 on success, 0 on error. Error codes: - DK4_E_INVALID_ARGUMENTS
if strptr is NULL or strm is NULL or not opened for reading, - DK4_E_SYNTAX
on unexpected end of data stream or when missing the finalizing 0x00 byte on end of string, - DK4_E_NOT_FOUND
if EOF was reached, - DK4_E_MEMORY_ALLOCATION_FAILED
with mem.elsize and mem.nelem set if there is not enough memory available. - DK4_E_READ_FAILED
if a read attempt failed for other reasons. */ int dk4stream_unser_string(char **strptr, dk4_stream_t *strm, dk4_er_t *erp); /** Retrieve double value from stream. @param ptr Address of result variable. @param strm Data stream to read from. @param erp Error report, may be NULL. @return 1 on success, 0 on error. Error codes: - DK4_E_INVALID_ARGUMENTS
if ptr is NULL or strm is NULL or not opened for reading, - DK4_E_SYNTAX
on - unexpected end of data stream - or when missing the finalizing 0x00 byte on end of string - or when the string is too long - or when the string does not contain a double number, - DK4_E_NOT_FOUND
if not further data was found (EOF reached), - DK4_E_READ_FAILED
if a read attempt failed for other reasons. */ int dk4stream_unser_double(double *ptr, dk4_stream_t *strm, dk4_er_t *erp); #ifdef __cplusplus } #endif #endif