65#define IOINTF_INVALIDNAME -11
69#define IOINTF_NOTFOUND -12
73#define IOINTF_EXIST -13
77#define IOINTF_ENOENT -14
81#define IOINTF_NOACCESS -15
85#define IOINTF_NOTEMPTY -16
89#define IOINTF_NOSPACE -17
93#define IOINTF_IOERROR -18
99#define IOINTF_LOCKED -20
104#define IOINTF_NOIMPLEMENTATION -50
108#define IOINTF_BUFTOOSMALL -51
113#define IOINTF_NOZIPLIB -100
118#define IOINTF_NOTCOMPRESSED -101
122#define IOINTF_ZIPERROR -102
129#define IOINTF_NOAESLIB -200
133#define IOINTF_AES_NO_SUPPORT -201
136#define IOINTF_NO_PASSWORD -202
140#define IOINTF_WRONG_PASSWORD -203
146#define IOINTF_AES_WRONG_AUTH -204
153#define IOINTF_AES_COMPROMISED -205
160typedef struct IoIntf* IoIntfPtr;
162typedef struct DirIntf* DirIntfPtr;
164typedef struct ResIntf* ResIntfPtr;
180#define OpenRes_READ 1
183#define OpenRes_WRITE 2
186#define OpenRes_APPEND 4
206 IoIntfPtr o,
const char* password,
size_t passwordLen);
220 IoIntfPtr o,
BaBool passwordRequired,
BaBool passwordBin);
253 IoIntfPtr o,
const char* name,
BaBool* isEncrypted);
275 IoIntfPtr io,
const char* name,
int* status,
const char** ecode);
292 ResIntfPtr resPtr,
const char* name,
ThreadMutex* m,
341 int* status,
const char** ecode);
380 U32 mode,
int* status,
408 int* status,
const char** ecode);
418typedef int (*
IoIntf_MkDir)(IoIntfPtr o,
const char* name,
const char** ecode);
439typedef int (*
IoIntf_Remove)(IoIntfPtr o,
const char* name,
const char** ecode);
449typedef int (*
IoIntf_RmDir)(IoIntfPtr o,
const char* name,
const char** ecode);
462 ResIntfPtr super,
BaFileSize offset,
void* buf,
size_t maxSize,
size_t* size);
524 struct IoIntf* attachedIo;
546#define IoIntf_constructorRW(o, property, closeDir, mkDir, rename,\
547 openDir, openRes, openResGzip, rm,\
549 (o)->propertyFp=property;\
550 (o)->closeDirFp=closeDir;\
552 (o)->renameFp=rename;\
553 (o)->openDirFp=openDir;\
554 (o)->openResFp=openRes;\
555 (o)->openResGzipFp=openResGzip;\
578#define IoIntf_constructorR(o, property, closeDir, openDir,\
579 openRes, openResGzip, st) do {\
580 (o)->propertyFp=property;\
581 (o)->closeDirFp=closeDir;\
584 (o)->openDirFp=openDir;\
585 (o)->openResFp=openRes;\
586 (o)->openResGzipFp=openResGzip;\
609typedef const char* (*DirIntf_GetName)(DirIntfPtr o);
661#define DirIntf_constructor(o, read, getName, st) do {\
663 (o)->getNameFp=getName;\
678 ResIntfPtr o,
void* buf,
size_t maxSize,
size_t* size);
733#define ResIntf_constructor(o, read, write, seek, flush, close) do {\
ResIntfPtr(* IoIntf_InflateGzip)(IoIntfPtr io, const char *name, int *status, const char **ecode)
Open a destination that accepts gzip bytes and stores decompressed data.
Definition: IoIntf.h:274
int(* IoIntf_Stat)(IoIntfPtr o, const char *name, IoStat *st)
Fetch metadata for a file or directory.
Definition: IoIntf.h:349
int(* ResIntf_Write)(ResIntfPtr o, const void *buf, size_t size)
Write binary bytes at the current resource position.
Definition: IoIntf.h:686
int(* ResIntf_Close)(ResIntfPtr o)
Close and consume a resource handle.
Definition: IoIntf.h:705
BA_API char * IoIntf_getAbspath(IoIntfPtr o, const char *path)
wrapper for IoIntf_Property: 'abs'.
int(* IoIntf_Rename)(IoIntfPtr o, const char *from, const char *to, const char **ecode)
Rename or move a resource within this filesystem.
Definition: IoIntf.h:429
int(* ResIntf_Seek)(ResIntfPtr o, BaFileSize offset)
Set the resource position relative to its beginning.
Definition: IoIntf.h:693
ResIntfPtr(* IoIntf_OpenRes)(IoIntfPtr o, const char *name, U32 mode, int *status, const char **ecode)
Open a file for reading or writing.
Definition: IoIntf.h:379
int(* IoIntf_SeekAndRead)(ResIntfPtr super, BaFileSize offset, void *buf, size_t maxSize, size_t *size)
Perform a combined seek and read on a resource.
Definition: IoIntf.h:461
void(* IoIntf_OnTerminate)(IoIntfPtr o, IoIntfPtr io)
Notify a filesystem attachment of termination/replacement.
Definition: IoIntf.h:471
int(* IoIntf_MkDir)(IoIntfPtr o, const char *name, const char **ecode)
Create a directory.
Definition: IoIntf.h:418
struct IoIntf IoIntf
The IoIntf class specifies an abstract file API, implementations include ZipIo, DiskIo,...
int(* IoIntf_RmDir)(IoIntfPtr o, const char *name, const char **ecode)
Remove an empty directory.
Definition: IoIntf.h:449
int(* IoIntf_Remove)(IoIntfPtr o, const char *name, const char **ecode)
Remove a file.
Definition: IoIntf.h:439
ResIntfPtr(* IoIntf_OpenResGzip)(IoIntfPtr o, const char *name, ThreadMutex *m, BaFileSize *size, int *status, const char **ecode)
Open a gzip representation for reading when supported.
Definition: IoIntf.h:406
int(* DirIntf_Read)(DirIntfPtr o)
Advance to the next directory entry, including the first after open.
Definition: IoIntf.h:602
BA_API int IoIntf_setPassword(IoIntfPtr o, const char *password, size_t passwordLen)
wrapper for IoIntf_Property: 'pl'.
struct DirIntf DirIntf
Directory handle for a directory opened with IoIntf_OpenDir.
int(* ResIntf_Flush)(ResIntfPtr o)
Flush buffered writes through the implementation.
Definition: IoIntf.h:699
ResIntfPtr(* IoIntf_DeflateGzip)(ResIntfPtr resPtr, const char *name, ThreadMutex *m, BaFileSize *size, BaBool *isCompressed)
Optionally compress an open resource or range into temporary gzip storage.
Definition: IoIntf.h:291
const char *(* DirIntf_GetName)(DirIntfPtr o)
Access the current entry name after successful readFp.
Definition: IoIntf.h:609
struct ResIntf ResIntf
Resource handle for a file opened with IoIntf_OpenRes.
BA_API void IoIntf_destructor(IoIntfPtr o)
Invoke the implementation's "destructor" property.
int(* DirIntf_Stat)(DirIntfPtr o, IoStat *st)
Fetch metadata for the current entry after successful readFp.
Definition: IoIntf.h:616
int(* ResIntf_Read)(ResIntfPtr o, void *buf, size_t maxSize, size_t *size)
Read binary bytes at the current resource position.
Definition: IoIntf.h:677
BA_API int IoIntf_isEncrypted(IoIntfPtr o, const char *name, BaBool *isEncrypted)
wrapper for IoIntf_Property: 'aes'.
int(* IoIntf_CloseDir)(IoIntfPtr o, DirIntfPtr *dirIntf)
Consume and close a directory iterator.
Definition: IoIntf.h:390
DirIntfPtr(* IoIntf_OpenDir)(IoIntfPtr o, const char *dirname, int *status, const char **ecode)
Open a directory iterator before its first entry.
Definition: IoIntf.h:340
BA_API int IoIntf_setPasswordProp(IoIntfPtr o, BaBool passwordRequired, BaBool passwordBin)
wrapper for IoIntf_Property: 'pp'.
int(* IoIntf_Property)(IoIntfPtr o, const char *name, void *a, void *b)
Implementation-specific property operation.
Definition: IoIntf.h:328
BA_API int IoIntf_getType(IoIntfPtr o, const char **type, const char **platform)
Query the implementation's type property.
S64 BaTime
An arithmetic type representing calendar time with epoch of 1970-01-01 00:00:00 UTC,...
Definition: GenPrimT.h:103
uint32_t U32
Unsigned 32-bit integer.
Definition: GenPrimT.h:93
U8 BaBool
Boolean stored in an unsigned byte; FALSE is zero and TRUE is one.
Definition: GenPrimT.h:118
U32 BaFileSize
Unsigned file size or position in bytes; 32 bits without BA_FILESIZE64.
Definition: GenPrimT.h:136
Directory handle for a directory opened with IoIntf_OpenDir.
Definition: IoIntf.h:643
DirIntf_Read readFp
Iterate the resources in the file system.
Definition: IoIntf.h:646
DirIntf_GetName getNameFp
Get resource name.
Definition: IoIntf.h:648
DirIntf_Stat statFp
Get resource information.
Definition: IoIntf.h:650
The IoIntf class specifies an abstract file API, implementations include ZipIo, DiskIo,...
Definition: IoIntf.h:482
IoIntf_Rename renameFp
Rename resource.
Definition: IoIntf.h:497
IoIntf_RmDir rmDirFp
Remove directory.
Definition: IoIntf.h:517
IoIntf_OpenDir openDirFp
Open directory.
Definition: IoIntf.h:501
IoIntf_OpenResGzip openResGzipFp
Open file as a compressed gzip file.
Definition: IoIntf.h:509
IoIntf_Property propertyFp
Set or get property.
Definition: IoIntf.h:485
IoIntf_Remove removeFp
Remove file.
Definition: IoIntf.h:513
IoIntf_OpenRes openResFp
Open resource.
Definition: IoIntf.h:505
IoIntf_Stat statFp
Get resource information.
Definition: IoIntf.h:521
IoIntf_MkDir mkDirFp
Make directory.
Definition: IoIntf.h:493
IoIntf_CloseDir closeDirFp
Close directory.
Definition: IoIntf.h:489
Resource information.
Definition: IoIntf.h:170
BaFileSize size
File size in bytes.
Definition: IoIntf.h:174
BaTime lastModified
Last modification time in Unix seconds; availability and precision depend on the filesystem.
Definition: IoIntf.h:172
BaBool isDir
TRUE for a directory, FALSE for a file.
Definition: IoIntf.h:176
Resource handle for a file opened with IoIntf_OpenRes.
Definition: IoIntf.h:711
ResIntf_Seek seekFp
Seek to position in resource.
Definition: IoIntf.h:717
ResIntf_Close closeFp
Close the resource and release any data.
Definition: IoIntf.h:721
ResIntf_Flush flushFp
Flush resource.
Definition: IoIntf.h:719
ResIntf_Read readFp
Read from resource.
Definition: IoIntf.h:713
ResIntf_Write writeFp
Write to resource.
Definition: IoIntf.h:715
A mutual exclusion class.
Definition: ThreadLib.h:196