netatalk  4.4.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
afphelper.h File Reference
#include <inttypes.h>
#include "dsi.h"

Go to the source code of this file.

Macros

#define AFP_LOG_DEBUG   0
#define AFP_LOG_INFO   1
#define AFP_LOG_WARNING   2
#define AFP_LOG_ERROR   3
#define AFP_LOG_CRITICAL   4
#define AFP_LOG_MAX   5
#define AFP_PRINTF(level, fmt, ...)
#define BITERR_NOOBJ   (1 << 0)
#define BITERR_NODIR   (1 << 1)
#define BITERR_PARAM   (1 << 2)
#define BITERR_BUSY   (1 << 3)
#define BITERR_BADTYPE   (1 << 4)
#define BITERR_NOITEM   (1 << 5)
#define BITERR_DENYCONF   (1 << 6)
#define BITERR_NFILE   (1 << 7)
#define BITERR_ACCESS   (1 << 8)
#define BITERR_NOID   (1 << 9)
#define BITERR_BITMAP   (1 << 10)
#define BITERR_MISC   (1 << 11)

Functions

void afp_printf (int level, int loglevel, int color, const char *fmt,...)
void illegal_fork (DSI *dsi, char cmd, char *name)
int no_access_folder (uint16_t vol, int did, char *name)
 Use the second user for creating a folder with no access right.
int read_only_folder (uint16_t vol, int did, char *name)
 Use the second user for creating a folder with read only access right.
int delete_folder (uint16_t vol, int did, char *name)
int get_did (CONN *conn, uint16_t vol, int dir, char *name)
int get_fid (CONN *conn, uint16_t vol, int dir, char *name)
uint32_t get_forklen (DSI *dsi, int type)
void write_fork (CONN *conn, uint16_t vol, int dir, char *name, char *data)
void read_fork (CONN *conn, uint16_t vol, int dir, char *name, int len)
int read_only_folder_with_file (uint16_t vol, int did, char *name, char *file)
 Use the second user for creating a folder with read only access right.
int delete_folder_with_file (uint16_t vol, int did, char *name, char *file)
int get_vol_attrib (uint16_t vol)
int group_folder (uint16_t vol, int did, char *name)
unsigned int get_vol_free (uint16_t vol)
int not_valid (unsigned int ret, int mac_error, int afpd_error)
int not_valid_bitmap (unsigned int ret, unsigned int bitmap, int afpd_error)
int32_t is_there (CONN *conn, uint16_t volume, int32_t did, char *name)
int delete_directory_tree (CONN *conn, uint16_t volume, uint32_t parent_did, char *dirname)
 depth-first recursively delete a directory tree
void clear_volume (uint16_t vol, CONN *conn)

Macro Definition Documentation

◆ AFP_LOG_CRITICAL

#define AFP_LOG_CRITICAL   4

◆ AFP_LOG_DEBUG

#define AFP_LOG_DEBUG   0

◆ AFP_LOG_ERROR

#define AFP_LOG_ERROR   3

◆ AFP_LOG_INFO

#define AFP_LOG_INFO   1

◆ AFP_LOG_MAX

#define AFP_LOG_MAX   5

◆ AFP_LOG_WARNING

#define AFP_LOG_WARNING   2

◆ AFP_PRINTF

#define AFP_PRINTF ( level,
fmt,
... )
Value:
afp_printf(level, Loglevel, Color, fmt, ##__VA_ARGS__)
int Color
Definition afpclient.c:12
void afp_printf(int level, int loglevel, int color, const char *fmt,...)
Definition afphelper.c:925
int Loglevel
Definition afphelper.c:13

◆ BITERR_ACCESS

#define BITERR_ACCESS   (1 << 8)

◆ BITERR_BADTYPE

#define BITERR_BADTYPE   (1 << 4)

◆ BITERR_BITMAP

#define BITERR_BITMAP   (1 << 10)

◆ BITERR_BUSY

#define BITERR_BUSY   (1 << 3)

◆ BITERR_DENYCONF

#define BITERR_DENYCONF   (1 << 6)

◆ BITERR_MISC

#define BITERR_MISC   (1 << 11)

◆ BITERR_NFILE

#define BITERR_NFILE   (1 << 7)

◆ BITERR_NODIR

#define BITERR_NODIR   (1 << 1)

◆ BITERR_NOID

#define BITERR_NOID   (1 << 9)

◆ BITERR_NOITEM

#define BITERR_NOITEM   (1 << 5)

◆ BITERR_NOOBJ

#define BITERR_NOOBJ   (1 << 0)

◆ BITERR_PARAM

#define BITERR_PARAM   (1 << 2)

Function Documentation

◆ afp_printf()

void afp_printf ( int level,
int loglevel,
int color,
const char * fmt,
... )
extern

◆ clear_volume()

void clear_volume ( uint16_t vol,
CONN * conn )
extern

◆ delete_directory_tree()

int delete_directory_tree ( CONN * conn,
uint16_t volume,
uint32_t parent_did,
char * dirname )
extern

depth-first recursively delete a directory tree

Algorithm:

  1. Try simple delete (works if directory is empty)
  2. If not empty, get directory ID
  3. Enumerate contents and for each entry:
    • If it's a file: delete it immediately
    • If it's a directory: recurse into it
  4. After all contents are deleted, delete the now-empty directory
Parameters
connAFP connection
volumeVolume ID
parent_didParent directory ID
dirnameDirectory name to delete
Returns
0 on success, -1 on failure

◆ delete_folder()

int delete_folder ( uint16_t vol,
int did,
char * name )
extern
Note
We need to set rw perm first for .AppleDouble

◆ delete_folder_with_file()

int delete_folder_with_file ( uint16_t vol,
int did,
char * name,
char * file )
extern
Note
We need to set rw perm first for .AppleDouble

◆ get_did()

int get_did ( CONN * conn,
uint16_t vol,
int dir,
char * name )
extern

◆ get_fid()

int get_fid ( CONN * conn,
uint16_t vol,
int dir,
char * name )
extern

◆ get_forklen()

uint32_t get_forklen ( DSI * dsi,
int type )
extern

◆ get_vol_attrib()

int get_vol_attrib ( uint16_t vol)
extern

◆ get_vol_free()

unsigned int get_vol_free ( uint16_t vol)
extern

◆ group_folder()

int group_folder ( uint16_t vol,
int did,
char * name )
extern

◆ illegal_fork()

void illegal_fork ( DSI * dsi,
char cmd,
char * name )
extern

◆ is_there()

int32_t is_there ( CONN * conn,
uint16_t volume,
int32_t did,
char * name )
extern

◆ no_access_folder()

int no_access_folder ( uint16_t vol,
int did,
char * name )
extern

Use the second user for creating a folder with no access right.

Note
assume did are the same for != user

◆ not_valid()

int not_valid ( unsigned int ret,
int mac_error,
int afpd_error )
extern

◆ not_valid_bitmap()

int not_valid_bitmap ( unsigned int ret,
unsigned int bitmap,
int afpd_error )
extern

◆ read_fork()

void read_fork ( CONN * conn,
uint16_t vol,
int dir,
char * name,
int len )
extern

◆ read_only_folder()

int read_only_folder ( uint16_t vol,
int did,
char * name )
extern

Use the second user for creating a folder with read only access right.

Note
assume did are the same for != user

◆ read_only_folder_with_file()

int read_only_folder_with_file ( uint16_t vol,
int did,
char * name,
char * file )
extern

Use the second user for creating a folder with read only access right.

Note
assume did are the same for != user

◆ write_fork()

void write_fork ( CONN * conn,
uint16_t vol,
int dir,
char * name,
char * data )
extern