/* ***********************IMPORTANT *********************************************
 *  Copyright (C) 2004-2007 Thierry Lagarde <tlagarde@users.sourceforge.net>
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License.
 *
 *
 *                      ********************
 *
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Library General Public License for more details.
 *
 *
 *                      ********************
 *
 *
 * You are highly encouraged to send your changes to <tlagarde@users.sourceforge.net>
 * for possible incorporation into the main distribution.
 * By sending these changes to <tlagarde@users.sourceforge.net>,
 * it is assumed that you are offering <tlagarde@users.sourceforge.net>
 * the unlimited, non-exclusive right to reuse, modify, and relicense the code.
 *
 *
 *                      ********************
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **************************************************************************************/
#ifndef         __SNMP
#define         __SNMP

#include <glib.h>
#include "Liste_Equipement.h"

#ifdef        __SNMP_ENABLE
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>

#define TIME_OUT_SNMP 2000


enum enum_ID_Snmp_Liste {
	SNMP_SYSTEM_LOGICAL_STORAGE = 0,
	SNMP_SOFTWARE,
	SNMP_NETWORK_TCPIP_TCP_CONNECTIONS,
	SNMP_NETWORK_ROUTES,
	SNMP_NETWORK_ARP,
	SNMP_SYSTEM_DEVICE,
	SNMP_SYSTEM_SERVICE,
	SNMP_NETWORK_INTERFACES_BASIC,
	SNMP_NETWORK_TCPIP_UDP_SERVICES,
	SNMP_BRIDGE_FORWARDING_DATABASE,
	SNMP_BRIDGE_STATIC_DATABASE,
	NB_ID_SNMP_LISTE
};

/*enum enum_ID_Snmp_Liste {
	SNMP_SYSTEM_DEVICE = 0,-
	SNMP_SYSTEM_LOGICAL_STORAGE,-
	SNMP_SYSTEM_SERVICE,-
	SNMP_NETWORK_ARP,-
	SNMP_NETWORK_ROUTES,-
	SNMP_NETWORK_INTERFACES_BASIC,-
	SNMP_NETWORK_TCPIP_TCP_CONNECTIONS,-
	SNMP_NETWORK_TCPIP_UDP_SERVICES,
	SNMP_SOFTWARE,-
	SNMP_BRIDGE_FORWARDING_DATABASE,
	SNMP_BRIDGE_STATIC_DATABASE,
	NB_ID_SNMP_LISTE
};
*/

enum enum_ID_Snmp {

	SNMP_SYSTEM_NAME = 0,
	SNMP_DESCRIPTION,
	SNMP_CONTACT,
	SNMP_LOCATION,
	SNMP_UPTIME,
	SNMP_RAM,

	SNMP_IP_FORWARDING,
	SNMP_DEFAULT_TTL,
	SNMP_REASSEMBLY_TIMEOUT,
	SNMP_NEEDED_TO_BE_REASSEMBLED,
	SNMP_REASSEMBLED,
	SNMP_REASSEMBLY_FAILURES,
	SNMP_SUCCESSFULLY_FRAGMENTED,
	SNMP_FRAGMENTATION_FAILURES,
	SNMP_CREATED_FRAGMENTS,
	SNMP_DISCARDED_ROUTING_ENTRIES,

	SNMP_ALL,
	SNMP_FORWARDED,
	SNMP_DELIVERED,
	SNMP_HEADER_ERRORS,
	SNMP_ADDRESS_ERRORS,
	SNMP_UNKNOWN_PROTOCOLS,
	SNMP_INPUT_BUFFER_ERRORS,

	SNMP_REQUESTED,
	SNMP_OUTPUT_BUFFER_ERRORS,
	SNMP_NOT_ROUTED,

	SNMP_MEM_TOTAL_SWAP,
	SNMP_MEM_AVAILABLE_SWAP,
	SNMP_MEM_TOTAL_REAL,
	SNMP_MEM_AVAILABLE_REAL,
	SNMP_MEM_TOTAL_FREE,
	SNMP_MEM_SHARED,
	SNMP_MEM_BUFFER,
	SNMP_MEM_CACHED,
	SNMP_MEM_SWAP_ERROR,
	SNMP_MEM_SWAP_ERROR_MSG,

	SNMP_CPU_RAW_USER,
	SNMP_CPU_RAW_NICE,
	SNMP_CPU_RAW_SYSTEM,
	SNMP_CPU_RAW_IDLE,
	SNMP_CPU_RAW_WAIT,
	SNMP_CPU_RAW_KERNEL,
	SNMP_CPU_RAW_INTERRUPT,
	
	NB_TOTAL_ID_SNMP_SCALAIRE
};

struct Struct_Liste_Snmp {
	gint      ID_Snmp;
	gint      Taille_oid;
	oid       objid_mib[20];
};

struct Struct_Objet_Snmp {
	gint      ID_Snmp;
	gint      Taille_oid;
	gint      Taille_Chaine_Max;
	oid       objid_mib[20];
};

gboolean  Demande_Snmp (struct Struct_Liste_Equipement *Equipement, gint Id_Snmp);
void      Traitement_Chaine_Snmp (gint Id_Snmp, gchar * Chaine_Brut, gchar * Stock);
void      Traitement_Timeticks_Snmp (gint Id_Snmp, gchar * Chaine_Brut, gchar * Stock);
gint      Traitement_Integer_Snmp (gint Id_Snmp, gchar * Chaine_Brut);
gint      Traitement_Counter_Snmp (gint Id_Snmp, gchar * Chaine_Brut);
void      Traitement_Integer_Conv_Chaine_Snmp (gint Id_Snmp, gchar * Chaine_Brut, gchar * Stock);
void      Demande_Snmp_Equipement (struct Struct_Liste_Equipement *Equipement);
gboolean  Envoie_Snmp_Liste (struct Struct_Liste_Equipement *Equipement, gint Id_Snmp);
void      Initialisation_Snmp (void);
#endif

void      Demande_Envoie_Liste_Snmp (gpointer * Donnee);
void      Demande_Envoie_Liste_Snmp_All (gpointer * Donnee);
void Demande_Envoie_Snmp_Scalaire (gpointer * Donnee);
#endif
