/*
** CBLM v3
** $Id: prefs.h,v 1.17 2008/07/14 00:25:08 sella Exp $
** Copyright (c) 2004-2007 James M. Sella. All Rights Reserved.
** Released under the GPL Version 2 License.
** http://www.digitalgenesis.com
** 
** Cheap Bastard Latency Monitor v3
*/

#ifndef __DGS_PREFS_H
#define __DGS_PREFS_H

#include "common.h"

#define DEF_NICENESS -10
#define DEF_PORT 7447
#define DEF_REPEAT 1800
#define DEF_RATE 120
#define DEF_TOS "0:0"
#define DEF_MAXOTT 1000
#define DEF_SIZE 64
#define DEF_PATTERN "kusabana" // Flower
#define DEF_KEY "o-soraizu" // Authorization
#define DEF_STATS "cblm.stats"
#define DEF_MAXAGE 90
#ifdef IPDEFTTL
	#define DEF_TTL IPDEFTTL
#else
	#define DEF_TTL 64
#endif

#define DEF_DBHOST ""
#define DEF_DBPORT MYSQL_PORT
#define DEF_DBTIMO 30 // Connection timeout
#define DEF_DBSOCK ""
#define DEF_DBNAME "cblm"
#define DEF_DBUSER "cblm"
#define DEF_DBPASS ""
#define DEF_DBPASS ""
#define DEF_DBCOMP 0

#define MAX_REPEAT 86400
#define MAX_RATE 32000
#define MAX_MAXOTT 5000
#define MIN_MAXAGE 3
#define MAX_MAXAGE 86400
#define MAX_TTL 255

/* Max allowed (usec) to consider a sample garbage. */
#define MAX_RTT (5000 * 1000)	/* 5 sec */
#define MAX_OTT (MAX_RTT / 2)	/* 2.5 sec */
#define MAX_JTR MAX_RTT			/* 5 sec */

/* Default threshold values */
#define DEF_THRESHOLD_LOSS 1
#define DEF_THRESHOLD_RTT 120
#define DEF_THRESHOLD_OTT 60
#define DEF_THRESHOLD_JTR 10
#define DEF_THRESHOLD_TOS 1
#define DEF_THRESHOLD_PRI 1
#define DEF_THRESHOLD_OOO 1
#define DEF_THRESHOLD_DUP 1

/* Function Definitions. */
int get_args(int argc, char** argv);
void version(int flag);
void usage();
int use_args();

int read_prefs(int flag);
int write_prefs();
uint64_t last_prefs();
void add_tos(const char* str, int shift);

void free_args();
void free_prefs();
void free_tos();

void display_args();
void display_prefs(int tty);

#endif 

/*
** Local Variables:
** c-basic-offset: 3
** tab-width: 3
** End:
** vim: noet ts=3 sw=3
*/
