/*!
 * \file    buffer_utils.h
 * \brief   Buffer check utility functions
 * \author  Lei Tang
 * \date    5/22/2015
 *
 * <hr>
 * \section LICENSE
 * Copyright Samsung Electronics, Co. Ltd. B2B TIMA team. 2015 05
 * <hr>
 */
#ifndef BUFFER_UTILS_H_
#define BUFFER_UTILS_H_

#include <stdint.h>
#include <string.h>
#include <stdio.h>

/**@Validate a buffer is within the given range, including buffer>=minAddr and buffer+bufLen<=maxAddr.
 *
 * @param[in] buffer:  The starting address of the buffer
 * @param[in] bufLen: The length of the buffer. 
 * @param[in] minAddr:  The minimum address allowed for the buffer.
 * @param[in] maxAddr:  The maximum address allowed for the buffer (the address of the last byte in the buffer plus 1).
 *
 * Return 1 if the buffer passes the validation. Otherwise, return 0.
 * */
int isBufferInRange(const void *buffer, const uint32_t bufLen, const void *minAddr, const void *maxAddr);

/**@Set all bytes in a buffer to be zero.
 *
 * @param[in] buffer:  The starting address of the buffer
 * @param[in] bufLen: The length of the buffer. 
 * Return void.
 * */
void zeroOutBuffer(const void *buffer, const uint32_t bufLen);

#endif /* BUFFER_UTILS_H_ */
