#ifndef __FILEUTIL_H__
#define __FILEUTIL_H__

#ifdef __cplusplus
#ifndef BEGIN_DECLS
#define BEGIN_DECLS extern "C" {
#endif
#ifndef END_DECLS
#define END_DECLS }
#endif
#else
#ifndef BEGIN_DECLS
#define BEGIN_DECLS
#endif
#ifndef END_DECLS
#define END_DECLS
#endif
#endif

BEGIN_DECLS

#if defined(_WIN32) && defined(UNICODE)
#include <wchar.h>
#endif

#ifdef _WIN32
#include <windows.h>
#else
#include <sys/sendfile.h>
#endif
#include <limits.h>
#include <sys/stat.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>


#include "Common.h"
#include "Config.h"
#include "Log.h"
#include "StringUtil.h"


#define FILE_ERR_SUCCESS                        0
#define FILE_ERR_SOURCEFILE_OPEN                -1
#define FILE_ERR_DESTINATIONFILE_OPEN           -2
#define FILE_ERR_COPY                           -3
#define FILE_ERR_FILENAME                       -4
#define FILE_ERR_NULL_POINTER                   -5
#define FILE_ERR_FILENAME_IS_NOT_FILE           -6
#define FILE_ERR_PARAMETER                      -7
#define FILE_ERR_MEM                            -8
#define FILE_ERR_PLATFORM                       -9


int FileMove(const char *pDestinationDir, const char *pSourceDir, const char *pFilename);
int MWGetFileSize(const char *pFilename, int nFilenameSize, int *pnFileSize);
int FileOpenforContinuousTransfer(FILE **ppFile, const char *pszFilename);


END_DECLS

#endif
