[cosmetics] update date in GPL header
[vuplus_xbmc] / addons / library.xbmc.addon / libXBMC_addon.h
1 #pragma once
2 /*
3  *      Copyright (C) 2005-2013 Team XBMC
4  *      http://www.xbmc.org
5  *
6  *  This Program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2, or (at your option)
9  *  any later version.
10  *
11  *  This Program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with XBMC; see the file COPYING.  If not, see
18  *  <http://www.gnu.org/licenses/>.
19  *
20  */
21
22 #include <string>
23 #include <vector>
24 #include <string.h>
25 #include <stdlib.h>
26 #include <stdio.h>
27 #include <stdint.h>
28 #include <stdarg.h>
29
30 #ifdef _WIN32                   // windows
31 #include "dlfcn-win32.h"
32 #define ADDON_DLL               "\\library.xbmc.addon\\libXBMC_addon" ADDON_HELPER_EXT
33 #define ADDON_HELPER_EXT        ".dll"
34 #else
35 #if defined(__APPLE__)          // osx
36 #if defined(__POWERPC__)
37 #define ADDON_HELPER_ARCH       "powerpc-osx"
38 #elif defined(__arm__)
39 #define ADDON_HELPER_ARCH       "arm-osx"
40 #elif defined(__x86_64__)
41 #define ADDON_HELPER_ARCH       "x86-osx"
42 #else
43 #define ADDON_HELPER_ARCH       "x86-osx"
44 #endif
45 #else                           // linux
46 #if defined(__x86_64__)
47 #define ADDON_HELPER_ARCH       "x86_64-linux"
48 #elif defined(_POWERPC)
49 #define ADDON_HELPER_ARCH       "powerpc-linux"
50 #elif defined(_POWERPC64)
51 #define ADDON_HELPER_ARCH       "powerpc64-linux"
52 #elif defined(__ARMEL__)
53 #define ADDON_HELPER_ARCH       "arm"
54 #elif defined(_MIPSEL)
55 #define ADDON_HELPER_ARCH       "mipsel-linux"
56 #else
57 #define ADDON_HELPER_ARCH       "i486-linux"
58 #endif
59 #endif
60 #include <dlfcn.h>              // linux+osx
61 #define ADDON_HELPER_EXT        ".so"
62 #define ADDON_DLL_NAME "libXBMC_addon-" ADDON_HELPER_ARCH ADDON_HELPER_EXT
63 #define ADDON_DLL "/library.xbmc.addon/" ADDON_DLL_NAME
64 #endif
65 #if defined(ANDROID)
66 #include <sys/stat.h>
67 #endif
68
69 #ifdef LOG_DEBUG
70 #undef LOG_DEBUG
71 #endif
72 #ifdef LOG_INFO
73 #undef LOG_INFO
74 #endif
75 #ifdef LOG_NOTICE
76 #undef LOG_NOTICE
77 #endif
78 #ifdef LOG_ERROR
79 #undef LOG_ERROR
80 #endif
81
82 namespace ADDON
83 {
84   typedef enum addon_log
85   {
86     LOG_DEBUG,
87     LOG_INFO,
88     LOG_NOTICE,
89     LOG_ERROR
90   } addon_log_t;
91
92   typedef enum queue_msg
93   {
94     QUEUE_INFO,
95     QUEUE_WARNING,
96     QUEUE_ERROR
97   } queue_msg_t;
98
99   class CHelper_libXBMC_addon
100   {
101   public:
102     CHelper_libXBMC_addon()
103     {
104       m_libXBMC_addon = NULL;
105       m_Handle        = NULL;
106     }
107
108     ~CHelper_libXBMC_addon()
109     {
110       if (m_libXBMC_addon)
111       {
112         XBMC_unregister_me(m_Handle, m_Callbacks);
113         dlclose(m_libXBMC_addon);
114       }
115     }
116
117     bool RegisterMe(void *Handle)
118     {
119       m_Handle = Handle;
120
121       std::string libBasePath;
122       libBasePath  = ((cb_array*)m_Handle)->libPath;
123       libBasePath += ADDON_DLL;
124
125 #if defined(ANDROID)
126       struct stat st;
127       if(stat(libBasePath.c_str(),&st) != 0)
128       {
129         std::string tempbin = getenv("XBMC_ANDROID_LIBS");
130         libBasePath = tempbin + "/" + ADDON_DLL_NAME;
131       }
132 #endif
133
134       m_libXBMC_addon = dlopen(libBasePath.c_str(), RTLD_LAZY);
135       if (m_libXBMC_addon == NULL)
136       {
137         fprintf(stderr, "Unable to load %s\n", dlerror());
138         return false;
139       }
140
141       XBMC_register_me = (void* (*)(void *HANDLE))
142         dlsym(m_libXBMC_addon, "XBMC_register_me");
143       if (XBMC_register_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
144
145       XBMC_unregister_me = (void (*)(void* HANDLE, void* CB))
146         dlsym(m_libXBMC_addon, "XBMC_unregister_me");
147       if (XBMC_unregister_me == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
148
149       XBMC_log = (void (*)(void* HANDLE, void* CB, const addon_log_t loglevel, const char *msg))
150         dlsym(m_libXBMC_addon, "XBMC_log");
151       if (XBMC_log == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
152
153       XBMC_get_setting = (bool (*)(void* HANDLE, void* CB, const char* settingName, void *settingValue))
154         dlsym(m_libXBMC_addon, "XBMC_get_setting");
155       if (XBMC_get_setting == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
156
157       XBMC_queue_notification = (void (*)(void* HANDLE, void* CB, const queue_msg_t loglevel, const char *msg))
158         dlsym(m_libXBMC_addon, "XBMC_queue_notification");
159       if (XBMC_queue_notification == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
160
161       XBMC_unknown_to_utf8 = (char* (*)(void* HANDLE, void* CB, const char* str))
162         dlsym(m_libXBMC_addon, "XBMC_unknown_to_utf8");
163       if (XBMC_unknown_to_utf8 == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
164
165       XBMC_get_localized_string = (char* (*)(void* HANDLE, void* CB, int dwCode))
166         dlsym(m_libXBMC_addon, "XBMC_get_localized_string");
167       if (XBMC_get_localized_string == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
168
169       XBMC_free_string = (void (*)(void* HANDLE, void* CB, char* str))
170         dlsym(m_libXBMC_addon, "XBMC_free_string");
171       if (XBMC_free_string == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
172
173       XBMC_get_dvd_menu_language = (char* (*)(void* HANDLE, void* CB))
174         dlsym(m_libXBMC_addon, "XBMC_get_dvd_menu_language");
175       if (XBMC_get_dvd_menu_language == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
176
177       XBMC_open_file = (void* (*)(void* HANDLE, void* CB, const char* strFileName, unsigned int flags))
178         dlsym(m_libXBMC_addon, "XBMC_open_file");
179       if (XBMC_open_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
180
181       XBMC_open_file_for_write = (void* (*)(void* HANDLE, void* CB, const char* strFileName, bool bOverWrite))
182         dlsym(m_libXBMC_addon, "XBMC_open_file_for_write");
183       if (XBMC_open_file_for_write == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
184
185       XBMC_read_file = (unsigned int (*)(void* HANDLE, void* CB, void* file, void* lpBuf, int64_t uiBufSize))
186         dlsym(m_libXBMC_addon, "XBMC_read_file");
187       if (XBMC_read_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
188
189       XBMC_read_file_string = (bool (*)(void* HANDLE, void* CB, void* file, char *szLine, int iLineLength))
190         dlsym(m_libXBMC_addon, "XBMC_read_file_string");
191       if (XBMC_read_file_string == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
192
193       XBMC_write_file = (int (*)(void* HANDLE, void* CB, void* file, const void* lpBuf, int64_t uiBufSize))
194         dlsym(m_libXBMC_addon, "XBMC_write_file");
195       if (XBMC_write_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
196
197       XBMC_flush_file = (void (*)(void* HANDLE, void* CB, void* file))
198         dlsym(m_libXBMC_addon, "XBMC_flush_file");
199       if (XBMC_flush_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
200
201       XBMC_seek_file = (int64_t (*)(void* HANDLE, void* CB, void* file, int64_t iFilePosition, int iWhence))
202         dlsym(m_libXBMC_addon, "XBMC_seek_file");
203       if (XBMC_seek_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
204
205       XBMC_truncate_file = (int (*)(void* HANDLE, void* CB, void* file, int64_t iSize))
206         dlsym(m_libXBMC_addon, "XBMC_truncate_file");
207       if (XBMC_truncate_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
208
209       XBMC_get_file_position = (int64_t (*)(void* HANDLE, void* CB, void* file))
210         dlsym(m_libXBMC_addon, "XBMC_get_file_position");
211       if (XBMC_get_file_position == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
212
213       XBMC_get_file_length = (int64_t (*)(void* HANDLE, void* CB, void* file))
214         dlsym(m_libXBMC_addon, "XBMC_get_file_length");
215       if (XBMC_get_file_length == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
216
217       XBMC_close_file = (void (*)(void* HANDLE, void* CB, void* file))
218         dlsym(m_libXBMC_addon, "XBMC_close_file");
219       if (XBMC_close_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
220
221       XBMC_get_file_chunk_size = (int (*)(void* HANDLE, void* CB, void* file))
222         dlsym(m_libXBMC_addon, "XBMC_get_file_chunk_size");
223       if (XBMC_get_file_chunk_size == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
224
225       XBMC_file_exists = (bool (*)(void* HANDLE, void* CB, const char *strFileName, bool bUseCache))
226         dlsym(m_libXBMC_addon, "XBMC_file_exists");
227       if (XBMC_file_exists == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
228
229       XBMC_stat_file = (int (*)(void* HANDLE, void* CB, const char *strFileName, struct __stat64* buffer))
230         dlsym(m_libXBMC_addon, "XBMC_stat_file");
231       if (XBMC_stat_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
232
233       XBMC_delete_file = (bool (*)(void* HANDLE, void* CB, const char *strFileName))
234         dlsym(m_libXBMC_addon, "XBMC_delete_file");
235       if (XBMC_delete_file == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
236
237       XBMC_can_open_directory = (bool (*)(void* HANDLE, void* CB, const char* strURL))
238         dlsym(m_libXBMC_addon, "XBMC_can_open_directory");
239       if (XBMC_can_open_directory == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
240
241       XBMC_create_directory = (bool (*)(void* HANDLE, void* CB, const char* strPath))
242         dlsym(m_libXBMC_addon, "XBMC_create_directory");
243       if (XBMC_create_directory == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
244
245       XBMC_directory_exists = (bool (*)(void* HANDLE, void* CB, const char* strPath))
246         dlsym(m_libXBMC_addon, "XBMC_directory_exists");
247       if (XBMC_directory_exists == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
248
249       XBMC_remove_directory = (bool (*)(void* HANDLE, void* CB, const char* strPath))
250         dlsym(m_libXBMC_addon, "XBMC_remove_directory");
251       if (XBMC_remove_directory == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
252
253       m_Callbacks = XBMC_register_me(m_Handle);
254       return m_Callbacks != NULL;
255     }
256
257     /*!
258      * @brief Add a message to XBMC's log.
259      * @param loglevel The log level of the message.
260      * @param format The format of the message to pass to XBMC.
261      */
262     void Log(const addon_log_t loglevel, const char *format, ... )
263     {
264       char buffer[16384];
265       va_list args;
266       va_start (args, format);
267       vsprintf (buffer, format, args);
268       va_end (args);
269       return XBMC_log(m_Handle, m_Callbacks, loglevel, buffer);
270     }
271
272     /*!
273      * @brief Get a settings value for this add-on.
274      * @param settingName The name of the setting to get.
275      * @param settingValue The value.
276      * @return True if the settings was fetched successfully, false otherwise.
277      */
278     bool GetSetting(const char* settingName, void *settingValue)
279     {
280       return XBMC_get_setting(m_Handle, m_Callbacks, settingName, settingValue);
281     }
282
283     /*!
284      * @brief Queue a notification in the GUI.
285      * @param type The message type.
286      * @param format The format of the message to pass to display in XBMC.
287      */
288     void QueueNotification(const queue_msg_t type, const char *format, ... )
289     {
290       char buffer[16384];
291       va_list args;
292       va_start (args, format);
293       vsprintf (buffer, format, args);
294       va_end (args);
295       return XBMC_queue_notification(m_Handle, m_Callbacks, type, buffer);
296     }
297
298     /*!
299      * @brief Translate a string with an unknown encoding to UTF8.
300      * @param str The string to translate.
301      * @return The string translated to UTF8. Must be freed by calling FreeString() when done.
302      */
303     char* UnknownToUTF8(const char* str)
304     {
305       return XBMC_unknown_to_utf8(m_Handle, m_Callbacks, str);
306     }
307
308     /*!
309      * @brief Get a localised message.
310      * @param dwCode The code of the message to get.
311      * @return The message. Must be freed by calling FreeString() when done.
312      */
313     char* GetLocalizedString(int dwCode)
314     {
315       return XBMC_get_localized_string(m_Handle, m_Callbacks, dwCode);
316     }
317
318
319     /*!
320      * @brief Get the DVD menu language.
321      * @return The language. Must be freed by calling FreeString() when done.
322      */
323     char* GetDVDMenuLanguage()
324     {
325       return XBMC_get_dvd_menu_language(m_Handle, m_Callbacks);
326     }
327
328     /*!
329      * @brief Free the memory used by str
330      * @param str The string to free
331      */
332     void FreeString(char* str)
333     {
334       return XBMC_free_string(m_Handle, m_Callbacks, str);
335     }
336
337     /*!
338      * @brief Open the file with filename via XBMC's CFile. Needs to be closed by calling CloseFile() when done.
339      * @param strFileName The filename to open.
340      * @param flags The flags to pass. Documented in XBMC's File.h
341      * @return A handle for the file, or NULL if it couldn't be opened.
342      */
343     void* OpenFile(const char* strFileName, unsigned int flags)
344     {
345       return XBMC_open_file(m_Handle, m_Callbacks, strFileName, flags);
346     }
347
348     /*!
349      * @brief Open the file with filename via XBMC's CFile in write mode. Needs to be closed by calling CloseFile() when done.
350      * @param strFileName The filename to open.
351      * @param bOverWrite True to overwrite, false otherwise.
352      * @return A handle for the file, or NULL if it couldn't be opened.
353      */
354     void* OpenFileForWrite(const char* strFileName, bool bOverWrite)
355     {
356       return XBMC_open_file_for_write(m_Handle, m_Callbacks, strFileName, bOverWrite);
357     }
358
359     /*!
360      * @brief Read from an open file.
361      * @param file The file handle to read from.
362      * @param lpBuf The buffer to store the data in.
363      * @param uiBufSize The size of the buffer.
364      * @return Number of bytes read.
365      */
366     unsigned int ReadFile(void* file, void* lpBuf, int64_t uiBufSize)
367     {
368       return XBMC_read_file(m_Handle, m_Callbacks, file, lpBuf, uiBufSize);
369     }
370
371     /*!
372      * @brief Read a string from an open file.
373      * @param file The file handle to read from.
374      * @param szLine The buffer to store the data in.
375      * @param iLineLength The size of the buffer.
376      * @return True when a line was read, false otherwise.
377      */
378     bool ReadFileString(void* file, char *szLine, int iLineLength)
379     {
380       return XBMC_read_file_string(m_Handle, m_Callbacks, file, szLine, iLineLength);
381     }
382
383     /*!
384      * @brief Write to a file opened in write mode.
385      * @param file The file handle to write to.
386      * @param lpBuf The data to write.
387      * @param uiBufSize Size of the data to write.
388      * @return The number of bytes read.
389      */
390     int WriteFile(void* file, const void* lpBuf, int64_t uiBufSize)
391     {
392       return XBMC_write_file(m_Handle, m_Callbacks, file, lpBuf, uiBufSize);
393     }
394
395     /*!
396      * @brief Flush buffered data.
397      * @param file The file handle to flush the data for.
398      */
399     void FlushFile(void* file)
400     {
401        return XBMC_flush_file(m_Handle, m_Callbacks, file);
402     }
403
404     /*!
405      * @brief Seek in an open file.
406      * @param file The file handle to see in.
407      * @param iFilePosition The new position.
408      * @param iWhence Seek argument. See stdio.h for possible values.
409      * @return The new position.
410      */
411     int64_t SeekFile(void* file, int64_t iFilePosition, int iWhence)
412     {
413       return XBMC_seek_file(m_Handle, m_Callbacks, file, iFilePosition, iWhence);
414     }
415
416     /*!
417      * @brief Truncate a file to the requested size.
418      * @param file The file handle to truncate.
419      * @param iSize The new max size.
420      * @return New size?
421      */
422     int TruncateFile(void* file, int64_t iSize)
423     {
424       return XBMC_truncate_file(m_Handle, m_Callbacks, file, iSize);
425     }
426
427     /*!
428      * @brief The current position in an open file.
429      * @param file The file handle to get the position for.
430      * @return The requested position.
431      */
432     int64_t GetFilePosition(void* file)
433     {
434       return XBMC_get_file_position(m_Handle, m_Callbacks, file);
435     }
436
437     /*!
438      * @brief Get the file size of an open file.
439      * @param file The file to get the size for.
440      * @return The requested size.
441      */
442     int64_t GetFileLength(void* file)
443     {
444       return XBMC_get_file_length(m_Handle, m_Callbacks, file);
445     }
446
447     /*!
448      * @brief Close an open file.
449      * @param file The file handle to close.
450      */
451     void CloseFile(void* file)
452     {
453       return XBMC_close_file(m_Handle, m_Callbacks, file);
454     }
455
456     /*!
457      * @brief Get the chunk size for an open file.
458      * @param file the file handle to get the size for.
459      * @return The requested size.
460      */
461     int GetFileChunkSize(void* file)
462     {
463       return XBMC_get_file_chunk_size(m_Handle, m_Callbacks, file);
464     }
465
466     /*!
467      * @brief Check if a file exists.
468      * @param strFileName The filename to check.
469      * @param bUseCache Check in file cache.
470      * @return true if the file exists false otherwise.
471      */
472     bool FileExists(const char *strFileName, bool bUseCache)
473     {
474       return XBMC_file_exists(m_Handle, m_Callbacks, strFileName, bUseCache);
475     }
476
477     /*!
478      * @brief Reads file status.
479      * @param strFileName The filename to read the status from.
480      * @param buffer The file status is written into this buffer.
481      * @return The file status was successfully read.
482      */
483     int StatFile(const char *strFileName, struct __stat64* buffer)
484     {
485       return XBMC_stat_file(m_Handle, m_Callbacks, strFileName, buffer);
486     }
487
488     /*!
489      * @brief Deletes a file.
490      * @param strFileName The filename to delete.
491      * @return The file was successfully deleted.
492      */
493     bool DeleteFile(const char *strFileName)
494     {
495       return XBMC_delete_file(m_Handle, m_Callbacks, strFileName);
496     }
497
498     /*!
499      * @brief Checks whether a directory can be opened.
500      * @param strUrl The URL of the directory to check.
501      * @return True when it can be opened, false otherwise.
502      */
503     bool CanOpenDirectory(const char* strUrl)
504     {
505       return XBMC_can_open_directory(m_Handle, m_Callbacks, strUrl);
506     }
507
508     /*!
509      * @brief Creates a directory.
510      * @param strPath Path to the directory.
511      * @return True when it was created, false otherwise.
512      */
513     bool CreateDirectory(const char *strPath)
514     {
515       return XBMC_create_directory(m_Handle, m_Callbacks, strPath);
516     }
517
518     /*!
519      * @brief Checks if a directory exists.
520      * @param strPath Path to the directory.
521      * @return True when it exists, false otherwise.
522      */
523     bool DirectoryExists(const char *strPath)
524     {
525       return XBMC_directory_exists(m_Handle, m_Callbacks, strPath);
526     }
527
528     /*!
529      * @brief Removes a directory.
530      * @param strPath Path to the directory.
531      * @return True when it was removed, false otherwise.
532      */
533     bool RemoveDirectory(const char *strPath)
534     {
535       return XBMC_remove_directory(m_Handle, m_Callbacks, strPath);
536     }
537
538   protected:
539     void* (*XBMC_register_me)(void *HANDLE);
540     void (*XBMC_unregister_me)(void *HANDLE, void* CB);
541     void (*XBMC_log)(void *HANDLE, void* CB, const addon_log_t loglevel, const char *msg);
542     bool (*XBMC_get_setting)(void *HANDLE, void* CB, const char* settingName, void *settingValue);
543     void (*XBMC_queue_notification)(void *HANDLE, void* CB, const queue_msg_t type, const char *msg);
544     char* (*XBMC_unknown_to_utf8)(void *HANDLE, void* CB, const char* str);
545     char* (*XBMC_get_localized_string)(void *HANDLE, void* CB, int dwCode);
546     char* (*XBMC_get_dvd_menu_language)(void *HANDLE, void* CB);
547     void (*XBMC_free_string)(void *HANDLE, void* CB, char* str);
548     void* (*XBMC_open_file)(void *HANDLE, void* CB, const char* strFileName, unsigned int flags);
549     void* (*XBMC_open_file_for_write)(void *HANDLE, void* CB, const char* strFileName, bool bOverWrite);
550     unsigned int (*XBMC_read_file)(void *HANDLE, void* CB, void* file, void* lpBuf, int64_t uiBufSize);
551     bool (*XBMC_read_file_string)(void *HANDLE, void* CB, void* file, char *szLine, int iLineLength);
552     int (*XBMC_write_file)(void *HANDLE, void* CB, void* file, const void* lpBuf, int64_t uiBufSize);
553     void (*XBMC_flush_file)(void *HANDLE, void* CB, void* file);
554     int64_t (*XBMC_seek_file)(void *HANDLE, void* CB, void* file, int64_t iFilePosition, int iWhence);
555     int (*XBMC_truncate_file)(void *HANDLE, void* CB, void* file, int64_t iSize);
556     int64_t (*XBMC_get_file_position)(void *HANDLE, void* CB, void* file);
557     int64_t (*XBMC_get_file_length)(void *HANDLE, void* CB, void* file);
558     void (*XBMC_close_file)(void *HANDLE, void* CB, void* file);
559     int (*XBMC_get_file_chunk_size)(void *HANDLE, void* CB, void* file);
560     bool (*XBMC_file_exists)(void *HANDLE, void* CB, const char *strFileName, bool bUseCache);
561     int (*XBMC_stat_file)(void *HANDLE, void* CB, const char *strFileName, struct __stat64* buffer);
562     bool (*XBMC_delete_file)(void *HANDLE, void* CB, const char *strFileName);
563     bool (*XBMC_can_open_directory)(void *HANDLE, void* CB, const char* strURL);
564     bool (*XBMC_create_directory)(void *HANDLE, void* CB, const char* strPath);
565     bool (*XBMC_directory_exists)(void *HANDLE, void* CB, const char* strPath);
566     bool (*XBMC_remove_directory)(void *HANDLE, void* CB, const char* strPath);
567
568   private:
569     void *m_libXBMC_addon;
570     void *m_Handle;
571     void *m_Callbacks;
572     struct cb_array
573     {
574       const char* libPath;
575     };
576   };
577 };