paulo@0: /* paulo@0: * $Id: gt_share_file.h,v 1.7 2003/06/01 09:20:35 hipnod Exp $ paulo@0: * paulo@0: * Copyright (C) 2001-2003 giFT project (gift.sourceforge.net) paulo@0: * paulo@0: * This program is free software; you can redistribute it and/or modify it paulo@0: * under the terms of the GNU General Public License as published by the paulo@0: * Free Software Foundation; either version 2, or (at your option) any paulo@0: * later version. paulo@0: * paulo@0: * This program is distributed in the hope that it will be useful, but paulo@0: * WITHOUT ANY WARRANTY; without even the implied warranty of paulo@0: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU paulo@0: * General Public License for more details. paulo@0: */ paulo@0: paulo@0: #ifndef __GT_SHARE_FILE_H__ paulo@0: #define __GT_SHARE_FILE_H__ paulo@0: paulo@0: /******************************************************************************/ paulo@0: paulo@0: struct file_share; paulo@0: paulo@0: struct gt_token_set; paulo@0: paulo@0: struct gt_share paulo@0: { paulo@0: uint32_t index; paulo@0: char *filename; paulo@0: struct gt_token_set *tokens; paulo@0: }; paulo@0: paulo@0: typedef struct gt_share GtShare; paulo@0: paulo@0: /******************************************************************************/ paulo@0: paulo@0: struct file_share *gt_share_new (char *filename, uint32_t index, paulo@0: off_t size, unsigned char *sha1); paulo@0: void gt_share_free (struct file_share *file); paulo@0: paulo@0: /******************************************************************************/ paulo@0: paulo@0: struct gt_token_set *gt_share_tokenize (char *words); paulo@0: paulo@0: /******************************************************************************/ paulo@0: paulo@0: unsigned int gt_share_ref (struct file_share *file); paulo@0: unsigned int gt_share_unref (struct file_share *file); paulo@0: paulo@0: /******************************************************************************/ paulo@0: paulo@0: GtShare *gt_share_new_data (struct file_share *file, uint32_t index); paulo@0: void gt_share_free_data (struct file_share *file, GtShare *share); paulo@0: paulo@0: /******************************************************************************/ paulo@0: paulo@0: FileShare *gt_share_local_lookup_by_hash (unsigned char *sha1); paulo@0: paulo@0: /******************************************************************************/ paulo@0: paulo@0: #endif /* __GT_SHARE_FILE_H__ */