/* ***********************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         __OBJET
#define         __OBJET

#include "Objet_Action.h"
#include "Reseau.h"
#include <gtk/gtk.h>

enum enum_Modele_Objet {
	LISTE_SERVEUR = 0,
	LISTE_SWITCH,
	LISTE_MULTIMEDIA,
	LISTE_CONSOLE,
	LISTE_WIFI,
	LISTE_PDA,
	LISTE_IMPRIMANTE,
	LISTE_ROUTEUR,
	LISTE_STATION,
	LISTE_DISQUE,
	LISTE_SECURITY_CAMERA,
	LISTE_UPS,
	LISTE_TELEPHONIE,
	LISTE_ROUTEUR_SWITCH,
	LISTE_ROUTEUR_ADSL,
	LISTE_MODEM,
	LISTE_FIREWALL,
	LISTE_VPN,
	LISTE_CAMERA,
	LISTE_CELLULAR_PHONE,	
	LISTE_MP3_PLAYER,
	LISTE_TABLET,
	LISTE_CAMCORDER,
	LISTE_POWERLINE,
	LISTE_FAX,
	LISTE_SECURITY_NETWORK,
	LISTE_INDUSTRIAL_EQUIPMENT,
	LISTE_FINGERPRINT_SCANNER,
	
	NB_TYPE_EQUIPEMENT = LISTE_FINGERPRINT_SCANNER,
	LISTE_INCONNU,
	LISTE_FIREWALLED,
	LISTE_MODELE_DOMAINE,
	LISTE_MODELE_EQUIPEMENT,
	LISTE_MODELE_EQUIPEMENT_INCONNU,
	LISTE_MODELE_EQUIPEMENT_PORT_FERMER,
	LISTE_MODELE_EQUIPEMENT_FIREWALL,
	LISTE_MODELE_EQUIPEMENT_AGENT_AUTOSCAN,
	INFO_ADRESSE_IP,
	INFO_ADRESSE_MAC,
	INFO_FOURNISSEUR,
	INFO_OS,
	INFO_OS_MD5,
	INFO_OS_MD5_W,
	INFO_OS_GROUP,
	INFO_NOM_DNS,	
	INFO_NOM_HOTE,
	INFO_ALIAS,	
	INFO_PING_TIME,
	INFO_GATEWAY,
	INFO_ROUTAGE,
	
	INFO_NOM_DOMAINE,
	INFO_NOM_UTILISATEUR,
	INFO_INFO,
	INFO_PORTS,	
	INFO_PORTS_OUVERT,
	INFO_PORTS_FERMER,
	INFO_PORTS_FIREWALLED,
	INFO_PORTS_UDP_OPEN_FILTERED,
	
	INFO_CONTACT_ADMIN,


	INFO_SNMP,

	INFO_SNMP_SYSTEM,
	INFO_SNMP_SYSTEM_NAME,
	INFO_SNMP_SYSTEM_DESCRIPTION,
	INFO_SNMP_SYSTEM_CONTACT,
	INFO_SNMP_SYSTEM_LOCATION,
	INFO_SNMP_SYSTEM_UPTIME,
	INFO_SNMP_SYSTEM_RAM,
	INFO_SNMP_SYSTEM_DEVICE,
	INFO_SNMP_SYSTEM_LOGICAL_STORAGE,
	INFO_SNMP_SYSTEM_SERVICE,

	INFO_SNMP_NETWORK,
	INFO_SNMP_NETWORK_ARP,
	INFO_SNMP_NETWORK_ROUTES,

	INFO_SNMP_NETWORK_INTERFACES,
	INFO_SNMP_NETWORK_INTERFACES_BASIC,
	INFO_SNMP_NETWORK_INTERFACES_IN,
	INFO_SNMP_NETWORK_INTERFACES_OUT,

	INFO_SNMP_NETWORK_TCPIP,
	INFO_SNMP_NETWORK_TCPIP_NETWORK,
	INFO_SNMP_NETWORK_TCPIP_TCP_CONNECTIONS,
	INFO_SNMP_NETWORK_TCPIP_UDP_SERVICES,

	INFO_SNMP_NETWORK_TCPIP_IP,

	INFO_SNMP_NETWORK_TCPIP_IP_INFO,
	INFO_SNMP_NETWORK_TCPIP_IP_INFO_IP_FORWARDING,
	INFO_SNMP_NETWORK_TCPIP_IP_INFO_IP_TTL,
	INFO_SNMP_NETWORK_TCPIP_IP_INFO_IP_REASS_TIMEOUT,
	INFO_SNMP_NETWORK_TCPIP_IP_INFO_IP_NEED_REASS,
	INFO_SNMP_NETWORK_TCPIP_IP_INFO_IP_RE_ASSEM,
	INFO_SNMP_NETWORK_TCPIP_IP_INFO_IP_REAS_FAIL,
	INFO_SNMP_NETWORK_TCPIP_IP_INFO_IP_SUCCESS_FRAG,
	INFO_SNMP_NETWORK_TCPIP_IP_INFO_IP_FRAG_FAIL,
	INFO_SNMP_NETWORK_TCPIP_IP_INFO_IP_CREAT_FRAG,
	INFO_SNMP_NETWORK_TCPIP_IP_INFO_IP_DISC_ROUT,

	INFO_SNMP_NETWORK_TCPIP_IP_INPUT,
	INFO_SNMP_NETWORK_TCPIP_IP_INPUT_ALL,
	INFO_SNMP_NETWORK_TCPIP_IP_INPUT_FORWARDED,
	INFO_SNMP_NETWORK_TCPIP_IP_INPUT_DELIVERED,
	INFO_SNMP_NETWORK_TCPIP_IP_INPUT_HEADER,
	INFO_SNMP_NETWORK_TCPIP_IP_INPUT_ADDRESS,
	INFO_SNMP_NETWORK_TCPIP_IP_INPUT_PROTOCOL,
	INFO_SNMP_NETWORK_TCPIP_IP_INPUT_BUFFER,

	INFO_SNMP_NETWORK_TCPIP_IP_OUPUT,
	INFO_SNMP_NETWORK_TCPIP_IP_OUPUT_REQUESTED,
	INFO_SNMP_NETWORK_TCPIP_IP_OUPUT_BUFFER,
	INFO_SNMP_NETWORK_TCPIP_IP_OUPUT_ROUTED,
	

	INFO_SNMP_MEM,
	INFO_SNMP_MEM_TOTAL_SWAP,
	INFO_SNMP_MEM_AVAILABLE_SWAP,
	INFO_SNMP_MEM_TOTAL_REAL,
	INFO_SNMP_MEM_AVAILABLE_REAL,
	INFO_SNMP_MEM_TOTAL_FREE,
	INFO_SNMP_MEM_SHARED,
	INFO_SNMP_MEM_BUFFER,
	INFO_SNMP_MEM_CACHED,
	INFO_SNMP_MEM_SWAP_ERROR,
	INFO_SNMP_MEM_SWAP_ERROR_MSG,
	INFO_MEM,

	INFO_SNMP_CPU,
	INFO_SNMP_CPU_RAW_USER,
	INFO_SNMP_CPU_RAW_NICE,
	INFO_SNMP_CPU_RAW_SYSTEM,
	INFO_SNMP_CPU_RAW_IDLE,
	INFO_SNMP_CPU_RAW_WAIT,
	INFO_SNMP_CPU_RAW_KERNEL,
	INFO_SNMP_CPU_RAW_INTERRUPT,
	INFO_CPU,
	
	

	INFO_SNMP_SOFTWARE,
	INFO_SNMP_RUNNING_SOFTWARE,

	INFO_SNMP_BRIDGE,
	INFO_SNMP_BRIDGE_FORWARDING_DATABASE,
	INFO_SNMP_BRIDGE_STATIC_DATABASE,
	

	INFO_INVENTAIRE,
	INFO_INVENTAIRE_CONTACT,
	INFO_INVENTAIRE_TEL_CONTACT,
	INFO_INVENTAIRE_NUM_SERIE,
	INFO_INVENTAIRE_NUM_SERIE_ECRAN,
	INFO_INVENTAIRE_NUM_SERIE_IMPRIMANTE,
	INFO_INVENTAIRE_NUM_SERIE_OS,
	INFO_INVENTAIRE_NUM_SERIE_SUITE_OFFICE,
	INFO_INVENTAIRE_PROCESSEUR,
	INFO_INVENTAIRE_MEMOIRE,
	INFO_INVENTAIRE_DISQUE,
	INFO_INVENTAIRE_NOTES,
	INFO_INVENTAIRE_LOCALISATION,
	INFO_NETBIOS,
	INFO_NETBIOS_ENFANT,
	INFO_NESSUS,
	INFO_NESSUS_VULNERABILITE,
	INFO_NESSUS_POTENTIEL,
	INFO_NESSUS_INFO,
	INFO_NESSUS_ENFANT_VULNERABILITE,
	INFO_NESSUS_ENFANT_POTENTIEL,
	INFO_NESSUS_ENFANT_INFO,
	INFO_HISTORIQUE,
	INFO_HISTORIQUE_ALERTE,
	INFO_HISTORIQUE_WARNING,
	INFO_HISTORIQUE_INFO,
	INFO_DERNIER_CHANGEMENT,
	INFO_TEMPS_SCAN_COMPLET,
	INFO_TEMPS_SCAN_PORT,
	INFO_TEMPS_SCAN_PORT_UDP,
	INFO_TEMPS_SCAN_SIGNATURE,
	
	INFO_TEMPS_SCAN_SERVICE_FTP,
	INFO_TEMPS_SCAN_SERVICE_HTTP,
	INFO_TEMPS_SCAN_SERVICE_IMAP,
	INFO_TEMPS_SCAN_SERVICE_SMTP,
	INFO_TEMPS_SCAN_SERVICE_SSH,
	INFO_TEMPS_SCAN_SERVICE_TELNET,	
	INFO_TEMPS_SCAN_SNMP,	
	INFO_TEMPS_SCAN_DNS,
	
	INFO_DATE_DECOUVERTE,
	PARTAGE,
	PARTAGE_IMPRIMANTE,
	PARTAGE_REPERTOIRE,
	FICHIER_PARTAGER,
	PARTAGE_REPERTOIRE_SUPERIEUR,
	PORTS,
	INFO_TYPE_PARENT,
	INFO_PARENT_NB_FILS,
/*
   Autre Constante
*/
	PAS_DE_PARENT,	
	PAS_DE_MODELE,
	OBJET_PARENT_MULTIPLE,
	OBJET_FILS,
	OBJET_PARENT,
	PERE_RACINE,	
	LISTE,		
	ICONE		
};


