1 /* $Id: rset.c,v 1.27 2004-08-24 14:25:16 heikki Exp $
2 Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
5 This file is part of the Zebra server.
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with Zebra; see the file LICENSE.zebra. If not, write to the
19 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
32 RSET rset_create_base(const struct rset_control *sel, NMEM nmem)
33 /* FIXME - Add keysize and cmp function */
34 /* FIXME - Add a general key-func block for cmp, dump, etc */
38 logf (LOG_DEBUG, "rs_create(%s)", sel->desc);
39 rnew = (RSET) xmalloc(sizeof(*rnew));
47 rnew->nmem=nmem_create();
53 void rset_delete (RSET rs)
58 (*rs->control->f_delete)(rs);
60 nmem_destroy(rs->nmem);
65 RSET rset_dup (RSET rs)
71 void rset_default_pos (RSFD rfd, double *current, double *total)
72 { /* This should never really be needed, but it is still used in */
73 /* those rsets that we don't really plan to use, like isam-s */
77 *current=-1; /* signal that pos is not implemented */
79 } /* rset_default_pos */
81 int rset_default_forward(RSET ct, RSFD rfd, void *buf,
82 int (*cmpfunc)(const void *p1, const void *p2),
87 logf (LOG_DEBUG, "rset_default_forward starting '%s' (ct=%p rfd=%p)",
88 ct->control->desc, ct,rfd);
89 /* key_logdump(LOG_DEBUG, untilbuf); */
90 while ( (cmp==2) && (more))
92 logf (LOG_DEBUG, "rset_default_forward looping m=%d c=%d",more,cmp);
93 more=rset_read(ct, rfd, buf);
95 cmp=(*cmpfunc)(untilbuf,buf);
97 key_logdump(LOG_DEBUG,buf); */
99 logf (LOG_DEBUG, "rset_default_forward exiting m=%d c=%d",more,cmp);