comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:85f3ccf09ad7
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 */
16
17 #ifndef __GT_SHARE_FILE_H__
18 #define __GT_SHARE_FILE_H__
19
20 /******************************************************************************/
21
22 struct file_share;
23
24 struct gt_token_set;
25
26 struct gt_share
27 {
28 uint32_t index;
29 char *filename;
30 struct gt_token_set *tokens;
31 };
32
33 typedef struct gt_share GtShare;
34
35 /******************************************************************************/
36
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);
40
41 /******************************************************************************/
42
43 struct gt_token_set *gt_share_tokenize (char *words);
44
45 /******************************************************************************/
46
47 unsigned int gt_share_ref (struct file_share *file);
48 unsigned int gt_share_unref (struct file_share *file);
49
50 /******************************************************************************/
51
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);
54
55 /******************************************************************************/
56
57 FileShare *gt_share_local_lookup_by_hash (unsigned char *sha1);
58
59 /******************************************************************************/
60
61 #endif /* __GT_SHARE_FILE_H__ */