view src/gt_share_file.h @ 0:d39e1d0d75b6

initial add
author paulo@hit-nxdomain.opendns.com
date Sat, 20 Feb 2010 21:18:28 -0800
parents
children
line source
1 /*
2 * $Id: gt_share_file.h,v 1.7 2003/06/01 09:20:35 hipnod Exp $
3 *
4 * Copyright (C) 2001-2003 giFT project (gift.sourceforge.net)
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
9 * later version.
10 *
11 * This program 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 * General Public License for more details.
15 */
17 #ifndef __GT_SHARE_FILE_H__
18 #define __GT_SHARE_FILE_H__
20 /******************************************************************************/
22 struct file_share;
24 struct gt_token_set;
26 struct gt_share
27 {
28 uint32_t index;
29 char *filename;
30 struct gt_token_set *tokens;
31 };
33 typedef struct gt_share GtShare;
35 /******************************************************************************/
37 struct file_share *gt_share_new (char *filename, uint32_t index,
38 off_t size, unsigned char *sha1);
39 void gt_share_free (struct file_share *file);
41 /******************************************************************************/
43 struct gt_token_set *gt_share_tokenize (char *words);
45 /******************************************************************************/
47 unsigned int gt_share_ref (struct file_share *file);
48 unsigned int gt_share_unref (struct file_share *file);
50 /******************************************************************************/
52 GtShare *gt_share_new_data (struct file_share *file, uint32_t index);
53 void gt_share_free_data (struct file_share *file, GtShare *share);
55 /******************************************************************************/
57 FileShare *gt_share_local_lookup_by_hash (unsigned char *sha1);
59 /******************************************************************************/
61 #endif /* __GT_SHARE_FILE_H__ */