/* 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 search

   This interfaces with JMMSP groups to perform searches.

 */



#ifndef _JMMSP_SEARCH_H
#define _JMMSP_SEARCH_H

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


#define JMMSP_SEARCH_TIMEOUT		(1 * 60 * 1000)		/* 1 minute */
#define JMMSP_SEARCH_MAX_HOPS		30
#define JMMSP_SEARCH_HOP_STEP		1
#define JMMSP_SEARCH_TIME_PER_HOP	(1 * 1000)		/* 1 second */


typedef gpointer JMMSPSearchID;


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

  GSList* searches;

} JMMSPSearch;

typedef void (*JMMSPSearchFunc)(JMMSPSearch* search, JMMSPSearchID id, 
				const JMMSPReply* reply, gpointer user_data);
/* A NULL reply indictates error.  On success, the search id is still
   valid.  On error, it becomes invalid. */




JMMSPSearch* 	jmmsp_search_new (void);
void   	  	jmmsp_search_delete (JMMSPSearch* search);

JMMSPSearchID 	jmmsp_search_query (JMMSPSearch* search, const gchar* keyword, 
				    JMMSPSearchFunc func, gpointer user_data);
void   	  	jmmsp_search_cancel (JMMSPSearch* search, JMMSPSearchID id);

const gchar*	jmmsp_search_get_keyword (const JMMSPSearchID id);


/* Add jmmsp? */


#endif /* _JMMSP_SEARCH_H */


syntax highlighted by Code2HTML, v. 0.9.1