#include "ca_defs.h"

/*
int bport = 43;
*/

GSList *sourceList = NULL;

/*
 * 20000609
 * Experiment:
 * The GSList variable, "mySrcList", is defined in the ca_defs.h
 * file (with an 'extern' modifier).
 * GSList *mySrcList = NULL;
 */

/*
int testmode = 0;
*/

/*
values_t globals[]	=	{
			{"43", &bport},
			{"/ncc/db2/doc/HELP", "/ncc/db2/doc/HELP"},
			{"% Rights restricted by copyright. See http://www.ripe.net/db/dbcopyright.html", "% Rights restricted by copyright. See http://www.ripe.net/db/dbcopyright.html"},
			{"SourceList", NULL},
			{"0", &testmode},
			{"1Bt9RNSMWcA.Y", "1Bt9RNSMWcA.Y"},
			{"/ncc/db2/doc/WHOIS-HELP", "/ncc/db2/doc/WHOIS-HELP"},
			{"/ncc/db2/doc/AUTO-DBM-HELP", "/ncc/db2/doc/AUTO-DBM-HELP"},
			{"/ncc/db2/etc/attr-desc.config", "/ncc/db2/etc/attr-desc.config"},
			{"RIPE", "RIPE"},
			{"RIPE          /ncc/db2/data/ripe/ripe.db         SPLIT", "RIPE          /ncc/db2/data/ripe/ripe.db         SPLIT"},
			{"RIPE", "RIPE"},
			{"SourceList", NULL},
			{"dbase", "dbase"},
			{"/ncc/db2/log/qry/qrylog", "/ncc/db2/log/qry/qrylog"},
			{"/ncc/db2/log/qry/qry2log", "/ncc/db2/log/qry/qry2log"},
			{"/ncc/db2/log/err/errlog", "/ncc/db2/log/err/errlog"},
			{"/ncc/db2/log/audit/auditlog", "/ncc/db2/log/audit/auditlog"},
			{"/ncc/db2/log/upd", "/ncc/db2/log/upd"},
			{"/ncc/db2/log/ack", "/ncc/db2/log/ack"},
			{"/ncc/db2/locks", "/ncc/db2/locks"},
			{"whoisd.pid", "whoisd.pid"},
			{"STOPUPDATES", "STOPUPDATES"},
			{"CLEANDB.LOCK", "CLEANDB.LOCK"},
			{"/ncc/db2/serials/current", "/ncc/db2/serials/current"},
			{"/ncc/db2/serials/old", "/ncc/db2/serials/old"},
			{"/ncc/db2/serials/incoming", "/ncc/db2/serials/incoming"},
			{"180", "180"},
			{"RIPE-NCC-HM-MNT ", "RIPE-NCC-HM-MNT "},
			{"127.0.0.1", "127.0.0.1"},
			{"193.0.0.1[345678][0-9]", "193.0.0.1[345678][0-9]"},
			{"195.88.156.1", "195.88.156.1"},
			{"/ncc/db2/tmp", "/ncc/db2/tmp"},
			{"/usr/local/bin/pgpv", "/usr/local/bin/pgpv"},
			{"/usr/local/bin/pgpk", "/usr/local/bin/pgpk"},
			{"/ncc/db2/.pgp", "/ncc/db2/.pgp"},
			{"/var/qmail/bin/qmail-inject -fripe-dbm", "/var/qmail/bin/qmail-inject -fripe-dbm"},
			{"8096", "8096"},
			{"2097152", "2097152"},
			{"2", "2"},
			{"ripe-dbm@ripe.net", "ripe-dbm@ripe.net"},
			{"ripe-dbm@ripe.net", "ripe-dbm@ripe.net"},
			{"auto-dbm@ripe.net", "auto-dbm@ripe.net"},
			{"nostrict", "nostrict"},
			{"% No entries found for the selected source(s).", "% No entries found for the selected source(s)."},
			{"Subject: RIPE RR: Addition of overlapping routes", "Subject: RIPE RR: Addition of overlapping routes"},
			{"Subject: RIPE RR: Removal  of overlapping routes", "Subject: RIPE RR: Removal  of overlapping routes"},
			{"The addition of your route object ... ", "The addition of your route object ... "},
			{"The deletion of your route object ... ", "The deletion of your route object ... "},
			{"created new overlaps with the following routes ...", "created new overlaps with the following routes ..."},
			{"removed the overlaps with the following routes ...", "removed the overlaps with the following routes ..."},
			{"Subject: RIPE RR: Addition of overlapping routes", "Subject: RIPE RR: Addition of overlapping routes"},
			{"Subject: RIPE RR: Removal  of overlapping routes", "Subject: RIPE RR: Removal  of overlapping routes"},
			{"The addition of the route object ... ", "The addition of the route object ... "},
			{"The deletion of the route object ... ", "The deletion of the route object ... "},
			{"created new overlaps with your following routes ...", "created new overlaps with your following routes ..."},
			{"removed the overlaps with your following routes ...", "removed the overlaps with your following routes ..."},
			{"Your e-mail:", "Your e-mail:"},
			{"From: RIPE Database Management <$HUMAILBOX>", "From: RIPE Database Management <$HUMAILBOX>"},
			{"From: RIPE Database Management <$HUMAILBOX>", "From: RIPE Database Management <$HUMAILBOX>"},
			{"Subject: SUCCEEDED: $SUBJECT", "Subject: SUCCEEDED: $SUBJECT"},
			{"Help file requested so body of message ignored.", "Help file requested so body of message ignored."},
			{"Objects that just generated a WARNING have been updated as shown.", "Objects that just generated a WARNING have been updated as shown."},
			{"No errors were found in your database update.  Congratulations.", "No errors were found in your database update.  Congratulations."},
			{"RIPE Database Maintenance Department (Automatic Section)", "RIPE Database Maintenance Department (Automatic Section)"},
			{"This is to notify you that some object(s) in the RIPE database", "This is to notify you that some object(s) in the RIPE database"},
			{"The update causing these changes had the following mail headers:", "The update causing these changes had the following mail headers:"},
			{"The update causing these changes came from the following host:", "The update causing these changes came from the following host:"},
			{"From: RIPE Database Notifications <$HUMAILBOX>", "From: RIPE Database Notifications <$HUMAILBOX>"},
			{"From: RIPE Database Maintainer Forwarding <$HUMAILBOX>", "From: RIPE Database Maintainer Forwarding <$HUMAILBOX>"},
			{"This is to notify you that some objects in which you are mentioned as", "This is to notify you that some objects in which you are mentioned as"},
			{"The mail message causing these failures had the following mail headers:", "The mail message causing these failures had the following mail headers:"},
			{"The update causing these failures came from the following host:", "The update causing these failures came from the following host:"},
			{"From: RIPE Database Maintainer Creation <$HUMAILBOX>", "From: RIPE Database Maintainer Creation <$HUMAILBOX>"},
			{"A maintainer object is requested by:", "A maintainer object is requested by:"},
			{"* A C C E S S    D E N I E D *", "* A C C E S S    D E N I E D *"},
			{"The object shown below is NOT in the RIPE database.", "The object shown below is NOT in the RIPE database."},
			{"Referred query to host $REFERHOST at port $REFERPORT", "Referred query to host $REFERHOST at port $REFERPORT"},
			{"Referral loop detected when querying ", "Referral loop detected when querying "},
			{"Referred query to host $REFERHOST at port $REFERPORT", "Referred query to host $REFERHOST at port $REFERPORT"},
			{"Result TRUNCATED. Answer lenght exceeded limit.", "Result TRUNCATED. Answer lenght exceeded limit."},
			{"%%% End of referred query result", "%%% End of referred query result"},
			{"10", "10"},
			{"2000", "2000"},
			{"Copyright (c)1992/1993/1994/1995/1996/1997/1998/1999 by RIPE NCC ", "Copyright (c)1992/1993/1994/1995/1996/1997/1998/1999 by RIPE NCC "},
			{"IE ie", "IE ie"}
	};
 values_t locals[]	=	{
			{"43", &bport},
			{"/ncc/db2/doc/HELP", "/ncc/db2/doc/HELP"},
			{"% Rights restricted by copyright. See http://www.ripe.net/db/dbcopyright.html", "% Rights restricted by copyright. See http://www.ripe.net/db/dbcopyright.html"},
			{"SourceList", NULL},
			{"0", &testmode},
			{"1Bt9RNSMWcA.Y", "1Bt9RNSMWcA.Y"},
			{"/ncc/db2/doc/WHOIS-HELP", "/ncc/db2/doc/WHOIS-HELP"},
			{"/ncc/db2/doc/AUTO-DBM-HELP", "/ncc/db2/doc/AUTO-DBM-HELP"},
			{"/ncc/db2/etc/attr-desc.config", "/ncc/db2/etc/attr-desc.config"},
			{"RIPE", "RIPE"},
			{"RIPE          /ncc/db2/data/ripe/ripe.db         SPLIT", "RIPE          /ncc/db2/data/ripe/ripe.db         SPLIT"},
			{"RIPE", "RIPE"},
			{"SourceList", NULL},
			{"dbase", "dbase"},
			{"/ncc/db2/log/qry/qrylog", "/ncc/db2/log/qry/qrylog"},
			{"/ncc/db2/log/qry/qry2log", "/ncc/db2/log/qry/qry2log"},
			{"/ncc/db2/log/err/errlog", "/ncc/db2/log/err/errlog"},
			{"/ncc/db2/log/audit/auditlog", "/ncc/db2/log/audit/auditlog"},
			{"/ncc/db2/log/upd", "/ncc/db2/log/upd"},
			{"/ncc/db2/log/ack", "/ncc/db2/log/ack"},
			{"/ncc/db2/locks", "/ncc/db2/locks"},
			{"whoisd.pid", "whoisd.pid"},
			{"STOPUPDATES", "STOPUPDATES"},
			{"CLEANDB.LOCK", "CLEANDB.LOCK"},
			{"/ncc/db2/serials/current", "/ncc/db2/serials/current"},
			{"/ncc/db2/serials/old", "/ncc/db2/serials/old"},
			{"/ncc/db2/serials/incoming", "/ncc/db2/serials/incoming"},
			{"180", "180"},
			{"RIPE-NCC-HM-MNT ", "RIPE-NCC-HM-MNT "},
			{"127.0.0.1", "127.0.0.1"},
			{"193.0.0.1[345678][0-9]", "193.0.0.1[345678][0-9]"},
			{"195.88.156.1", "195.88.156.1"},
			{"/ncc/db2/tmp", "/ncc/db2/tmp"},
			{"/usr/local/bin/pgpv", "/usr/local/bin/pgpv"},
			{"/usr/local/bin/pgpk", "/usr/local/bin/pgpk"},
			{"/ncc/db2/.pgp", "/ncc/db2/.pgp"},
			{"/var/qmail/bin/qmail-inject -fripe-dbm", "/var/qmail/bin/qmail-inject -fripe-dbm"},
			{"8096", "8096"},
			{"2097152", "2097152"},
			{"2", "2"},
			{"ripe-dbm@ripe.net", "ripe-dbm@ripe.net"},
			{"ripe-dbm@ripe.net", "ripe-dbm@ripe.net"},
			{"auto-dbm@ripe.net", "auto-dbm@ripe.net"},
			{"nostrict", "nostrict"},
			{"% No entries found for the selected source(s).", "% No entries found for the selected source(s)."},
			{"Subject: RIPE RR: Addition of overlapping routes", "Subject: RIPE RR: Addition of overlapping routes"},
			{"Subject: RIPE RR: Removal  of overlapping routes", "Subject: RIPE RR: Removal  of overlapping routes"},
			{"The addition of your route object ... ", "The addition of your route object ... "},
			{"The deletion of your route object ... ", "The deletion of your route object ... "},
			{"created new overlaps with the following routes ...", "created new overlaps with the following routes ..."},
			{"removed the overlaps with the following routes ...", "removed the overlaps with the following routes ..."},
			{"Subject: RIPE RR: Addition of overlapping routes", "Subject: RIPE RR: Addition of overlapping routes"},
			{"Subject: RIPE RR: Removal  of overlapping routes", "Subject: RIPE RR: Removal  of overlapping routes"},
			{"The addition of the route object ... ", "The addition of the route object ... "},
			{"The deletion of the route object ... ", "The deletion of the route object ... "},
			{"created new overlaps with your following routes ...", "created new overlaps with your following routes ..."},
			{"removed the overlaps with your following routes ...", "removed the overlaps with your following routes ..."},
			{"Your e-mail:", "Your e-mail:"},
			{"From: RIPE Database Management <$HUMAILBOX>", "From: RIPE Database Management <$HUMAILBOX>"},
			{"From: RIPE Database Management <$HUMAILBOX>", "From: RIPE Database Management <$HUMAILBOX>"},
			{"Subject: SUCCEEDED: $SUBJECT", "Subject: SUCCEEDED: $SUBJECT"},
			{"Help file requested so body of message ignored.", "Help file requested so body of message ignored."},
			{"Objects that just generated a WARNING have been updated as shown.", "Objects that just generated a WARNING have been updated as shown."},
			{"No errors were found in your database update.  Congratulations.", "No errors were found in your database update.  Congratulations."},
			{"RIPE Database Maintenance Department (Automatic Section)", "RIPE Database Maintenance Department (Automatic Section)"},
			{"This is to notify you that some object(s) in the RIPE database", "This is to notify you that some object(s) in the RIPE database"},
			{"The update causing these changes had the following mail headers:", "The update causing these changes had the following mail headers:"},
			{"The update causing these changes came from the following host:", "The update causing these changes came from the following host:"},
			{"From: RIPE Database Notifications <$HUMAILBOX>", "From: RIPE Database Notifications <$HUMAILBOX>"},
			{"From: RIPE Database Maintainer Forwarding <$HUMAILBOX>", "From: RIPE Database Maintainer Forwarding <$HUMAILBOX>"},
			{"This is to notify you that some objects in which you are mentioned as", "This is to notify you that some objects in which you are mentioned as"},
			{"The mail message causing these failures had the following mail headers:", "The mail message causing these failures had the following mail headers:"},
			{"The update causing these failures came from the following host:", "The update causing these failures came from the following host:"},
			{"From: RIPE Database Maintainer Creation <$HUMAILBOX>", "From: RIPE Database Maintainer Creation <$HUMAILBOX>"},
			{"A maintainer object is requested by:", "A maintainer object is requested by:"},
			{"* A C C E S S    D E N I E D *", "* A C C E S S    D E N I E D *"},
			{"The object shown below is NOT in the RIPE database.", "The object shown below is NOT in the RIPE database."},
			{"Referred query to host $REFERHOST at port $REFERPORT", "Referred query to host $REFERHOST at port $REFERPORT"},
			{"Referral loop detected when querying ", "Referral loop detected when querying "},
			{"Referred query to host $REFERHOST at port $REFERPORT", "Referred query to host $REFERHOST at port $REFERPORT"},
			{"Result TRUNCATED. Answer lenght exceeded limit.", "Result TRUNCATED. Answer lenght exceeded limit."},
			{"%%% End of referred query result", "%%% End of referred query result"},
			{"10", "10"},
			{"2000", "2000"},
			{"Copyright (c)1992/1993/1994/1995/1996/1997/1998/1999 by RIPE NCC ", "Copyright (c)1992/1993/1994/1995/1996/1997/1998/1999 by RIPE NCC "},
			{"IE ie", "IE ie"}
	};
*/

