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

#include <gtk/gtk.h>
#include <time.h>
#include "Equipement.h"

#define PORT_FTP 21
#define PORT_HTTP 80
#define PORT_HTTPS 443
#define PORT_IMAP 143
#define PORT_SMTP 25
#define PORT_SSH 22
#define PORT_TELNET 23
#define PORT_SPOOLER 515
#define PORT_JETDIRECT 9100
#define PORT_SIP 5060
enum enum_Notification_Port {
	NOTIFICATION_STANDARD = 0,
	NOTIFICATION_PORT_SERVEUR,
	NOTIFICATION_PORT_CRITIQUE
};

enum enum_Etat_Port {
	ETAT_INCONNU = 0,
	OUVERT,
	FERMER,
	FIREWALLED,	
	UNKOWN_UDP,
	FERMER_UDP
};

struct Struct_Port {
	gint      Num_Port;
	gboolean  Notification_En_Cours;
	gboolean  Alert_notification;
	gint      Niveau_Notification;
	gint      Etat_Port;
	time_t64  Derniere_Modification_Etat_Port;
	unsigned char Flags;
};

struct Struct_Port_Fermer_Firewall {
	gint      Num_Port;
	gint      Etat_Port;
	unsigned char Flags;
};


gboolean  Cherche_Si_Port_Serveur (struct Struct_Equipement *Equipement);
struct Struct_Modele_Objet *Recherche_Objet_Port (gint Num_Port);
void      Retour_Notification_Port (gpointer * Donnee);
void      Copie_Icone_Port (gpointer * pointeur);
struct Struct_Port *Recherche_Info_Port_Equipement_Selectionner (gchar * Nom_Port);
struct Struct_Port *Cherche_Pointeur_Port (struct Struct_Equipement *Equipement, gint Num_Port);
struct Struct_Port *Ajouter_Nouveau_Port_Equipement (struct Struct_Equipement *Equipement, gint Num_Port,unsigned char Flags);
struct Struct_Port_Fermer_Firewall *Ajouter_Nouveau_Port_Equipement_Fermer_Firewall (struct Struct_Equipement *Equipement, gint Num_Port,gint Etat,unsigned char Flags);
void      Modifie_Etat_Port_Equipement (struct Struct_Equipement *Equipement, gint Num_Port, gint Nouvelle_Etat);
gboolean  Cherche_Si_Port_Ouvert (struct Struct_Equipement *Equipement, gint Num_Port);
gboolean  Recherche_Port_SSH_Ouvert_Sur_Equipement_Selectionner (void);
gboolean  Recherche_Port_Telnet_Ouvert_Sur_Equipement_Selectionner (void);
gboolean  Recherche_Port_Samba_Ouvert_Sur_Equipement_Selectionner (void);
void      Retour_Modification_Etat_Port (gpointer * Donnee);
void      Efface_Tout_Les_Ports (struct Struct_Equipement *Equipement);
unsigned char Cherche_Flags_Port (struct Struct_Equipement * Equipement, gint Num_Port);
#endif
