#ifndef VENDOR_SAMSUNG_SECURITY_DRK_FILE_H
#define VENDOR_SAMSUNG_SECURITY_DRK_FILE_H

#include "systemConfig.h"

namespace vendor {
namespace samsung {
namespace hardware {
namespace security {
namespace drk {

#define READ    0
#define WRITE   1
#define APPEND  2

class File
{
private:
    int      fd;
    int      fdmode;
    char     path[MAX_FILE_PATH_LEN];
    uint32_t filesize;
    uint32_t index;
    const static uint32_t max_filesize = 0x100000;
public:
    File();
    File(char *fpath);
    File(char *fpath, int mode);
    ~File();
    int32_t   openFile(char *fpath, int mode);
    int32_t   readFile(uint8_t *data, uint32_t *data_len);
    int32_t   readFile(uint8_t *data, uint32_t data_len);
    int32_t   readFile(Bytes& out);
    int32_t   readLine(uint8_t *out, uint32_t *out_len);
    int32_t   writeFile(uint8_t *data, uint32_t data_len);
    int32_t   writeFile(Bytes& in);
    int32_t   makeDir(char *fpath, int32_t fpath_len);
    uint32_t  getFileSize();
    int32_t   resetFileIndex();
    void      closeFile();
};

}  // namespace drk
}  // namespace security
}  // namespace hardware
}  // namespace samsung
}  // namespace vendor

#endif