/*
ca_database_t ripe		= 	{
				     "rowan.ripe.net", "4343", "Idiot", "scramble", "RIPE6"
		};

ca_database_t arin		= {
						
									"rowan", "2005", "dbint", "passwrd", "ARIN2"
		};
*/

/*
 * ca_database_t radb		= {
 *									"rowan", "default", "default", "default", "RADB1"
 *		};
	*/
	
/*
 * ca_database_t radb = {
 *								ca_defHost, ca_defPort, ca_defUser, ca_defPassword, "RADB1"	
 *		};
	*/

/*
ca_database_t radb = {
								CA_DEFHOST, CA_DEFPORT, CA_DEFUSER, CA_DEFPASSWORD, "RADB1"	
		};

ca_database_list_t ripeComponent = {
						"RIPE",	
						 {
						 "rowan.ripe.net",
						 "4343",
						 "Idiot",
						 "scramble",
						 "RIPE6"
						 }
		};

ca_database_list_t arinComponent = {
						"ARIN",
						{
						"rowan",
						"2005",
						"dbint",
						"passwd",
						"ARIN2"
						}
		};
*/

/*
 * char ca_defHost[64] = "rowan";
 * char ca_defPort[16] = "43";
 * char ca_defUser[16] = "dbase";
 * char ca_defPassword[9] = "encrypt1";
 * char ca_defdbName[16] = "default-db";
 */

/*
ca_database_list_t radbComponent = {
						"RADB",
						{
						CA_DEFHOST,
						CA_DEFPORT,
						CA_DEFUSER,
						CA_DEFPASSWORD,
						"RADB1"
						}
		};
*/

/*
	* The test configuration file.
 */
const char *testFile = "test.config";
const char *tempFile = "temp.config";
const char *dictFile = "dictionary.txt";
const char *confFile = "amrm.config";

values_t confVars[VARS];
dict_t dictionary[VARS];
values_t globals[VARS];
values_t locals[VARS];

ca_dbSource_t *theSrc;

