Add cache support
[platform/framework/web/download-provider.git] / agent / include / download-agent-interface.h
1 /*
2  * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef _DOWNLOAD_AGENT_INTERFACE_H
18 #define _DOWNLOAD_AGENT_INTERFACE_H
19
20 #ifndef EXPORT_API
21 #define EXPORT_API __attribute__((visibility("default")))
22 #endif
23
24 #ifdef __cplusplus
25 extern "C"
26 {
27 #endif
28
29 #include "download-agent-defs.h"
30 #include <stdarg.h>
31
32 typedef struct {
33         int download_id;
34         char *file_type;
35         unsigned long long file_size;
36         char *tmp_saved_path;
37         char *content_name;
38         char *etag;
39 } download_info_t;
40
41 typedef struct {
42         int download_id;
43         char *saved_path;
44         char *ori_file;
45         char *etag;
46         char *cache_control;
47         char *last_modified;
48         int err;
49         int http_status;
50 } finished_info_t;
51
52 typedef struct {
53         const char **request_header;
54         int request_header_count;
55         const char *proxy;
56         const char *install_path;
57         const char *file_name;
58         const char *temp_file_path;
59         const char *etag;
60         const char *pkg_name;
61         int network_bonding;
62         int disable_verify_host;
63         int cache;
64         void *user_req_data;
65         void *user_client_data;
66 } req_data_t;
67
68 typedef void (*da_paused_cb) (int download_id,
69                 void *user_param1, void *user_param2);
70 typedef void (*da_progress_cb) (int download_id,
71                 unsigned long long received_size,
72                 void *user_param1, void *user_param2);
73 typedef void (*da_started_cb) (download_info_t *download_info,
74                 void *user_param1, void *user_param2);
75 typedef void (*da_finished_cb) (finished_info_t *finished_info,
76                 void *user_param1, void *user_param2);
77
78 typedef struct {
79         da_started_cb download_info_cb;
80         da_progress_cb progress_cb;
81         da_finished_cb finished_cb;
82         da_paused_cb paused_cb;
83 } da_cb_t;
84
85 EXPORT_API int da_init();
86 EXPORT_API int da_deinit();
87
88 EXPORT_API int da_start_download(const char *url, req_data_t *ext_data,
89                 da_cb_t *da_cb_data,    int *download_id);
90 EXPORT_API int da_cancel_download(int download_id);
91 EXPORT_API int da_cancel_download_without_update(int download_id);
92 EXPORT_API int da_suspend_download(int download_id);
93 EXPORT_API int da_suspend_download_without_update(int download_id);
94 EXPORT_API int da_resume_download(int download_id);
95 EXPORT_API int da_is_valid_download_id(int download_id);
96
97 #ifdef __cplusplus
98 }
99 #endif
100
101 #endif //_DOWNLOAD_AGENT_INTERFACE_H
102
103