/*
** SellaNMS
** $Id: email.h,v 1.7 2006/01/24 07:08:10 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_OUTPUT_EMAIL_H
#define __DGS_OUTPUT_EMAIL_H

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

#include "defaults.h"
#include "common/util.h"
#include "policy_framework/policy_framework.h"
#include "storage/storage.h"
#include <stdio.h>
#include <stdlib.h>
#include <stl/slist>
#include <stl/string>

#define OUTPUT_EMAIL_INTERVAL_DEF	15
#define OUTPUT_EMAIL_INTERVAL_MIN	1
#define OUTPUT_EMAIL_INTERVAL_MAX	900
#define OUTPUT_EMAIL_INTERVAL_MLT	1000000
#define OUTPUT_EMAIL_QUEUEDEPTH_DEF	250
#define OUTPUT_EMAIL_QUEUEDEPTH_MIN	1	
#define OUTPUT_EMAIL_QUEUEDEPTH_MAX	2500

typedef struct output_t {
   unsigned long  id;
   string         timestamp;
   time_t         unix_timestamp;
   string         element;
   string         interface;
   string         ip;
   string         source;
   string         module;
   string         protocol;
   string         channel;
   string         status;
   string         brief;
   string         detail;
} _output_t;

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

	protected:
		virtual void printConfig();

		virtual RESULT policyInputNext(variable_binding_t &policy_input);
		virtual RESULT processPolicyOutput(variable_binding_t &policy_output);
		virtual RESULT readOutput(const string &module);
		virtual RESULT deleteOutput(slist<unsigned long> &output_ids);

	private:
		bool assignValues(const string &req, variable_binding_t &policy_output, ConfigNode *alias_node, ConfigNode *default_node, vector<string> &values);

		Storage storage;
		slist<output_t> output;

		unsigned long interval;
		unsigned long queueDepth;

      PolicyFramework inputPolicy;
      PolicyFramework outputPolicy;
};

#endif

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