[965] | 1 | /*
|
---|
| 2 | Directory caching code for Netdrive plugins.
|
---|
| 3 | Copyright (C) netlabs.org 2010-2016
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | #ifndef __DIRCACHE_H__
|
---|
| 7 | #define __DIRCACHE_H__
|
---|
| 8 |
|
---|
[984] | 9 | #ifdef __cplusplus
|
---|
| 10 | extern "C" {
|
---|
| 11 | #endif
|
---|
| 12 |
|
---|
[965] | 13 | #include <limits.h>
|
---|
| 14 |
|
---|
| 15 | #define NDPL_LARGEFILES
|
---|
| 16 | #define INCL_LONGLONG
|
---|
| 17 | #include <ndextpl2.h>
|
---|
| 18 |
|
---|
[969] | 19 |
|
---|
[975] | 20 | /* callback for fsphAddFile32L */
|
---|
| 21 | typedef void FNADDDIRENTRY(void *plist, void *finfo);
|
---|
| 22 | typedef FNADDDIRENTRY *PFNADDDIRENTRY;
|
---|
[969] | 23 |
|
---|
[975] | 24 | /* callback for releasing memory */
|
---|
| 25 | typedef void FNFREEDIRENTRY(void *finfo);
|
---|
| 26 | typedef FNFREEDIRENTRY *PFNFREEDIRENTRY;
|
---|
[965] | 27 |
|
---|
[977] | 28 | /* forward declarations */
|
---|
| 29 | typedef struct DirectoryCache DirectoryCache;
|
---|
[975] | 30 |
|
---|
[965] | 31 | /* Directory cache helpers. */
|
---|
[975] | 32 | int dircache_create(DirectoryCache **ppdc, void* pRes, int cachetimeout, int cachedepth,
|
---|
[983] | 33 | PFNFREEDIRENTRY fn, PLUGINHELPERTABLE2L *ph);
|
---|
[965] | 34 | void dircache_delete(DirectoryCache *pdc);
|
---|
| 35 |
|
---|
| 36 | /* directory cache scanning */
|
---|
| 37 | int dircache_list_files(DirectoryCache *pdc, PFNADDDIRENTRY fn,
|
---|
| 38 | void *plist,
|
---|
| 39 | char* dir_mask, char* fullpath,
|
---|
| 40 | int *ptotal_received);
|
---|
| 41 | int dircache_find_path(DirectoryCache *pdc,
|
---|
| 42 | const char *path,
|
---|
[975] | 43 | void **finfo,
|
---|
[965] | 44 | unsigned long *pulAge);
|
---|
| 45 |
|
---|
| 46 | /* directory cache creation */
|
---|
| 47 | void *dircache_write_begin(DirectoryCache *pdc,
|
---|
| 48 | char* dir_mask, char* fullpath,
|
---|
| 49 | int cFiles);
|
---|
| 50 | void dircache_write_entry(DirectoryCache *pdc, void *dircachectx,
|
---|
[975] | 51 | const char *fname, const void *finfo);
|
---|
[965] | 52 | void dircache_write_end(DirectoryCache *pdc, void *dircachectx);
|
---|
| 53 |
|
---|
| 54 | /* directory cache invalidation */
|
---|
| 55 | void dircache_invalidate(DirectoryCache *pdc,
|
---|
| 56 | const char *path,
|
---|
| 57 | int fParent);
|
---|
| 58 |
|
---|
[984] | 59 | #ifdef __cplusplus
|
---|
| 60 | }
|
---|
| 61 | #endif
|
---|
| 62 |
|
---|
[965] | 63 | #endif // __DIRCACHE_H__
|
---|