]> arthur.barton.de Git - netatalk.git/blob - include/atalk/globals.h
Merge master
[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 <netatalk/at.h>
21 #include <atalk/afp.h>
22 #include <atalk/compat.h>
23 #include <atalk/unicode.h>
24 #include <atalk/uam.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 OPTION_DEBUG         (1 << 0)
36 #define OPTION_USERVOLFIRST  (1 << 1)
37 #define OPTION_NOUSERVOL     (1 << 2)
38 #define OPTION_PROXY         (1 << 3)
39 #define OPTION_CUSTOMICON    (1 << 4)
40 #define OPTION_NOSLP         (1 << 5)
41 #define OPTION_ANNOUNCESSH   (1 << 6)
42 #define OPTION_UUID          (1 << 7)
43 #define OPTION_ACL2MACCESS   (1 << 8)
44 #define OPTION_NOZEROCONF    (1 << 9)
45 #define OPTION_KEEPSESSIONS  (1 << 10) /* preserve sessions across master afpd restart with SIGQUIT */
46
47 /* a couple of these options could get stuck in unions to save
48  * space. */
49 struct afp_volume_name {
50     time_t     mtime;
51     char       *name;
52     char       *full_name;
53     int        loaded;
54 };
55
56 struct afp_options {
57     int connections, transports, tickleval, timeout, server_notif, flags, dircachesize;
58     int sleep;                  /* Maximum time allowed to sleep (in tickles) */
59     int disconnected;           /* Maximum time in disconnected state (in tickles) */
60     int fce_fmodwait;           /* number of seconds FCE file mod events are put on hold */
61     unsigned int tcp_sndbuf, tcp_rcvbuf;
62     unsigned char passwdbits, passwdminlen, loginmaxfail;
63     uint32_t server_quantum;
64     int dsireadbuf; /* scale factor for sizefof(dsi->buffer) = server_quantum * dsireadbuf */
65     char hostname[MAXHOSTNAMELEN + 1], *server, *ipaddr, *port, *configfile;
66     char *uampath, *fqdn;
67     char *pidfile;
68     char *sigconffile;
69     char *uuidconf;
70     struct afp_volume_name defaultvol, systemvol, uservol;
71     int  closevol;
72
73     char *guest, *loginmesg, *keyfile, *passwdfile;
74     char *uamlist;
75     char *authprintdir;
76     char *signatureopt;
77     unsigned char signature[16];
78     char *k5service, *k5realm, *k5keytab;
79     char *unixcodepage,*maccodepage;
80     charset_t maccharset, unixcharset; 
81     mode_t umask;
82     mode_t save_mask;
83 #ifdef ADMIN_GRP
84     gid_t admingid;
85 #endif /* ADMIN_GRP */
86     int    volnamelen;
87
88     /* default value for winbind authentication */
89     char *ntdomain, *ntseparator;
90     char *logconfig;
91
92     char *mimicmodel;
93     char *adminauthuser;
94 };
95
96 #define AFPOBJ_TMPSIZ (MAXPATHLEN)
97 typedef struct _AFPObj {
98     int proto;
99     unsigned long servernum;
100     void *handle;               /* either (DSI *) or (ASP *) */
101     void *config; 
102     struct afp_options options;
103     char *Obj, *Type, *Zone;
104     char username[MAXUSERLEN];
105     void (*logout)(void), (*exit)(int);
106     int (*reply)(void *, int);
107     int (*attention)(void *, AFPUserBytes);
108     /* to prevent confusion, only use these in afp_* calls */
109     char oldtmp[AFPOBJ_TMPSIZ + 1], newtmp[AFPOBJ_TMPSIZ + 1];
110     void *uam_cookie; /* cookie for uams */
111     struct session_info  sinfo;
112     uid_t uid;  /* client running user id */
113     int ipc_fd; /* anonymous PF_UNIX socket for IPC with afpd parent */
114 } AFPObj;
115
116 /* typedef for AFP functions handlers */
117 typedef int (*AFPCmd)(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
118
119 /* Global variables */
120 extern AFPObj             *AFPobj;
121 extern int                afp_version;
122 extern int                afp_errno;
123 extern unsigned char      nologin;
124 extern struct dir         *curdir;
125 extern char               getwdbuf[];
126 extern struct afp_options default_options;
127 extern const char         *Cnid_srv;
128 extern const char         *Cnid_port;
129
130 extern int  get_afp_errno   (const int param);
131 extern void afp_options_init (struct afp_options *);
132 extern int afp_options_parse (int, char **, struct afp_options *);
133 extern int afp_options_parseline (char *, struct afp_options *);
134 extern void afp_options_free (struct afp_options *,
135                                       const struct afp_options *);
136 extern void setmessage (const char *);
137 extern void readmessage (AFPObj *);
138
139 /* gettok.c */
140 extern void initline   (int, char *);
141 extern int  parseline  (int, char *);
142
143 /* afp_util.c */
144 extern const char *AfpNum2name (int );
145 extern const char *AfpErr2name(int err);
146
147 /* directory.c */
148 extern struct dir rootParent;
149
150 extern void afp_over_dsi (AFPObj *);
151
152 #endif /* globals.h */