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 data_object_internal.h 00022 * 00023 * Definitions for internal use by the data_object_t implementations. 00024 */ 00025 #ifndef _DATA_OBJECT_INTERNAL_H 00026 #define _DATA_OBJECT_INTERNAL_H 00027 00028 #ifdef __cplusplus 00029 extern "C" { 00030 #endif 00031 00032 #include <sys/types.h> 00033 #include "data_object.h" 00034 00035 /** 00036 * The functions in the data_object ADT that must be implemented. 00037 */ 00038 struct data_object_funcs { 00039 int (*get_data)(data_object_t *obj, void **buf, off_t offset, 00040 off_t *length, data_object_flags flags); 00041 int (*free)(data_object_t *obj); 00042 int (*get_size)(data_object_t *obj, off_t *size); 00043 int (*compare)(int *result, data_object_t *obj1, data_object_t *obj2); 00044 }; 00045 00046 int data_object_create_impl(data_object_t **obj, void *impl, 00047 struct data_object_funcs *funcs); 00048 00049 void *data_object_get_impl(data_object_t *obj); 00050 00051 #ifdef __cplusplus 00052 } 00053 #endif 00054 00055 #endif 00056