2
* $Id: share.h,v 1.25 2004/01/01 18:28:24 rmanfredi Exp $
4
* Copyright (c) 2001-2003, Raphael Manfredi
5
* Copyright (c) 2000 Daniel Walker (dwalker@cats.ucsc.edu)
7
*----------------------------------------------------------------------
8
* This file is part of gtk-gnutella.
10
* gtk-gnutella is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
15
* gtk-gnutella is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with gtk-gnutella; if not, write to the Free Software
23
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24
*----------------------------------------------------------------------
36
/* A file extension we have to share */
38
gchar *str; /* Extension string (e.g. "html") */
39
gint len; /* Extension length (e.g. 4) */
42
typedef struct shared_file {
43
gchar *file_path; /* The full path of the file */
44
gchar *file_name; /* Pointer within file_path at start of filename */
45
guint32 file_index; /* the files index within our local DB */
46
guint32 file_size; /* File size in Bytes */
47
guint32 flags; /* See below for definition */
49
time_t mtime; /* Last modification time, for SHA1 computation */
50
gchar sha1_digest[SHA1_RAW_SIZE]; /* SHA1 digest, binary form */
51
struct dl_file_info *fi; /* PFSP-server: the holding fileinfo */
58
#define SHARE_F_HAS_DIGEST 0x00000001 /* Digest is set */
59
#define SHARE_F_RECOMPUTING 0x00000002 /* Digest being recomputed */
61
struct gnutella_search_results_out {
67
/* Last 16 bytes = client_id */
74
extern guint32 files_scanned, bytes_scanned, kbytes_scanned;
75
extern GSList *extensions, *shared_dirs;
78
* Special return value from shared_file() during library rebuild time.
79
* This is needed because we no longer block the GUI whilst scanning.
82
#define SHARE_REBUILDING ((struct shared_file *) 0x1)
88
void share_init(void);
89
struct shared_file *shared_file(guint idx);
90
struct shared_file *shared_file_by_name(const gchar *basename);
91
void share_scan(void);
92
void share_close(void);
93
gboolean search_request(struct gnutella_node *n, struct query_hashvec *qhv);
94
void parse_extensions(const gchar *);
95
gchar *get_file_path(gint);
96
void shared_dirs_update_prop(void);
97
gboolean shared_dirs_parse(const gchar *);
98
void shared_dir_add(const gchar *);
99
gint get_file_size(gint);
101
void shared_file_free(shared_file_t *sf);
103
void set_sha1(struct shared_file *, const gchar *sha1_digest);
104
struct shared_file *shared_file_by_sha1(gchar *sha1_digest);
105
gboolean sha1_hash_available(const struct shared_file *);
106
gboolean sha1_hash_is_uptodate(struct shared_file *sf);
107
gboolean is_latin_locale(void);
108
void use_map_on_query(guchar *query, int len);
110
#endif /* _share_h_ */