/*-*-linux-c-*-*/

/*
 *  gnewtellium - Newtella for Unix
 *  Copyright (C) 2001 Elias Athanasopoulos
 *
 *  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
 */

#ifndef GLOBAL_H
#define GLOBAL_H

#include "../config.h"

#include <gtk/gtk.h>
#include <inttypes.h>

#include "guid.h"

#define GNEWTELLIUM  "gnewtellium-IPv6"
#define RELEASE_DATE "Feb 27 2004"
#define GNEW_WEBSITE "http://gnewtellium.sourceforge.net/"

#define MAX_TEMPBUF_LEN 4096

#define GNUTELLA_MAX_HOPS               7
#define GNUTELLA_MAX_TTL                50
#define GNUTELLA_MAX_QUERY              255
#define GNUTELLA_MAX_QUERYRESPONSE      67075
#define MAX_PACKET_LENGTH               67075

#define BYTES_PER_SECOND     700
#define MIN_BYTES_PER_SECOND 14400
#define MAX_BYTES_PER_SECOND 10000000

#define GNUTELLA_PING_TTL    7
#define GNUTELLA_SEARCH_TTL 12

#define CON_TIMEOUT 21
#define CON_IDLE    31
#define CON_REMOVE   5

#define HOST_CACHE_LOW_LIMIT 50
#define HOST_FEED            10
#define HOST_CACHE_SERVER    "lion.ibr.cs.tu-bs.de:6346"

GList *gl_results;
GList *gl_down_con;
GList *gl_up_con;
GList *gl_con;
GList *gl_file_db;

/* routing list */
GSList *rmessages;

GList *gl_hosts_in_cache;

GSList *gl_queries;

struct newtella_options {
	gint hosts_in_cache, files_found;

	/* obsolete: TOREMOVE */
	gint current_con, current_down_con, current_up_con;

	gint cons, dcons, ucons;
	gint connected;

	guint32 max_bytes_per_second;

	gchar   gl_guid[GUID_LEN];

	/* loadable/saveable config */
	guint16 con_speed;
	guint16 newtella_port;
	//guint32 local_ip;
	uint8_t local_ip[16];
	guint16 max_downloads, max_uploads, max_uploads_per_host, max_search_results;
	guint16 host_cache_length;

	guint8  min_con, max_con;
	guint8  auto_connect, accept_in_con, auto_reconnect;

	gchar  download_dir[255];
	GList *shared_dirs;
};

struct newtella_options *gl_options;
int gl_server, gl_read_tag;

struct host_info *gl_my_host_info;

#endif
