From 5d0f173af5f4036a3793392899836b0fe7a01376 Mon Sep 17 00:00:00 2001 From: Neal Walfield Date: Sun, 24 Nov 2002 18:27:59 +0000 Subject: 2002-11-24 Neal H. Walfield * assuan.h (assuan_sendfd): New prototype. (assuan_receivefd): New prototype. * assuan-buffer.c (assuan_sendfd): New function. (assuan_receivefd): New function. * assuan-handler.c (parse_cmd_input_output): Recognize incoming file descriptors and act appropriately. * assuan-defs.h (struct assuan_io): Add fields sendfd and receivefd. (struct assuan_context_s): Add fields pendingfds and pendingfdscount. * assuan-pipe-server.c (_assuan_new_context): Update IO to reflect new features. * assuan-domain-connect.c (do_deinit): Cleanup any unreceived file descriptors. (domain_reader): Receive file descriptors. (domain_sendfd): New function. (domain_receivefd): New function. (_assuan_domain_init): Update initialization code to reflect new features. --- src/assuan-buffer.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/assuan-buffer.c') diff --git a/src/assuan-buffer.c b/src/assuan-buffer.c index 8ccd3bd..bbe3990 100644 --- a/src/assuan-buffer.c +++ b/src/assuan-buffer.c @@ -437,3 +437,23 @@ assuan_send_data (ASSUAN_CONTEXT ctx, const void *buffer, size_t length) return 0; } + +AssuanError +assuan_sendfd (ASSUAN_CONTEXT ctx, int fd) +{ + if (! ctx->io->sendfd) + return set_error (ctx, Not_Implemented, + "server does not support sending and receiving " + "of file descriptors"); + return ctx->io->sendfd (ctx, fd); +} + +AssuanError +assuan_receivefd (ASSUAN_CONTEXT ctx, int *fd) +{ + if (! ctx->io->receivefd) + return set_error (ctx, Not_Implemented, + "server does not support sending and receiving " + "of file descriptors"); + return ctx->io->receivefd (ctx, fd); +} -- cgit v1.2.3