netatalk  4.4.0dev
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
catsearch.c File Reference
#include <ctype.h>
#include <errno.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include <atalk/adouble.h>
#include <atalk/afp.h>
#include <atalk/cnid_bdb_private.h>
#include <atalk/cnid.h>
#include <atalk/globals.h>
#include <atalk/logger.h>
#include <atalk/netatalk_conf.h>
#include <atalk/unicode.h>
#include <atalk/util.h>
#include "desktop.h"
#include "dircache.h"
#include "directory.h"
#include "file.h"
#include "filedir.h"
#include "fork.h"
#include "volume.h"

Data Structures

struct  finderinfo
struct  scrit
struct  dsitem

Macros

#define DS_BSIZE   128
#define CATPBIT_PARTIAL   31
#define VETO_STR    "./../.AppleDouble/.AppleDB/Network Trash Folder/TheVolumeSettingsFolder/TheFindByContentFolder/.AppleDesktop/.Parent/"
#define NUM_ROUNDS   200

Typedefs

typedef char packed_finder[ADEDLEN_FINDERI]

Functions

static void clearstack (void)
static int addstack (char *uname _U_, struct dir *dir, int pidx _U_)
static int reducestack (void)
static struct adoubleadl_lkup (struct vol *vol, struct path *path, struct adouble *adp)
static struct finderinfounpack_buffer (struct finderinfo *finfo, char *buffer)
static struct finderinfounpack_finderinfo (struct vol *vol, struct path *path, struct adouble **adp, struct finderinfo *finfo, int islnk)
static int crit_check (struct vol *vol, struct path *path)
static int rslt_add (const AFPObj *obj, struct vol *vol, struct path *path, char **buf, int ext)
static int catsearch (const AFPObj *obj, struct vol *vol, struct dir *dir, int rmatches, uint32_t *pos, char *rbuf, uint32_t *nrecs, int *rsize, int ext)
static int catsearch_db (const AFPObj *obj, struct vol *vol, const char *uname, int rmatches, uint32_t *pos, char *rbuf, uint32_t *nrecs, int *rsize, int ext)
static int catsearch_afp (AFPObj *obj _U_, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen, int ext)
int afp_catsearch (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
int afp_catsearch_ext (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)

Variables

static int save_cidx = -1
static struct dsitemdstack = NULL
static int dssize = 0
static int dsidx = 0
static struct scrit c1 c2

Macro Definition Documentation

◆ CATPBIT_PARTIAL

#define CATPBIT_PARTIAL   31

◆ DS_BSIZE

#define DS_BSIZE   128

◆ NUM_ROUNDS

#define NUM_ROUNDS   200

This function performs a filesystem search

Uses globals c1, c2, the search criteria

Parameters
vol(r) volume we are searching on ...
dir(rw) directory we are starting from ...
rmatches(r) maximum number of matches we can return
pos(r) position we've stopped recently
rbuf(w) output buffer
nrecs(w) number of matches
rsize(w) length of data written to output buffer
ext(r) extended search flag

◆ VETO_STR

#define VETO_STR    "./../.AppleDouble/.AppleDB/Network Trash Folder/TheVolumeSettingsFolder/TheFindByContentFolder/.AppleDesktop/.Parent/"

Typedef Documentation

◆ packed_finder

typedef char packed_finder[ADEDLEN_FINDERI]

Function Documentation

◆ addstack()

int addstack ( char *uname _U_,
struct dir * dir,
int pidx _U_ )
static

◆ adl_lkup()

struct adouble * adl_lkup ( struct vol * vol,
struct path * path,
struct adouble * adp )
static

◆ afp_catsearch()

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

◆ afp_catsearch_ext()

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

◆ catsearch()

int catsearch ( const AFPObj * obj,
struct vol * vol,
struct dir * dir,
int rmatches,
uint32_t * pos,
char * rbuf,
uint32_t * nrecs,
int * rsize,
int ext )
static

◆ catsearch_afp()

int catsearch_afp ( AFPObj *obj _U_,
char * ibuf,
size_t ibuflen,
char * rbuf,
size_t * rbuflen,
int ext )
static

◆ catsearch_db()

int catsearch_db ( const AFPObj * obj,
struct vol * vol,
const char * uname,
int rmatches,
uint32_t * pos,
char * rbuf,
uint32_t * nrecs,
int * rsize,
int ext )
static

This function performs a CNID db search

Uses globals c1, c2, the search criteria Always searches the whole volume, not a subtree

Parameters
obj(r) AFP connection object
vol(r) volume we are searching on ...
uname(r) UNIX name of object to search
rmatches(r) maximum number of matches we can return
pos(r) position we've stopped recently
rbuf(w) output buffer
nrecs(w) number of matches
rsize(w) length of data written to output buffer
ext(r) extended search flag

◆ clearstack()

void clearstack ( void )
static

◆ crit_check()

int crit_check ( struct vol * vol,
struct path * path )
static

◆ reducestack()

int reducestack ( void )
static

◆ rslt_add()

int rslt_add ( const AFPObj * obj,
struct vol * vol,
struct path * path,
char ** buf,
int ext )
static

◆ unpack_buffer()

struct finderinfo * unpack_buffer ( struct finderinfo * finfo,
char * buffer )
static

◆ unpack_finderinfo()

struct finderinfo * unpack_finderinfo ( struct vol * vol,
struct path * path,
struct adouble ** adp,
struct finderinfo * finfo,
int islnk )
static

Variable Documentation

◆ c2

struct scrit c1 c2
static

◆ dsidx

int dsidx = 0
static

◆ dssize

int dssize = 0
static

◆ dstack

struct dsitem* dstack = NULL
static

◆ save_cidx

int save_cidx = -1
static