4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
7 * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 #ifndef __RPM_INSTALLER_UTIL_H_
24 #define __RPM_INSTALLER_UTIL_H_
28 #endif /* __cplusplus */
33 #include <sys/types.h>
39 #define RPM_BACKEND_EXEC "rpm-backend"
43 #define RPM_INSTALLER_SUCCESS 0
44 #define RPM_INSTALLER_ERR_WRONG_PARAM 3
45 #define RPM_INSTALLER_ERR_DBUS_PROBLEM 4
46 #define RPM_INSTALLER_ERR_NOT_ENOUGH_MEMORY 5
47 #define RPM_INSTALLER_ERR_PACKAGE_EXIST 7
48 #define RPM_INSTALLER_ERR_PACKAGE_NOT_INSTALLED 8
49 #define RPM_INSTALLER_ERR_RESOURCE_BUSY 9
50 #define RPM_INSTALLER_ERR_UNKNOWN 10
51 #define RPM_INSTALLER_ERR_PKG_NOT_FOUND 11
52 #define RPM_INSTALLER_ERR_NOT_SUPPOTED_VERSION 12
53 #define RPM_INSTALLER_ERR_NO_RPM_FILE 13
54 #define RPM_INSTALLER_ERR_DB_ACCESS_FAILED 14
55 #define RPM_INSTALLER_ERR_RPM_OPERATION_FAILED 15
56 #define RPM_INSTALLER_ERR_PACKAGE_NOT_UPGRADED 16
57 #define RPM_INSTALLER_ERR_RPM_SCRIPT_WRONG_ARGS 17
58 #define RPM_INSTALLER_ERR_NEED_USER_CONFIRMATION 18
59 #define RPM_INSTALLER_ERR_PACKAGE_INSTALLATION_DISABLED 19
60 #define RPM_INSTALLER_ERR_PACKAGE_UNINSTALLATION_DISABLED 20
61 #define RPM_INSTALLER_ERR_CLEAR_DATA_FAILED 21
62 #define RPM_INSTALLER_ERR_INTERNAL 22
63 #define RPM_INSTALLER_ERR_NO_MANIFEST 23
64 #define RPM_INSTALLER_ERR_INVALID_MANIFEST 24
66 #define RPM_INSTALLER_SUCCESS_STR "Success"
67 #define RPM_INSTALLER_ERR_WRONG_PARAM_STR "Wrong Input Param"
68 #define RPM_INSTALLER_ERR_DBUS_PROBLEM_STR "DBUS Error"
69 #define RPM_INSTALLER_ERR_NOT_ENOUGH_MEMORY_STR "Not Enough Memory"
70 #define RPM_INSTALLER_ERR_PACKAGE_EXIST_STR "Package Already Installed"
71 #define RPM_INSTALLER_ERR_PACKAGE_NOT_INSTALLED_STR "Package Not Installed"
72 #define RPM_INSTALLER_ERR_RESOURCE_BUSY_STR "Resource Busy"
73 #define RPM_INSTALLER_ERR_UNKNOWN_STR "Unknown Error"
74 #define RPM_INSTALLER_ERR_PKG_NOT_FOUND_STR "Package file not found"
75 #define RPM_INSTALLER_ERR_NOT_SUPPOTED_VERSION_STR "Version Not supported"
76 #define RPM_INSTALLER_ERR_NO_RPM_FILE_STR "No RPM Package"
77 #define RPM_INSTALLER_ERR_DB_ACCESS_FAILED_STR "DB Access Failed"
78 #define RPM_INSTALLER_ERR_RPM_OPERATION_FAILED_STR "RPM operation failed"
79 #define RPM_INSTALLER_ERR_PACKAGE_NOT_UPGRADED_STR "Package Not Upgraded"
80 #define RPM_INSTALLER_ERR_RPM_SCRIPT_WRONG_ARGS_STR "Wrong Args to Script"
81 #define RPM_INSTALLER_ERR_PACKAGE_INSTALLATION_DISABLED_STR "Installation Disabled"
82 #define RPM_INSTALLER_ERR_PACKAGE_UNINSTALLATION_DISABLED_STR "Uninstallation Disabled"
83 #define RPM_INSTALLER_ERR_CLEAR_DATA_FAILED_STR "Clear Data Failed"
84 #define RPM_INSTALLER_ERR_INTERNAL_STR "Internal Error"
85 #define RPM_INSTALLER_ERR_NO_MANIFEST_STR "Manifest File Not Found"
86 #define RPM_INSTALLER_ERR_INVALID_MANIFEST_STR "Manifest Validation Failed"
88 #define DEBUG_ERR 0x0001
89 #define DEBUG_INFO 0x0002
90 #define DEBUG_RESULT 0x0004
94 void _print_msg(int type, int exetype, char *format, ...);
95 #define _d_msg(type, fmtstr, args...) { \
96 _print_msg(type, RPM_LOG, "%s:%d:%s(): " fmtstr, basename(__FILE__), \
97 __LINE__, __func__, ##args); \
100 void _d_msg_init(char *program);
101 void _d_msg_deinit();
102 int _ri_xsystem(const char *argv[]);
103 char *_ri_substring(const char *str, size_t begin, size_t len);
104 int _ri_tok_split_string(char tok, char *input, char **list,
105 unsigned long listmax);
106 void _ri_error_no_to_string(int errnumber, char **errstr);
107 int _ri_string_to_error_no(char *errstr);
111 #endif /* __cplusplus */
112 #endif /* __RPM_INSTALLER_UTIL_H_ */