Kodi Development  20.0
for Binary and Script based Add-Ons
vfs.h
1 /*
2  * Copyright (C) 2005-2020 Team Kodi
3  *
4  * SPDX-License-Identifier: GPL-2.0-or-later
5  * See LICENSES/README.md for more information.
6  */
7 
8 #ifndef C_API_ADDONINSTANCE_VFS_H
9 #define C_API_ADDONINSTANCE_VFS_H
10 
11 #include "../addon_base.h"
12 #include "../filesystem.h"
13 
14 #define VFS_FILE_HANDLE void*
15 
16 #ifdef __cplusplus
17 extern "C"
18 {
19 #endif /* __cplusplus */
20 
21  struct VFSURL
22  {
23  const char* url;
24  const char* domain;
25  const char* hostname;
26  const char* filename;
27  unsigned int port;
28  const char* options;
29  const char* username;
30  const char* password;
31  const char* redacted;
32  const char* sharename;
33  const char* protocol;
34  };
35 
36  typedef struct VFSGetDirectoryCallbacks /* internal */
37  {
38  bool(__cdecl* get_keyboard_input)(KODI_HANDLE ctx,
39  const char* heading,
40  char** input,
41  bool hidden_input);
42  void(__cdecl* set_error_dialog)(KODI_HANDLE ctx,
43  const char* heading,
44  const char* line1,
45  const char* line2,
46  const char* line3);
47  void(__cdecl* require_authentication)(KODI_HANDLE ctx, const char* url);
48  KODI_HANDLE ctx;
50 
51  typedef struct AddonProps_VFSEntry /* internal */
52  {
53  int dummy;
55 
56  typedef struct AddonToKodiFuncTable_VFSEntry /* internal */
57  {
58  KODI_HANDLE kodiInstance;
60 
62  typedef struct KodiToAddonFuncTable_VFSEntry /* internal */
63  {
64  KODI_HANDLE addonInstance;
65 
66  VFS_FILE_HANDLE(__cdecl* open)
67  (const struct AddonInstance_VFSEntry* instance, const struct VFSURL* url);
68  VFS_FILE_HANDLE(__cdecl* open_for_write)
69  (const struct AddonInstance_VFSEntry* instance, const struct VFSURL* url, bool overwrite);
70  ssize_t(__cdecl* read)(const struct AddonInstance_VFSEntry* instance,
71  VFS_FILE_HANDLE context,
72  uint8_t* buffer,
73  size_t buf_size);
74  ssize_t(__cdecl* write)(const struct AddonInstance_VFSEntry* instance,
75  VFS_FILE_HANDLE context,
76  const uint8_t* buffer,
77  size_t buf_size);
78  int64_t(__cdecl* seek)(const struct AddonInstance_VFSEntry* instance,
79  VFS_FILE_HANDLE context,
80  int64_t position,
81  int whence);
82  int(__cdecl* truncate)(const struct AddonInstance_VFSEntry* instance,
83  VFS_FILE_HANDLE context,
84  int64_t size);
85  int64_t(__cdecl* get_length)(const struct AddonInstance_VFSEntry* instance,
86  VFS_FILE_HANDLE context);
87  int64_t(__cdecl* get_position)(const struct AddonInstance_VFSEntry* instance,
88  VFS_FILE_HANDLE context);
89  int(__cdecl* get_chunk_size)(const struct AddonInstance_VFSEntry* instance,
90  VFS_FILE_HANDLE context);
91  bool(__cdecl* io_control_get_seek_possible)(const struct AddonInstance_VFSEntry* instance,
92  VFS_FILE_HANDLE context);
93  bool(__cdecl* io_control_get_cache_status)(const struct AddonInstance_VFSEntry* instance,
94  VFS_FILE_HANDLE context,
95  struct VFS_CACHE_STATUS_DATA* status);
96  bool(__cdecl* io_control_set_cache_rate)(const struct AddonInstance_VFSEntry* instance,
97  VFS_FILE_HANDLE context,
98  unsigned int rate);
99  bool(__cdecl* io_control_set_retry)(const struct AddonInstance_VFSEntry* instance,
100  VFS_FILE_HANDLE context,
101  bool retry);
102  int(__cdecl* stat)(const struct AddonInstance_VFSEntry* instance,
103  const struct VFSURL* url,
104  struct STAT_STRUCTURE* buffer);
105  bool(__cdecl* close)(const struct AddonInstance_VFSEntry* instance, VFS_FILE_HANDLE context);
106 
107  bool(__cdecl* exists)(const struct AddonInstance_VFSEntry* instance, const struct VFSURL* url);
108  void(__cdecl* clear_out_idle)(const struct AddonInstance_VFSEntry* instance);
109  void(__cdecl* disconnect_all)(const struct AddonInstance_VFSEntry* instance);
110  bool(__cdecl* delete_it)(const struct AddonInstance_VFSEntry* instance,
111  const struct VFSURL* url);
112  bool(__cdecl* rename)(const struct AddonInstance_VFSEntry* instance,
113  const struct VFSURL* url,
114  const struct VFSURL* url2);
115  bool(__cdecl* directory_exists)(const struct AddonInstance_VFSEntry* instance,
116  const struct VFSURL* url);
117  bool(__cdecl* remove_directory)(const struct AddonInstance_VFSEntry* instance,
118  const struct VFSURL* url);
119  bool(__cdecl* create_directory)(const struct AddonInstance_VFSEntry* instance,
120  const struct VFSURL* url);
121  bool(__cdecl* get_directory)(const struct AddonInstance_VFSEntry* instance,
122  const struct VFSURL* url,
123  struct VFSDirEntry** entries,
124  int* num_entries,
125  struct VFSGetDirectoryCallbacks* callbacks);
126  bool(__cdecl* contains_files)(const struct AddonInstance_VFSEntry* instance,
127  const struct VFSURL* url,
128  struct VFSDirEntry** entries,
129  int* num_entries,
130  char* rootpath);
131  void(__cdecl* free_directory)(const struct AddonInstance_VFSEntry* instance,
132  struct VFSDirEntry* entries,
133  int num_entries);
135 
136  typedef struct AddonInstance_VFSEntry /* internal */
137  {
138  struct AddonProps_VFSEntry* props;
139  struct AddonToKodiFuncTable_VFSEntry* toKodi;
140  struct KodiToAddonFuncTable_VFSEntry* toAddon;
142 
143 #ifdef __cplusplus
144 } /* extern "C" */
145 #endif /* __cplusplus */
146 
147 #endif /* !C_API_ADDONINSTANCE_VFS_H */
exists(...)
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
rename(...)
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
Definition: vfs.h:137
Definition: vfs.h:52
Definition: vfs.h:57
Definition: vfs.h:63
Definition: filesystem.h:189
Definition: filesystem.h:220
Definition: filesystem.h:234
Definition: vfs.h:37
Definition: vfs.h:22