]> arthur.barton.de Git - netatalk.git/blob - etc/afpd/volume.h
Add a Samba like preexec functionality.
[netatalk.git] / etc / afpd / volume.h
1 /*
2  * $Id: volume.h,v 1.19.2.1 2003-05-26 11:04:36 didg Exp $
3  *
4  * Copyright (c) 1990,1994 Regents of The University of Michigan.
5  * All Rights Reserved.  See COPYRIGHT.
6  */
7
8 #ifndef AFPD_VOLUME_H
9 #define AFPD_VOLUME_H 1
10
11 #include <sys/cdefs.h>
12 #include <sys/types.h>
13 #include <netatalk/endian.h>
14
15 #ifdef HAVE_USABLE_ICONV
16 #include <iconv.h>
17 #endif
18
19 #include "globals.h"
20
21 #define AFPVOL_NAMELEN   27
22
23 struct codepage_hash {
24     unsigned char *from, *to;
25     struct codepage_hash *next, *prev;
26 };
27
28 union codepage_val {
29     struct codepage_hash hash; /* hash for multibyte values */
30     unsigned char value; /* single byte value/rule */
31 };
32
33 struct codepage {
34     union codepage_val *map;
35     int quantum;
36 };
37
38 #define CP_HASH(a)    (*(a))
39
40 struct vol {
41     struct vol          *v_next;
42     char                *v_name;
43     char                *v_path;
44     struct dir          *v_dir, *v_root;
45     int                 v_flags;
46 #ifdef __svr4__
47     int                 v_qfd;
48 #endif /*__svr4__*/
49     char                *v_gvs;
50     time_t              v_time;
51     int                 v_lastdid;
52     u_int16_t           v_vid;
53     void                *v_nfsclient;
54     int                 v_nfs;
55     
56     int                 v_casefold;
57     struct codepage     *v_mtoupage, *v_utompage, *v_badumap;
58     size_t              max_filename;
59     
60     char                *v_password;
61     char                *v_veto;
62
63 #ifdef CNID_DB
64     void                *v_db;
65     char                *v_dbpath;
66 #endif 
67     mode_t              v_umask;
68
69 #ifdef FORCE_UIDGID
70     char                *v_forceuid;
71     char                *v_forcegid;
72 #endif 
73
74 #ifdef HAVE_USABLE_ICONV
75     iconv_t             *v_utf8toucs2;
76     iconv_t             *v_ucs2toutf8;
77     iconv_t             *v_mactoutf8;
78     iconv_t             *v_ucs2tomac;
79 #endif
80
81     char                *v_root_preexec;
82     char                *v_preexec;
83
84     char                *v_root_postexec;
85     char                *v_postexec;
86
87     int                 v_root_preexec_close;
88     int                 v_preexec_close;
89 };
90
91 #ifdef NO_LARGE_VOL_SUPPORT
92 typedef u_int32_t VolSpace;
93 #else /* NO_LARGE_VOL_SUPPORT */
94 typedef u_int64_t VolSpace;
95 #endif /* NO_LARGE_VOL_SUPPORT */
96
97 #define AFPVOL_OPEN     (1<<0)
98 #define AFPVOL_DT       (1<<1)
99
100 #define AFPVOL_GVSMASK  (7<<2)
101 #define AFPVOL_NONE     (0<<2)
102 #define AFPVOL_AFSGVS   (1<<2)
103 #define AFPVOL_USTATFS  (2<<2)
104 #define AFPVOL_UQUOTA   (4<<2)
105
106 /* flags that alter volume behaviour. */
107 #define AFPVOL_A2VOL     (1 << 5)   /* prodos volume */
108 #define AFPVOL_CRLF      (1 << 6)   /* cr/lf translation */
109 #define AFPVOL_NOADOUBLE (1 << 7)   /* don't create .AppleDouble by default */
110 #define AFPVOL_RO        (1 << 8)   /* read-only volume */
111 #define AFPVOL_MSWINDOWS (1 << 9)   /* deal with ms-windows yuckiness.
112 this is going away. */
113 #define AFPVOL_NOHEX     (1 << 10)  /* don't do :hex translation */
114 #define AFPVOL_USEDOTS   (1 << 11)  /* use real dots */
115 #define AFPVOL_LIMITSIZE (1 << 12)  /* limit size for older macs */
116 #define AFPVOL_MAPASCII  (1 << 13)  /* map the ascii range as well */
117 #define AFPVOL_DROPBOX   (1 << 14)  /* dropkludge dropbox support */
118 #define AFPVOL_NOFILEID  (1 << 15)  /* don't advertise createid resolveid and deleteid calls */
119 #define AFPVOL_UTF8      (1 << 16)  /* unix name are in UTF8 */
120
121 /* FPGetSrvrParms options */
122 #define AFPSRVR_CONFIGINFO     (1 << 0)
123 #define AFPSRVR_PASSWD         (1 << 7)
124
125 /* handle casefolding */
126 #define AFPVOL_MTOUUPPER       (1 << 0) 
127 #define AFPVOL_MTOULOWER       (1 << 1) 
128 #define AFPVOL_UTOMUPPER       (1 << 2) 
129 #define AFPVOL_UTOMLOWER       (1 << 3) 
130 #define AFPVOL_UMLOWER         (AFPVOL_MTOULOWER | AFPVOL_UTOMLOWER)
131 #define AFPVOL_UMUPPER         (AFPVOL_MTOUUPPER | AFPVOL_UTOMUPPER)
132 #define AFPVOL_UUPPERMLOWER    (AFPVOL_MTOUUPPER | AFPVOL_UTOMLOWER)
133 #define AFPVOL_ULOWERMUPPER    (AFPVOL_MTOULOWER | AFPVOL_UTOMUPPER)
134
135 #define MSWINDOWS_BADCHARS ":\t\\/<>*?|\""
136 #define MSWINDOWS_CODEPAGE "maccode.iso8859-1"
137
138 int wincheck(const struct vol *vol, const char *path);
139
140 #define AFPVOLSIG_FLAT          0x0001 /* flat fs */
141 #define AFPVOLSIG_FIX           0x0002 /* fixed ids */
142 #define AFPVOLSIG_VAR           0x0003 /* variable ids */
143 #define AFPVOLSIG_DEFAULT       AFPVOLSIG_FIX
144
145 /* volume attributes */
146 #define VOLPBIT_ATTR_RO           (1 << 0)
147 #define VOLPBIT_ATTR_PASSWD       (1 << 1)
148 #define VOLPBIT_ATTR_FILEID       (1 << 2)
149 #define VOLPBIT_ATTR_CATSEARCH    (1 << 3)
150 #define VOLPBIT_ATTR_BLANKACCESS  (1 << 4)
151 #define VOLPBIT_ATTR_UNIXPRIV     (1 << 5)
152 #define VOLPBIT_ATTR_UTF8         (1 << 6)
153 #define VOLPBIT_ATTR_NONETUID     (1 << 7)
154
155 #define VOLPBIT_ATTR    0
156 #define VOLPBIT_SIG     1
157 #define VOLPBIT_CDATE   2
158 #define VOLPBIT_MDATE   3
159 #define VOLPBIT_BDATE   4
160 #define VOLPBIT_VID     5
161 #define VOLPBIT_BFREE   6
162 #define VOLPBIT_BTOTAL  7
163 #define VOLPBIT_NAME    8
164 /* handle > 4GB volumes */
165 #define VOLPBIT_XBFREE  9
166 #define VOLPBIT_XBTOTAL 10
167 #define VOLPBIT_BSIZE   11        /* block size */
168
169
170 #define vol_noadouble(vol) (((vol)->v_flags & AFPVOL_NOADOUBLE) ? \
171                             ADFLAGS_NOADOUBLE : 0)
172
173 #ifdef AFP3x
174 #define vol_utf8(vol) ((vol)->v_flags & AFPVOL_UTF8)
175 #define utf8_encoding() (afp_version >= 30)
176 #else
177 #define vol_utf8(vol) (0)
178 #define utf8_encoding() (0)
179 #endif
180
181 extern struct vol       *getvolbyvid __P((const u_int16_t));
182 extern int              ustatfs_getvolspace __P((const struct vol *,
183             VolSpace *, VolSpace *,
184             u_int32_t *));
185 extern int              codepage_init __P((struct vol *, const int,
186             const int));
187 extern int              codepage_read __P((struct vol *, const char *));
188 extern union codepage_val codepage_find __P(());
189 extern void             setvoltime __P((AFPObj *, struct vol *));
190 extern int              pollvoltime __P((AFPObj *));
191
192 /* FP functions */
193 extern int      afp_openvol      __P((AFPObj *, char *, int, char *, int *));
194 extern int      afp_getvolparams __P((AFPObj *, char *, int, char *, int *));
195 extern int      afp_setvolparams __P((AFPObj *, char *, int, char *, int *));
196 extern int      afp_getsrvrparms __P((AFPObj *, char *, int, char *, int *));
197 extern int      afp_closevol     __P((AFPObj *, char *, int, char *, int *));
198
199 /* netatalk functions */
200 extern void     close_all_vol   __P((void));
201
202 #endif