* fixed all headers to use extern "C" so C/C++ linking will work properly
[libundertow.git] / src / undertow-download.h
blob970583b1998010582f6ba34f3a4fc3e12caaeb14
1 /* libundertow - undertow-download.h
2 * Copyright (C) 2008 Michael Frank <msfrank@syntaxjockey.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 3 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 /**\file undertow-download.h */
22 #ifndef LIBUNDERTOW_DOWNLOAD_H
23 #define LIBUNDERTOW_DOWNLOAD_H
25 #include <sys/types.h>
27 #include "undertow-episode.h"
28 #include "undertow-main.h"
29 #include "undertow-error.h"
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
35 /** download status */
36 typedef enum {
37 LUT_DOWNLOAD_STATE_NOT_RUNNING, /**< Initial download state */
38 LUT_DOWNLOAD_STATE_RUNNING, /**< Download is running */
39 LUT_DOWNLOAD_STATE_FINISHED /**< Download is complete */
40 } lut_download_state;
42 /** download object */
43 typedef struct {
44 lut_download_state state; /**< The current download state */
45 char *channel; /**< The channel where the file comes from */
46 char *content_url; /**< Location of the file to download */
47 char *file_path; /**< Destination where the download is saved */
48 } lut_download;
50 lut_download *lut_download_copy (lut_download *download);
51 void lut_download_free (lut_download *download);
52 lut_errno lut_get_download (const char *file_path, lut_download **download);
53 lut_errno lut_start_download (lut_episode * episode,
54 lut_download ** download,
55 void (*on_progress)(size_t, size_t, float, float, void *),
56 void (*on_completion)(lut_errno, void *),
57 void * data);
58 lut_errno lut_resume_download (const char * file_path,
59 lut_download ** download,
60 void (*on_progress)(size_t, size_t, float, float, void *),
61 void (*on_completion)(lut_errno, void *),
62 void * data);
63 lut_errno lut_cancel_download (const char *file_path);
64 lut_errno lut_delete_download (const char *file_path);
66 #ifdef __cplusplus
68 #endif
70 #endif