Add trivial HM decoder
[doldaconnect.git] / daemon / client.h
CommitLineData
d3372da9 1/*
2 * Dolda Connect - Modular multiuser Direct Connect-style client
3 * Copyright (C) 2004 Fredrik Tolf (fredrik@dolda2000.com)
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19#ifndef _CLIENT_H
20#define _CLIENT_H
21
22#include <sys/types.h>
23
24#include <utils.h>
25
26#define FILE_REG 0
27#define FILE_DIR 1
28#define FILE_INT 2
29
30#define HASHHASHSIZE 12
31
32struct sharepoint
33{
34 struct sharepoint *prev, *next;
35 char *path;
36 wchar_t *name;
37 int delete;
38};
39
40struct hashcache
41{
42 struct hashcache *next, *prev;
43 dev_t dev;
44 ino_t inode;
45 time_t mtime;
46 char tth[24];
47};
48
49struct sharecache
50{
51 struct sharecache *next, *prev, *child, *parent;
52 char *path;
53 wchar_t *name;
54 size_t size;
55 time_t mtime;
56 dev_t dev;
57 ino_t inode;
58 char hashtth[24];
59 union
60 {
61 struct
62 {
63 int type:3;
64 int hastth:1;
65 int found:1;
66 } b;
67 int w;
68 } f;
69 CBCHAIN(share_delete, struct sharecache *);
70};
71
72void clientpreinit(void);
73int clientinit(void);
74int doscan(int quantum);
75int opensharecache(struct sharecache *node);
76struct sharecache *findcache(struct sharecache *parent, wchar_t *name);
77void queuescan(struct sharecache *node);
78char *getfspath(struct sharecache *node);
79struct sharecache *nextscnode(struct sharecache *node);
80
81extern struct sharecache *shareroot;
82extern unsigned long long sharesize;
83EGCBCHAIN(sharechangecb, unsigned long long);
84
85#endif