struct Struct_Modele_Objet {
	int       ID_Modele_Objet;
	int       ID_Reseau;
	int       ID_Liste;
	int       ID_Type_Objet;
	gpointer *Objet_Pere;
	int       Presentation;
	gboolean  Texte_Default_Non_Modifier;
	gboolean  Afficher;
	gchar    *Texte_Defaut;
	gchar    *(*Gestion_Texte) (gpointer *);
	gpointer *Pointeur_Attacher;
	gboolean  Chaine_Attacher_Non_Modifier;
	gchar    *Chaine_Attacher;
	gchar    *Chemin_Icone;
	void      (*Recupere_icone) (gpointer *);
	GdkPixbuf *icone;
	GdkPixbuf *icone_griser;
	int       Nb_Enfant;
	gboolean  Afficher_Nb_Enfant_Direct;
	void      (*Modification) (gpointer *, gchar *);
	void      (*Modification_menu) (gpointer *, gchar *);
	void      (*Action_Selection) (gpointer *);
	void      (*Action_Double_Clique) (gpointer *);
	void      (*Action_Clique_Droit) (gpointer *, GdkEventButton *);
	void      (*Action_Rafraichissement) (gpointer *);
	void      (*Action_Notification) (gpointer *);
	gboolean  Notification_En_Cours;
	void      (*Creer_Raccourci) (gpointer *);
	GtkWidget *Win_Bulle;
	void      (*Ajouter) (gpointer *);
	void      (*Enlever) (gpointer *);
	gboolean  Favoris;
	void      (*Action_Favoris) (gpointer *);
	GtkTreeIter ID_Arbre_Ligne;
};

