Code Sync with Private GIT
[profile/ivi/download-provider.git] / include / download-provider.h
1 #ifndef DOWNLOAD_PROVIDER_H
2 #define DOWNLOAD_PROVIDER_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 #define DOWNLOAD_PROVIDER_IPC "/tmp/download-provider"
9
10 #define DP_MAX_STR_LEN_64 64
11 #define DP_MAX_STR_LEN 256
12 #define DP_MAX_PATH_LEN DP_MAX_STR_LEN
13 #define DP_MAX_URL_LEN 2048
14
15         typedef enum {
16                 DOWNLOAD_CONTROL_START = 1,
17                 DOWNLOAD_CONTROL_STOP = 2,
18                 DOWNLOAD_CONTROL_PAUSE = 3,
19                 DOWNLOAD_CONTROL_RESUME = 4,
20                 DOWNLOAD_CONTROL_GET_DOWNLOADING_INFO = 11,
21                 DOWNLOAD_CONTROL_GET_STATE_INFO = 13,
22                 DOWNLOAD_CONTROL_GET_DOWNLOAD_INFO = 14,
23                 DOWNLOAD_CONTROL_GET_REQUEST_STATE_INFO = 15
24         } download_controls;
25
26         typedef enum {
27                 DOWNLOAD_STATE_NONE = 0,
28                 DOWNLOAD_STATE_READY = 1,
29                 DOWNLOAD_STATE_PENDED = 2,
30                 DOWNLOAD_STATE_PAUSE_REQUESTED = 3,
31                 DOWNLOAD_STATE_PAUSED = 4,
32                 DOWNLOAD_STATE_DOWNLOADING = 5,
33                 DOWNLOAD_STATE_INSTALLING = 6,
34                 DOWNLOAD_STATE_FINISHED = 7,
35                 DOWNLOAD_STATE_STOPPED = 10,
36                 DOWNLOAD_STATE_FAILED = 11
37         } download_states;
38
39         typedef enum {
40                 DOWNLOAD_ERROR_NONE = 0,
41                 DOWNLOAD_ERROR_INVALID_PARAMETER = 1,
42                 DOWNLOAD_ERROR_OUT_OF_MEMORY = 2,
43                 DOWNLOAD_ERROR_IO_ERROR = 3,
44                 DOWNLOAD_ERROR_NETWORK_UNREACHABLE = 4,
45                 DOWNLOAD_ERROR_CONNECTION_TIMED_OUT = 5,
46                 DOWNLOAD_ERROR_NO_SPACE = 6,
47                 DOWNLOAD_ERROR_FILED_NOT_FOUND = 7,
48                 DOWNLOAD_ERROR_INVALID_STATE = 8,
49                 DOWNLOAD_ERROR_CONNECTION_FAILED = 9,
50                 DOWNLOAD_ERROR_INVALID_URL = 10,
51                 DOWNLOAD_ERROR_INVALID_DESTINATION = 11,
52                 DOWNLOAD_ERROR_TOO_MANY_DOWNLOADS = 12,
53                 DOWNLOAD_ERROR_ALREADY_COMPLETED = 13,
54                 DOWNLOAD_ERROR_INSTALL_FAIL = 20,
55                 DOWNLOAD_ERROR_FAIL_INIT_AGENT = 100,
56                 DOWNLOAD_ERROR_UNKOWN = 900
57         } download_error;
58
59         typedef struct {
60                 unsigned int started;
61                 unsigned int paused;
62                 unsigned int completed;
63                 unsigned int stopped;
64                 unsigned int progress;
65         } callback_info;
66
67         typedef struct {
68                 unsigned int length;
69                 char *str;
70         } download_flexible_string;
71
72         typedef struct {
73                 unsigned int rows;
74                 download_flexible_string *str;
75         } download_flexible_double_string;
76
77         typedef struct {
78                 unsigned int received_size;
79                 char saved_path[DP_MAX_PATH_LEN];
80         } downloading_state_info;
81
82         typedef struct {
83                 download_states state;
84                 download_error err;
85         } download_state_info;
86
87         typedef struct {
88                 unsigned int file_size;
89                 char mime_type[DP_MAX_STR_LEN];
90                 char content_name[DP_MAX_STR_LEN];
91         } download_content_info;
92
93         typedef struct {
94                 callback_info callbackinfo;
95                 unsigned int notification;
96                 int requestid;
97                 download_flexible_string client_packagename;
98                 download_flexible_string url;
99                 download_flexible_string install_path;
100                 download_flexible_string filename;
101                 download_flexible_string service_data;
102                 download_flexible_double_string headers;
103         } download_request_info;
104
105         typedef struct {
106                 download_state_info stateinfo;
107                 int requestid;
108         } download_request_state_info;
109
110 #ifdef __cplusplus
111 }
112 #endif
113 #endif