| 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 |
|
|---|
| 9 | #ifdef __cplusplus
|
|---|
| 10 | extern "C" {
|
|---|
| 11 | #endif
|
|---|
| 12 |
|
|---|
| 13 | #include <limits.h>
|
|---|
| 14 |
|
|---|
| 15 | #define NDPL_LARGEFILES
|
|---|
| 16 | #define INCL_LONGLONG
|
|---|
| 17 | #include <ndextpl2.h>
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 | /* callback for fsphAddFile32L */
|
|---|
| 21 | typedef void FNADDDIRENTRY(void *plist, void *finfo);
|
|---|
| 22 | typedef FNADDDIRENTRY *PFNADDDIRENTRY;
|
|---|
| 23 |
|
|---|
| 24 | /* callback for releasing memory */
|
|---|
| 25 | typedef void FNFREEDIRENTRY(void *finfo);
|
|---|
| 26 | typedef FNFREEDIRENTRY *PFNFREEDIRENTRY;
|
|---|
| 27 |
|
|---|
| 28 | /* forward declarations */
|
|---|
| 29 | typedef struct DirectoryCache DirectoryCache;
|
|---|
| 30 |
|
|---|
| 31 | /* Directory cache helpers. */
|
|---|
| 32 | int dircache_create(DirectoryCache **ppdc, void* pRes, int cachetimeout, int cachedepth,
|
|---|
| 33 | PFNFREEDIRENTRY fn, PLUGINHELPERTABLE2L *ph);
|
|---|
| 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,
|
|---|
| 43 | void **finfo,
|
|---|
| 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,
|
|---|
| 51 | const char *fname, const void *finfo);
|
|---|
| 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 |
|
|---|
| 59 | #ifdef __cplusplus
|
|---|
| 60 | }
|
|---|
| 61 | #endif
|
|---|
| 62 |
|
|---|
| 63 | #endif // __DIRCACHE_H__
|
|---|