netatalk: file.h File Reference

netatalk 4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
file.h File Reference
`#include <arpa/inet.h>`
`#include <sys/param.h>`
`#include <atalk/adouble.h>`
`#include <atalk/globals.h>`
`#include "directory.h"`
`#include "volume.h"`

Go to the source code of this file.

## Macros
#define | FILPBIT_ATTR 0
#define | FILPBIT_PDID 1
#define | FILPBIT_CDATE 2
#define | FILPBIT_MDATE 3
#define | FILPBIT_BDATE 4
#define | FILPBIT_FINFO 5
#define | FILPBIT_LNAME 6
#define | FILPBIT_SNAME 7
#define | FILPBIT_FNUM 8
#define | FILPBIT_DFLEN 9
#define | FILPBIT_RFLEN 10
#define | FILPBIT_EXTDFLEN 11
#define | FILPBIT_PDINFO 13
#define | FILPBIT_EXTRFLEN 14
#define | FILPBIT_UNIXPR 15
#define | kTextEncodingUTF8 0x08000103

## Enumerations
enum | kTextEncoding_t { kTextEncodingMacRoman = 0L , kTextEncodingMacJapanese = 1 , kTextEncodingMacChineseTrad = 2 , kTextEncodingMacKorean = 3 , kTextEncodingMacArabic = 4 , kTextEncodingMacHebrew = 5 , kTextEncodingMacGreek = 6 , kTextEncodingMacCyrillic = 7 , kTextEncodingMacDevanagari = 9 , kTextEncodingMacGurmukhi = 10 , kTextEncodingMacGujarati = 11 , kTextEncodingMacOriya = 12 , kTextEncodingMacBengali = 13 , kTextEncodingMacTamil = 14 , kTextEncodingMacTelugu = 15 , kTextEncodingMacKannada = 16 , kTextEncodingMacMalayalam = 17 , kTextEncodingMacSinhalese = 18 , kTextEncodingMacBurmese = 19 , kTextEncodingMacKhmer = 20 , kTextEncodingMacThai = 21 , kTextEncodingMacLaotian = 22 , kTextEncodingMacGeorgian = 23 , kTextEncodingMacArmenian = 24 , kTextEncodingMacChineseSimp = 25 , kTextEncodingMacTibetan = 26 , kTextEncodingMacMongolian = 27 , kTextEncodingMacEthiopic = 28 , kTextEncodingMacCentralEurRoman = 29 , kTextEncodingMacVietnamese = 30 , kTextEncodingMacExtArabic = 31 , kTextEncodingMacSymbol = 33 , kTextEncodingMacDingbats = 34 , kTextEncodingMacTurkish = 35 , kTextEncodingMacCroatian = 36 , kTextEncodingMacIcelandic = 37 , kTextEncodingMacRomanian = 38 , kTextEncodingMacCeltic = 39 , kTextEncodingMacGaelic = 40 , kTextEncodingMacKeyboardGlyphs = 41 }

