/*
** SellaNMS
** $Id: state.h,v 1.4 2005/11/06 05:00:27 sella Exp $
** Copyright (c) 2001-2005 Digital Genesis Software, LLC. All Rights Reserved.
** Released under the GPL Version 2 License.
** http://www.digitalgenesis.com
*/

#ifndef __DGS_MONITOR_STATE_H
#define __DGS_MONITOR_STATE_H

#ifdef HAVE_CONFIG_H
	#include "config.h"
#endif

#include "defaults.h"
#include "state.h"
#include "common/util.h"
#include "common/netblock.h"
#include "common/storagedata.h"
#include "policy_framework/policy_framework.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <arpa/inet.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#include <stl/hash_map>

#define MODULE_MONITOR_STATE_INTERVAL_DEF		30
#define MODULE_MONITOR_STATE_INTERVAL_MIN		1
#define MODULE_MONITOR_STATE_INTERVAL_MAX		3600

class State {
	public:
		State();
		~State();
		virtual RESULT execute();
		virtual RESULT readConfig();

	protected:
		RESULT expire();
		RESULT update();
		RESULT processPolicy(variable_binding_t& policy_input, hash_map<string, string>& tableMap);
		RESULT processChange(variable_binding_t& policy_input, variable_binding_t& policy_output, hash_map<string, string>& tableMap);

	private:
		virtual void printConfig();

		time_t timestamp;
		unsigned long interval;

		Storage storage;

		PolicyFramework inputPolicy;
		PolicyFramework outputPolicy;

};

#endif

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