libalpm
Arch Linux Package Manager Library
|
00001 /* 00002 * handle.h 00003 * 00004 * Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org> 00005 * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org> 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 #ifndef _ALPM_HANDLE_H 00021 #define _ALPM_HANDLE_H 00022 00023 #include <stdio.h> 00024 #include <sys/types.h> 00025 #include <regex.h> 00026 00027 #include "alpm_list.h" 00028 #include "alpm.h" 00029 00030 #ifdef HAVE_LIBCURL 00031 #include <curl/curl.h> 00032 #endif 00033 00034 #define EVENT(h, e, d1, d2) \ 00035 do { \ 00036 if((h)->eventcb) { \ 00037 (h)->eventcb(e, d1, d2); \ 00038 } \ 00039 } while(0) 00040 #define QUESTION(h, q, d1, d2, d3, r) \ 00041 do { \ 00042 if((h)->questioncb) { \ 00043 (h)->questioncb(q, d1, d2, d3, r); \ 00044 } \ 00045 } while(0) 00046 #define PROGRESS(h, e, p, per, n, r) \ 00047 do { \ 00048 if((h)->progresscb) { \ 00049 (h)->progresscb(e, p, per, n, r); \ 00050 } \ 00051 } while(0) 00052 00053 struct __alpm_handle_t { 00054 /* internal usage */ 00055 alpm_db_t *db_local; /* local db pointer */ 00056 alpm_list_t *dbs_sync; /* List of (alpm_db_t *) */ 00057 FILE *logstream; /* log file stream pointer */ 00058 FILE *lckstream; /* lock file stream pointer if one exists */ 00059 alpm_trans_t *trans; 00060 00061 #ifdef HAVE_LIBCURL 00062 /* libcurl handle */ 00063 CURL *curl; /* reusable curl_easy handle */ 00064 #endif 00065 00066 /* callback functions */ 00067 alpm_cb_log logcb; /* Log callback function */ 00068 alpm_cb_download dlcb; /* Download callback function */ 00069 alpm_cb_totaldl totaldlcb; /* Total download callback function */ 00070 alpm_cb_fetch fetchcb; /* Download file callback function */ 00071 alpm_cb_event eventcb; 00072 alpm_cb_question questioncb; 00073 alpm_cb_progress progresscb; 00074 00075 /* filesystem paths */ 00076 char *root; /* Root path, default '/' */ 00077 char *dbpath; /* Base path to pacman's DBs */ 00078 char *logfile; /* Name of the log file */ 00079 char *lockfile; /* Name of the lock file */ 00080 char *gpgdir; /* Directory where GnuPG files are stored */ 00081 alpm_list_t *cachedirs; /* Paths to pacman cache directories */ 00082 00083 /* package lists */ 00084 alpm_list_t *noupgrade; /* List of packages NOT to be upgraded */ 00085 alpm_list_t *noextract; /* List of files NOT to extract */ 00086 alpm_list_t *ignorepkg; /* List of packages to ignore */ 00087 alpm_list_t *ignoregroup; /* List of groups to ignore */ 00088 00089 /* options */ 00090 char *arch; /* Architecture of packages we should allow */ 00091 int usesyslog; /* Use syslog instead of logfile? */ /* TODO move to frontend */ 00092 int usedelta; /* Download deltas if possible */ 00093 int checkspace; /* Check disk space before installing */ 00094 alpm_siglevel_t siglevel; /* Default signature verification level */ 00095 00096 /* error code */ 00097 alpm_errno_t pm_errno; 00098 00099 /* for delta parsing efficiency */ 00100 int delta_regex_compiled; 00101 regex_t delta_regex; 00102 }; 00103 00104 alpm_handle_t *_alpm_handle_new(void); 00105 void _alpm_handle_free(alpm_handle_t *handle); 00106 00107 int _alpm_handle_lock(alpm_handle_t *handle); 00108 int _alpm_handle_unlock(alpm_handle_t *handle); 00109 00110 alpm_errno_t _alpm_set_directory_option(const char *value, 00111 char **storage, int must_exist); 00112 00113 #endif /* _ALPM_HANDLE_H */ 00114 00115 /* vim: set ts=2 sw=2 noet: */