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_AGENT_TYPE_H
18 #define _DOWNLOAD_AGENT_TYPE_H
20 #include "linux/limits.h"
21 #include "download-agent-defs.h"
22 #include <tzplatform_config.h>
25 typedef int da_bool_t;
26 typedef unsigned long long da_size_t;
28 #define IS_NOT_VALID_ID(x) (x <= DA_INVALID_ID)
30 #define DA_MAX_URI_LEN 1024
31 #define DA_MAX_FULL_PATH_LEN PATH_MAX - 1 /* 4096 -1 chars in a path name excluding NULL */
32 #define DA_MAX_FILE_NAME_LEN NAME_MAX /* 255 chars in a file name excluding NULL */
33 #define DA_MAX_STR_LEN 256
34 #define DA_MAX_MIME_STR_LEN 256
35 #define DA_MAX_PROXY_ADDR_LEN 64 // e.g. 100.200.300.400:10000
37 #define SCHEME_HTTP "http://"
39 #define DA_DEFAULT_INSTALL_PATH_FOR_PHONE tzplatform_getenv(TZ_USER_DOWNLOADS)
40 // #define DA_DEFAULT_INSTALL_PATH_FOR_PHONE "/home/owner/content/Downloads"
42 #define DA_MAX_ID DA_MAX_DOWNLOAD_REQ_AT_ONCE
44 #define SAVE_FILE_BUFFERING_SIZE_50KB (50*1024)
46 #define NULL_CHECK(DATA) {\
48 DA_LOGE("NULL CHECK!:%s",(#DATA));\
53 #define NULL_CHECK_RET(DATA) {\
55 DA_LOGE("NULL CHECK!:%s",(#DATA));\
56 return DA_ERR_INVALID_ARGUMENT;\
60 #define NULL_CHECK_GOTO(DATA) {\
62 DA_LOGE("NULL CHECK!:%s",(#DATA));\
63 ret = DA_ERR_INVALID_ARGUMENT;\
68 #define NULL_CHECK_RET_OPT(DATA, RET_DATA) {\
70 DA_LOGE("NULL CHECK!:%s",(#DATA));\
75 #define NULL_CHECK_AND_FREE(DATA) {\