1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-11-04 20:38:50 +01:00

* assuan-handler.c (assuan_register_input_notify): New.

(assuan_register_output_notify): New.
This commit is contained in:
Werner Koch 2001-11-27 17:39:09 +00:00
parent d9aecd9eb7
commit 5a6a2ca248
4 changed files with 36 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2001-11-27 Werner Koch <wk@gnupg.org>
* assuan-handler.c (assuan_register_input_notify): New.
(assuan_register_output_notify): New.
2001-11-26 Werner Koch <wk@gnupg.org> 2001-11-26 Werner Koch <wk@gnupg.org>
* assuan.h: Added more status codes. * assuan.h: Added more status codes.

View File

@ -70,8 +70,10 @@ struct assuan_context_s {
size_t cmdtbl_size; /* allocated size of table */ size_t cmdtbl_size; /* allocated size of table */
void (*bye_notify_fnc)(ASSUAN_CONTEXT); void (*bye_notify_fnc)(ASSUAN_CONTEXT);
void (*cancel_notify_fnc)(ASSUAN_CONTEXT);
void (*reset_notify_fnc)(ASSUAN_CONTEXT); void (*reset_notify_fnc)(ASSUAN_CONTEXT);
void (*cancel_notify_fnc)(ASSUAN_CONTEXT);
void (*input_notify_fnc)(ASSUAN_CONTEXT, const char *);
void (*output_notify_fnc)(ASSUAN_CONTEXT, const char *);
int input_fd; /* set by INPUT command */ int input_fd; /* set by INPUT command */

View File

@ -107,6 +107,8 @@ std_handler_input (ASSUAN_CONTEXT ctx, char *line)
if (rc) if (rc)
return rc; return rc;
ctx->input_fd = fd; ctx->input_fd = fd;
if (ctx->input_notify_fnc)
ctx->input_notify_fnc (ctx, line);
return 0; return 0;
} }
@ -120,6 +122,8 @@ std_handler_output (ASSUAN_CONTEXT ctx, char *line)
if (rc) if (rc)
return rc; return rc;
ctx->output_fd = fd; ctx->output_fd = fd;
if (ctx->output_notify_fnc)
ctx->output_notify_fnc (ctx, line);
return 0; return 0;
} }
@ -253,6 +257,26 @@ assuan_register_cancel_notify (ASSUAN_CONTEXT ctx, void (*fnc)(ASSUAN_CONTEXT))
return 0; return 0;
} }
int
assuan_register_input_notify (ASSUAN_CONTEXT ctx,
void (*fnc)(ASSUAN_CONTEXT, const char *))
{
if (!ctx)
return ASSUAN_Invalid_Value;
ctx->input_notify_fnc = fnc;
return 0;
}
int
assuan_register_output_notify (ASSUAN_CONTEXT ctx,
void (*fnc)(ASSUAN_CONTEXT, const char *))
{
if (!ctx)
return ASSUAN_Invalid_Value;
ctx->output_notify_fnc = fnc;
return 0;
}
/* Helper to register the standards commands */ /* Helper to register the standards commands */
int int

View File

@ -104,6 +104,10 @@ int assuan_register_reset_notify (ASSUAN_CONTEXT ctx,
void (*fnc)(ASSUAN_CONTEXT)); void (*fnc)(ASSUAN_CONTEXT));
int assuan_register_cancel_notify (ASSUAN_CONTEXT ctx, int assuan_register_cancel_notify (ASSUAN_CONTEXT ctx,
void (*fnc)(ASSUAN_CONTEXT)); void (*fnc)(ASSUAN_CONTEXT));
int assuan_register_input_notify (ASSUAN_CONTEXT ctx,
void (*fnc)(ASSUAN_CONTEXT, const char *));
int assuan_register_output_notify (ASSUAN_CONTEXT ctx,
void (*fnc)(ASSUAN_CONTEXT, const char *));
int assuan_process (ASSUAN_CONTEXT ctx); int assuan_process (ASSUAN_CONTEXT ctx);
int assuan_process_next (ASSUAN_CONTEXT ctx); int assuan_process_next (ASSUAN_CONTEXT ctx);
int assuan_get_active_fds (ASSUAN_CONTEXT ctx, int what, int assuan_get_active_fds (ASSUAN_CONTEXT ctx, int what,