/*
** SellaNMS
** $Id: snmp_util.h,v 1.3 2006/01/24 07:08:09 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_COMMON_SNMP_UTIL_H
#define __DGS_COMMON_SNMP_UTIL_H

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

#include "defaults.h"
#ifdef HAVE_NET_SNMP
	#include <net-snmp/net-snmp-config.h>
	#include <net-snmp/net-snmp-includes.h>
	#include <net-snmp/library/parse.h>
#else
	#include <ucd-snmp/ucd-snmp-config.h>
	#include <ucd-snmp/ucd-snmp-includes.h>
	#include <ucd-snmp/parse.h>
#endif
#include <stl/slist>
#include <stl/string>
#include <stl/utility>

#undef ACTION
extern "C" {
	struct parsed_oid_t {
		string main_oid;
		slist<pair<string, string> > indexes;
	};

	bool convTxtToOid(oid *objid, size_t &objid_size, const string &input_oid);
	char* convOidToChar(char* ret_val, size_t ret_len, oid *name, size_t name_len);
	void convOidToString(string &ret_val, oid *name, size_t name_len);
	bool convOidValueToString(string &ret_val, struct variable_list *vp);
	char* convVariableToIP(char* ret_val, size_t ret_len, variable_list *var);

	RESULT resolveMIBObject(string &in_out);
	RESULT resolveEnumeration(string &out_val, const string &in_oid, const string &in_value);
	RESULT parseOid(parsed_oid_t &parsed_oid, const string &input_oid);

	struct snmp_session *snmp_async_session(string &host, string &community, void* callback, void* magic);
}

#endif

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