/****************************************************************** * * * Nest version 2 - 3D Wasp Nest Simulator * * Copyright (C) 1997 Sylvain GUERIN * * LIASC, ENST Bretagne & Santa Fe Institute * * * ****************************************************************** E-mail: Sylvain.Guerin@enst-bretagne.fr or: Sylvain Guerin 13 rue des Monts Lorgeaux, 51460 L'EPINE, FRANCE ****************************************************************** 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, or (at your option) any later version. 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 General Public License for more details. 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. ****************************************************************** Name : NetInt.h Component : evaluation interface Fonctionality : contains specifications refering to the net interface (including the Net object) ******************************************************************/ #ifndef __NetInterface_H #define __NetInterface_H #include "graphical.h" #include "algo.h" #include "time.h" #include "config.h" #include "date.h" #define TIMEOUT 2 enum hostStateType { unreachable, unknown, sleeping, running, down }; class Host { public: Host (char* aHostName); ~Host(); char *hostName; Boolean isEnable; /* do the current machine see the host ? */ hostStateType hostState; char beginSimulationDate[40]; Date beginDate; void checkIfAlive (); }; class Net { public: Net (unsigned int aMaxHostsNumber); ~Net (); unsigned int add (char* aHostName); /* returns index */ void remove (unsigned int index); void update (unsigned int index); Host* get (unsigned int index); unsigned int getNumber (); ArrayContent* getNetContent (); int loadFromConfigFile (InfoBox* infoBox); /* return -1 when failure */ int saveInConfigFile (); int getFreeHost (char* returnedHost, int* returnedHostNb); void testAll (); /* return 1 when free, else 0 */ Host** host; protected: char domainName[256]; unsigned int numberOfHosts; unsigned int maxHostsNumber; ArrayContent* netContent; /* structure dont se sert l'interface pour gerer la fenetre */ }; class NetInterface : public Interface { public: NetInterface (Interface* theMainInterface, int x0, int y0, Display* aDisplay, Net* aNet); virtual ~NetInterface (); actionType manageInterface (XEvent report); void refresh (); ArrayWindow* netArray; /* on le met en public pour pouvoir s'en servir a partir de main Inter. */ protected: Interface* mainInterface; Button* exitButton; Button* addButton; Button* removeButton; Button* saveButton; Button* testButton; Button* testAllButton; Button* optionsButton; Net* net; }; #endif