1 /* data-fd.c - A file descripor based data object.
2 Copyright (C) 2002, 2004 g10 Code GmbH
4 This file is part of GPGME.
6 GPGME is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation; either version 2.1 of
9 the License, or (at your option) any later version.
11 GPGME is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
26 #include <sys/types.h>
32 fd_read (gpgme_data_t dh, void *buffer, size_t size)
34 return read (dh->data.fd, buffer, size);
39 fd_write (gpgme_data_t dh, const void *buffer, size_t size)
41 return write (dh->data.fd, buffer, size);
46 fd_seek (gpgme_data_t dh, off_t offset, int whence)
48 return lseek (dh->data.fd, offset, whence);
53 fd_get_fd (gpgme_data_t dh)
59 static struct _gpgme_data_cbs fd_cbs =
70 gpgme_data_new_from_fd (gpgme_data_t *dh, int fd)
72 gpgme_error_t err = _gpgme_data_new (dh, &fd_cbs);