diff options
author | Dan McGee <dan@archlinux.org> | 2011-08-24 13:24:42 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-08-28 19:51:54 -0500 |
commit | de43d00db071a04653cff592607647bb9c01d025 (patch) | |
tree | 9ad6cc271d87124a6d8004a76e53f16f052d222c /lib/libalpm/alpm.h | |
parent | 12387ca4e5c16994bacad52c142ef94868ba545a (diff) | |
download | pacman-de43d00db071a04653cff592607647bb9c01d025.tar.xz |
Refactor signature result return format
I was trying to take a shortcut and not introduce a wrapper struct for
the signature results, so packed it all into alpm_sigresult_t in the
first iteration. However, this is painful when one wants to add new
fields or only return information regarding a single signature.
Refactor the type into a few components which are exposed to the end
user, and will allow a lot more future flexibility. This also exposes
more information regarding the key to the frontend than was previously
available.
The "private" void *data pointer is used by the library to store the
actual key object returned by gpgme; it is typed this way so the
frontend has no expectations of what is there, and so we don't have any
hard gpgme requirement in our public API.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/alpm.h')
-rw-r--r-- | lib/libalpm/alpm.h | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index fc8f0bcd..c94cdf7f 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -209,16 +209,30 @@ typedef struct _alpm_backup_t { char *hash; } alpm_backup_t; +typedef struct _alpm_pgpkey_t { + void *data; + char *fingerprint; + char *uid; + char *name; + char *email; + time_t created; + time_t expires; +} alpm_pgpkey_t; + /** Signature result. Contains the number of signatures found and pointers to * arrays containing key and status info. All contained arrays have size * #count.*/ typedef struct _alpm_sigresult_t { - int count; - alpm_sigstatus_t *status; - alpm_sigvalidity_t *validity; - char **uid; + alpm_pgpkey_t key; + alpm_sigstatus_t status; + alpm_sigvalidity_t validity; } alpm_sigresult_t; +typedef struct _alpm_siglist_t { + size_t count; + alpm_sigresult_t *results; +} alpm_siglist_t; + /* * Logging facilities */ @@ -776,11 +790,11 @@ alpm_list_t *alpm_pkg_unused_deltas(alpm_pkg_t *pkg); * Signatures */ -int alpm_pkg_check_pgp_signature(alpm_pkg_t *pkg, alpm_sigresult_t *result); +int alpm_pkg_check_pgp_signature(alpm_pkg_t *pkg, alpm_siglist_t *siglist); -int alpm_db_check_pgp_signature(alpm_db_t *db, alpm_sigresult_t *result); +int alpm_db_check_pgp_signature(alpm_db_t *db, alpm_siglist_t *siglist); -int alpm_sigresult_cleanup(alpm_sigresult_t *result); +int alpm_siglist_cleanup(alpm_siglist_t *siglist); /* * Groups |