## Functions
char * | set_name (const struct vol *, char *, cnid_t, char *, cnid_t, uint32_t)
struct extmap * | getextmap (const char *)
struct extmap * | getdefextmap (void)
int | getfilparams (const AFPObj *obj, struct vol *, uint16_t, struct path *, struct dir *, char *buf, size_t *, int skip_fork_check)
int | setfilparams (const AFPObj *obj, struct vol *, struct path *, uint16_t, char *)
int | renamefile (struct vol *, struct dir *, int, char *, char *, char *, struct adouble *)
| Rename a file, including its resource fork and mac name.
int | copyfile (struct vol *, struct vol *, struct dir *, int, char *, char *, char *, struct adouble *)
int | deletefile (const struct vol *, int, char *, int)
int | getmetadata (const AFPObj *obj, struct vol *vol, uint16_t bitmap, struct path *path, struct dir *dir, char *buf, size_t *buflen, struct adouble *adp)
void * | get_finderinfo (const struct vol *, const char *, struct adouble *, void *, int)
size_t | mtoUTF8 (const struct vol *, const char *, size_t, char *, size_t)
int | copy_path_name (const struct vol *, char *, char *i)
uint32_t | get_id (struct vol *, struct adouble *, const struct stat *, cnid_t, const char *, int)
| Get CNID for did/upath args both from database and adouble file.
int | afp_exchangefiles (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
int | afp_setfilparams (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
int | afp_copyfile (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
int | afp_createfile (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
int | afp_createid (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
int | afp_resolveid (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
int | afp_deleteid (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)

## Variables
const uint8_t | ufinderi []

## Macro Definition Documentation

## ◆ FILPBIT_ATTR

#define FILPBIT_ATTR 0

## ◆ FILPBIT_BDATE

#define FILPBIT_BDATE 4

## ◆ FILPBIT_CDATE

#define FILPBIT_CDATE 2

## ◆ FILPBIT_DFLEN

#define FILPBIT_DFLEN 9

## ◆ FILPBIT_EXTDFLEN

#define FILPBIT_EXTDFLEN 11

## ◆ FILPBIT_EXTRFLEN

#define FILPBIT_EXTRFLEN 14

## ◆ FILPBIT_FINFO

#define FILPBIT_FINFO 5

## ◆ FILPBIT_FNUM

#define FILPBIT_FNUM 8

## ◆ FILPBIT_LNAME

#define FILPBIT_LNAME 6

## ◆ FILPBIT_MDATE

#define FILPBIT_MDATE 3

## ◆ FILPBIT_PDID

#define FILPBIT_PDID 1

## ◆ FILPBIT_PDINFO

#define FILPBIT_PDINFO 13

ProDOS Info/ UTF8 name

## ◆ FILPBIT_RFLEN

#define FILPBIT_RFLEN 10

## ◆ FILPBIT_SNAME

#define FILPBIT_SNAME 7

## ◆ FILPBIT_UNIXPR

#define FILPBIT_UNIXPR 15

## ◆ kTextEncodingUTF8

#define kTextEncodingUTF8 0x08000103

## Enumeration Type Documentation

## ◆ kTextEncoding_t

enum kTextEncoding_t

Mac OS encodings

Enumerator
kTextEncodingMacRoman |
kTextEncodingMacJapanese |
kTextEncodingMacChineseTrad |
kTextEncodingMacKorean |
kTextEncodingMacArabic |
kTextEncodingMacHebrew |
kTextEncodingMacGreek |
kTextEncodingMacCyrillic |
kTextEncodingMacDevanagari |
kTextEncodingMacGurmukhi |
kTextEncodingMacGujarati |
kTextEncodingMacOriya |
kTextEncodingMacBengali |
kTextEncodingMacTamil |
kTextEncodingMacTelugu |
kTextEncodingMacKannada |
kTextEncodingMacMalayalam |
kTextEncodingMacSinhalese |
kTextEncodingMacBurmese |
kTextEncodingMacKhmer |
kTextEncodingMacThai |
kTextEncodingMacLaotian |
kTextEncodingMacGeorgian |
kTextEncodingMacArmenian |
kTextEncodingMacChineseSimp |
kTextEncodingMacTibetan |
kTextEncodingMacMongolian |
kTextEncodingMacEthiopic |
kTextEncodingMacCentralEurRoman |
kTextEncodingMacVietnamese |
kTextEncodingMacExtArabic | The following use script code 0, smRoman
kTextEncodingMacSymbol |
kTextEncodingMacDingbats |
kTextEncodingMacTurkish |
kTextEncodingMacCroatian |
kTextEncodingMacIcelandic |
kTextEncodingMacRomanian |
kTextEncodingMacCeltic |
kTextEncodingMacGaelic |
kTextEncodingMacKeyboardGlyphs |

## Function Documentation

## ◆ afp_copyfile()

int afp_copyfile | ( | AFPObj * | obj,
|  | char * | ibuf,
|  | size_t | ibuflen,
|  | char * | rbuf,
|  | size_t * | rbuflen )

## ◆ afp_createfile()

int afp_createfile | ( | AFPObj * | obj,
|  | char * | ibuf,
|  | size_t | ibuflen,
|  | char * | rbuf,
|  | size_t * | rbuflen )

## ◆ afp_createid()

int afp_createid | ( | AFPObj * | obj,
|  | char * | ibuf,
|  | size_t | ibuflen,
|  | char * | rbuf,
|  | size_t * | rbuflen )

Returns
  a file id

## ◆ afp_deleteid()

int afp_deleteid | ( | AFPObj * | obj,
|  | char * | ibuf,
|  | size_t | ibuflen,
|  | char * | rbuf,
|  | size_t * | rbuflen )

## ◆ afp_exchangefiles()

int afp_exchangefiles | ( | AFPObj * | obj,
|  | char * | ibuf,
|  | size_t | ibuflen,
|  | char * | rbuf,
|  | size_t * | rbuflen )

## ◆ afp_resolveid()

int afp_resolveid | ( | AFPObj * | obj,
|  | char * | ibuf,
|  | size_t | ibuflen,
|  | char * | rbuf,
|  | size_t * | rbuflen )

resolve a file id

## ◆ afp_setfilparams()

int afp_setfilparams | ( | AFPObj * | obj,
|  | char * | ibuf,
|  | size_t | ibuflen,
|  | char * | rbuf,
|  | size_t * | rbuflen )

## ◆ copy_path_name()

int copy_path_name | ( | const struct vol * | vol,
|  | char * | newname,
|  | char * | i )
| extern

## ◆ copyfile()

int copyfile | ( | struct vol * | s_vol,
|  | struct vol * | d_vol,
|  | struct dir * | d_dir,
|  | int | sfd,
|  | char * | src,
|  | char * | dst,
|  | char * | newname,
|  | struct adouble * | adp )
| extern

Note
  if newname is NULL (from directory.c) we don't want to copy the resource fork. because we are doing it elsewhere. currently if newname is NULL then adp is NULL.

## ◆ deletefile()

int deletefile | ( | const struct vol * | vol,
|  | int | dirfd,
|  | char * | file,
|  | int | checkAttrib )
| extern

Note
  dirfd can be used for unlinkat semantics

## ◆ get_finderinfo()

void * get_finderinfo | ( | const struct vol * | vol,
|  | const char * | upath,
|  | struct adouble * | adp,
|  | void * | data,
|  | int | islink )
| extern

## ◆ get_id()

uint32_t get_id | ( | struct vol * | vol,
|  | struct adouble * | adp,
|  | const struct stat * | st,
|  | const cnid_t | did,
|  | const char * | upath,
|  | const int | len )
| extern

Get CNID for did/upath args both from database and adouble file.

1. Get the objects CNID as stored in its adouble file
2. Get the objects CNID from the database
3. Store resource fork data

Parameters

  [in,out] | vol | volume
  [in,out] | adp | adouble struct of object upath, might be NULL
  [in] | st | stat of upath, must NOT be NULL
  [in] | did | parent CNID of upath
  [in] | upath | name of object
  [in] | len | strlen of upath

## ◆ getdefextmap()

struct extmap * getdefextmap | ( | void |  | ) |
| extern

## ◆ getextmap()

struct extmap * getextmap | ( | const char * | path | ) |
| extern

## ◆ getfilparams()

int getfilparams | ( | const AFPObj * | obj,
|  | struct vol * | vol,
|  | uint16_t | bitmap,
|  | struct path * | path,
|  | struct dir * | dir,
|  | char * | buf,
|  | size_t * | buflen,
|  | int | skip_fork_check )
| extern

## ◆ getmetadata()

int getmetadata | ( | const AFPObj * | obj,
|  | struct vol * | vol,
|  | uint16_t | bitmap,
|  | struct path * | path,
|  | struct dir * | dir,
|  | char * | buf,
|  | size_t * | buflen,
|  | struct adouble * | adp )
| extern

## ◆ mtoUTF8()

size_t mtoUTF8 | ( | const struct vol * | vol,
|  | const char * | src,
|  | size_t | srclen,
|  | char * | dest,
|  | size_t | destlen )
| extern

convert a Mac long name to an utf8 name

## ◆ renamefile()

int renamefile | ( | struct vol * | vol,
|  | struct dir * | ddir,
|  | int | sdir_fd,
|  | char * | src,
|  | char * | dst,
|  | char * | newname,
|  | struct adouble * | adp )
| extern

Rename a file, including its resource fork and mac name.

renamefile and copyfile take the old and new unix pathnames and the new mac name.

Parameters

  vol | volume structure
  ddir | dest dir structure
  sdir_fd | source dir fd to which src path is relative (for openat et al semantics) passing -1 means this is not used, src path is a full path
  src | the source path
  dst | the dest filename in current dir
  newname | the dest mac name
  adp | adouble struct of src file, if open, or & zeroed one

## ◆ set_name()

char * set_name | ( | const struct vol * | vol,
|  | char * | data,
|  | cnid_t | pid,
|  | char * | name,
|  | cnid_t | id,
|  | uint32_t | utf8 )
| extern

## ◆ setfilparams()

int setfilparams | ( | const AFPObj * | obj,
|  | struct vol * | vol,
|  | struct path * | path,
|  | uint16_t | f_bitmap,
|  | char * | buf )
| extern

## Variable Documentation

## ◆ ufinderi

const uint8_t ufinderi[]
| extern

the format for the finderinfo fields (from IM: Toolbox Essentials):
field bytes subfield bytes
files:
ioFlFndrInfo 16 -> type 4 type field
creator 4 creator field
flags 2 finder flags:
alias, bundle, etc.
location 4 location in window
folder 2 window that contains file
ioFlXFndrInfo 16 -> iconID 2 icon id
unused 6 reserved
script 1 script system
xflags 1 reserved
commentID 2 comment id
putawayID 4 home directory id
flags
static dbd_flags_t flags
Definition cmd_dbd.c:43
type
static enum op type
Definition nad_cp.c:96
finderinfo
Definition catsearch.c:61