Apply tizen coding rule
[platform/framework/web/download-provider.git] / agent / include / download-agent-defs.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_DEFS_H
18 #define _DOWNLOAD_AGENT_DEFS_H
19
20 #ifndef DEPRECATED
21 #define DEPRECATED __attribute__((deprecated))
22 #endif
23
24 /**
25  * Max count to download files simultaneously. \n
26  * Main reason for this restriction is because of Network bandwidth.
27  */
28 #define DA_MAX_DOWNLOAD_REQ_AT_ONCE     50
29 #define DA_MAX_TIME_OUT                                 65
30
31 #define DA_RESULT_OK    0
32
33 #define DA_TRUE         1
34 #define DA_FALSE        0
35 #define DA_NULL         (void *)0
36 #define DA_INVALID_ID   -1
37
38 #define DA_RESULT_USER_CANCELED -10
39
40 // InputError Input error (-100 ~ -199)
41 // Client passed wrong parameter
42 #define DA_ERR_INVALID_ARGUMENT         -100
43 #define DA_ERR_INVALID_DL_REQ_ID        -101
44 #define DA_ERR_INVALID_URL                      -103
45 #define DA_ERR_INVALID_INSTALL_PATH     -104
46 #define DA_ERR_INVALID_MIME_TYPE        -105
47
48 // Client passed correct parameter, but Download Agent rejects the request because of internal policy.
49 #define DA_ERR_ALREADY_CANCELED         -160
50 #define DA_ERR_ALREADY_SUSPENDED        -161
51 #define DA_ERR_ALREADY_RESUMED          -162
52 #define DA_ERR_CANNOT_SUSPEND           -170
53 #define DA_ERR_CANNOT_RESUME            -171
54 #define DA_ERR_INVALID_STATE            -190
55 #define DA_ERR_ALREADY_MAX_DOWNLOAD     -191
56 #define DA_ERR_UNSUPPORTED_PROTOCAL     -192
57
58 // System error (-200 ~ -299)
59 #define DA_ERR_FAIL_TO_MEMALLOC         -200
60 #define DA_ERR_FAIL_TO_CREATE_THREAD            -210
61 #define DA_ERR_FAIL_TO_ACCESS_FILE      -230
62 #define DA_ERR_DISK_FULL                        -240
63
64 // Network error (-400 ~ -499)
65 #define DA_ERR_NETWORK_FAIL                             -400
66 #define DA_ERR_UNREACHABLE_SERVER               -410
67 #define DA_ERR_CONNECTION_FAIL                  -420
68 #define DA_ERR_HTTP_TIMEOUT                             -430
69 #define DA_ERR_SSL_FAIL                                 -440
70 #define DA_ERR_TOO_MANY_REDIRECTS               -450
71 #define DA_ERR_NETWORK_UNAUTHORIZED     -460
72
73 // HTTP error - not conforming with HTTP spec (-500 ~ -599)
74 #define DA_ERR_MISMATCH_CONTENT_TYPE    -500
75 #define DA_ERR_SERVER_RESPOND_BUT_SEND_NO_CONTENT       -501
76 #define DA_ERR_MISMATCH_CONTENT_SIZE    -502
77
78 // DRM error - not conforming with DRM spec (-600 ~ -699)
79 #define DA_ERR_DRM_FAIL                 -600
80
81 // string to check invalid characters in path before using open() and fopen() API's
82 #define DA_INVALID_PATH_STRING "/\\?%*:|\"<>"
83
84 #endif
85