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

#include <glib.h>
#include <gnet/gnet.h>

#include "btp/btp.h"
#include "mtp/mtp_server.h"
#include "util/sha_cache.h"


extern gboolean	   jm_running;

extern gchar*	   jm_hostname;
extern GInetAddr*  jm_iface;

extern GInetAddr*  jm_btp_iface;
extern BPeer*      jm_btp_bpeer;

extern GInetAddr*  jm_mtp_iface;
extern MtpServer*  jm_mtp_server;
 
extern GURL*	   jm_mtp_rvous_url;
extern gboolean    jm_mtp_rvous_locally;
extern gboolean    jm_mtp_mirror_on_download;

extern ShaCache*   jm_sha_cache;




#define JMUTIL_POPT_VARS					\
                                                                \
  gchar*   jmutil_hostname_name = NULL;				\
  gboolean jmutil_use_dns = FALSE;				\
  gchar*   jmutil_interface_name = NULL;			\
  gint     jmutil_btp_port = 0;					\
  gboolean jmutil_force_btp_port = FALSE;			\
  gint     jmutil_mtp_port = 0;					\
  gboolean jmutil_force_mtp_port = FALSE;			\
  gchar*   jmutil_rendezvous_url_str = NULL;


#define JMUTIL_POPT_ARGS					\
                                                                \
    {"hostname", '\0', POPT_ARG_STRING, &jmutil_hostname_name, 0,\
     "Hostname or address of this host", "HOSTNAME"},		\
    {"use-dns", '\0', POPT_ARG_NONE, &jmutil_use_dns, 0,	\
     "Use DNS to figure out my hostname", NULL},		\
                                                                \
    {"interface", '\0', POPT_ARG_STRING, &jmutil_interface_name, 0,\
     "Interface address for listening socket", "ADDR"},		\
                                                                \
    {"btp-port", '\0', POPT_ARG_INT, &jmutil_btp_port, 0,	\
     "Port for BTP listening socket", "PORT"},			\
    {"force-btp-port", '\0', POPT_ARG_NONE, &jmutil_force_btp_port, 0,	\
     "Fail if can't set MTP port", NULL},			\
                                                                \
    {"mtp-port", '\0', POPT_ARG_INT, &jmutil_mtp_port, 0,	\
     "Port for MTP listening socket", "PORT"},			\
    {"force-mtp-port", '\0', POPT_ARG_NONE, &jmutil_force_mtp_port, 0,	\
     "Fail if can't set MTP port", NULL},			\
                                                                \
    {"rendezvous", '\0', POPT_ARG_STRING, &jmutil_rendezvous_url_str, 0, \
     "URL of rendezvous server", "URL"},			



#define JMUTIL_INIT jmutil_init (jmutil_hostname_name, jmutil_use_dns,   \
				 jmutil_interface_name,                  \
				 jmutil_btp_port, jmutil_force_btp_port, \
				 jmutil_mtp_port, jmutil_force_mtp_port, \
				 jmutil_rendezvous_url_str)

gboolean jmutil_init (gchar* hostname_name, gboolean use_dns,
		      gchar* interface_name, 
		      gint btp_port, gboolean force_btp_port,  
		      gint mtp_port, gboolean force_mtp_port,
		      gchar* rendezvous_url_str);

gboolean jmutil_shutdown (void);  /* TRUE if can exit now, FALSE if wait */



syntax highlighted by Code2HTML, v. 0.9.1