http://prdownloads.sourceforge.net/lufs/lufs-0.9.7.tar.gz?download
[lufs.git] / filesystems / sshfs / sshfs.h
1 /*
2  * sshfs.h
3  * Copyright (C) 2002 Florin Malita <mali@go.ro>
4  *
5  * This file is part of LUFS, a free userspace filesystem implementation.
6  * See http://lufs.sourceforge.net/ for updates.
7  *
8  * LUFS is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * LUFS is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
22
23 #ifndef _SSHFS_H_
24 #define _SSHFS_H_
25
26 using namespace std;
27
28 struct directory;
29 struct dir_cache;
30
31 #ifdef DEBUGGING
32 #define HANDLES_TTL     30
33 #else
34 #define HANDLES_TTL     300
35 #endif
36
37 struct atbl{
38     string name;
39     string handle;
40     time_t stamp;
41     unsigned mode;
42 };
43
44 class SConnection;
45
46 class SSHFS{
47   private:
48     struct credentials *cred;
49     struct dir_cache *cache;
50     struct list_head *cfg;
51     unsigned seq;
52     SConnection *conn;
53     vector<struct atbl> handles;
54
55     struct atbl* find_handle(char*, unsigned, vector<struct atbl>*);
56
57   public:
58     SSHFS(struct list_head*, struct dir_cache*, struct credentials*);
59     ~SSHFS();
60
61     int do_mount();
62     void do_umount();
63     int do_readdir(char*, struct directory*);
64     int do_stat(char*, struct lufs_fattr*);
65     int do_readlink(char*, char*, int);
66     int do_open(char*, unsigned);
67     int do_release(char*);
68     int do_read(char*, long long, unsigned long, char*);
69     int do_write(char*, long long, unsigned long, char*);
70     int do_mkdir(char*, int);
71     int do_rmdir(char*);
72     int do_unlink(char*);
73     int do_create(char*, int);
74     int do_rename(char*, char*);
75     int do_setattr(char*, struct lufs_fattr*);
76     int do_symlink(char*, char*);
77 };
78
79 #endif