]> arthur.barton.de Git - netatalk.git/blob - include/atalk/globals.h
Merge remote branch 'sf/develop'
[netatalk.git] / include / atalk / globals.h
1 /*
2  * Copyright (c) 1990,1993 Regents of The University of Michigan.
3  * All Rights Reserved.  See COPYRIGHT.
4  */
5
6 #ifndef AFPD_GLOBALS_H
7 #define AFPD_GLOBALS_H 1
8
9 #include <sys/param.h>
10
11 #ifdef ADMIN_GRP
12 #include <grp.h>
13 #include <sys/types.h>
14 #endif /* ADMIN_GRP */
15
16 #ifdef HAVE_NETDB_H
17 #include <netdb.h>  /* this isn't header-protected under ultrix */
18 #endif /* HAVE_NETDB_H */
19
20 #include <atalk/afp.h>
21 #include <atalk/compat.h>
22 #include <atalk/unicode.h>
23 #include <atalk/uam.h>
24 #include <atalk/iniparser.h>
25
26 /* #define DOSFILELEN 12 */             /* Type1, DOS-compat*/
27 #define MACFILELEN 31                   /* Type2, HFS-compat */
28 #define UTF8FILELEN_EARLY 255           /* Type3, early Mac OS X 10.0-10.4.? */
29 /* #define UTF8FILELEN_NAME_MAX 765 */  /* Type3, 10.4.?- , getconf NAME_MAX */
30 /* #define UTF8FILELEN_SPEC 0xFFFF */   /* Type3, spec on document */
31 /* #define HFSPLUSFILELEN 510 */        /* HFS+ spec, 510byte = 255codepoint */
32
33 #define MAXUSERLEN 256
34
35 #define DEFAULT_MAX_DIRCACHE_SIZE 8192
36
37 #define OPTION_DEBUG         (1 << 0)
38 #define OPTION_CLOSEVOL      (1 << 1)
39 #define OPTION_SERVERNOTIF   (1 << 2)
40 #define OPTION_NOSENDFILE    (1 << 3)
41 /* #define OPTION_CUSTOMICON    (1 << 4) */
42 #define OPTION_AFP_READ_LOCK (1 << 5) /* whether to do AFP spec conforming read locks (default: no) */
43 #define OPTION_ANNOUNCESSH   (1 << 6)
44 #define OPTION_UUID          (1 << 7)
45 #define OPTION_ACL2MACCESS   (1 << 8)
46 #define OPTION_NOZEROCONF    (1 << 9)
47 #define OPTION_KEEPSESSIONS  (1 << 10) /* preserve sessions across master afpd restart with SIGQUIT */
48 #define OPTION_SHARE_RESERV  (1 << 11) /* whether to use Solaris fcntl F_SHARE locks */
49
50 #define PASSWD_NONE     0
51 #define PASSWD_SET     (1 << 0)
52 #define PASSWD_NOSAVE  (1 << 1)
53 #define PASSWD_ALL     (PASSWD_SET | PASSWD_NOSAVE)
54
55 #define IS_AFP_SESSION(obj) ((obj)->dsi && (obj)->dsi->serversock == -1)
56
57 /**********************************************************************************************
58  * Ini config sections
59  **********************************************************************************************/
60
61 #define INISEC_GLOBAL "Global"
62 #define INISEC_HOMES  "Homes"
63
64 struct DSI;
65 #define AFPOBJ_TMPSIZ (MAXPATHLEN)
66
67 struct afp_volume_name {
68     time_t     mtime;
69     int        loaded;
70 };
71
72 struct afp_options {
73     int connections;            /* Maximum number of possible AFP connections */
74     int tickleval;
75     int timeout;
76     int flags;
77     int dircachesize;
78     int sleep;                  /* Maximum time allowed to sleep (in tickles) */
79     int disconnected;           /* Maximum time in disconnected state (in tickles) */
80     int fce_fmodwait;           /* number of seconds FCE file mod events are put on hold */
81     unsigned int tcp_sndbuf, tcp_rcvbuf;
82     unsigned char passwdbits, passwdminlen;
83     uint32_t server_quantum;
84     int dsireadbuf; /* scale factor for sizefof(dsi->buffer) = server_quantum * dsireadbuf */
85     char *hostname;
86     char *listen, *port;
87     char *Cnid_srv, *Cnid_port;
88     char *configfile;
89     char *uampath, *fqdn;
90     char *sigconffile;
91     char *uuidconf;
92     char *guest, *loginmesg, *keyfile, *passwdfile;
93     char *uamlist;
94     char *signatureopt;
95     unsigned char signature[16];
96     char *k5service, *k5realm, *k5keytab;
97     char *unixcodepage, *maccodepage, *volcodepage;
98     charset_t maccharset, unixcharset; 
99     mode_t umask;
100     mode_t save_mask;
101 #ifdef ADMIN_GRP
102     gid_t admingid;
103 #endif /* ADMIN_GRP */
104     int    volnamelen;
105     /* default value for winbind authentication */
106     char *ntdomain, *ntseparator;
107     char *logconfig;
108     char *logfile;
109     char *mimicmodel;
110     char *adminauthuser;
111     struct afp_volume_name volfile;
112 };
113
114 typedef struct AFPObj {
115     const char *cmdlineconfigfile;
116     int cmdlineflags;
117     const void *signature;
118     struct DSI *dsi;
119     struct afp_options options;
120     dictionary *iniconfig;
121     char username[MAXUSERLEN];
122     /* to prevent confusion, only use these in afp_* calls */
123     char oldtmp[AFPOBJ_TMPSIZ + 1], newtmp[AFPOBJ_TMPSIZ + 1];
124     void *uam_cookie; /* cookie for uams */
125     struct session_info  sinfo;
126     uid_t uid;  /* client running user id */
127     int ipc_fd; /* anonymous PF_UNIX socket for IPC with afpd parent */
128     gid_t *groups;
129     int ngroups;
130     int afp_version;
131     /* Functions */
132     void (*logout)(void);
133     void (*exit)(int);
134     int (*reply)(void *, int);
135     int (*attention)(void *, AFPUserBytes);
136 } AFPObj;
137
138 /* typedef for AFP functions handlers */
139 typedef int (*AFPCmd)(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
140
141 /* Global variables */
142 extern AFPObj             *AFPobj;
143 extern int                afp_version;
144 extern int                afp_errno;
145 extern unsigned char      nologin;
146 extern struct dir         *curdir;
147 extern char               getwdbuf[];
148 extern struct afp_options default_options;
149 extern const char         *Cnid_srv;
150 extern const char         *Cnid_port;
151
152 extern int  get_afp_errno   (const int param);
153 extern void afp_options_init (struct afp_options *);
154 extern void afp_options_parse_cmdline(AFPObj *obj, int ac, char **av);
155 extern void afp_options_free(struct afp_options *);
156 extern void setmessage (const char *);
157 extern void readmessage (AFPObj *);
158
159 /* gettok.c */
160 extern void initline   (int, char *);
161 extern int  parseline  (int, char *);
162
163 /* afp_util.c */
164 extern const char *AfpNum2name (int );
165 extern const char *AfpErr2name(int err);
166
167 /* directory.c */
168 extern struct dir rootParent;
169
170 extern void afp_over_dsi (AFPObj *);
171
172 #endif /* globals.h */