Add support for non-API GnuPG status codes.

As an example stub code for DECRYTPION_INFO has been added.  Note
that the status codes in gpgme.h do only make sense for the edit
interactor interface and thus certain codes don't need to be part of
the public interface.
This commit is contained in:
Werner Koch 2011-02-03 20:49:41 +01:00
parent 3a7058cade
commit 55ad4d80e2
5 changed files with 125 additions and 79 deletions

View File

@ -1,3 +1,10 @@
2011-02-03 Werner Koch <wk@g10code.com>
* extra-stati.h: New.
* mkstatus: Extend to also process extra-stati.h
* Makefile.am (main_sources): Add extra-stati.h
(status-table.h): Depend on extra-stati.h and adjust rule.
2010-12-08 Werner Koch <wk@g10code.com> 2010-12-08 Werner Koch <wk@g10code.com>
* gpgme-tool.c (strcpy_escaped_plus): New. * gpgme-tool.c (strcpy_escaped_plus): New.

View File

@ -120,6 +120,7 @@ main_sources = \
import.c export.c genkey.c delete.c edit.c getauditlog.c \ import.c export.c genkey.c delete.c edit.c getauditlog.c \
opassuan.c passwd.c \ opassuan.c passwd.c \
engine.h engine-backend.h engine.c engine-gpg.c status-table.h \ engine.h engine-backend.h engine.c engine-gpg.c status-table.h \
extra-stati.h \
$(gpgsm_components) $(assuan_components) $(gpgconf_components) \ $(gpgsm_components) $(assuan_components) $(gpgconf_components) \
$(uiserver_components) \ $(uiserver_components) \
$(g13_components) vfs-mount.c vfs-create.c \ $(g13_components) vfs-mount.c vfs-create.c \
@ -241,8 +242,9 @@ endif
noinst_PROGRAMS = gpgme-tool noinst_PROGRAMS = gpgme-tool
gpgme_tool_LDADD = libgpgme.la gpgme_tool_LDADD = libgpgme.la
status-table.h : gpgme.h status-table.h : gpgme.h extra-stati.h
$(srcdir)/mkstatus < $(builddir)/gpgme.h > status-table.h cat $(builddir)/gpgme.h $(srcdir)extra-stati.h \
| $(srcdir)/mkstatus > status-table.h
install-data-local: install-def-file install-data-local: install-def-file

View File

@ -31,6 +31,8 @@
#include "util.h" #include "util.h"
#include "context.h" #include "context.h"
#include "ops.h" #include "ops.h"
#include "extra-stati.h"
typedef struct typedef struct
@ -200,6 +202,10 @@ _gpgme_decrypt_status_handler (void *priv, gpgme_status_code_t code,
return gpg_error (GPG_ERR_NO_DATA); return gpg_error (GPG_ERR_NO_DATA);
break; break;
case GPGME_STATUS_DECRYPTION_INFO:
/* Fixme: Provide a way to return the used symmetric algorithm. */
break;
case GPGME_STATUS_DECRYPTION_OKAY: case GPGME_STATUS_DECRYPTION_OKAY:
opd->okay = 1; opd->okay = 1;
break; break;

29
src/extra-stati.h Normal file
View File

@ -0,0 +1,29 @@
/* extra-stati.lst - Extra GnuPG status codes.
Copyright 2011 g10 Code GmbH
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without
modifications, as long as this notice is preserved.
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY, to the extent permitted by law; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. */
/* A list of internal status code to be processed by mkstatus. Those
* status codes are not part of the API but internally required by
* gpgme. We use a second enum type here but make sure that the
* values don't clash with those of gpgme_status_code_t.
*/
enum
{
/* This value is the first used one. It needs to be larger than
the last value of gpgme_status_code_t. There is no need to
explictly list the values because they are internal only. */
_GPGME_STATUS_FIRST_EXTRA = 192,
GPGME_STATUS_DECRYPTION_INFO,
_GPGME_STATUS_LAST_EXTRA
};

View File

@ -39,9 +39,11 @@ static struct status_table_s status_table[] =
EOF EOF
awk ' awk '
/GPGME_STATUS_ENTER/ { okay = 1 } okay == 0 && /GPGME_STATUS_ENTER/ { okay = 1 }
!okay { next } okay == 2 && /_GPGME_STATUS_FIRST_EXTRA/ { okay = 1; next }
/}/ { exit 0 } okay != 1 { next }
/}/ { okay = 2 }
/_GPGME_STATUS_LAST_EXTRA/ { exit 0 }
/GPGME_STATUS_[A-Za-z_]*/ { sub (/,/, "", $1); printf " { \"%s\", %s },\n", substr($1,14), $1 } /GPGME_STATUS_[A-Za-z_]*/ { sub (/,/, "", $1); printf " { \"%s\", %s },\n", substr($1,14), $1 }
' | sort ' | sort