[svn] assuan - r308 - in trunk: . doc src
svn author wk
cvs at cvs.gnupg.org
Wed Oct 14 13:27:08 CEST 2009
Author: wk
Date: 2009-10-14 13:27:08 +0200 (Wed, 14 Oct 2009)
New Revision: 308
Modified:
trunk/NEWS
trunk/autogen.sh
trunk/doc/ChangeLog
trunk/doc/assuan.texi
trunk/src/ChangeLog
trunk/src/assuan-defs.h
trunk/src/assuan-handler.c
trunk/src/assuan.c
trunk/src/assuan.h
trunk/src/libassuan.def
trunk/src/libassuan.vers
Log:
Add new ducntion assuan_get_command_name. This makes
error reporting in the server much easier.
Modified: trunk/doc/ChangeLog
===================================================================
--- trunk/doc/ChangeLog 2009-10-13 23:38:23 UTC (rev 307)
+++ trunk/doc/ChangeLog 2009-10-14 11:27:08 UTC (rev 308)
@@ -1,3 +1,7 @@
+2009-10-14 Werner Koch <wk at g10code.com>
+
+ * assuan.texi (Utilities): Describe assuan_get_command_name.
+
2009-09-21 Marcus Brinkmann <marcus at g10code.de>
* assuan.texi: Update to new API.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2009-10-13 23:38:23 UTC (rev 307)
+++ trunk/src/ChangeLog 2009-10-14 11:27:08 UTC (rev 308)
@@ -1,3 +1,10 @@
+2009-10-14 Werner Koch <wk at g10code.com>
+
+ * assuan-defs.h (assuan_context_s): Add field CURRENT_CMD_NAME.
+ * assuan-handler.c (dispatch_command): Set this field.
+ (assuan_get_command_name): New.
+ * assuan.h, libassuan.vers, libassuan.def: Add new fucntion.
+
2009-10-08 Marcus Brinkmann <marcus at g10code.de>
* assuan.h (assuan_get_assuan_log_stream,
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2009-10-13 23:38:23 UTC (rev 307)
+++ trunk/NEWS 2009-10-14 11:27:08 UTC (rev 308)
@@ -50,8 +50,10 @@
assuan_set_io_hooks REMOVED: Will come back in expanded form.
assuan_io_hooks_t REMOVED: Will come back in expanded form.
assuan_io_monitor_t CHANGED: Add a hook data argument.
+assuan_get_command_name NEW
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
Noteworthy changes in version 1.0.5 (2008-05-25)
------------------------------------------------
Modified: trunk/autogen.sh
===================================================================
--- trunk/autogen.sh 2009-10-13 23:38:23 UTC (rev 307)
+++ trunk/autogen.sh 2009-10-14 11:27:08 UTC (rev 308)
@@ -197,4 +197,6 @@
echo "Running autoconf${FORCE} ..."
$AUTOCONF${FORCE}
-echo "You may now run \"./configure --enable-maintainer-mode && make\"."
+echo "You may now run
+ ./configure --enable-maintainer-mode && make
+"
Modified: trunk/doc/assuan.texi
===================================================================
--- trunk/doc/assuan.texi 2009-10-13 23:38:23 UTC (rev 307)
+++ trunk/doc/assuan.texi 2009-10-14 11:27:08 UTC (rev 308)
@@ -1675,6 +1675,15 @@
@end deftypefun
+ at deftypefun @w{const char *} assuan_get_command_name (@w{assuan_context_t @var{ctx}})
+
+Return the name of the command currently processed by a handler.
+The returned string is valid until the next call to an Assuan
+function on the same context. Returns @code{NULL} if no handler is
+executed or the command is not known.
+ at end deftypefun
+
+
@deftypefun int assuan_get_input_fd (@w{assuan_context_t @var{ctx}})
Return the file descriptor sent by the client using the last @code{INPUT}
Modified: trunk/src/assuan-defs.h
===================================================================
--- trunk/src/assuan-defs.h 2009-10-13 23:38:23 UTC (rev 307)
+++ trunk/src/assuan-defs.h 2009-10-14 11:27:08 UTC (rev 308)
@@ -200,6 +200,11 @@
struct cmdtbl_s *cmdtbl;
size_t cmdtbl_used; /* used entries */
size_t cmdtbl_size; /* allocated size of table */
+
+ /* The name of the command currently processed by a command handler.
+ This is a pointer into CMDTBL. NULL if not in a command
+ handler. */
+ const char *current_cmd_name;
void (*bye_notify_fnc)(assuan_context_t);
void (*reset_notify_fnc)(assuan_context_t);
Modified: trunk/src/assuan-handler.c
===================================================================
--- trunk/src/assuan-handler.c 2009-10-13 23:38:23 UTC (rev 307)
+++ trunk/src/assuan-handler.c 2009-10-14 11:27:08 UTC (rev 308)
@@ -330,6 +330,16 @@
return 0;
}
+/* Return the name of the command currently processed by a handler.
+ The string returned is valid until the next call to an assuan
+ function on the same context. Returns NULL if no handler is
+ executed or the command is not known. */
+const char *
+assuan_get_command_name (assuan_context_t ctx)
+{
+ return ctx? ctx->current_cmd_name : NULL;
+}
+
gpg_error_t
assuan_register_post_cmd_notify (assuan_context_t ctx,
void (*fnc)(assuan_context_t, gpg_error_t))
@@ -453,6 +463,7 @@
static gpg_error_t
dispatch_command (assuan_context_t ctx, char *line, int linelen)
{
+ gpg_error_t err;
char *p;
const char *s;
int shift, i;
@@ -499,7 +510,10 @@
linelen -= shift;
/* fprintf (stderr, "DBG-assuan: processing %s `%s'\n", s, line); */
- return ctx->cmdtbl[i].handler (ctx, line);
+ ctx->current_cmd_name = ctx->cmdtbl[i].name;
+ err = ctx->cmdtbl[i].handler (ctx, line);
+ ctx->current_cmd_name = NULL;
+ return err;
}
Modified: trunk/src/assuan.c
===================================================================
--- trunk/src/assuan.c 2009-10-13 23:38:23 UTC (rev 307)
+++ trunk/src/assuan.c 2009-10-14 11:27:08 UTC (rev 308)
@@ -160,7 +160,7 @@
ctx->engine.release = NULL;
}
- // FIXME: Clean standard commands
+ /* FIXME: Clean standard commands */
}
Modified: trunk/src/assuan.h
===================================================================
--- trunk/src/assuan.h 2009-10-13 23:38:23 UTC (rev 307)
+++ trunk/src/assuan.h 2009-10-14 11:27:08 UTC (rev 308)
@@ -288,6 +288,7 @@
int assuan_get_active_fds (assuan_context_t ctx, int what,
assuan_fd_t *fdarray, int fdarraysize);
+const char *assuan_get_command_name (assuan_context_t ctx);
FILE *assuan_get_data_fp (assuan_context_t ctx);
gpg_error_t assuan_set_okay_line (assuan_context_t ctx, const char *line);
Modified: trunk/src/libassuan.def
===================================================================
--- trunk/src/libassuan.def 2009-10-13 23:38:23 UTC (rev 307)
+++ trunk/src/libassuan.def 2009-10-14 11:27:08 UTC (rev 308)
@@ -84,6 +84,7 @@
assuan_transact @63
assuan_write_line @64
assuan_write_status @65
+ assuan_get_command_name @66
; END
Modified: trunk/src/libassuan.vers
===================================================================
--- trunk/src/libassuan.vers 2009-10-13 23:38:23 UTC (rev 307)
+++ trunk/src/libassuan.vers 2009-10-14 11:27:08 UTC (rev 308)
@@ -30,6 +30,7 @@
assuan_end_confidential;
assuan_get_active_fds;
assuan_get_assuan_log_prefix;
+ assuan_get_command_name;
assuan_get_data_fp;
assuan_get_flag;
assuan_get_input_fd;
More information about the Gnupg-commits
mailing list