diff options
author | Werner Koch <[email protected]> | 2001-12-05 23:45:01 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2001-12-05 23:45:01 +0000 |
commit | ac88a4e804713b70794d55beea3af7cc23b1807b (patch) | |
tree | cb54e7e22c42473143bd7bfb43dcebc66f9ec9c9 /assuan/assuan-buffer.c | |
parent | --armor does now produce PEM format. (diff) | |
download | gnupg-ac88a4e804713b70794d55beea3af7cc23b1807b.tar.gz gnupg-ac88a4e804713b70794d55beea3af7cc23b1807b.zip |
assuan-connect.c (assuan_pipe_connect): Add more error reporting.
assuan-client.c: New.
assuan-inquire.c: New.
assuan-handler.c (process_request): Check for nested invocations.
Diffstat (limited to 'assuan/assuan-buffer.c')
-rw-r--r-- | assuan/assuan-buffer.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/assuan/assuan-buffer.c b/assuan/assuan-buffer.c index f3fe2b188..eec4876f8 100644 --- a/assuan/assuan-buffer.c +++ b/assuan/assuan-buffer.c @@ -265,5 +265,50 @@ _assuan_cookie_write_flush (void *cookie) } +/** + * assuan_send_data: + * @ctx: An assuan context + * @buffer: Data to send or NULL to flush + * @length: length of the data to send/ + * + * This function may be used by the server or the client to send data + * lines. The data will be escaped as required by the Assuan protocol + * and may get buffered until a line is full. To force sending the + * data out @buffer may be passed as NULL (in which case @length must + * also be 0); however when used by a client this flush operation does + * also send the terminating "END" command to terminate the reponse on + * a INQUIRE response. However, when assuan_transact() is used, this + * function takes care of sending END itself. + * + * Return value: 0 on success or an error code + **/ + +AssuanError +assuan_send_data (ASSUAN_CONTEXT ctx, const void *buffer, size_t length) +{ + if (!ctx) + return ASSUAN_Invalid_Value; + if (!buffer && length) + return ASSUAN_Invalid_Value; + + if (!buffer) + { /* flush what we have */ + _assuan_cookie_write_flush (ctx); + if (ctx->outbound.data.error) + return ctx->outbound.data.error; + if (!ctx->is_server) + return _assuan_write_line (ctx, "END"); + } + else + { + _assuan_cookie_write_data (ctx, buffer, length); + if (ctx->outbound.data.error) + return ctx->outbound.data.error; + } + + return 0; +} + + |