netatalk: nad.h File Reference

netatalk 4.5.1
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
nad.h File Reference
`#include <arpa/inet.h>`
`#include <signal.h>`
`#include <sys/stat.h>`
`#include <sys/types.h>`
`#include <atalk/globals.h>`
`#include <atalk/cnid.h>`
`#include <atalk/compat.h>`
`#include <atalk/volume.h>`

Go to the source code of this file.

## Data Structures
struct | afpvol_t
struct | PATH_T

## Macros
#define | DIR_DOT_OR_DOTDOT(a)
#define | ADVOL_V2_OR_EA(ad)
#define | SLOG(...)
#define | ERROR(...)

## Enumerations
enum | logtype { STD , DBG }

## Functions
void | _log (enum logtype lt, char *fmt,...)
void | set_signal (void)
int | nad_ls (int argc, char **argv, AFPObj *obj)
int | nad_cp (int argc, char **argv, AFPObj *obj)
int | nad_rm (int argc, char **argv, AFPObj *obj)
int | nad_mv (int argc, char **argv, AFPObj *obj)
int | nad_set (int argc, char **argv, AFPObj *obj)
int | nad_find (int argc, char **argv, AFPObj *obj)
int | nad_mkdir (int argc, char **argv, AFPObj *obj)
int | nad_rmdir (int argc, char **argv, AFPObj *obj)
int | openvol (AFPObj *obj, const char *path, afpvol_t *vol)
| Load volinfo and initialize struct vol.
int | openvol_optional (AFPObj *obj, const char *path, afpvol_t *vol)
| Open an AFP volume, or return a stub for non-AFP paths.
void | closevol (afpvol_t *vol)
cnid_t | cnid_for_paths_parent (const afpvol_t *vol, const char *path, cnid_t *did)
| Resolves CNID of a given paths parent directory.
char * | utompath (const struct vol *, const char *)
int | convert_dots_encoding (const afpvol_t *svol, const afpvol_t *dvol, char *path)
| Convert dot encoding of basename in place.

## Variables
int | log_verbose
volatile sig_atomic_t | alarmed
int | fflag
int | iflag
int | lflag
int | nflag
int | pflag
int | vflag

## Macro Definition Documentation

## ◆ ADVOL_V2_OR_EA

#define ADVOL_V2_OR_EA | ( |  | ad | ) |

Value:
((ad) == AD_VERSION2 || (ad) == AD_VERSION_EA)
AD_VERSION2
#define AD_VERSION2
Definition adouble.h:45
AD_VERSION_EA
#define AD_VERSION_EA
Definition adouble.h:46

## ◆ DIR_DOT_OR_DOTDOT

#define DIR_DOT_OR_DOTDOT | ( |  | a | ) |

Value:
((strcmp(a, ".") == 0) || (strcmp(a, "..") == 0))

## ◆ ERROR

#define ERROR | ( |  | ... | ) |

Value:
do { \
_log(STD, __VA_ARGS__); \
exit(1); \
} while (0)
STD
@ STD
Definition nad.h:33

## ◆ SLOG

#define SLOG | ( |  | ... | ) |

Value:
_log(STD, __VA_ARGS__)
_log
void _log(enum logtype lt, char *fmt,...)
Definition nad_util.c:118

## Enumeration Type Documentation

## ◆ logtype

enum logtype

Enumerator
STD |
DBG |

## Function Documentation

## ◆ _log()

void _log | ( | enum logtype | lt,
|  | char * | fmt,
|  |  | ... )
| extern

## ◆ closevol()

void closevol | ( | afpvol_t * | vol | ) |
| extern

## ◆ cnid_for_paths_parent()

cnid_t cnid_for_paths_parent | ( | const afpvol_t * | vol,
|  | const char * | path,
|  | cnid_t * | did )
| extern

Resolves CNID of a given paths parent directory.

path might be: (a) relative: "dir/subdir" with cwd: "/afp_volume/topdir" (b) absolute: "/afp_volume/dir/subdir"

path MUST be pointing inside vol, this is usually the case as vol has been build from path using loadvolinfo and friends.

Parameters

  [in] | vol | pointer to afpvol_t
  [in] | path | path, see above
  [in,out] | did | parent CNID of returned CNID

Returns
  CNID of path

## ◆ convert_dots_encoding()

int convert_dots_encoding | ( | const afpvol_t * | svol,
|  | const afpvol_t * | dvol,
|  | char * | path )
| extern

Convert dot encoding of basename in place.

path arg can be "[/][dir/ | ...]filename". It will be converted in place possible encoding ".file" as ":2efile" which means the result will be longer then the original which means provide a big enough buffer.

Parameters

  [in] | svol | source volume
  [in] | dvol | destination volume
  [in,out] | path | path to convert in place

Returns
  0 on success, -1 on error

## ◆ nad_cp()

int nad_cp | ( | int | argc,
|  | char ** | argv,
|  | AFPObj * | obj )
| extern

## ◆ nad_find()

int nad_find | ( | int | argc,
|  | char ** | argv,
|  | AFPObj * | obj )
| extern

## ◆ nad_ls()

int nad_ls | ( | int | argc,
|  | char ** | argv,
|  | AFPObj * | obj )
| extern

## ◆ nad_mkdir()

int nad_mkdir | ( | int | argc,
|  | char ** | argv,
|  | AFPObj * | obj )
| extern

## ◆ nad_mv()

int nad_mv | ( | int | argc,
|  | char ** | argv,
|  | AFPObj * | obj )
| extern

## ◆ nad_rm()

int nad_rm | ( | int | argc,
|  | char ** | argv,
|  | AFPObj * | obj )
| extern

## ◆ nad_rmdir()

int nad_rmdir | ( | int | argc,
|  | char ** | argv,
|  | AFPObj * | obj )
| extern

## ◆ nad_set()

int nad_set | ( | int | argc,
|  | char ** | argv,
|  | AFPObj * | obj )
| extern

## ◆ openvol()

int openvol | ( | AFPObj * | obj,
|  | const char * | path,
|  | afpvol_t * | vol )
| extern

Load volinfo and initialize struct vol.

The path must be inside an AFP volume. Returns -1 if it is not.

Parameters

  [in] | obj | AFPObj of the current connection
  [in] | path | path to evaluate
  [in,out] | vol | structure to initialize

Returns
  0 on success, -1 on error

## ◆ openvol_optional()

int openvol_optional | ( | AFPObj * | obj,
|  | const char * | path,
|  | afpvol_t * | vol )
| extern

Open an AFP volume, or return a stub for non-AFP paths.

If the path is inside an AFP volume, the volume's CNID database is opened. If the path is outside any AFP volume, a stub volume with v_path=NULL and v_cdb=NULL is returned so that callers can use v_path as a guard for AFP-specific operations.

This is intended for commands like mv and cp that may operate across AFP and non-AFP paths.

Parameters

  [in] | obj | AFPObj of the current connection
  [in] | path | path to evaluate
  [in,out] | vol | structure to initialize

Returns
  0 on success, -1 on error

## ◆ set_signal()

void set_signal | ( | void |  | ) |
| extern

## ◆ utompath()

char * utompath | ( | const struct vol * | ,
|  | const char * | )
| extern

## Variable Documentation

## ◆ alarmed

volatile sig_atomic_t alarmed
| extern

Signal flag for clean exit

flags for signals

## ◆ fflag

int fflag
| extern

## ◆ iflag

int iflag

## ◆ lflag

int lflag

## ◆ log_verbose

int log_verbose
| extern

Logging flag

## ◆ nflag

int nflag

## ◆ pflag

int pflag

## ◆ vflag

int vflag