Main Page | Class List | File List | Class Members | File Members

share.h

Go to the documentation of this file.
00001 /* 00002 * $Id: share.h,v 1.6 2003/10/16 18:50:55 jasta Exp $ 00003 * 00004 * Copyright (C) 2001-2003 giFT project (gift.sourceforge.net) 00005 * 00006 * This program is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU General Public License as published by the 00008 * Free Software Foundation; either version 2, or (at your option) any 00009 * later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, but 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * General Public License for more details. 00015 */ 00016 00017 #ifndef __SHARE_H 00018 #define __SHARE_H 00019 00020 /*****************************************************************************/ 00021 00036 /*****************************************************************************/ 00037 00038 /* duplicate here because this file may be used without protocol.h */ 00039 #ifndef LIBGIFTPROTO_EXPORT 00040 # define LIBGIFTPROTO_EXPORT /* nothing */ 00041 #endif 00042 00043 /*****************************************************************************/ 00044 00045 struct protocol; 00046 00047 /*****************************************************************************/ 00048 00049 #include "share_hash.h" 00050 00051 /*****************************************************************************/ 00052 00058 struct file_share 00059 { 00063 char *path; 00064 char *root; 00067 char *mime; 00069 time_t mtime; 00071 off_t size; 00077 unsigned int ref; 00082 Dataset *meta; 00083 Dataset *hash; 00084 Dataset *udata; 00089 struct protocol *p; 00092 }; 00093 00094 typedef struct file_share Share; 00095 00096 /*****************************************************************************/ 00097 00098 /* backwards compatibility should be maintained for now so that we can 00099 * easily identify old interfaces */ 00100 #define SHARE_BACKCOMPAT 00101 00102 #ifdef SHARE_BACKCOMPAT 00103 typedef struct file_share FileShare; 00104 #define SHARE_DATA(share) (share) 00105 #endif /* SHARE_BACKCOMPAT */ 00106 00107 /*****************************************************************************/ 00108 00109 EXTERN_C_BEGIN 00110 00111 /*****************************************************************************/ 00112 00117 LIBGIFTPROTO_EXPORT 00118 BOOL share_init (Share *share, const char *path); 00119 00125 LIBGIFTPROTO_EXPORT 00126 void share_finish (Share *share); 00127 00128 /*****************************************************************************/ 00129 00138 LIBGIFTPROTO_EXPORT 00139 Share *share_new (const char *path); 00140 00146 LIBGIFTPROTO_EXPORT 00147 Share *share_new_ex (struct protocol *p, const char *root, size_t root_len, 00148 const char *path, const char *mime, off_t size, 00149 time_t mtime); 00150 00156 LIBGIFTPROTO_EXPORT 00157 void share_free (Share *share); 00158 00159 /*****************************************************************************/ 00160 00169 LIBGIFTPROTO_EXPORT 00170 unsigned int share_ref (Share *share); 00171 00179 LIBGIFTPROTO_EXPORT 00180 unsigned int share_unref (Share *share); 00181 00182 /*****************************************************************************/ 00183 00197 LIBGIFTPROTO_EXPORT 00198 char *share_get_hpath (Share *share); 00199 00200 /*****************************************************************************/ 00201 00206 LIBGIFTPROTO_EXPORT 00207 void share_set_path (Share *share, const char *path); 00208 00215 LIBGIFTPROTO_EXPORT 00216 void share_set_root (Share *share, const char *root, size_t len); 00217 00223 LIBGIFTPROTO_EXPORT 00224 void share_set_mime (Share *share, const char *mime); 00225 00226 /*****************************************************************************/ 00227 00237 LIBGIFTPROTO_EXPORT 00238 void share_set_meta (Share *share, const char *key, const char *value); 00239 00243 LIBGIFTPROTO_EXPORT 00244 char *share_get_meta (Share *share, const char *key); 00245 00249 LIBGIFTPROTO_EXPORT 00250 void share_clear_meta (Share *share); 00251 00255 LIBGIFTPROTO_EXPORT 00256 void share_foreach_meta (Share *share, DatasetForeachFn func, void *udata); 00257 00258 /*****************************************************************************/ 00259 00269 LIBGIFTPROTO_EXPORT 00270 void share_set_udata (Share *share, const char *proto, void *udata); 00271 00276 LIBGIFTPROTO_EXPORT 00277 void *share_get_udata (Share *share, const char *proto); 00278 00279 /*****************************************************************************/ 00280 00286 LIBGIFTPROTO_EXPORT 00287 BOOL share_complete (Share *share); 00288 00289 /*****************************************************************************/ 00290 00291 EXTERN_C_END 00292 00293 /*****************************************************************************/ 00294 00295 #endif /* __SHARE_H */

Generated on Sun Aug 22 08:08:53 2004 by doxygen 1.3.7