mirror of
git://git.gnupg.org/gnupg.git
synced 2024-11-11 21:48:50 +01:00
* assuan-handler.c (assuan_register_bye_notify)
(assuan_register_reset_notify) (assuan_register_cancel_notify): New and call them from the standard handlers.
This commit is contained in:
parent
922cedfe58
commit
c0d12ef3fb
@ -1,3 +1,10 @@
|
|||||||
|
2001-11-25 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* assuan-handler.c (assuan_register_bye_notify)
|
||||||
|
(assuan_register_reset_notify)
|
||||||
|
(assuan_register_cancel_notify): New and call them from the
|
||||||
|
standard handlers.
|
||||||
|
|
||||||
2001-11-24 Werner Koch <wk@gnupg.org>
|
2001-11-24 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
* assuan-connect.c (assuan_get_pid): New.
|
* assuan-connect.c (assuan_get_pid): New.
|
||||||
|
@ -69,6 +69,10 @@ struct assuan_context_s {
|
|||||||
size_t cmdtbl_used; /* used entries */
|
size_t cmdtbl_used; /* used entries */
|
||||||
size_t cmdtbl_size; /* allocated size of table */
|
size_t cmdtbl_size; /* allocated size of table */
|
||||||
|
|
||||||
|
void (*bye_notify_fnc)(ASSUAN_CONTEXT);
|
||||||
|
void (*cancel_notify_fnc)(ASSUAN_CONTEXT);
|
||||||
|
void (*reset_notify_fnc)(ASSUAN_CONTEXT);
|
||||||
|
|
||||||
|
|
||||||
int input_fd; /* set by INPUT command */
|
int input_fd; /* set by INPUT command */
|
||||||
int output_fd; /* set by OUTPUT command */
|
int output_fd; /* set by OUTPUT command */
|
||||||
|
@ -44,12 +44,16 @@ std_handler_nop (ASSUAN_CONTEXT ctx, char *line)
|
|||||||
static int
|
static int
|
||||||
std_handler_cancel (ASSUAN_CONTEXT ctx, char *line)
|
std_handler_cancel (ASSUAN_CONTEXT ctx, char *line)
|
||||||
{
|
{
|
||||||
|
if (ctx->cancel_notify_fnc)
|
||||||
|
ctx->cancel_notify_fnc (ctx);
|
||||||
return set_error (ctx, Not_Implemented, NULL);
|
return set_error (ctx, Not_Implemented, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
std_handler_bye (ASSUAN_CONTEXT ctx, char *line)
|
std_handler_bye (ASSUAN_CONTEXT ctx, char *line)
|
||||||
{
|
{
|
||||||
|
if (ctx->bye_notify_fnc)
|
||||||
|
ctx->bye_notify_fnc (ctx);
|
||||||
return -1; /* pretty simple :-) */
|
return -1; /* pretty simple :-) */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +66,9 @@ std_handler_auth (ASSUAN_CONTEXT ctx, char *line)
|
|||||||
static int
|
static int
|
||||||
std_handler_reset (ASSUAN_CONTEXT ctx, char *line)
|
std_handler_reset (ASSUAN_CONTEXT ctx, char *line)
|
||||||
{
|
{
|
||||||
return set_error (ctx, Not_Implemented, NULL);
|
if (ctx->reset_notify_fnc)
|
||||||
|
ctx->reset_notify_fnc (ctx);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -128,7 +134,7 @@ static struct {
|
|||||||
const char *name;
|
const char *name;
|
||||||
int cmd_id;
|
int cmd_id;
|
||||||
int (*handler)(ASSUAN_CONTEXT, char *line);
|
int (*handler)(ASSUAN_CONTEXT, char *line);
|
||||||
int always; /* always initializethis command */
|
int always; /* always initialize this command */
|
||||||
} std_cmd_table[] = {
|
} std_cmd_table[] = {
|
||||||
{ "NOP", ASSUAN_CMD_NOP, std_handler_nop, 1 },
|
{ "NOP", ASSUAN_CMD_NOP, std_handler_nop, 1 },
|
||||||
{ "CANCEL", ASSUAN_CMD_CANCEL, std_handler_cancel, 1 },
|
{ "CANCEL", ASSUAN_CMD_CANCEL, std_handler_cancel, 1 },
|
||||||
@ -220,6 +226,34 @@ assuan_register_command (ASSUAN_CONTEXT ctx,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
assuan_register_bye_notify (ASSUAN_CONTEXT ctx, void (*fnc)(ASSUAN_CONTEXT))
|
||||||
|
{
|
||||||
|
if (!ctx)
|
||||||
|
return ASSUAN_Invalid_Value;
|
||||||
|
ctx->bye_notify_fnc = fnc;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
assuan_register_reset_notify (ASSUAN_CONTEXT ctx, void (*fnc)(ASSUAN_CONTEXT))
|
||||||
|
{
|
||||||
|
if (!ctx)
|
||||||
|
return ASSUAN_Invalid_Value;
|
||||||
|
ctx->reset_notify_fnc = fnc;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
assuan_register_cancel_notify (ASSUAN_CONTEXT ctx, void (*fnc)(ASSUAN_CONTEXT))
|
||||||
|
{
|
||||||
|
if (!ctx)
|
||||||
|
return ASSUAN_Invalid_Value;
|
||||||
|
ctx->cancel_notify_fnc = fnc;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Helper to register the standards commands */
|
/* Helper to register the standards commands */
|
||||||
int
|
int
|
||||||
_assuan_register_std_commands (ASSUAN_CONTEXT ctx)
|
_assuan_register_std_commands (ASSUAN_CONTEXT ctx)
|
||||||
|
@ -39,6 +39,7 @@ typedef enum {
|
|||||||
ASSUAN_Timeout = 4,
|
ASSUAN_Timeout = 4,
|
||||||
ASSUAN_Read_Error = 5,
|
ASSUAN_Read_Error = 5,
|
||||||
ASSUAN_Write_Error = 6,
|
ASSUAN_Write_Error = 6,
|
||||||
|
ASSUAN_Problem_Starting_Server = 7,
|
||||||
|
|
||||||
/* error codes above 99 are meant as status codes */
|
/* error codes above 99 are meant as status codes */
|
||||||
ASSUAN_Not_Implemented = 100,
|
ASSUAN_Not_Implemented = 100,
|
||||||
@ -53,6 +54,7 @@ typedef enum {
|
|||||||
ASSUAN_No_Input = 109,
|
ASSUAN_No_Input = 109,
|
||||||
ASSUAN_No_Output = 110,
|
ASSUAN_No_Output = 110,
|
||||||
ASSUAN_Canceled = 111,
|
ASSUAN_Canceled = 111,
|
||||||
|
ASSUAN_Unsupported_Algorithm = 112,
|
||||||
|
|
||||||
ASSUAN_Cert_Revoked = 301,
|
ASSUAN_Cert_Revoked = 301,
|
||||||
ASSUAN_No_CRL_For_Cert = 302,
|
ASSUAN_No_CRL_For_Cert = 302,
|
||||||
@ -83,6 +85,12 @@ typedef struct assuan_context_s *ASSUAN_CONTEXT;
|
|||||||
int assuan_register_command (ASSUAN_CONTEXT ctx,
|
int assuan_register_command (ASSUAN_CONTEXT ctx,
|
||||||
int cmd_id, const char *cmd_string,
|
int cmd_id, const char *cmd_string,
|
||||||
int (*handler)(ASSUAN_CONTEXT, char *));
|
int (*handler)(ASSUAN_CONTEXT, char *));
|
||||||
|
int assuan_register_bye_notify (ASSUAN_CONTEXT ctx,
|
||||||
|
void (*fnc)(ASSUAN_CONTEXT));
|
||||||
|
int assuan_register_reset_notify (ASSUAN_CONTEXT ctx,
|
||||||
|
void (*fnc)(ASSUAN_CONTEXT));
|
||||||
|
int assuan_register_cancel_notify (ASSUAN_CONTEXT ctx,
|
||||||
|
void (*fnc)(ASSUAN_CONTEXT));
|
||||||
int assuan_process (ASSUAN_CONTEXT ctx);
|
int assuan_process (ASSUAN_CONTEXT ctx);
|
||||||
FILE *assuan_get_data_fp (ASSUAN_CONTEXT ctx);
|
FILE *assuan_get_data_fp (ASSUAN_CONTEXT ctx);
|
||||||
void assuan_write_status (ASSUAN_CONTEXT ctx,
|
void assuan_write_status (ASSUAN_CONTEXT ctx,
|
||||||
|
Loading…
Reference in New Issue
Block a user