netatalk: afphelper.c File Reference

netatalk 4.5.1
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
afphelper.c File Reference
`#include <signal.h>`
`#include <stdarg.h>`
`#include <stdlib.h>`
`#include <atalk/compat.h>`
`#include "afpclient.h"`
`#include "afphelper.h"`
`#include "afpcmd.h"`
`#include "testhelper.h"`

## Macros
#define | AFPHELPER_NAME_MAX 255

## Functions
void | illegal_fork (DSI *dsi, char cmd, 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 *txt)
void | read_fork (CONN *conn, uint16_t vol, int dir, char *name, int len)
int | no_access_folder (uint16_t vol, int did, char *name)
| Use the second user for creating a folder with no access right.
int | group_folder (uint16_t vol, int did, char *name)
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 | 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 (uint16_t vol, int did, char *name)
int | delete_folder_with_file (uint16_t vol, int did, char *name, char *file)
int | get_vol_attrib (uint16_t vol)
unsigned int | get_vol_free (uint16_t vol)
int | not_valid (unsigned int ret, int mac_error, int netatalk_error)
static int | error_in_list (unsigned int bitmap, unsigned int error)
static char * | bitmap2text (unsigned int bitmap)
int | not_valid_bitmap (unsigned int ret, unsigned int bitmap, int netatalk_error)
static void | afp_print_prefix (int level, int color)
static void | afp_print_postfix (int level, int color)
void | afp_printf (int level, int loglevel, int color, const char *fmt,...)
int32_t | is_there (CONN *conn, uint16_t volume, int32_t did, char *name)
static int | copy_filedir_name (char *dst, size_t dstlen, const struct afp_filedir_parms *filedir)
static void | free_filedir_names (struct afp_filedir_parms *filedir)
int | delete_directory_tree_by_did (CONN *conn, uint16_t volume, uint32_t dir_id)
| depth-first recursively delete a directory tree by DID
int | delete_directory_tree (CONN *conn, uint16_t volume, uint32_t parent_did, char *dirname)
| depth-first recursively delete a directory tree by parent DID and name
void | clear_volume (uint16_t vol, CONN *conn)

## Variables
int | Loglevel = AFP_LOG_INFO

## Macro Definition Documentation

## ◆ AFPHELPER_NAME_MAX

#define AFPHELPER_NAME_MAX 255

## Function Documentation

## ◆ afp_print_postfix()

void afp_print_postfix | ( | int | level,
|  | int | color )
| static

## ◆ afp_print_prefix()

void afp_print_prefix | ( | int | level,
|  | int | color )
| static

## ◆ afp_printf()

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

## ◆ bitmap2text()

char * bitmap2text | ( | unsigned int | bitmap | ) |
| static

## ◆ clear_volume()

void clear_volume | ( | uint16_t | vol,
|  | CONN * | conn )

## ◆ copy_filedir_name()

int copy_filedir_name | ( | char * | dst,
|  | size_t | dstlen,
|  | const struct afp_filedir_parms * | filedir )
| static

## ◆ delete_directory_tree()

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

depth-first recursively delete a directory tree by parent DID and name

Resolves the starting directory once, then deletes descendants by DID so cleanup does not depend on round-tripping mangled long names from enumerate.

Parameters

  conn | AFP connection
  volume | Volume ID
  parent_did | Parent directory ID
  dirname | Directory name to delete

Returns
  0 on success, -1 on failure

## ◆ delete_directory_tree_by_did()

int delete_directory_tree_by_did | ( | CONN * | conn,
|  | uint16_t | volume,
|  | uint32_t | dir_id )

depth-first recursively delete a directory tree by DID

Parameters

  conn | AFP connection
  volume | Volume ID
  dir_id | Directory ID to delete

Returns
  0 on success, -1 on failure

## ◆ delete_folder()

int delete_folder | ( | uint16_t | vol,
|  | int | did,
|  | char * | name )

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 )

Note
  We need to set rw perm first for .AppleDouble

## ◆ error_in_list()

int error_in_list | ( | unsigned int | bitmap,
|  | unsigned int | error )
| static

## ◆ free_filedir_names()

void free_filedir_names | ( | struct afp_filedir_parms * | filedir | ) |
| static

## ◆ get_did()

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

## ◆ get_fid()

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

## ◆ get_forklen()

uint32_t get_forklen | ( | DSI * | dsi,
|  | int | type )

## ◆ get_vol_attrib()

int get_vol_attrib | ( | uint16_t | vol | ) |

## ◆ get_vol_free()

unsigned int get_vol_free | ( | uint16_t | vol | ) |

## ◆ group_folder()

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

## ◆ illegal_fork()

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

## ◆ is_there()

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

## ◆ no_access_folder()

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

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 | netatalk_error )

## ◆ not_valid_bitmap()

int not_valid_bitmap | ( | unsigned int | ret,
|  | unsigned int | bitmap,
|  | int | netatalk_error )

## ◆ read_fork()

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

## ◆ read_only_folder()

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

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 )

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 * | txt )

## Variable Documentation

## ◆ Loglevel

int Loglevel = AFP_LOG_INFO