diff options
Diffstat (limited to 'src/assuan-handler.c')
-rw-r--r-- | src/assuan-handler.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/assuan-handler.c b/src/assuan-handler.c index c19117f..5016fcb 100644 --- a/src/assuan-handler.c +++ b/src/assuan-handler.c @@ -400,7 +400,7 @@ assuan_register_command (assuan_context_t ctx, const char *cmd_name, } else if (ctx->cmdtbl_used >= ctx->cmdtbl_size) { - struct cmdtbl_s *x; + struct _assuan_command_s *x; x = _assuan_realloc (ctx, ctx->cmdtbl, (ctx->cmdtbl_size+10) * sizeof *x); if (!x) @@ -427,6 +427,17 @@ assuan_get_command_name (assuan_context_t ctx) } gpg_error_t +assuan_register_pre_cmd_notify (assuan_context_t ctx, + gpg_error_t (*fnc)(assuan_context_t, + assuan_command_t)) +{ + if (!ctx) + return _assuan_error (ctx, GPG_ERR_ASS_INV_VALUE); + ctx->pre_cmd_notify_fnc = fnc; + return 0; +} + +gpg_error_t assuan_register_post_cmd_notify (assuan_context_t ctx, void (*fnc)(assuan_context_t, gpg_error_t)) { @@ -590,6 +601,13 @@ dispatch_command (assuan_context_t ctx, char *line, int linelen) line += shift; linelen -= shift; + if (ctx->pre_cmd_notify_fnc) { + err = ctx->pre_cmd_notify_fnc(ctx, &ctx->cmdtbl[i]); + + if (err) + return PROCESS_DONE(ctx, err); + } + /* fprintf (stderr, "DBG-assuan: processing %s `%s'\n", s, line); */ ctx->current_cmd_name = ctx->cmdtbl[i].name; err = ctx->cmdtbl[i].handler (ctx, line); |