/* Jungle Monkey
 * Copyright (C) 1999-2001  The Regents of the University of Michigan
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */


/**

   Jungle Monkey Multicast Search Protocol cache

   A JMMSP cache hooks up with one or more JMMSP's.  It caches matches
   and attempts to answer queries from its cache.

*/



#ifndef _JMMSP_CACHE_H
#define _JMMSP_CACHE_H

#include <glib.h>
#include "jmmsp.h"



#define JMMSP_CACHE_SIZE_DEFAULT       16384	/* bytes        */
#define JMMSP_CACHE_TIMEOUT_DEFAULT   300000	/* milliseconds */
#define JMMSP_CACHE_MAX_REPLIES		 100
#define JMMSP_CACHE_MAX_ENTRY_SIZE	 256    /* bytes        */


typedef struct _JMMSPCache  /* Derived from JMMSPHandler */
{
  JMMSPHandler handler;

  GSList*      entries;
  GSList*      entry_last;
  GHashTable*  entry_set;
  guint        cache_size;
  guint        max_cache_size;
  guint        cache_timeout;

} JMMSPCache;


JMMSPCache* jmmsp_cache_new (void);
void   	    jmmsp_cache_delete (JMMSPCache* cache);

void   	    jmmsp_cache_set_policy (JMMSPCache* cache, guint max_cache_size, 
				    guint cache_timeout);
void   	    jmmsp_cache_clear (JMMSPCache* cache);

/* Use jmmsp_add/remove_handler to connect/disconnect to JMMSP */

#endif /* _JMMSP_CACHE_H */


syntax highlighted by Code2HTML, v. 0.9.1