00001 /* 00002 * Copyright 2008, 2009 Alexandros Frantzis, Michael Iatrou 00003 * 00004 * This file is part of libbls. 00005 * 00006 * libbls is free software: you can redistribute it and/or modify it under the 00007 * terms of the GNU Lesser General Public License as published by the Free Software 00008 * Foundation, either version 3 of the License, or (at your option) any later 00009 * version. 00010 * 00011 * libbls is distributed in the hope that it will be useful, but WITHOUT ANY 00012 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00013 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 00014 * details. 00015 * 00016 * You should have received a copy of the GNU General Public License along with 00017 * libbls. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00020 /** 00021 * @file buffer_source.h 00022 * 00023 * Buffer source API 00024 */ 00025 #ifndef _BLESS_BUFFER_SOURCE_H 00026 #define _BLESS_BUFFER_SOURCE_H 00027 00028 #ifdef __cplusplus 00029 extern "C" { 00030 #endif 00031 00032 #include <sys/types.h> 00033 00034 /** 00035 * @addtogroup buffer 00036 * 00037 * @{ 00038 */ 00039 00040 /** 00041 * @name Buffer Sources 00042 */ 00043 00044 /** 00045 * Opaque type for a buffer source object. 00046 */ 00047 typedef void bless_buffer_source_t; 00048 00049 /** 00050 * A function to call to free the memory associated with a memory source object. 00051 */ 00052 typedef void (bless_mem_free_func)(void *); 00053 00054 /** 00055 * A function to call to close the file associated with a file source object. 00056 */ 00057 typedef int (bless_file_close_func)(int); 00058 00059 int bless_buffer_source_memory(bless_buffer_source_t **src, void *data, 00060 size_t length, bless_mem_free_func *mem_free); 00061 00062 int bless_buffer_source_file(bless_buffer_source_t **src, int fd, 00063 bless_file_close_func *file_close); 00064 00065 int bless_buffer_source_unref(bless_buffer_source_t *src); 00066 00067 /** @} */ 00068 00069 /** @} */ 00070 00071 #ifdef __cplusplus 00072 } 00073 #endif 00074 00075 #endif