struct Struct_Modele_Objet *Objet_Selectionner;
struct Struct_Modele_Objet *Objet_Equipement_Selectionner;


void      Selectionne_Objet_Dans_Liste (struct Struct_Modele_Objet *Objet, struct Struct_Liste_Reseau *Reseau);
GtkWidget *Widget_Liste (struct Struct_Modele_Objet *Objet, struct Struct_Liste_Reseau *Reseau);
GList    *GList_Liste_ID_Liste (struct Struct_Liste_Reseau *Reseau, guint ID_Liste);
GList    *GList_Liste (struct Struct_Modele_Objet *Objet, struct Struct_Liste_Reseau *Reseau);
void      Recupere_Nouveau_Pointeur_Liste (struct Struct_Modele_Objet *Objet, struct Struct_Liste_Reseau *Reseau, GList * Nouveau_Pointeur_Glist);
struct Struct_Modele_Objet *Recupere_Pointeur_Objet_Dans_Une_Liste (GList * GList, int rang);
guint     Recupere_Rang_Objet_Dans_Une_Liste (GList * GList, struct Struct_Modele_Objet *Objet);
GList    *Supprime_Dans_Liste_Objets (GList * GList, struct Struct_Modele_Objet *Objet, gboolean Message_Erreur);
GList    *Ajouter_Dans_Liste_Objets (GList * GList, struct Struct_Modele_Objet *Objet);
void      Affiche_Icone_Defaut_Griser_Objet_liste (struct Struct_Modele_Objet *Objet, struct Struct_Liste_Reseau *Reseau);
void      Affiche_Icone_Defaut_Objet_liste (struct Struct_Modele_Objet *Objet, struct Struct_Liste_Reseau *Reseau);
void      Active_Rachaichissment_Objet (struct Struct_Modele_Objet *Objet, struct Struct_Liste_Reseau *Reseau);
void      Active_Alerte_Objet (struct Struct_Modele_Objet *Objet, struct Struct_Liste_Reseau *Reseau);
void      Active_Test_Etat_Objet (struct Struct_Modele_Objet *Objet, struct Struct_Liste_Reseau *Reseau);
void      Desactive_Rachaichissment_Objet (struct Struct_Modele_Objet *Objet, struct Struct_Liste_Reseau *Reseau, gboolean Message_Erreur);
void      Desactive_Alerte_Objet (struct Struct_Modele_Objet *Objet, struct Struct_Liste_Reseau *Reseau, gboolean Message_Erreur);
void      Desactive_Test_Etat_Objet (struct Struct_Modele_Objet *Objet, struct Struct_Liste_Reseau *Reseau, gboolean Message_Erreur);
void      Afficher_Liste (GList * GList);
void      Supprime_Objet_Liste (struct Struct_Modele_Objet *Objet, struct Struct_Liste_Reseau *Reseau);
void      Supprime_Objet_Fils_Liste (struct Struct_Modele_Objet *Objet, struct Struct_Liste_Reseau *Reseau);
void      Supprime_Objet_Fils_Num_Liste (int i, struct Struct_Liste_Reseau *Reseau);
void      Efface_Toute_Objet_Liste (struct Struct_Liste_Reseau *Reseau, guint ID_Liste);
struct Struct_Modele_Objet *Recherche_Si_Objet_Deja_Afficher (struct Struct_Liste_Reseau *Reseau, int Modele_Objet, gchar * Texte, struct Struct_Modele_Objet *Parent, guint ID_Liste);
struct Struct_Modele_Objet *Ajouter_Objet_comme_modele (struct Struct_Liste_Reseau *Reseau, int Modele_Objet, gchar * Texte, guint ID_Liste, gpointer * Pointeur_Attacher);
struct Struct_Modele_Objet *Ajouter_Nouvelle_Objet (int Modele_Objet, gchar * Texte, gpointer * Pointeur_Attacher, gchar * Chaine_Attacher, int Modele_Objet_Parent, gchar * Texte_Parent, int Modele_Objet_Grand_Parent, int Modele_Objet_AGrand_Parent, int Modele_Objet_AAGrand_Parent, int Modele_Objet_AAAGrand_Parent, guint ID_Reseau, guint ID_Liste);
void      Modifie_Etat_Bouton (struct Struct_Modele_Objet *Objet);
void      Force_Objet_Repertoire_Liste (struct Struct_Modele_Objet *objet, guint ID_Reseau);
#endif
