From aad94cb7c313d4501bed748f48830cbb93c67e20 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 3 Nov 2016 16:29:45 +0100 Subject: core: Add gpgme_op_query_swdb and helper. * src/gpgme.h.in (gpgme_query_swdb_result_t): New. (gpgme_op_query_swdb): New. (gpgme_op_query_swdb_result): New. * src/libgpgme.vers, src/gpgme.def: Add the two new functions. * src/queryswdb.c: New. * src/Makefile.am (main_sources): Add new file. * src/context.h (OPDATA_QUERY_SWDB): New. * src/engine-backend.h (struct engine_ops): Add field 'query_swdb'. Adjust all initializer. * src/engine.c (_gpgme_engine_op_query_swdb): New. * src/engine-gpgconf.c (parse_swdb_line): New. (gpgconf_query_swdb): New. (_gpgme_engine_ops_gpgconf): Register that function. * src/util.h (GPG_ERR_TOO_OLD): Define for older libgpg-error. (GPG_ERR_ENGINE_TOO_OLD): Ditto. * tests/run-swdb.c: New. * tests/Makefile.am (noinst_PROGRAMS): Add new debug tool. Signed-off-by: Werner Koch --- src/gpgme.h.in | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'src/gpgme.h.in') diff --git a/src/gpgme.h.in b/src/gpgme.h.in index 94ef51de..4f470a03 100644 --- a/src/gpgme.h.in +++ b/src/gpgme.h.in @@ -2418,6 +2418,67 @@ gpgme_error_t gpgme_op_conf_load (gpgme_ctx_t ctx, gpgme_conf_comp_t *conf_p); gpgme_error_t gpgme_op_conf_save (gpgme_ctx_t ctx, gpgme_conf_comp_t comp); +/* Information about software versions. */ +typedef struct _gpgme_op_query_swdb_result +{ + /* RFU */ + struct _gpgme_op_query_swdb_result *next; + + /* The name of the package (e.g. "gpgme", "gnupg") */ + char *name; + + /* The version number of the installed version. */ + char *iversion; + + /* The time the online info was created. */ + unsigned long created; + + /* The time the online info was retrieved. */ + unsigned long retrieved; + + /* This bit is set if an error occured or some of the information + * in this structure may not be set. */ + unsigned int warning : 1; + + /* An update is available. */ + unsigned int update : 1; + + /* The update is important. */ + unsigned int urgent : 1; + + /* No information at all available. */ + unsigned int noinfo : 1; + + /* The package name is not known. */ + unsigned int unknown : 1; + + /* The information here is too old. */ + unsigned int tooold : 1; + + /* Other error. */ + unsigned int error : 1; + + unsigned int _reserved : 25; + + /* The version number of the latest released version. */ + char *version; + + /* The release date of that version. */ + unsigned long reldate; + +} *gpgme_query_swdb_result_t; + + +/* Run the gpgconf --query-swdb command. */ +gpgme_error_t gpgme_op_query_swdb (gpgme_ctx_t ctx, + const char *name, const char *iversion, + unsigned int reserved); + +/* Return the result from the last query_swdb operation. */ +gpgme_query_swdb_result_t gpgme_op_query_swdb_result (gpgme_ctx_t ctx); + + + /* * Various functions. -- cgit v1.2.3