2 * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef DOWNLOAD_PROVIDER2_SLOTS_H
18 #define DOWNLOAD_PROVIDER2_SLOTS_H
20 #include "download-provider.h"
21 #include "download-provider-pthread.h"
23 // Backgound Daemon should has the limitation of resource.
24 #define DP_MAX_GROUP 15
25 #define DP_MAX_REQUEST 64
34 // send command * get return value.
36 // send event to client
38 unsigned queued_count; // start ++, finish or failed -- ( queue & active )
39 // fill by app-manager
41 dp_credential credential;
45 int id; // ID created in create request in requests thread.
48 int start_time; // setted by START command
49 int pause_time; // setted by PAUSE command
50 int stop_time; // time setted by finished_cb
52 unsigned state_cb; // set : 1 unset : 0
53 unsigned progress_cb; // set : 1 unset : 0
55 unsigned auto_notification;
56 dp_state_type state; // downloading state
58 dp_network_type network_type;
59 size_t progress_lasttime;
60 unsigned long long received_size; // progress
61 unsigned long long file_size;
63 dp_credential credential;
64 dp_client_group *group; // indicate dp_client_group included this request
65 pthread_mutex_t mutex;
69 dp_client_group *group;
78 dp_group_slots *dp_client_group_slots_new(int size);
79 dp_request_slots *dp_request_slots_new(int size);
80 int dp_client_group_free(dp_client_group *group);
81 int dp_client_group_slots_free(dp_group_slots *slots, int size);
82 dp_request *dp_request_new();
83 void dp_request_init(dp_request *request);
84 int dp_request_free(dp_request *request);
85 int dp_request_slots_free(dp_request_slots *slots, int size);
86 int dp_get_request_count(dp_request_slots *slots);