/**
 * @file file_integrity_check.h
 *
 * @brief This file contains function prototypes and data definitions that
 * helps to calculate file size and calculate file checksum
 *
 * @copyright Copyright 2023 Antaris, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#ifndef FILE_INTEGRITY_CHECK_H_
#define FILE_INTEGRITY_CHECK_H_
#include "exo_lib/file_transfer/inc/common.h"

#ifndef FT_OBC



/******************************************************************************/
/*               Declaration of exported function prototypes                  */
/******************************************************************************/

/**
 * @brief This function will calculate checksum for file
 *
 * @param[in]  file_name  : Pointer to input file name.
 *
 * @return checksum value in hex
 * @retval non zero value is valid checksum, value 0 indicates error
 */
uint32_t file_integrity_check(char file_name[]);


/**
 * @brief This function will calculate file size
 *
 * @param[in]  file_name  : Pointer to input file name.
 *
 * @return file size in integer
 * @retval non zero value is file size, value -1 indicates error
 */
long int find_fileSize(char file_name[]);


/**
 * @brief This function will calculate checksum for file with input file size
 *
 * @param[in]  file_name  : Pointer to input file name.
 * @param[in]  length  : Pointer to input file name.
 *
 * @return checksum value in hex
 * @retval non zero value is valid checksum, value 0 indicates error
 */
uint32_t ft_calc_filechecksum(char file_name[], uint32_t length);

#endif


/**
 * @brief This API will evaluate crc value for given input data buffer with length
 *
 * @param[in]  data_buf  : Pointer to input data buffer.
 * @param[in] length   : input buffer size
 *
 * @return crc value for input buffer
 * @retval non zero value is valid calculated crc, value 0 indicates error
 */
uint32_t calc_checksum_bulkdata(uint8_t *data_buf,uint32_t length);


#endif /*FILE_INTEGRITY_CHECK_H_ */
