1 /*
2  * Copyright (c) 1990,1991 Regents of The University of Michigan.
3  * All Rights Reserved.
4  *
5  * Permission to use, copy, modify, and distribute this software and
6  * its documentation for any purpose and without fee is hereby granted,
7  * provided that the above copyright notice appears in all copies and
8  * that both that copyright notice and this permission notice appear
9  * in supporting documentation, and that the name of The University
10  * of Michigan not be used in advertising or publicity pertaining to
11  * distribution of the software without specific, written prior
12  * permission. This software is supplied as is without expressed or
13  * implied warranties of any kind.
14  *
15  *	Research Systems Unix Group
16  *	The University of Michigan
17  *	c/o Mike Clark
18  *	535 W. William Street
19  *	Ann Arbor, Michigan
20  *	+1-313-763-0525
21  *	netatalk@itd.umich.edu
22  */
23 
24 #ifndef AFPD_FILE_H
25 #define AFPD_FILE_H 1
26 
27 /*#include <sys/stat.h>*/ /* including it here causes some confusion */
28 #include <sys/param.h>
29 #include <arpa/inet.h>
30 #include <atalk/adouble.h>
31 #include <atalk/globals.h>
32 
33 #include "volume.h"
34 #include "directory.h"
35 
36 extern const u_char	ufinderi[];
37 
38 #define FILPBIT_ATTR	 0
39 #define FILPBIT_PDID	 1
40 #define FILPBIT_CDATE	 2
41 #define FILPBIT_MDATE	 3
42 #define FILPBIT_BDATE	 4
43 #define FILPBIT_FINFO	 5
44 #define FILPBIT_LNAME	 6
45 #define FILPBIT_SNAME	 7
46 #define FILPBIT_FNUM	 8
47 #define FILPBIT_DFLEN	 9
48 #define FILPBIT_RFLEN	 10
49 #define FILPBIT_EXTDFLEN 11
50 #define FILPBIT_PDINFO   13    /* ProDOS Info/ UTF8 name */
51 #define FILPBIT_EXTRFLEN 14
52 #define FILPBIT_UNIXPR   15
53 
54 #define kTextEncodingUTF8 0x08000103
55 
56 typedef enum {
57                                         /* Mac OS encodings*/
58   kTextEncodingMacRoman         = 0L,
59   kTextEncodingMacJapanese      = 1,
60   kTextEncodingMacChineseTrad   = 2,
61   kTextEncodingMacKorean        = 3,
62   kTextEncodingMacArabic        = 4,
63   kTextEncodingMacHebrew        = 5,
64   kTextEncodingMacGreek         = 6,
65   kTextEncodingMacCyrillic      = 7,
66   kTextEncodingMacDevanagari    = 9,
67   kTextEncodingMacGurmukhi      = 10,
68   kTextEncodingMacGujarati      = 11,
69   kTextEncodingMacOriya         = 12,
70   kTextEncodingMacBengali       = 13,
71   kTextEncodingMacTamil         = 14,
72   kTextEncodingMacTelugu        = 15,
73   kTextEncodingMacKannada       = 16,
74   kTextEncodingMacMalayalam     = 17,
75   kTextEncodingMacSinhalese     = 18,
76   kTextEncodingMacBurmese       = 19,
77   kTextEncodingMacKhmer         = 20,
78   kTextEncodingMacThai          = 21,
79   kTextEncodingMacLaotian       = 22,
80   kTextEncodingMacGeorgian      = 23,
81   kTextEncodingMacArmenian      = 24,
82   kTextEncodingMacChineseSimp   = 25,
83   kTextEncodingMacTibetan       = 26,
84   kTextEncodingMacMongolian     = 27,
85   kTextEncodingMacEthiopic      = 28,
86   kTextEncodingMacCentralEurRoman = 29,
87   kTextEncodingMacVietnamese    = 30,
88   kTextEncodingMacExtArabic     = 31,   /* The following use script code 0, smRoman*/
89   kTextEncodingMacSymbol        = 33,
90   kTextEncodingMacDingbats      = 34,
91   kTextEncodingMacTurkish       = 35,
92   kTextEncodingMacCroatian      = 36,
93   kTextEncodingMacIcelandic     = 37,
94   kTextEncodingMacRomanian      = 38,
95   kTextEncodingMacCeltic        = 39,
96   kTextEncodingMacGaelic        = 40,
97   kTextEncodingMacKeyboardGlyphs = 41,
98 } kTextEncoding_t;
99 
100 extern char *set_name   (const struct vol *, char *, cnid_t, char *, cnid_t, uint32_t );
101 
102 extern struct extmap	*getextmap (const char *);
103 extern struct extmap	*getdefextmap (void);
104 
105 extern int getfilparams (const AFPObj *obj, struct vol *, uint16_t, struct path *,
106                          struct dir *, char *buf, size_t *, int);
107 extern int setfilparams (const AFPObj *obj, struct vol *, struct path *, uint16_t, char *);
108 extern int renamefile   (struct vol *, struct dir *, int, char *, char *, char *, struct adouble *);
109 extern int copyfile     (struct vol *, struct vol *, struct dir *, int, char *, char *, char *, struct adouble *);
110 extern int deletefile   (const struct vol *, int, char *, int);
111 
112 extern int getmetadata  (const AFPObj *obj, struct vol *vol, uint16_t bitmap, struct path *path,
113                          struct dir *dir, char *buf, size_t *buflen, struct adouble *adp);
114 
115 extern void *get_finderinfo (const struct vol *, const char *, struct adouble *, void *, int);
116 
117 extern size_t mtoUTF8   (const struct vol *, const char *, size_t , char *, size_t );
118 extern int  copy_path_name (const struct vol *, char *, char *i);
119 
120 extern uint32_t get_id  (struct vol *,
121                          struct adouble *,
122                          const struct stat *,
123                          cnid_t ,
124                          const char *,
125                          int );
126 
127 /* FP functions */
128 int afp_exchangefiles (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
129 int afp_setfilparams (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
130 int afp_copyfile (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
131 int afp_createfile (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
132 int afp_createid (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
133 int afp_resolveid (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
134 int afp_deleteid (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
135 
136 #endif
137