|
Packit |
8ea169 |
/*
|
|
Packit |
8ea169 |
RPM.h - header file for rpm database
|
|
Packit |
8ea169 |
- it implements query for local rpm database
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
Copyright (C) 2009 Zdenek Prikryl (zprikryl@redhat.com)
|
|
Packit |
8ea169 |
Copyright (C) 2009 RedHat inc.
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
This program is free software; you can redistribute it and/or modify
|
|
Packit |
8ea169 |
it under the terms of the GNU General Public License as published by
|
|
Packit |
8ea169 |
the Free Software Foundation; either version 2 of the License, or
|
|
Packit |
8ea169 |
(at your option) any later version.
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
This program is distributed in the hope that it will be useful,
|
|
Packit |
8ea169 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
8ea169 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
8ea169 |
GNU General Public License for more details.
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
You should have received a copy of the GNU General Public License along
|
|
Packit |
8ea169 |
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
Packit |
8ea169 |
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
Packit |
8ea169 |
*/
|
|
Packit |
8ea169 |
#ifndef RPM_H_
|
|
Packit |
8ea169 |
#define RPM_H_
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
#ifdef __cplusplus
|
|
Packit |
8ea169 |
extern "C" {
|
|
Packit |
8ea169 |
#endif
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
struct pkg_envra {
|
|
Packit |
8ea169 |
char *p_nvr;
|
|
Packit |
8ea169 |
char *p_epoch;
|
|
Packit |
8ea169 |
char *p_name;
|
|
Packit |
8ea169 |
char *p_version;
|
|
Packit |
8ea169 |
char *p_release;
|
|
Packit |
8ea169 |
char *p_arch;
|
|
Packit |
8ea169 |
char *p_vendor;
|
|
Packit |
8ea169 |
};
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
void free_pkg_envra(struct pkg_envra *p);
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
/**
|
|
Packit |
8ea169 |
* Checks if an application is modified by third party.
|
|
Packit |
8ea169 |
* @param pPackage A package name. The package contains the application.
|
|
Packit |
8ea169 |
* @param pPath A path to the application.
|
|
Packit |
8ea169 |
*
|
|
Packit |
8ea169 |
* Not used. Delete?
|
|
Packit |
8ea169 |
*/
|
|
Packit |
8ea169 |
//bool CheckHash(const char* pPackage, const char* pPath);
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
void rpm_init();
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
void rpm_destroy();
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
/**
|
|
Packit |
8ea169 |
* A function, which loads one GPG public key.
|
|
Packit |
8ea169 |
* @param filename A path to the public key.
|
|
Packit |
8ea169 |
*/
|
|
Packit |
8ea169 |
void rpm_load_gpgkey(const char* filename);
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
/**
|
|
Packit |
8ea169 |
* A function, which checks if package's finger print is valid.
|
|
Packit |
8ea169 |
* @param pkg A package name.
|
|
Packit |
8ea169 |
* @return 1 if valid, otherwise (invalid, or error) 0
|
|
Packit |
8ea169 |
*/
|
|
Packit |
8ea169 |
int rpm_chk_fingerprint(const char* pkg);
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
/**
|
|
Packit |
8ea169 |
* A function, which checks if the given finger print is imported.
|
|
Packit |
8ea169 |
* @param pkg A package name.
|
|
Packit |
8ea169 |
* @return 1 if imported, otherwise (not-imported, or error) 0
|
|
Packit |
8ea169 |
*/
|
|
Packit |
8ea169 |
int rpm_fingerprint_is_imported(const char* fingerprint);
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
/**
|
|
Packit |
8ea169 |
* A function, which returns package's finger print
|
|
Packit |
8ea169 |
* @param pkg A package name.
|
|
Packit |
8ea169 |
* @return NULL if not-valid, otherwise malloced NULL-terminated string.
|
|
Packit |
8ea169 |
*/
|
|
Packit |
8ea169 |
char *rpm_get_fingerprint(const char* pkg);
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
/**
|
|
Packit |
8ea169 |
* Gets a package name. This package contains particular
|
|
Packit |
8ea169 |
* file. If the file doesn't belong to any package, empty string is
|
|
Packit |
8ea169 |
* returned.
|
|
Packit |
8ea169 |
* @param filename A file name.
|
|
Packit |
8ea169 |
* @return A package name (malloc'ed string)
|
|
Packit |
8ea169 |
*/
|
|
Packit |
8ea169 |
struct pkg_envra *rpm_get_package_nvr(const char *filename, const char *rootdir_or_NULL);
|
|
Packit |
8ea169 |
/**
|
|
Packit |
8ea169 |
* Finds a main package for given file. This package contains particular
|
|
Packit |
8ea169 |
* file. If the file doesn't belong to any package, empty string is
|
|
Packit |
8ea169 |
* returned.
|
|
Packit |
8ea169 |
* @param filename A file name.
|
|
Packit |
8ea169 |
* @return Component name (malloc'ed string)
|
|
Packit |
8ea169 |
*/
|
|
Packit |
8ea169 |
char* rpm_get_component(const char *filename, const char *rootdir_or_NULL);
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
char* get_package_name_from_NVR_or_NULL(const char* packageNVR);
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
#ifdef __cplusplus
|
|
Packit |
8ea169 |
}
|
|
Packit |
8ea169 |
#endif
|
|
Packit |
8ea169 |
|
|
Packit |
8ea169 |
#endif
|