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