3 * Copyright (C) 1990, 1993 Regents of The University of Michigan
4 * All Rights Reserved. See COPYRIGHT
9 * This file contains FPCatSearch implementation. FPCatSearch performs
10 * file/directory search based on specified criteria. It is used by client
11 * to perform fast searches on (propably) big volumes. So, it has to be
14 * This implementation bypasses most of adouble/libatalk stuff as long as
15 * possible and does a standard filesystem search. It calls higher-level
16 * libatalk/afpd functions only when it is really needed, mainly while
17 * returning some non-UNIX information or filtering by non-UNIX criteria.
19 * Initial version written by Rafal Lewczuk <rlewczuk@pronet.pl>
25 #endif /* HAVE_CONFIG_H */
39 #define memcpy(d,s,n) bcopy ((s), (d), (n))
40 #define memmove(d,s,n) bcopy ((s), (d), (n))
41 #endif /* ! HAVE_MEMCPY */
45 #include <netinet/in.h>
47 #include <atalk/afp.h>
48 #include <atalk/adouble.h>
49 #include <atalk/logger.h>
51 #include <atalk/cnid.h>
54 #include "directory.h"
65 u_int16_t attrs; /* File attributes (high 8 bits)*/
66 u_int16_t label; /* Label (low 8 bits )*/
67 char reserved[22]; /* Unknown (at least for now...) */
70 typedef char packed_finder[ADEDLEN_FINDERI];
73 * 0x04 - has a custom icon
74 * 0x20 - name/icon is locked
88 /* This is our search-criteria structure. */
90 u_int32_t rbitmap; /* Request bitmap - which values should we check ? */
91 u_int16_t fbitmap, dbitmap; /* file & directory bitmap - which values should we return ? */
92 u_int16_t attr; /* File attributes */
93 time_t cdate; /* Creation date */
94 time_t mdate; /* Last modification date */
95 time_t bdate; /* Last backup date */
96 u_int32_t pdid; /* Parent DID */
97 u_int16_t offcnt; /* Offspring count */
98 struct finderinfo finfo; /* Finder info */
99 char lname[64]; /* Long name */
100 char utf8name[514]; /* UTF8 or UCS2 name */ /* for convert_charset dest_len parameter +2 */
104 * Directory tree search is recursive by its nature. But AFP specification
105 * requires FPCatSearch to pause after returning n results and be able to
106 * resume the search later. So we have to do recursive search using flat
107 * (iterative) algorithm and remember all directories to look into in an
108 * stack-like structure. The structure below is one item of directory stack.
112 struct dir *dir; /* Structure describing this directory */
113 int pidx; /* Parent's dsitem structure index. */
114 int checked; /* Have we checked this directory ? */
115 char *path; /* absolute UNIX path to this directory */
120 static u_int32_t cur_pos = 0; /* Saved position index (ID) - used to remember "position" across FPCatSearch calls */
121 static DIR *dirpos = NULL; /* UNIX structure describing currently opened directory. */
122 static int save_cidx = -1; /* Saved index of currently scanned directory. */
124 static struct dsitem *dstack = NULL; /* Directory stack data... */
125 static int dssize = 0; /* Directory stack (allocated) size... */
126 static int dsidx = 0; /* First free item index... */
128 static struct scrit c1, c2; /* search criteria */
130 /* Puts new item onto directory stack. */
131 static int addstack(char *uname, struct dir *dir, int pidx)
136 /* check if we have some space on stack... */
137 if (dsidx >= dssize) {
139 dstack = realloc(dstack, dssize * sizeof(struct dsitem));
144 /* Put new element. Allocate and copy lname and path. */
145 ds = dstack + dsidx++;
149 l = strlen(dstack[pidx].path);
150 if (!(ds->path = malloc(l + strlen(uname) + 2) ))
152 strcpy(ds->path, dstack[pidx].path);
153 strcat(ds->path, "/");
154 strcat(ds->path, uname);
162 /* Removes checked items from top of directory stack. Returns index of the first unchecked elements or -1. */
163 static int reducestack()
166 if (save_cidx != -1) {
173 if (dstack[dsidx-1].checked) {
175 free(dstack[dsidx].path);
182 /* Clears directory stack. */
183 static void clearstack()
188 free(dstack[dsidx].path);
192 /* Looks up for an opened adouble structure, opens resource fork of selected file.
193 * FIXME What about noadouble?
195 static struct adouble *adl_lkup(struct vol *vol, struct path *path, struct adouble *adp)
197 static struct adouble ad;
205 isdir = S_ISDIR(path->st.st_mode);
207 if (!isdir && (of = of_findname(path))) {
210 ad_init(&ad, vol->v_adouble, vol->v_ad_options);
214 if ( ad_metadata( path->u_name, ((isdir)?ADFLAGS_DIR:0), adp) < 0 ) {
215 adp = NULL; /* FIXME without resource fork adl_lkup will be call again */
221 /* -------------------- */
222 static struct finderinfo *unpack_buffer(struct finderinfo *finfo, char *buffer)
224 memcpy(&finfo->f_type, buffer +FINDERINFO_FRTYPEOFF, sizeof(finfo->f_type));
225 memcpy(&finfo->creator, buffer +FINDERINFO_FRCREATOFF, sizeof(finfo->creator));
226 memcpy(&finfo->attrs, buffer +FINDERINFO_FRFLAGOFF, sizeof(finfo->attrs));
227 memcpy(&finfo->label, buffer +FINDERINFO_FRFLAGOFF, sizeof(finfo->label));
228 finfo->attrs &= 0xff00; /* high 8 bits */
229 finfo->label &= 0xff; /* low 8 bits */
234 /* -------------------- */
235 static struct finderinfo *
236 unpack_finderinfo(struct vol *vol, struct path *path, struct adouble **adp, struct finderinfo *finfo)
241 *adp = adl_lkup(vol, path, *adp);
242 ptr = get_finderinfo(vol, path->u_name, *adp, &buf);
243 return unpack_buffer(finfo, ptr);
246 /* -------------------- */
247 #define CATPBIT_PARTIAL 31
248 /* Criteria checker. This function returns a 2-bit value. */
249 /* bit 0 means if checked file meets given criteria. */
250 /* bit 1 means if it is a directory and we should descent into it. */
252 * fname - our fname (translated to UNIX)
253 * cidx - index in directory stack
255 static int crit_check(struct vol *vol, struct path *path) {
257 u_int16_t attr, flags = CONV_PRECOMPOSE;
258 struct finderinfo *finfo = NULL, finderinfo;
259 struct adouble *adp = NULL;
260 time_t c_date, b_date;
261 u_int32_t ac_date, ab_date;
262 static char convbuf[514]; /* for convert_charset dest_len parameter +2 */
265 if (S_ISDIR(path->st.st_mode)) {
273 /* compute the Mac name
274 * first try without id (it's slow to find it)
275 * An other option would be to call get_id in utompath but
276 * we need to pass parent dir
278 if (!(path->m_name = utompath(vol, path->u_name, 0 , utf8_encoding()) )) {
279 /*retry with the right id */
283 adp = adl_lkup(vol, path, adp);
284 id = get_id(vol, adp, &path->st, path->d_dir->d_did, path->u_name, strlen(path->u_name));
289 if (!(path->m_name = utompath(vol, path->u_name, id , utf8_encoding()))) {
295 /* Kind of optimization:
296 * -- first check things we've already have - filename
297 * -- last check things we get from ad_open()
298 * FIXME strmcp strstr (icase)
301 /* Check for filename */
302 if ((c1.rbitmap & (1<<DIRPBIT_LNAME))) {
303 if ( (size_t)(-1) == (len = convert_string(vol->v_maccharset, CH_UCS2, path->m_name, strlen(path->m_name), convbuf, 512)) )
306 if ((c1.rbitmap & (1<<CATPBIT_PARTIAL))) {
307 if (strcasestr_w( (ucs2_t*) convbuf, (ucs2_t*) c1.lname) == NULL)
310 if (strcasecmp_w((ucs2_t*) convbuf, (ucs2_t*) c1.lname) != 0)
314 if ((c1.rbitmap & (1<<FILPBIT_PDINFO))) {
315 if ( (size_t)(-1) == (len = convert_charset( CH_UTF8_MAC, CH_UCS2, CH_UTF8, path->m_name, strlen(path->m_name), convbuf, 512, &flags))) {
319 if (c1.rbitmap & (1<<CATPBIT_PARTIAL)) {
320 if (strcasestr_w((ucs2_t *) convbuf, (ucs2_t*)c1.utf8name) == NULL)
323 if (strcasecmp_w((ucs2_t *)convbuf, (ucs2_t*)c1.utf8name) != 0)
329 if ((unsigned)c2.mdate > 0x7fffffff)
330 c2.mdate = 0x7fffffff;
331 if ((unsigned)c2.cdate > 0x7fffffff)
332 c2.cdate = 0x7fffffff;
333 if ((unsigned)c2.bdate > 0x7fffffff)
334 c2.bdate = 0x7fffffff;
336 /* Check for modification date */
337 if ((c1.rbitmap & (1<<DIRPBIT_MDATE))) {
338 if (path->st.st_mtime < c1.mdate || path->st.st_mtime > c2.mdate)
342 /* Check for creation date... */
343 if ((c1.rbitmap & (1<<DIRPBIT_CDATE))) {
344 c_date = path->st.st_mtime;
345 adp = adl_lkup(vol, path, adp);
346 if (adp && ad_getdate(adp, AD_DATE_CREATE, &ac_date) >= 0)
347 c_date = AD_DATE_TO_UNIX(ac_date);
349 if (c_date < c1.cdate || c_date > c2.cdate)
353 /* Check for backup date... */
354 if ((c1.rbitmap & (1<<DIRPBIT_BDATE))) {
355 b_date = path->st.st_mtime;
356 adp = adl_lkup(vol, path, adp);
357 if (adp && ad_getdate(adp, AD_DATE_BACKUP, &ab_date) >= 0)
358 b_date = AD_DATE_TO_UNIX(ab_date);
360 if (b_date < c1.bdate || b_date > c2.bdate)
364 /* Check attributes */
365 if ((c1.rbitmap & (1<<DIRPBIT_ATTR)) && c2.attr != 0) {
366 if ((adp = adl_lkup(vol, path, adp))) {
367 ad_getattr(adp, &attr);
368 if ((attr & c2.attr) != c1.attr)
374 /* Check file type ID */
375 if ((c1.rbitmap & (1<<DIRPBIT_FINFO)) && c2.finfo.f_type != 0) {
376 finfo = unpack_finderinfo(vol, path, &adp, &finderinfo);
377 if (finfo->f_type != c1.finfo.f_type)
381 /* Check creator ID */
382 if ((c1.rbitmap & (1<<DIRPBIT_FINFO)) && c2.finfo.creator != 0) {
384 finfo = unpack_finderinfo(vol, path, &adp, &finderinfo);
386 if (finfo->creator != c1.finfo.creator)
390 /* Check finder info attributes */
391 if ((c1.rbitmap & (1<<DIRPBIT_FINFO)) && c2.finfo.attrs != 0) {
393 finfo = unpack_finderinfo(vol, path, &adp, &finderinfo);
396 if ((finfo->attrs & c2.finfo.attrs) != c1.finfo.attrs)
401 if ((c1.rbitmap & (1<<DIRPBIT_FINFO)) && c2.finfo.label != 0) {
403 finfo = unpack_finderinfo(vol, path, &adp, &finderinfo);
405 if ((finfo->label & c2.finfo.label) != c1.finfo.label)
408 /* FIXME: Attributes check ! */
410 /* All criteria are met. */
414 ad_close(adp, ADFLAGS_HF);
418 /* ------------------------------ */
419 static int rslt_add ( struct vol *vol, struct path *path, char **buf, int ext)
424 u_int16_t resultsize;
425 int isdir = S_ISDIR(path->st.st_mode);
427 /* Skip resultsize */
429 p += sizeof(resultsize);
434 *p++ = isdir ? FILDIRBIT_ISDIR : FILDIRBIT_ISFILE; /* IsDir ? */
441 ret = getdirparams(vol, c1.dbitmap, path, path->d_dir, p , &tbuf );
444 /* FIXME slow if we need the file ID, we already know it */
445 ret = getfilparams ( vol, c1.fbitmap, path, path->d_dir, p, &tbuf);
451 /* Make sure entry length is even */
458 resultsize = htons(tbuf);
459 memcpy ( *buf, &resultsize, sizeof(resultsize) );
471 "./../.AppleDouble/.AppleDB/Network Trash Folder/TheVolumeSettingsFolder/TheFindByContentFolder/.AppleDesktop/.Parent/"
473 /* This function performs search. It is called directly from afp_catsearch
474 * vol - volume we are searching on ...
475 * dir - directory we are starting from ...
476 * c1, c2 - search criteria
477 * rmatches - maximum number of matches we can return
478 * pos - position we've stopped recently
479 * rbuf - output buffer
480 * rbuflen - output buffer length
482 #define NUM_ROUNDS 100
483 static int catsearch(struct vol *vol, struct dir *dir,
484 int rmatches, u_int32_t *pos, char *rbuf, u_int32_t *nrecs, int *rsize, int ext)
487 struct dirent *entry;
491 char *orig_dir = NULL;
492 int orig_dir_len = 128;
493 char *vpath = vol->v_path;
496 int num_rounds = NUM_ROUNDS;
499 if (*pos != 0 && *pos != cur_pos) {
500 result = AFPERR_CATCHNG;
504 /* FIXME: Category "offspring count ! */
506 /* So we are beginning... */
507 start_time = time(NULL);
509 /* We need to initialize all mandatory structures/variables and change working directory appropriate... */
512 if (dirpos != NULL) {
517 if (addstack("", dir, -1) == -1) {
518 result = AFPERR_MISC;
521 dstack[0].path = strdup(vpath);
522 /* FIXME: Sometimes DID is given by client ! (correct this one above !) */
525 /* Save current path */
526 orig_dir = (char*)malloc(orig_dir_len);
527 while (getcwd(orig_dir, orig_dir_len-1)==NULL) {
528 if (errno != ERANGE) {
529 result = AFPERR_MISC;
533 orig_dir = realloc(orig_dir, orig_dir_len);
536 while ((cidx = reducestack()) != -1) {
538 if (dirpos == NULL) {
539 dirpos = opendir(dstack[cidx].path);
540 cached = (dstack[cidx].dir->d_child != NULL);
542 if (dirpos == NULL) {
545 dstack[cidx].checked = 1;
550 result = AFPERR_NFILE;
555 result = AFPERR_MISC;
556 } /* switch (errno) */
559 /* FIXME error in chdir, what do we do? */
560 chdir(dstack[cidx].path);
563 while ((entry=readdir(dirpos)) != NULL) {
566 if (!check_dirent(vol, entry->d_name))
570 path.u_name = entry->d_name;
571 if (of_stat(&path) != 0) {
582 result = AFPERR_MISC;
586 if (S_ISDIR(path.st.st_mode)) {
587 /* here we can short cut
588 ie if in the same loop the parent dir wasn't in the cache
589 ALL dirsearch_byname will fail.
592 path.d_dir = dirsearch_byname(dstack[cidx].dir, path.u_name);
596 /* path.m_name is set by adddir */
597 if (NULL == (path.d_dir = adddir( vol, dstack[cidx].dir, &path) ) ) {
598 result = AFPERR_MISC;
602 path.m_name = path.d_dir->d_m_name;
604 if (addstack(path.u_name, path.d_dir, cidx) == -1) {
605 result = AFPERR_MISC;
610 /* yes it sucks for directory d_dir is the directory, for file it's the parent directory*/
611 path.d_dir = dstack[cidx].dir;
613 ccr = crit_check(vol, &path);
615 /* bit 0 means that criteria has been met */
617 r = rslt_add ( vol, &path, &rrbuf, ext);
620 result = AFPERR_MISC;
624 /* Number of matches limit */
626 goto catsearch_pause;
627 /* Block size limit */
628 if (rrbuf - rbuf >= 448)
629 goto catsearch_pause;
631 /* MacOS 9 doesn't like servers executing commands longer than few seconds */
632 if (--num_rounds <= 0) {
633 if (start_time != time(NULL)) {
635 goto catsearch_pause;
637 num_rounds = NUM_ROUNDS;
639 } /* while ((entry=readdir(dirpos)) != NULL) */
642 dstack[cidx].checked = 1;
643 } /* while (current_idx = reducestack()) != -1) */
645 /* We have finished traversing our tree. Return EOF here. */
653 catsearch_end: /* Exiting catsearch: error condition */
654 *rsize = rrbuf - rbuf;
655 if (orig_dir != NULL) {
662 /* -------------------------- */
663 int catsearch_afp(AFPObj *obj _U_, char *ibuf, int ibuflen,
664 char *rbuf, int *rbuflen, int ext)
669 u_int32_t rmatches, reserved;
674 unsigned char *spec1, *spec2, *bspec1, *bspec2;
682 /* min header size */
687 memset(&c1, 0, sizeof(c1));
688 memset(&c2, 0, sizeof(c2));
691 memcpy(&vid, ibuf, sizeof(vid));
694 if ((vol = getvolbyvid(vid)) == NULL) {
698 memcpy(&rmatches, ibuf, sizeof(rmatches));
699 rmatches = ntohl(rmatches);
700 ibuf += sizeof(rmatches);
702 /* FIXME: (rl) should we check if reserved == 0 ? */
703 ibuf += sizeof(reserved);
705 memcpy(catpos, ibuf, sizeof(catpos));
706 ibuf += sizeof(catpos);
708 memcpy(&c1.fbitmap, ibuf, sizeof(c1.fbitmap));
709 c1.fbitmap = c2.fbitmap = ntohs(c1.fbitmap);
710 ibuf += sizeof(c1.fbitmap);
712 memcpy(&c1.dbitmap, ibuf, sizeof(c1.dbitmap));
713 c1.dbitmap = c2.dbitmap = ntohs(c1.dbitmap);
714 ibuf += sizeof(c1.dbitmap);
716 memcpy(&c1.rbitmap, ibuf, sizeof(c1.rbitmap));
717 c1.rbitmap = c2.rbitmap = ntohl(c1.rbitmap);
718 ibuf += sizeof(c1.rbitmap);
720 if (! (c1.fbitmap || c1.dbitmap)) {
721 return AFPERR_BITMAP;
725 memcpy(&spec_len, ibuf, sizeof(spec_len));
726 spec_len = ntohs(spec_len);
729 /* with catsearch only name and parent id are allowed */
730 c1.fbitmap &= (1<<FILPBIT_LNAME) | (1<<FILPBIT_PDID);
731 c1.dbitmap &= (1<<DIRPBIT_LNAME) | (1<<DIRPBIT_PDID);
732 spec_len = *(unsigned char*)ibuf;
735 /* Parse file specifications */
737 spec2 = ibuf + spec_len + 2;
744 /* File attribute bits... */
745 if (c1.rbitmap & (1 << FILPBIT_ATTR)) {
746 memcpy(&c1.attr, spec1, sizeof(c1.attr));
747 spec1 += sizeof(c1.attr);
748 memcpy(&c2.attr, spec2, sizeof(c2.attr));
749 spec2 += sizeof(c1.attr);
753 if (c1.rbitmap & (1 << FILPBIT_PDID)) {
754 memcpy(&c1.pdid, spec1, sizeof(pdid));
755 spec1 += sizeof(c1.pdid);
756 memcpy(&c2.pdid, spec2, sizeof(pdid));
757 spec2 += sizeof(c2.pdid);
758 } /* FIXME: PDID - do we demarshall this argument ? */
761 if (c1.rbitmap & (1 << FILPBIT_CDATE)) {
762 memcpy(&c1.cdate, spec1, sizeof(c1.cdate));
763 spec1 += sizeof(c1.cdate);
764 c1.cdate = AD_DATE_TO_UNIX(c1.cdate);
765 memcpy(&c2.cdate, spec2, sizeof(c2.cdate));
766 spec2 += sizeof(c1.cdate);
767 ibuf += sizeof(c1.cdate);;
768 c2.cdate = AD_DATE_TO_UNIX(c2.cdate);
771 /* Modification date */
772 if (c1.rbitmap & (1 << FILPBIT_MDATE)) {
773 memcpy(&c1.mdate, spec1, sizeof(c1.mdate));
774 c1.mdate = AD_DATE_TO_UNIX(c1.mdate);
775 spec1 += sizeof(c1.mdate);
776 memcpy(&c2.mdate, spec2, sizeof(c2.mdate));
777 c2.mdate = AD_DATE_TO_UNIX(c2.mdate);
778 spec2 += sizeof(c1.mdate);
782 if (c1.rbitmap & (1 << FILPBIT_BDATE)) {
783 memcpy(&c1.bdate, spec1, sizeof(c1.bdate));
784 spec1 += sizeof(c1.bdate);
785 c1.bdate = AD_DATE_TO_UNIX(c1.bdate);
786 memcpy(&c2.bdate, spec2, sizeof(c2.bdate));
787 spec2 += sizeof(c2.bdate);
788 c1.bdate = AD_DATE_TO_UNIX(c2.bdate);
792 if (c1.rbitmap & (1 << FILPBIT_FINFO)) {
795 memcpy(buf, spec1, sizeof(buf));
796 unpack_buffer(&c1.finfo, buf);
797 spec1 += sizeof(buf);
799 memcpy(buf, spec2, sizeof(buf));
800 unpack_buffer(&c2.finfo, buf);
801 spec2 += sizeof(buf);
804 if ((c1.rbitmap & (1 << DIRPBIT_OFFCNT)) != 0) {
805 /* Offspring count - only directories */
806 if (c1.fbitmap == 0) {
807 memcpy(&c1.offcnt, spec1, sizeof(c1.offcnt));
808 spec1 += sizeof(c1.offcnt);
809 c1.offcnt = ntohs(c1.offcnt);
810 memcpy(&c2.offcnt, spec2, sizeof(c2.offcnt));
811 spec2 += sizeof(c2.offcnt);
812 c2.offcnt = ntohs(c2.offcnt);
814 else if (c1.dbitmap == 0) {
815 /* ressource fork length */
818 return AFPERR_BITMAP; /* error */
820 } /* Offspring count/ressource fork length */
823 if (c1.rbitmap & (1 << FILPBIT_LNAME)) {
824 /* Get the long filename */
825 memcpy(tmppath, bspec1 + spec1[1] + 1, (bspec1 + spec1[1])[0]);
826 tmppath[(bspec1 + spec1[1])[0]]= 0;
827 len = convert_string ( vol->v_maccharset, CH_UCS2, tmppath, strlen(tmppath), c1.lname, sizeof(c1.lname));
828 if (len == (size_t)(-1))
832 /* FIXME: do we need it ? It's always null ! */
833 memcpy(c2.lname, bspec2 + spec2[1] + 1, (bspec2 + spec2[1])[0]);
834 c2.lname[(bspec2 + spec2[1])[0]]= 0;
838 if (c1.rbitmap & (1 << FILPBIT_PDINFO)) {
841 memcpy(&namelen, spec1, sizeof(namelen));
842 namelen = ntohs (namelen);
844 spec1 = bspec1+namelen+4; /* Skip Unicode Hint */
847 memcpy(&namelen, spec1, sizeof(namelen));
848 namelen = ntohs (namelen);
849 if (namelen > 255) /* Safeguard */
852 memcpy (c1.utf8name, spec1+2, namelen);
853 c1.utf8name[(namelen+1)] =0;
855 /* convert charset */
856 flags = CONV_PRECOMPOSE;
857 len = convert_charset(CH_UTF8_MAC, CH_UCS2, CH_UTF8, c1.utf8name, namelen, c1.utf8name, 512, &flags);
858 if (len == (size_t)(-1))
864 ret = catsearch(vol, vol->v_dir, rmatches, &catpos[0], rbuf+24, &nrecs, &rsize, ext);
865 memcpy(rbuf, catpos, sizeof(catpos));
866 rbuf += sizeof(catpos);
868 c1.fbitmap = htons(c1.fbitmap);
869 memcpy(rbuf, &c1.fbitmap, sizeof(c1.fbitmap));
870 rbuf += sizeof(c1.fbitmap);
872 c1.dbitmap = htons(c1.dbitmap);
873 memcpy(rbuf, &c1.dbitmap, sizeof(c1.dbitmap));
874 rbuf += sizeof(c1.dbitmap);
876 nrecs = htonl(nrecs);
877 memcpy(rbuf, &nrecs, sizeof(nrecs));
878 rbuf += sizeof(nrecs);
882 } /* catsearch_afp */
884 /* -------------------------- */
885 int afp_catsearch (AFPObj *obj, char *ibuf, int ibuflen,
886 char *rbuf, int *rbuflen)
888 return catsearch_afp( obj, ibuf, ibuflen, rbuf, rbuflen, 0);
892 int afp_catsearch_ext (AFPObj *obj, char *ibuf, int ibuflen,
893 char *rbuf, int *rbuflen)
895 return catsearch_afp( obj, ibuf, ibuflen, rbuf, rbuflen, 1);
898 /* FIXME: we need a clean separation between afp stubs and 'real' implementation */
899 /* (so, all buffer packing/unpacking should be done in stub, everything else
900 should be done in other functions) */