http://prdownloads.sourceforge.net/lufs/lufs-0.9.6.tar.gz?download
[lufs.git] / filesystems / cardfs / cardfs.h
1 /***************************************************************************
2  $RCSfile$
3                              -------------------
4     cvs         : $Id$
5     begin       : Thu Aug 15 2002
6     copyright   : (C) 2002 by Martin Preuss
7     email       : martin@libchipcard.de
8
9  ***************************************************************************
10  *                                                                         *
11  *   This library is free software; you can redistribute it and/or         *
12  *   modify it under the terms of the GNU Lesser General Public            *
13  *   License as published by the Free Software Foundation; either          *
14  *   version 2.1 of the License, or (at your option) any later version.    *
15  *                                                                         *
16  *   This library is distributed in the hope that it will be useful,       *
17  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
18  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
19  *   Lesser General Public License for more details.                       *
20  *                                                                         *
21  *   You should have received a copy of the GNU Lesser General Public      *
22  *   License along with this library; if not, write to the Free Software   *
23  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
24  *   MA  02111-1307  USA                                                   *
25  *                                                                         *
26  ***************************************************************************/
27
28
29 #ifndef _CARDFS_H_
30 #define _CARDFS_H_
31
32 #include <vector>
33 #include <string>
34
35 #include <chipcard.h>
36 #include <fileclient.h>
37
38 using namespace std;
39
40 struct directory;
41
42 #define TIMEOUT1 (10*1000)
43 #define TIMEOUT2 (60*1000)
44
45 /* Main filesystem class, extending FileSystem */
46 class CardFS{
47 private:
48     struct credentials *cred;
49     struct dir_cache *cache;
50     struct list_head *cfg;
51
52     string _host;
53     string _terminal;
54     string _cid;
55
56     struct lufs_fattr _entry2fattr(const CTDirEntry &e);
57     unsigned int _mode2attribs(int mode);
58
59 public:
60     CardFS(struct list_head*, struct dir_cache*, struct credentials*);
61     ~CardFS();
62
63     int do_mount();
64     void do_umount();
65     int do_readdir(char*, struct directory*);
66     int do_stat(char*, struct lufs_fattr*);
67     int do_mkdir(char*, int);
68     int do_rmdir(char*);
69     int do_create(char*, int);
70     int do_unlink(char*);
71     int do_rename(char*, char*);
72     int do_open(char*, unsigned);
73     int do_release(char*);
74     int do_read(char*, unsigned long, unsigned long, char*);
75     int do_write(char*, unsigned long, unsigned long, char*);
76     int do_readlink(char*, char*, int);
77     int do_link(char*, char*);
78     int do_symlink(char*, char*);
79     int do_setattr(char*, struct lufs_fattr*);
80 };
81
82 #endif
83