diff options
author | Marcus Brinkmann <mb@g10code.com> | 2009-09-01 17:19:45 +0000 |
---|---|---|
committer | Marcus Brinkmann <mb@g10code.com> | 2009-09-01 17:19:45 +0000 |
commit | 7389cbf6e71c402b68a9ad61afa8b113a05ea1ea (patch) | |
tree | a3d9beea7003fd515560367c8703a5bf6a7da563 /src | |
parent | ddd3bd63797bb02018e1bfb59811b8dcd818af2b (diff) | |
download | libassuan-7389cbf6e71c402b68a9ad61afa8b113a05ea1ea.tar.gz |
doc/
2009-09-01 Marcus Brinkmann <marcus@g10code.de>
* assuan.texi: (External I/O Loop Server): Document
assuan_process_done.
(assuan_register_post_cmd_notify): Change type of ERR from int to
gpg_error_t.
(assuan_set_error): Likewise.
(assuan_register_option_handler): Change types in callback handler
from int to gpg_error_t.
(assuan_inquire_ext): Likewise.
src/
2009-09-01 Marcus Brinkmann <marcus@g10code.de>
* assuan.h: Change types in all functions from int to gpg_error_t
where relevant.
* assuan-listen.c (assuan_accept): Change type of RC from int to
gpg_error_t.
* assuan-pipe-server.c (accept_connection, finish_connection):
Change return type to gpg_error_t.
* assuan-socket-server.c (accept_connection_bottom)
(accept_connection, finish_connection): Likewise.
(assuan_init_connected_socket_server): Remove.
* assuan-defs.h (struct assuan_context_s): Change return type of
accept_handler and finish_handler to gpg_error_t.
* assuan-pipe-connect.c (do_finish): Change to void.
* assuan-inquire.c (_assuan_inquire_ext_cb): Change type of RC
from int to gpg_error_t.
* assuan-handler.c: Change return codes and RC variables from int
to gpg_error_t where appropriate.
* assuan-buffer.c (_assuan_read_line): Fix error code on EOF.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 18 | ||||
-rw-r--r-- | src/assuan-buffer.c | 25 | ||||
-rw-r--r-- | src/assuan-defs.h | 14 | ||||
-rw-r--r-- | src/assuan-handler.c | 79 | ||||
-rw-r--r-- | src/assuan-inquire.c | 8 | ||||
-rw-r--r-- | src/assuan-listen.c | 2 | ||||
-rw-r--r-- | src/assuan-pipe-connect.c | 3 | ||||
-rw-r--r-- | src/assuan-pipe-server.c | 10 | ||||
-rw-r--r-- | src/assuan-socket-server.c | 18 | ||||
-rw-r--r-- | src/assuan-util.c | 4 | ||||
-rw-r--r-- | src/assuan.h | 91 |
11 files changed, 142 insertions, 130 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e67ce87..c561abc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,23 @@ 2009-09-01 Marcus Brinkmann <marcus@g10code.de> + * assuan.h: Change types in all functions from int to gpg_error_t + where relevant. + * assuan-listen.c (assuan_accept): Change type of RC from int to + gpg_error_t. + * assuan-pipe-server.c (accept_connection, finish_connection): + Change return type to gpg_error_t. + * assuan-socket-server.c (accept_connection_bottom) + (accept_connection, finish_connection): Likewise. + (assuan_init_connected_socket_server): Remove. + * assuan-defs.h (struct assuan_context_s): Change return type of + accept_handler and finish_handler to gpg_error_t. + * assuan-pipe-connect.c (do_finish): Change to void. + * assuan-inquire.c (_assuan_inquire_ext_cb): Change type of RC + from int to gpg_error_t. + * assuan-handler.c: Change return codes and RC variables from int + to gpg_error_t where appropriate. + * assuan-buffer.c (_assuan_read_line): Fix error code on EOF. + * assuan.h (ASSUAN_INT2FD, ASSUAN_FD2INT): Remove macros. * assuan-defs.h (DIMof): Remove macro. diff --git a/src/assuan-buffer.c b/src/assuan-buffer.c index 84538f4..e973341 100644 --- a/src/assuan-buffer.c +++ b/src/assuan-buffer.c @@ -97,13 +97,13 @@ readline (assuan_context_t ctx, char *buf, size_t buflen, gpg_error_t _assuan_read_line (assuan_context_t ctx) { + gpg_error_t rc = 0; char *line = ctx->inbound.line; int nread, atticlen; - int rc; char *endp = 0; if (ctx->inbound.eof) - return _assuan_error (-1); + return _assuan_error (GPG_ERR_EOF); atticlen = ctx->inbound.attic.linelen; if (atticlen) @@ -113,15 +113,14 @@ _assuan_read_line (assuan_context_t ctx) endp = memchr (line, '\n', atticlen); if (endp) - /* Found another line in the attic. */ { - rc = 0; + /* Found another line in the attic. */ nread = atticlen; atticlen = 0; } else - /* There is pending data but not a full line. */ { + /* There is pending data but not a full line. */ assert (atticlen < LINELENGTH); rc = readline (ctx, line + atticlen, LINELENGTH - atticlen, &nread, &ctx->inbound.eof); @@ -336,21 +335,21 @@ gpg_error_t assuan_write_line (assuan_context_t ctx, const char *line) { size_t len; - const char *s; + const char *str; - if (!ctx) + if (! ctx) return _assuan_error (GPG_ERR_ASS_INV_VALUE); /* Make sure that we never take a LF from the user - this might violate the protocol. */ - s = strchr (line, '\n'); - len = s? (s-line) : strlen (line); + str = strchr (line, '\n'); + len = str ? (str - line) : strlen (line); - if (ctx->log_fp && s) + if (ctx->log_fp && str) fprintf (ctx->log_fp, "%s[%u.%d] DBG: -> " "[supplied line contained a LF - truncated]\n", assuan_get_assuan_log_prefix (), - (unsigned int)getpid (), (int)ctx->inbound.fd); + (unsigned int) getpid (), (int) ctx->inbound.fd); return _assuan_write_line (ctx, NULL, line, len); } @@ -439,7 +438,7 @@ _assuan_cookie_write_data (void *cookie, const char *buffer, size_t orig_size) } ctx->outbound.data.linelen = linelen; - return (int)orig_size; + return (int) orig_size; } @@ -481,7 +480,7 @@ _assuan_cookie_write_flush (void *cookie) } *line++ = '\n'; linelen++; - if ( !(monitor_result & 2) + if (! (monitor_result & 2) && writen (ctx, ctx->outbound.data.line, linelen)) { ctx->outbound.data.error = gpg_err_code_from_syserror (); diff --git a/src/assuan-defs.h b/src/assuan-defs.h index 194853f..5fc14f4 100644 --- a/src/assuan-defs.h +++ b/src/assuan-defs.h @@ -43,7 +43,7 @@ struct cmdtbl_s { const char *name; - int (*handler)(assuan_context_t, char *line); + gpg_error_t (*handler)(assuan_context_t, char *line); }; @@ -154,8 +154,8 @@ struct assuan_context_s } uds; void (*deinit_handler)(assuan_context_t); - int (*accept_handler)(assuan_context_t); - int (*finish_handler)(assuan_context_t); + gpg_error_t (*accept_handler)(assuan_context_t); + gpg_error_t (*finish_handler)(assuan_context_t); struct cmdtbl_s *cmdtbl; size_t cmdtbl_used; /* used entries */ @@ -164,7 +164,7 @@ struct assuan_context_s void (*bye_notify_fnc)(assuan_context_t); void (*reset_notify_fnc)(assuan_context_t); void (*cancel_notify_fnc)(assuan_context_t); - int (*option_handler_fnc)(assuan_context_t,const char*, const char*); + gpg_error_t (*option_handler_fnc)(assuan_context_t,const char*, const char*); void (*input_notify_fnc)(assuan_context_t, const char *); void (*output_notify_fnc)(assuan_context_t, const char *); @@ -190,7 +190,7 @@ struct assuan_context_s }; /*-- assuan-pipe-server.c --*/ -int _assuan_new_context (assuan_context_t *r_ctx); +gpg_error_t _assuan_new_context (assuan_context_t *r_ctx); void _assuan_release_context (assuan_context_t ctx); /*-- assuan-uds.c --*/ @@ -200,7 +200,7 @@ void _assuan_init_uds_io (assuan_context_t ctx); /*-- assuan-handler.c --*/ -int _assuan_register_std_commands (assuan_context_t ctx); +gpg_error_t _assuan_register_std_commands (assuan_context_t ctx); /*-- assuan-buffer.c --*/ gpg_error_t _assuan_read_line (assuan_context_t ctx); @@ -216,7 +216,7 @@ gpg_error_t _assuan_read_from_server (assuan_context_t ctx, /*-- assuan-error.c --*/ /*-- assuan-inquire.c --*/ -int _assuan_inquire_ext_cb (assuan_context_t ctx); +gpg_error_t _assuan_inquire_ext_cb (assuan_context_t ctx); void _assuan_inquire_release (assuan_context_t ctx); /* Check if ERR means EAGAIN. */ diff --git a/src/assuan-handler.c b/src/assuan-handler.c index bc8ec51..057d7e7 100644 --- a/src/assuan-handler.c +++ b/src/assuan-handler.c @@ -39,7 +39,7 @@ static int my_strcasecmp (const char *a, const char *b); #define PROCESS_DONE(ctx, rc) \ ((ctx)->in_process_next ? assuan_process_done ((ctx), (rc)) : (rc)) -static int +static gpg_error_t dummy_handler (assuan_context_t ctx, char *line) { return @@ -48,13 +48,13 @@ dummy_handler (assuan_context_t ctx, char *line) } -static int +static gpg_error_t std_handler_nop (assuan_context_t ctx, char *line) { return PROCESS_DONE (ctx, 0); /* okay */ } -static int +static gpg_error_t std_handler_cancel (assuan_context_t ctx, char *line) { if (ctx->cancel_notify_fnc) @@ -62,7 +62,7 @@ std_handler_cancel (assuan_context_t ctx, char *line) return PROCESS_DONE (ctx, set_error (ctx, GPG_ERR_NOT_IMPLEMENTED, NULL)); } -static int +static gpg_error_t std_handler_option (assuan_context_t ctx, char *line) { char *key, *value, *p; @@ -115,7 +115,7 @@ std_handler_option (assuan_context_t ctx, char *line) return PROCESS_DONE (ctx, 0); } -static int +static gpg_error_t std_handler_bye (assuan_context_t ctx, char *line) { if (ctx->bye_notify_fnc) @@ -126,13 +126,13 @@ std_handler_bye (assuan_context_t ctx, char *line) return PROCESS_DONE (ctx, _assuan_error (GPG_ERR_EOF)); } -static int +static gpg_error_t std_handler_auth (assuan_context_t ctx, char *line) { return PROCESS_DONE (ctx, set_error (ctx, GPG_ERR_NOT_IMPLEMENTED, NULL)); } -static int +static gpg_error_t std_handler_reset (assuan_context_t ctx, char *line) { if (ctx->reset_notify_fnc) @@ -143,7 +143,7 @@ std_handler_reset (assuan_context_t ctx, char *line) return PROCESS_DONE (ctx, 0); } -static int +static gpg_error_t std_handler_help (assuan_context_t ctx, char *line) { unsigned int i; @@ -160,7 +160,7 @@ std_handler_help (assuan_context_t ctx, char *line) } -static int +static gpg_error_t std_handler_end (assuan_context_t ctx, char *line) { return PROCESS_DONE (ctx, set_error (ctx, GPG_ERR_NOT_IMPLEMENTED, NULL)); @@ -204,10 +204,10 @@ assuan_command_parse_fd (assuan_context_t ctx, char *line, assuan_fd_t *rfd) /* Format is INPUT FD=<n> */ -static int +static gpg_error_t std_handler_input (assuan_context_t ctx, char *line) { - int rc; + gpg_error_t rc; assuan_fd_t fd; rc = assuan_command_parse_fd (ctx, line, &fd); @@ -220,10 +220,10 @@ std_handler_input (assuan_context_t ctx, char *line) } /* Format is OUTPUT FD=<n> */ -static int +static gpg_error_t std_handler_output (assuan_context_t ctx, char *line) { - int rc; + gpg_error_t rc; assuan_fd_t fd; rc = assuan_command_parse_fd (ctx, line, &fd); @@ -244,7 +244,7 @@ std_handler_output (assuan_context_t ctx, char *line) with default handlers */ static struct { const char *name; - int (*handler)(assuan_context_t, char *line); + gpg_error_t (*handler)(assuan_context_t, char *line); int always; /* always initialize this command */ } std_cmd_table[] = { { "NOP", std_handler_nop, 1 }, @@ -275,10 +275,10 @@ static struct { * * Return value: 0 on success or an error code **/ -int +gpg_error_t assuan_register_command (assuan_context_t ctx, const char *cmd_name, - int (*handler)(assuan_context_t, char *)) + gpg_error_t (*handler)(assuan_context_t, char *)) { int i; const char *s; @@ -330,9 +330,9 @@ assuan_register_command (assuan_context_t ctx, return 0; } -int +gpg_error_t assuan_register_post_cmd_notify (assuan_context_t ctx, - void (*fnc)(assuan_context_t, int)) + void (*fnc)(assuan_context_t, gpg_error_t)) { if (!ctx) return _assuan_error (GPG_ERR_ASS_INV_VALUE); @@ -340,7 +340,7 @@ assuan_register_post_cmd_notify (assuan_context_t ctx, return 0; } -int +gpg_error_t assuan_register_bye_notify (assuan_context_t ctx, void (*fnc)(assuan_context_t)) { @@ -350,7 +350,7 @@ assuan_register_bye_notify (assuan_context_t ctx, return 0; } -int +gpg_error_t assuan_register_reset_notify (assuan_context_t ctx, void (*fnc)(assuan_context_t)) { @@ -360,7 +360,7 @@ assuan_register_reset_notify (assuan_context_t ctx, return 0; } -int +gpg_error_t assuan_register_cancel_notify (assuan_context_t ctx, void (*fnc)(assuan_context_t)) { @@ -370,10 +370,10 @@ assuan_register_cancel_notify (assuan_context_t ctx, return 0; } -int +gpg_error_t assuan_register_option_handler (assuan_context_t ctx, - int (*fnc)(assuan_context_t, - const char*, const char*)) + gpg_error_t (*fnc)(assuan_context_t, + const char*, const char*)) { if (!ctx) return _assuan_error (GPG_ERR_ASS_INV_VALUE); @@ -381,7 +381,7 @@ assuan_register_option_handler (assuan_context_t ctx, return 0; } -int +gpg_error_t assuan_register_input_notify (assuan_context_t ctx, void (*fnc)(assuan_context_t, const char *)) { @@ -391,7 +391,7 @@ assuan_register_input_notify (assuan_context_t ctx, return 0; } -int +gpg_error_t assuan_register_output_notify (assuan_context_t ctx, void (*fnc)(assuan_context_t, const char *)) { @@ -403,12 +403,13 @@ assuan_register_output_notify (assuan_context_t ctx, /* Helper to register the standards commands */ -int +gpg_error_t _assuan_register_std_commands (assuan_context_t ctx) { - int i, rc; + gpg_error_t rc; + int i; - for (i=0; std_cmd_table[i].name; i++) + for (i = 0; std_cmd_table[i].name; i++) { if (std_cmd_table[i].always) { @@ -424,7 +425,7 @@ _assuan_register_std_commands (assuan_context_t ctx) /* Process the special data lines. The "D " has already been removed from the line. As all handlers this function may modify the line. */ -static int +static gpg_error_t handle_data_line (assuan_context_t ctx, char *line, int linelen) { return set_error (ctx, GPG_ERR_NOT_IMPLEMENTED, NULL); @@ -449,7 +450,7 @@ my_strcasecmp (const char *a, const char *b) /* Parse the line, break out the command, find it in the command table, remove leading and white spaces from the arguments, call the handler with the argument line and return the error. */ -static int +static gpg_error_t dispatch_command (assuan_context_t ctx, char *line, int linelen) { char *p; @@ -503,8 +504,8 @@ dispatch_command (assuan_context_t ctx, char *line, int linelen) /* Call this to acknowledge the current command. */ -int -assuan_process_done (assuan_context_t ctx, int rc) +gpg_error_t +assuan_process_done (assuan_context_t ctx, gpg_error_t rc) { if (!ctx->in_command) return _assuan_error (GPG_ERR_ASS_GENERAL); @@ -567,10 +568,10 @@ assuan_process_done (assuan_context_t ctx, int rc) } -static int +static gpg_error_t process_next (assuan_context_t ctx) { - int rc; + gpg_error_t rc; /* What the next thing to do is depends on the current state. However, we will always first read the next line. The client is @@ -626,10 +627,10 @@ process_next (assuan_context_t ctx) should be invoked the next time the connected FD is readable. Eventually, the caller will finish by invoking assuan_process_done. */ -int +gpg_error_t assuan_process_next (assuan_context_t ctx) { - int rc; + gpg_error_t rc; do { @@ -645,7 +646,7 @@ assuan_process_next (assuan_context_t ctx) static gpg_error_t process_request (assuan_context_t ctx) { - int rc; + gpg_error_t rc; if (ctx->in_inquire) return _assuan_error (GPG_ERR_ASS_NESTED_COMMANDS); @@ -683,7 +684,7 @@ process_request (assuan_context_t ctx) gpg_error_t assuan_process (assuan_context_t ctx) { - int rc; + gpg_error_t rc; do { rc = process_request (ctx); diff --git a/src/assuan-inquire.c b/src/assuan-inquire.c index 8fdf14d..55ab280 100644 --- a/src/assuan-inquire.c +++ b/src/assuan-inquire.c @@ -253,10 +253,10 @@ _assuan_inquire_release (assuan_context_t ctx) } -int +gpg_error_t _assuan_inquire_ext_cb (assuan_context_t ctx) { - int rc; + gpg_error_t rc; unsigned char *line; int linelen; struct membuf *mb; @@ -350,8 +350,8 @@ _assuan_inquire_ext_cb (assuan_context_t ctx) **/ gpg_error_t assuan_inquire_ext (assuan_context_t ctx, const char *keyword, size_t maxlen, - int (*cb) (void *cb_data, int rc, unsigned char *buf, - size_t len), + gpg_error_t (*cb) (void *cb_data, gpg_error_t rc, + unsigned char *buf, size_t len), void *cb_data) { gpg_error_t rc; diff --git a/src/assuan-listen.c b/src/assuan-listen.c index 3fe6975..7a17181 100644 --- a/src/assuan-listen.c +++ b/src/assuan-listen.c @@ -72,7 +72,7 @@ assuan_set_hello_line (assuan_context_t ctx, const char *line) gpg_error_t assuan_accept (assuan_context_t ctx) { - int rc; + gpg_error_t rc; const char *p, *pend; if (!ctx) diff --git a/src/assuan-pipe-connect.c b/src/assuan-pipe-connect.c index 4dea21e..92d3926 100644 --- a/src/assuan-pipe-connect.c +++ b/src/assuan-pipe-connect.c @@ -106,7 +106,7 @@ writen (int fd, const char *buffer, size_t length) } #endif -static int +static void do_finish (assuan_context_t ctx) { if (ctx->inbound.fd != ASSUAN_INVALID_FD) @@ -134,7 +134,6 @@ do_finish (assuan_context_t ctx) ctx->pid = (pid_t) INVALID_HANDLE_VALUE; #endif /*HAVE_W32_SYSTEM*/ } - return 0; } diff --git a/src/assuan-pipe-server.c b/src/assuan-pipe-server.c index afc0848..a732db7 100644 --- a/src/assuan-pipe-server.c +++ b/src/assuan-pipe-server.c @@ -40,14 +40,14 @@ deinit_pipe_server (assuan_context_t ctx) /* nothing to do for this simple server */ } -static int +static gpg_error_t accept_connection (assuan_context_t ctx) { /* This is a NOP for a pipe server */ return 0; } -static int +static gpg_error_t finish_connection (assuan_context_t ctx) { /* This is a NOP for a pipe server */ @@ -56,7 +56,7 @@ finish_connection (assuan_context_t ctx) /* Create a new context. Note that the handlers are set up for a pipe server/client - this way we don't need extra dummy functions */ -int +gpg_error_t _assuan_new_context (assuan_context_t *r_ctx) { static struct assuan_io io = { _assuan_simple_read, @@ -64,7 +64,7 @@ _assuan_new_context (assuan_context_t *r_ctx) 0, 0 }; assuan_context_t ctx; - int rc; + gpg_error_t rc; *r_ctx = NULL; ctx = _assuan_calloc (1, sizeof *ctx); @@ -106,7 +106,7 @@ is_valid_socket (const char *s) #endif /*!HAVE_W32_SYSTEM*/ -int +gpg_error_t assuan_init_pipe_server (assuan_context_t *r_ctx, int filedes[2]) { int rc; diff --git a/src/assuan-socket-server.c b/src/assuan-socket-server.c index 67b07d1..a205b9e 100644 --- a/src/assuan-socket-server.c +++ b/src/assuan-socket-server.c @@ -44,7 +44,7 @@ static struct assuan_io io = { _assuan_simple_read, _assuan_simple_write, NULL, NULL }; -static int +static gpg_error_t accept_connection_bottom (assuan_context_t ctx) { assuan_fd_t fd = ctx->connected_fd; @@ -86,7 +86,7 @@ accept_connection_bottom (assuan_context_t ctx) } -static int +static gpg_error_t accept_connection (assuan_context_t ctx) { assuan_fd_t fd; @@ -109,7 +109,7 @@ accept_connection (assuan_context_t ctx) return accept_connection_bottom (ctx); } -static int +static gpg_error_t finish_connection (assuan_context_t ctx) { if (ctx->inbound.fd != ASSUAN_INVALID_FD) @@ -130,26 +130,18 @@ deinit_socket_server (assuan_context_t ctx) /* Initialize a server for the socket LISTEN_FD which has already be put into listen mode */ -int +gpg_error_t assuan_init_socket_server (assuan_context_t *r_ctx, assuan_fd_t listen_fd) { return assuan_init_socket_server_ext (r_ctx, listen_fd, 0); } -/* Initialize a server using the already accepted socket FD. This - function is deprecated. */ -int -assuan_init_connected_socket_server (assuan_context_t *r_ctx, assuan_fd_t fd) -{ - return assuan_init_socket_server_ext (r_ctx, fd, 2); -} - /* Flag bits: 0 - use sendmsg/recvmsg to allow descriptor passing 1 - FD has already been accepted. */ -int +gpg_error_t assuan_init_socket_server_ext (assuan_context_t *r_ctx, assuan_fd_t fd, unsigned int flags) { diff --git a/src/assuan-util.c b/src/assuan-util.c index 589e98f..e12b44e 100644 --- a/src/assuan-util.c +++ b/src/assuan-util.c @@ -102,8 +102,8 @@ _assuan_free (void *p) /* Store the error in the context so that the error sending function can take out a descriptive text. Inside the assuan code, use the macro set_error instead of this function. */ -int -assuan_set_error (assuan_context_t ctx, int err, const char *text) +gpg_error_t +assuan_set_error (assuan_context_t ctx, gpg_error_t err, const char *text) { ctx->err_no = err; ctx->err_str = text; diff --git a/src/assuan.h b/src/assuan.h index 9755696..105862f 100644 --- a/src/assuan.h +++ b/src/assuan.h @@ -293,29 +293,29 @@ typedef struct assuan_io_hooks *assuan_io_hooks_t; /*-- assuan-handler.c --*/ -int assuan_register_command (assuan_context_t ctx, - const char *cmd_string, - int (*handler)(assuan_context_t, char *)); -int assuan_register_post_cmd_notify (assuan_context_t ctx, - void (*fnc)(assuan_context_t, int)); -int assuan_register_bye_notify (assuan_context_t ctx, - void (*fnc)(assuan_context_t)); -int assuan_register_reset_notify (assuan_context_t ctx, - void (*fnc)(assuan_context_t)); -int assuan_register_cancel_notify (assuan_context_t ctx, - void (*fnc)(assuan_context_t)); -int assuan_register_input_notify (assuan_context_t ctx, - void (*fnc)(assuan_context_t, const char *)); -int assuan_register_output_notify (assuan_context_t ctx, - void (*fnc)(assuan_context_t, const char *)); - -int assuan_register_option_handler (assuan_context_t ctx, - int (*fnc)(assuan_context_t, - const char*, const char*)); +gpg_error_t assuan_register_command (assuan_context_t ctx, + const char *cmd_string, + gpg_error_t (*handler)(assuan_context_t, char *)); +gpg_error_t assuan_register_post_cmd_notify (assuan_context_t ctx, + void (*fnc)(assuan_context_t, gpg_error_t)); +gpg_error_t assuan_register_bye_notify (assuan_context_t ctx, + void (*fnc)(assuan_context_t)); +gpg_error_t assuan_register_reset_notify (assuan_context_t ctx, + void (*fnc)(assuan_context_t)); +gpg_error_t assuan_register_cancel_notify (assuan_context_t ctx, + void (*fnc)(assuan_context_t)); +gpg_error_t assuan_register_input_notify (assuan_context_t ctx, + void (*fnc)(assuan_context_t, const char *)); +gpg_error_t assuan_register_output_notify (assuan_context_t ctx, + void (*fnc)(assuan_context_t, const char *)); + +gpg_error_t assuan_register_option_handler (assuan_context_t ctx, + gpg_error_t (*fnc)(assuan_context_t, + const char*, const char*)); gpg_error_t assuan_process (assuan_context_t ctx); -int assuan_process_next (assuan_context_t ctx); -int assuan_process_done (assuan_context_t ctx, int rc); +gpg_error_t assuan_process_next (assuan_context_t ctx); +gpg_error_t assuan_process_done (assuan_context_t ctx, gpg_error_t rc); int assuan_get_active_fds (assuan_context_t ctx, int what, assuan_fd_t *fdarray, int fdarraysize); @@ -344,36 +344,38 @@ gpg_error_t assuan_close_output_fd (assuan_context_t ctx); /*-- assuan-pipe-server.c --*/ -int assuan_init_pipe_server (assuan_context_t *r_ctx, int filedes[2]); +gpg_error_t assuan_init_pipe_server (assuan_context_t *r_ctx, int filedes[2]); void assuan_deinit_server (assuan_context_t ctx); /*-- assuan-socket-server.c --*/ -int assuan_init_socket_server (assuan_context_t *r_ctx, assuan_fd_t listen_fd); -int assuan_init_socket_server_ext (assuan_context_t *r_ctx, assuan_fd_t fd, - unsigned int flags); +gpg_error_t assuan_init_socket_server (assuan_context_t *r_ctx, + assuan_fd_t listen_fd); +gpg_error_t assuan_init_socket_server_ext (assuan_context_t *r_ctx, + assuan_fd_t fd, + unsigned int flags); void assuan_set_sock_nonce (assuan_context_t ctx, assuan_sock_nonce_t *nonce); /*-- assuan-pipe-connect.c --*/ gpg_error_t assuan_pipe_connect (assuan_context_t *ctx, - const char *name, - const char *const argv[], - int *fd_child_list); + const char *name, + const char *const argv[], + int *fd_child_list); gpg_error_t assuan_pipe_connect_ext (assuan_context_t *ctx, - const char *name, - const char *const argv[], - int *fd_child_list, - void (*atfork) (void *, int), - void *atforkvalue, - unsigned int flags); + const char *name, + const char *const argv[], + int *fd_child_list, + void (*atfork) (void *, int), + void *atforkvalue, + unsigned int flags); /*-- assuan-socket-connect.c --*/ gpg_error_t assuan_socket_connect (assuan_context_t *ctx, - const char *name, - pid_t server_pid); + const char *name, + pid_t server_pid); gpg_error_t assuan_socket_connect_ext (assuan_context_t *ctx, - const char *name, - pid_t server_pid, - unsigned int flags); + const char *name, + pid_t server_pid, + unsigned int flags); /*-- assuan-connect.c --*/ void assuan_disconnect (assuan_context_t ctx); @@ -401,9 +403,10 @@ gpg_error_t assuan_inquire (assuan_context_t ctx, const char *keyword, size_t maxlen); gpg_error_t assuan_inquire_ext (assuan_context_t ctx, const char *keyword, size_t maxlen, - int (*cb) (void *cb_data, int rc, - unsigned char *buf, - size_t buf_len), + gpg_error_t (*cb) (void *cb_data, + gpg_error_t rc, + unsigned char *buf, + size_t buf_len), void *cb_data); /*-- assuan-buffer.c --*/ gpg_error_t assuan_read_line (assuan_context_t ctx, @@ -426,7 +429,7 @@ void assuan_set_malloc_hooks ( void *(*new_alloc_func)(size_t n), void (*new_free_func)(void*) ); void assuan_set_io_hooks (assuan_io_hooks_t io_hooks); void assuan_set_log_stream (assuan_context_t ctx, FILE *fp); -int assuan_set_error (assuan_context_t ctx, int err, const char *text); +gpg_error_t assuan_set_error (assuan_context_t ctx, gpg_error_t err, const char *text); void assuan_set_pointer (assuan_context_t ctx, void *pointer); void *assuan_get_pointer (assuan_context_t ctx); @@ -445,7 +448,7 @@ void assuan_set_io_monitor (assuan_context_t ctx, void assuan_set_flag (assuan_context_t ctx, assuan_flag_t flag, int value); /* Return the VALUE of FLAG in context CTX. */ -int assuan_get_flag (assuan_context_t ctx, assuan_flag_t flag); +int assuan_get_flag (assuan_context_t ctx, assuan_flag_t flag); /*-- assuan-errors.c --*/ |