ajout algo glouton + filius
This commit is contained in:
@@ -0,0 +1,176 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Konfiguration der Firewall auf dem Vermittlungsrechner</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
:errorMsg:
|
||||
<form action=":action_pfad:" method="POST">
|
||||
<center> <table border="0" cellspacing="5" width="400"> <tr><td> <h2>Firewall-Konfiguration </h2> </td></tr><tr><td>
|
||||
<table bgcolor="#E0E0E0" border="0" width="100%" cellpadding="5">
|
||||
<tr><td align="center">
|
||||
<table border="0" cellpadding="5">
|
||||
<tr>
|
||||
<td width="10%">
|
||||
:firewallActivate:
|
||||
</td>
|
||||
<td width="90%">Firewall aktivieren</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
Erst durch Aktivieren der Firewall werden die Firewall-Regeln angewendet.
|
||||
Bei deaktivierter Firewall findet keine Filterung statt.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
:dropICMP:
|
||||
</td>
|
||||
<td>ICMP-Pakete filtern</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
Alle ICMP Pakete, z.B. Ping-Anfragen, werden von der Firewall verworfen.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
:onlySYN:
|
||||
</td>
|
||||
<td>
|
||||
nur SYN-Pakete verwerfen
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
Neue Verbindungsanfragen zu gesperrten Ports werden verworfen.
|
||||
Der Rückkanal für erlaubte Verbindungsanfragen wird akzeptiert.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="submit" name="btnSave" value="speichern"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</td></tr><tr><td>
|
||||
|
||||
<!-- Konfiguration der Regeln -->
|
||||
<table border="0" bgcolor="#E0E0E0" width="100%" cellpadding="5">
|
||||
<tr>
|
||||
<td>
|
||||
<h3>Firewall-Regeln:</h3><br>
|
||||
Die Regeln werden von oben nach unten geprüft.<br>
|
||||
Sobald eine Regel zutrifft, wird die angegebene Aktion ausgeführt.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Falls keine Regel zutrifft, wird folgende Standard-Aktion ausgeführt:<br>
|
||||
<select name="defaultPolicy" size="1">
|
||||
<option value="drop"
|
||||
:defPolDropSelected:
|
||||
>verwerfen</option>
|
||||
<option value="accept"
|
||||
:defPolAcceptSelected:
|
||||
>akzeptieren</option>
|
||||
</select>
|
||||
<input type="submit" name="defPolSet" value="speichern">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<font size="-2">
|
||||
<table border="1" width="100%">
|
||||
<tr>
|
||||
<th>lfd. Nr.</th>
|
||||
<th>Quell-IP</th>
|
||||
<th>Quell-Subnetzmaske</th>
|
||||
<th>Ziel-IP</th>
|
||||
<th>Ziel-Subnetzmaske</th>
|
||||
<th>Protokoll</th>
|
||||
<th>Port</th>
|
||||
<th>Aktion</th>
|
||||
</tr>
|
||||
|
||||
:ruleset:
|
||||
|
||||
</table>
|
||||
</font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Aktion für ausgewählte Regel:
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="submit" name="moveup" value="rauf">
|
||||
<input type="submit" name="movedown" value="runter">
|
||||
<input type="submit" name="delrule" value="löschen">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</td></tr><tr><td>
|
||||
:errorMsg:
|
||||
|
||||
<!-- Konfiguration neuer Regeln -->
|
||||
<table border="0" bgcolor="#E0E0E0" width="100%" cellpadding="5">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h3>Neue Regel erstellen</h3><br>
|
||||
Alle Felder sind optional und werden <br>-- falls leer gelassen --<br> für die Filterung nicht verwendet.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="30%">Quell-IP: </td>
|
||||
<td width="70%"><input name="srcIP" type="text" size="15" maxlength="15" value=":srcIP:"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Quell-Subnetzmaske: </td>
|
||||
<td><input name="srcMask" type="text" size="15" maxlength="15" value=":srcMask:"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Ziel-IP: </td>
|
||||
<td> <input name="destIP" type="text" size="15" maxlength="15" value=":destIP:"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Ziel-Subnetzmaske: </td>
|
||||
<td> <input name="destMask" type="text" size="15" maxlength="15" value=":destMask:"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Protokoll: </td>
|
||||
<td>
|
||||
<select name="protocol" size="1">
|
||||
<option value="*" :optionProtAll:>*</option>
|
||||
<option value="TCP" :optionProtTCP:>TCP</option>
|
||||
<option value="UDP" :optionProtUDP:>UDP</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Port: </td>
|
||||
<td> <input name="port" type="text" size="5" maxlength="5" value=":port:"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Aktion: </td>
|
||||
<td>
|
||||
<select name="action" size="1">
|
||||
<option value="drop" :optionActionDrop:>verwerfen</option>
|
||||
<option value="accept" :optionActionAccept:>akzeptieren</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="submit" name="addrule" value="hinzufügen">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td></tr></table></center>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,177 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Router Firewall Configuration</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
:errorMsg:
|
||||
<form action=":action_pfad:" method="POST">
|
||||
<center> <table border="0" cellspacing="5" width="400"> <tr><td> <h2>Router Firewall Configuration</h2> </td></tr><tr><td>
|
||||
<table bgcolor="#E0E0E0" border="0" width="100%" cellpadding="5">
|
||||
<tr><td align="center">
|
||||
<table border="0" cellpadding="5">
|
||||
<tr>
|
||||
<td width="10%">
|
||||
:firewallActivate:
|
||||
</td>
|
||||
<td width="90%">Activate firewall</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
Firewall rules will only be applied, if the firewall is activated.
|
||||
In the case of a not activated firewall no packet filtering will take place.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
:dropICMP:
|
||||
</td>
|
||||
<td>Filter ICMP packets</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
All ICMP packets, e.g., ping requests, will be dropped.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
:onlySYN:
|
||||
</td>
|
||||
<td>
|
||||
only drop SYN packets
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
New connection requests to blocked ports will be dropped.
|
||||
Back channels for allowed connection requests will be accepted.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="submit" name="btnSave" value="save"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</td></tr><tr><td>
|
||||
|
||||
|
||||
<!-- Konfiguration der Regeln -->
|
||||
<table border="0" bgcolor="#E0E0E0" width="100%" cellpadding="5">
|
||||
<tr>
|
||||
<td>
|
||||
<h3>Firewall rules:</h3><br>
|
||||
The rules are evaluated from top to bottom.<br>
|
||||
If a rule matches, the given action will be followed.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
If no rule applies, the following default policy is used:<br>
|
||||
<select name="defaultPolicy" size="1">
|
||||
<option value="drop"
|
||||
:defPolDropSelected:
|
||||
>drop</option>
|
||||
<option value="accept"
|
||||
:defPolAcceptSelected:
|
||||
>accept</option>
|
||||
</select>
|
||||
<input type="submit" name="defPolSet" value="speichern">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<font size="-2">
|
||||
<table border="1" width="100%">
|
||||
<tr>
|
||||
<th>no.</th>
|
||||
<th>source IP</th>
|
||||
<th>source subnet mask</th>
|
||||
<th>dest. IP</th>
|
||||
<th>dest. subnet mask</th>
|
||||
<th>protocol</th>
|
||||
<th>port</th>
|
||||
<th>action</th>
|
||||
</tr>
|
||||
|
||||
:ruleset:
|
||||
|
||||
</table>
|
||||
</font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Action for selected rule:
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="submit" name="moveup" value="move upwards">
|
||||
<input type="submit" name="movedown" value="move downwards">
|
||||
<input type="submit" name="delrule" value="delete">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</td></tr><tr><td>
|
||||
|
||||
:errorMsg:
|
||||
<!-- Konfiguration neuer Regeln -->
|
||||
<table border="0" bgcolor="#E0E0E0" width="100%" cellpadding="5">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h3>Create new rule</h3><br>
|
||||
All fields are optional and will be<br> -- if empty --<br> ignored for filtering.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="30%">source IP: </td>
|
||||
<td width="70%"><input name="srcIP" type="text" size="15" maxlength="15" value=":srcIP:"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>source subnet mask: </td>
|
||||
<td><input name="srcMask" type="text" size="15" maxlength="15" value=":srcMask:"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>dest. IP: </td>
|
||||
<td> <input name="destIP" type="text" size="15" maxlength="15" value=":destIP:"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>dest. subnet mask: </td>
|
||||
<td> <input name="destMask" type="text" size="15" maxlength="15" value=":destMask:"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>protocol: </td>
|
||||
<td>
|
||||
<select name="protocol" size="1">
|
||||
<option value="*" :optionProtAll:>*</option>
|
||||
<option value="TCP" :optionProtTCP:>TCP</option>
|
||||
<option value="UDP" :optionProtUDP:>UDP</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>port: </td>
|
||||
<td> <input name="port" type="text" size="5" maxlength="5" value=":port:"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>action: </td>
|
||||
<td>
|
||||
<select name="action" size="1">
|
||||
<option value="drop" :optionActionDrop:>drop</option>
|
||||
<option value="accept" :optionActionAccept>accept</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="submit" name="addrule" value="add rule">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td></tr></table></center>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,194 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Configuration du parefeu du routeur</title>
|
||||
<style type="text/css">
|
||||
body { font-family:Helvetica,Arial,sans-serif; margin:0; margin-bottom:10px; }
|
||||
form {padding:0;}
|
||||
#mainTable {width:350px; margin-left:auto; margin-right:auto; border:0; border-collapse:collapse; }
|
||||
.blockTable {background-color:#E0E0E0; border:0; width:100%; }
|
||||
.blockTable td {padding:5px;}
|
||||
#rulesTable { font-size:12pt; border: 1px solid black; width: 100%; border-collapse:collapse;}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
:errorMsg:
|
||||
<form action=":action_pfad:" method="POST">
|
||||
<table id="mainTable" border="0" >
|
||||
<tr><td> <h2>Configuration du parefeu du routeur</h2> </td></tr>
|
||||
<tr><td>
|
||||
<table class="blockTable">
|
||||
<tr><td align="center">
|
||||
<table border="0" cellpadding="5">
|
||||
<tr>
|
||||
<td width="10%">
|
||||
:firewallActivate:
|
||||
</td>
|
||||
<td width="90%">Activer le parefeu</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
Les règles ne sont appliquées que lorsque le parefeu est actif.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
:dropICMP:
|
||||
</td>
|
||||
<td>Filtrer les paquets ICMP</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
Tous les paquets ICMP seront rejetés (ceux d’un ping, par exemple).
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
:onlySYN:
|
||||
</td>
|
||||
<td>
|
||||
Ne filtrer que les paquets SYN
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
Les requêtes vers les ports bloqués seront rejetées.
|
||||
Le canal de retour pour les requêtes de connexion autorisées sera ouvert.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="submit" name="btnSave" value="Enregistrer"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</td></tr><tr><td>
|
||||
|
||||
|
||||
<!-- Konfiguration der Regeln -->
|
||||
<table class="blockTable">
|
||||
<tr>
|
||||
<td>
|
||||
<h3>Règles du parefeu</h3><br>
|
||||
Les règles sont parcourues du haut de la liste vers le bas.<br>
|
||||
Seule la première règle satisfaite rencontrée est appliquée.
|
||||
La règle par défaut s’applique lorsqu’aucune règle de la liste n’est satisfaite.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Règle par défaut :<br>
|
||||
<select name="defaultPolicy" size="1">
|
||||
<option value="drop"
|
||||
:defPolDropSelected:
|
||||
>rejeter</option>
|
||||
<option value="accept"
|
||||
:defPolAcceptSelected:
|
||||
>accepter</option>
|
||||
</select>
|
||||
<input type="submit" name="defPolSet" value="Enregistrer">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<font size="-2">
|
||||
<table id="rulesTable">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>IP source</th>
|
||||
<th>Masque</th>
|
||||
<th>IP dest.</th>
|
||||
<th>Masque</th>
|
||||
<th>Protocole</th>
|
||||
<th>Port</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
|
||||
:ruleset:
|
||||
|
||||
</table>
|
||||
</font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Actions applicables à la règle sélectionnée :
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="submit" name="moveup" value="Remonter">
|
||||
<input type="submit" name="movedown" value="Descendre">
|
||||
<input type="submit" name="delrule" value="Supprimer">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</td></tr><tr><td>
|
||||
|
||||
:errorMsg:
|
||||
<!-- Konfiguration neuer Regeln -->
|
||||
<table class="blockTable">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h3>Nouvelle règle</h3>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
Tous les champs sont optionnels, sauf protocole et Action.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="30%">IP source : </td>
|
||||
<td width="70%"><input name="srcIP" type="text" size="15" maxlength="15" value=":srcIP:"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Masque : </td>
|
||||
<td><input name="srcMask" type="text" size="15" maxlength="15" value=":srcMask:"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>IP destination : </td>
|
||||
<td> <input name="destIP" type="text" size="15" maxlength="15" value=":destIP:"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Masque : </td>
|
||||
<td> <input name="destMask" type="text" size="15" maxlength="15" value=":destMask:"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Protocole : </td>
|
||||
<td>
|
||||
<select name="protocol" size="1">
|
||||
<option value="*" :optionProtAll:>*</option>
|
||||
<option value="TCP" :optionProtTCP:>TCP</option>
|
||||
<option value="UDP" :optionProtUDP:>UDP</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Port : </td>
|
||||
<td> <input name="port" type="text" size="5" maxlength="5" value=":port:"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Action : </td>
|
||||
<td>
|
||||
<select name="action" size="1">
|
||||
<option value="drop" :optionActionDrop:>rejeter</option>
|
||||
<option value="accept" :optionActionAccept>accepter</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="submit" name="addrule" value="Ajouter la règle">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
<tr><td> <p><a href="/">Retour au menu principal</a></p> </td></tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
9
reseau/filius/filius-1.12.5/tmpl/http_fehler_de_DE.txt
Normal file
9
reseau/filius/filius-1.12.5/tmpl/http_fehler_de_DE.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Fehler :meldung: (:code:)</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>:meldung:</h1>
|
||||
<p> Es ist ein Fehler aufgetreten (HTTP-Status: :code:) </p>
|
||||
</body>
|
||||
</html>
|
||||
9
reseau/filius/filius-1.12.5/tmpl/http_fehler_en_GB.txt
Normal file
9
reseau/filius/filius-1.12.5/tmpl/http_fehler_en_GB.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Error :meldung: (:code:)</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>:meldung:</h1>
|
||||
<p> An error occurred (HTTP-Status: :code:) </p>
|
||||
</body>
|
||||
</html>
|
||||
10
reseau/filius/filius-1.12.5/tmpl/http_fehler_fr_FR.txt
Normal file
10
reseau/filius/filius-1.12.5/tmpl/http_fehler_fr_FR.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Erreur :meldung: (:code:)</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>:meldung:</h1>
|
||||
<p> Une erreur s’est produite (HTTP-Status: :code:) </p>
|
||||
</body>
|
||||
</html>
|
||||
212
reseau/filius/filius-1.12.5/tmpl/quelltext_vorlagen/client.txt
Normal file
212
reseau/filius/filius-1.12.5/tmpl/quelltext_vorlagen/client.txt
Normal file
@@ -0,0 +1,212 @@
|
||||
/*
|
||||
** This file is part of Filius, a network construction and simulation software.
|
||||
**
|
||||
** Originally created at the University of Siegen, Institute "Didactics of
|
||||
** Informatics and E-Learning" by a students' project group:
|
||||
** members (2006-2007):
|
||||
** André Asschoff, Johannes Bade, Carsten Dittich, Thomas Gerding,
|
||||
** Nadja Haßler, Ernst Johannes Klebert, Michell Weyer
|
||||
** supervisors:
|
||||
** Stefan Freischlad (maintainer until 2009), Peer Stechert
|
||||
** Project is maintained since 2010 by Christian Eibl <filius@c.fameibl.de>
|
||||
** and Stefan Freischlad
|
||||
** Filius 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) version 3.
|
||||
**
|
||||
** Filius 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 Filius. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package filius.software.clientserver;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import filius.rahmenprogramm.I18n;
|
||||
import filius.software.transportschicht.TCPSocket;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* In dieser Klasse wird das Client-Programm einer einfachen Client-Server-Anwendung implementiert. Nachrichten an die
|
||||
* graphische Benutzungsoberflaeche werden durch den Aufruf banachrichtigeBeobachter(Object) versendet.
|
||||
* </p>
|
||||
* <p>
|
||||
* Aufrufe folgender Methoden des Sockets blockieren:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>verbinden()</li>
|
||||
* <li>senden()</li>
|
||||
* <li>empfangen()</li>
|
||||
* <li>schliessen()</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* Deshalb muessen Methoden dieser Klasse, die Aufrufe dieser Methoden enthalten, ueber die Methode
|
||||
* <code>ausfuehren(String, Object[])</code> aufgerufen werden. Das bewirkt, dass diese Methoden in einem eigenen Thread
|
||||
* ausgefuehrt werden und damit der aufrufende Thread nicht blockiert. Das ist wichtig, wenn die Aufrufe von der
|
||||
* graphischen Benutzungsoberflaeche ausgeloest werden.
|
||||
* </p>
|
||||
* <p>
|
||||
* Ein Beispiel fuer die Verwendung von <code>ausfuehren()</code> ist folgendes: <br />
|
||||
* <code> public void verbinden(String zielAdresse, Integer port) { <br />
|
||||
* Object[] args; <br /> <br />
|
||||
* args = new Object[2]; <br />
|
||||
* args[0] = zielAdresse; <br />
|
||||
* args[1] = port; <br /> <br />
|
||||
* ausfuehren("initialisiereSocket", args); <br />
|
||||
* }
|
||||
* </p>
|
||||
* <p>
|
||||
* Dabei wird als erstes Argument der auszufuehrenden blockierenden Methode
|
||||
* uebergeben (hier: <code> initialisiereSocket</code>) und dann in einem Array die zu uebergebenden Parameter (hier:
|
||||
* <code>zielAdresse</code> und <code>port</code>). Der Aufruf der Methode <code>verbinden(zielAdresse, port)
|
||||
* </code> bewirkt also das Ausfuehren der Methode <code>initialisiereSocket(zielAdresse, port)</code> in einem anderen
|
||||
* Thread. Damit blockiert die Methode <code>verbinden</code> nicht.
|
||||
* </p>
|
||||
* <p>
|
||||
* <b> Achtung:</b> Die indirekt aufgerufene Methode (d. h. ueber <code>
|
||||
* ausfuehren(String, Object[])</code>) muss als <code>public</code> deklariert sein!
|
||||
* </p>
|
||||
*/
|
||||
public class ClientBaustein extends ClientAnwendung implements I18n {
|
||||
private static Logger LOG = LoggerFactory.getLogger(ClientBaustein.class);
|
||||
|
||||
/** Port-Nummer des Servers, an dem Verbindungsanfragen angenommen werden */
|
||||
private int zielPort = 55555;
|
||||
|
||||
/**
|
||||
* Adresse des Rechners, auf dem der Server laeuft als Domainname oder IP-Adresse.
|
||||
*/
|
||||
private String zielIPAdresse;
|
||||
|
||||
/**
|
||||
* Methode zum Verbindungsaufbau zu einem Server. Hier wird der Client-Socket als TCP/IP-Socket erzeugt. Wenn UDP
|
||||
* verwendet werden soll, muss diese Methode ueberschrieben werden. <br />
|
||||
* Diese Methode ist <b>nicht blockierend</b>. Diese Methode veranlasst den Aufruf von
|
||||
* <code>initialisiereSocket</code> in einem anderen Thread.
|
||||
*/
|
||||
public void verbinden() {
|
||||
LOG.debug("INVOKED (" + this.hashCode() + ", T" + this.getId() + ") " + getClass()
|
||||
+ " (ClientBaustein), verbinden()");
|
||||
Object[] args;
|
||||
|
||||
args = new Object[2];
|
||||
args[0] = zielIPAdresse;
|
||||
args[1] = Integer.valueOf(zielPort);
|
||||
|
||||
ausfuehren("initialisiereSocket", args);
|
||||
ausfuehren("empfangeNachricht", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Methode zum Aufbau einer Verbindung mit einem TCP-Socket. Diese Methode ist blockierend.
|
||||
*/
|
||||
public synchronized void initialisiereSocket(String zielAdresse, Integer port) {
|
||||
LOG.debug("INVOKED (" + this.hashCode() + ", T" + this.getId() + ") " + getClass()
|
||||
+ " (ClientBaustein), initialisiereSocket(" + zielAdresse + "," + port + ")");
|
||||
if (!istVerbunden()) {
|
||||
try {
|
||||
socket = new TCPSocket(getSystemSoftware(), zielAdresse, port);
|
||||
socket.verbinden();
|
||||
|
||||
benachrichtigeBeobachter(messages.getString("sw_clientbaustein_msg2"));
|
||||
} catch (Exception e) {
|
||||
LOG.debug("", e);
|
||||
socket = null;
|
||||
benachrichtigeBeobachter(messages.getString("sw_clientbaustein_msg1") + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Methode zum trennen einer Verbindung. Der Socket wird durch den Aufruf der Methode schliessen() geschlossen und
|
||||
* und der Socket fuer diese Anwendung auf null gesetzt. <br />
|
||||
* Diese Methode ist <b> blockierend</b>.
|
||||
*/
|
||||
public void trennen() {
|
||||
LOG.debug("INVOKED (" + this.hashCode() + ", T" + this.getId() + ") " + getClass()
|
||||
+ " (ClientBaustein), trennen()");
|
||||
if (socket != null) {
|
||||
socket.schliessen();
|
||||
socket = null;
|
||||
benachrichtigeBeobachter(messages.getString("sw_clientbaustein_msg3"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Diese Methode <b>blockiert</b> bis die Nachricht versand wurde. Der Empfang der Antwort erfolgt asynchron.
|
||||
*/
|
||||
public void senden(String nachricht) {
|
||||
LOG.debug("INVOKED (" + this.hashCode() + ", T" + this.getId() + ") " + getClass()
|
||||
+ " (ClientBaustein), versendeNachricht(" + nachricht + ")");
|
||||
|
||||
if (socket != null && socket.istVerbunden()) {
|
||||
try {
|
||||
socket.senden(nachricht);
|
||||
benachrichtigeBeobachter("<<" + nachricht);
|
||||
} catch (Exception e) {
|
||||
benachrichtigeBeobachter(e.getMessage());
|
||||
LOG.debug("", e);
|
||||
}
|
||||
} else {
|
||||
benachrichtigeBeobachter(messages.getString("sw_clientbaustein_msg4"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Methode zum Empfang einer Nachricht vom Socket. Die empfangene Nachricht wird mit
|
||||
* <code>benachrichtigeBeobachter</code> an die GUI weiter gegeben. Diese Methode ist blockierend und sollte nicht
|
||||
* direkt von der GUI aufgerufen werden.
|
||||
*/
|
||||
public void empfangeNachricht() {
|
||||
LOG.debug("INVOKED (" + this.hashCode() + ", T" + this.getId() + ") " + getClass()
|
||||
+ " (ClientBaustein), empfangeNachricht()");
|
||||
String nachricht;
|
||||
|
||||
while (socket != null && socket.istVerbunden()) {
|
||||
try {
|
||||
nachricht = socket.empfangen(Long.MAX_VALUE);
|
||||
if (nachricht != null) {
|
||||
benachrichtigeBeobachter(">>" + nachricht);
|
||||
} else {
|
||||
socket.schliessen();
|
||||
benachrichtigeBeobachter(
|
||||
messages.getString("sw_clientbaustein_msg5") + " " + socket.holeZielIPAdresse() + ":"
|
||||
+ socket.holeZielPort() + " " + messages.getString("sw_clientbaustein_msg6"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
benachrichtigeBeobachter(e.getMessage());
|
||||
LOG.debug("", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Methode fuer den Zugriff auf die Server-Adresse */
|
||||
public String getZielIPAdresse() {
|
||||
return zielIPAdresse;
|
||||
}
|
||||
|
||||
/** Methode fuer den Zugriff auf die Server-Adresse */
|
||||
public void setZielIPAdresse(String zielIPAdresse) {
|
||||
this.zielIPAdresse = zielIPAdresse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Methode fuer den Zugriff auf die Port-Nummer, an dem der Server zu erreichen ist.
|
||||
*/
|
||||
public int getZielPort() {
|
||||
return zielPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Methode fuer den Zugriff auf die Port-Nummer, an dem der Server zu erreichen ist.
|
||||
*/
|
||||
public void setZielPort(int zielPort) {
|
||||
this.zielPort = zielPort;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
/*
|
||||
** This file is part of Filius, a network construction and simulation software.
|
||||
**
|
||||
** Originally created at the University of Siegen, Institute "Didactics of
|
||||
** Informatics and E-Learning" by a students' project group:
|
||||
** members (2006-2007):
|
||||
** André Asschoff, Johannes Bade, Carsten Dittich, Thomas Gerding,
|
||||
** Nadja Haßler, Ernst Johannes Klebert, Michell Weyer
|
||||
** supervisors:
|
||||
** Stefan Freischlad (maintainer until 2009), Peer Stechert
|
||||
** Project is maintained since 2010 by Christian Eibl <filius@c.fameibl.de>
|
||||
** and Stefan Freischlad
|
||||
** Filius 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) version 3.
|
||||
**
|
||||
** Filius 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 Filius. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package filius.gui.anwendungssicht;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Observable;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import filius.software.clientserver.ClientBaustein;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Diese Klasse stellt die Benutzungsoberflaeche fuer das Client-Programm einer
|
||||
* einfachen Client-Server-Anwendung zur Verfuegung.
|
||||
* </p>
|
||||
* <p>
|
||||
* Nachrichten von der Anwendung werden nach dem Beobachtermuster durch die
|
||||
* Benachrichtigung der Beobachter angenommen und verarbeitet.
|
||||
* </p>
|
||||
*/
|
||||
public class GUIApplicationClientBausteinWindow extends GUIApplicationWindow {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Textfeld fuer die Ausgabe gesendeter und empfangener Nachrichten sowie
|
||||
* fuer Fehlermeldungen
|
||||
*/
|
||||
private JTextArea taAusgabe;
|
||||
|
||||
/**
|
||||
* Textfeld fuer die Adresse des Servers, zu dem die Verbindung hergestellt
|
||||
* werden soll
|
||||
*/
|
||||
private JTextField tfServerAdresse;
|
||||
|
||||
/**
|
||||
* Textfeld zur Angabe des TCP-Ports, auf dem der Server auf eingehende
|
||||
* Nachrichten wartet
|
||||
*/
|
||||
private JTextField tfServerPort;
|
||||
|
||||
/** Textbereich zur Eingabe der Nachrichten */
|
||||
private JTextArea taSenden;
|
||||
|
||||
/** Schaltflaeche zum initiieren des Verbindungsaufbaus */
|
||||
private JButton btVerbinden;
|
||||
|
||||
/**
|
||||
* Schaltflaeche zum Senden einer zuvor eingegebenen Nachricht
|
||||
*/
|
||||
private JButton btSenden;
|
||||
|
||||
/**
|
||||
* Standard-Konstruktor, der automatisch zur Erzeugung der graphischen
|
||||
* Benutzungsoberflaeche fuer diese Anwendung aufgerufen wird.
|
||||
*/
|
||||
public GUIApplicationClientBausteinWindow(GUIDesktopPanel desktop, String appName) {
|
||||
super(desktop, appName);
|
||||
initialisiereKomponenten();
|
||||
}
|
||||
|
||||
/** Methode zur Initialisierung der graphischen Komponenten */
|
||||
private void initialisiereKomponenten() {
|
||||
JPanel hauptPanel;
|
||||
JScrollPane scrollPane;
|
||||
Box hauptBox;
|
||||
Box hBox;
|
||||
JLabel label;
|
||||
|
||||
hauptPanel = new JPanel(new BorderLayout());
|
||||
|
||||
hauptBox = Box.createVerticalBox();
|
||||
hauptBox.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
|
||||
hauptBox.add(Box.createVerticalStrut(5));
|
||||
|
||||
hBox = Box.createHorizontalBox();
|
||||
label = new JLabel(messages.getString("clientbaustein_msg1"));
|
||||
label.setPreferredSize(new Dimension(140, label.getHeight()));
|
||||
hBox.add(label);
|
||||
|
||||
tfServerAdresse = new JTextField();
|
||||
tfServerAdresse.setPreferredSize(new Dimension(100, 20));
|
||||
hBox.add(tfServerAdresse);
|
||||
hauptBox.add(hBox);
|
||||
hauptBox.add(Box.createVerticalStrut(5));
|
||||
|
||||
hBox = Box.createHorizontalBox();
|
||||
label = new JLabel(messages.getString("clientbaustein_msg2"));
|
||||
label.setPreferredSize(new Dimension(140, label.getHeight()));
|
||||
hBox.add(label);
|
||||
|
||||
tfServerPort = new JTextField();
|
||||
tfServerPort.setPreferredSize(new Dimension(100, 20));
|
||||
hBox.add(tfServerPort);
|
||||
hauptBox.add(hBox);
|
||||
hauptBox.add(Box.createVerticalStrut(5));
|
||||
|
||||
btVerbinden = new JButton(messages.getString("clientbaustein_msg3"));
|
||||
btVerbinden.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (e.getActionCommand().equals("verbinden")) {
|
||||
((ClientBaustein) holeAnwendung()).setZielIPAdresse(tfServerAdresse.getText());
|
||||
((ClientBaustein) holeAnwendung()).setZielPort(Integer.parseInt(tfServerPort.getText()));
|
||||
((ClientBaustein) holeAnwendung()).verbinden();
|
||||
} else {
|
||||
((ClientBaustein) holeAnwendung()).trennen();
|
||||
}
|
||||
aktualisieren();
|
||||
}
|
||||
});
|
||||
hauptBox.add(btVerbinden);
|
||||
hauptBox.add(Box.createVerticalStrut(5));
|
||||
|
||||
label = new JLabel(messages.getString("clientbaustein_msg4"));
|
||||
label.setPreferredSize(new Dimension(100, 20));
|
||||
hauptBox.add(label);
|
||||
|
||||
taSenden = new JTextArea();
|
||||
scrollPane = new JScrollPane(taSenden);
|
||||
scrollPane.setPreferredSize(new Dimension(400, 50));
|
||||
hauptBox.add(scrollPane);
|
||||
|
||||
btSenden = new JButton(messages.getString("clientbaustein_msg5"));
|
||||
btSenden.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
((ClientBaustein) holeAnwendung()).senden(taSenden.getText());
|
||||
taSenden.setText("");
|
||||
}
|
||||
});
|
||||
hauptBox.add(btSenden);
|
||||
hauptBox.add(Box.createVerticalStrut(5));
|
||||
|
||||
taAusgabe = new JTextArea();
|
||||
taAusgabe.setEditable(false);
|
||||
scrollPane = new JScrollPane(taAusgabe);
|
||||
scrollPane.setPreferredSize(new Dimension(400, 200));
|
||||
hauptBox.add(scrollPane);
|
||||
hauptBox.add(Box.createVerticalStrut(5));
|
||||
|
||||
hauptPanel.add(hauptBox, BorderLayout.CENTER);
|
||||
|
||||
getContentPane().add(hauptPanel);
|
||||
pack();
|
||||
|
||||
aktualisieren();
|
||||
}
|
||||
|
||||
/**
|
||||
* Methode zum aktualisieren der Komponenten der graphischen
|
||||
* Benutzungsoberflaeche in Abhaengigkeit vom Zustand der Anwendung
|
||||
*/
|
||||
private void aktualisieren() {
|
||||
ClientBaustein client;
|
||||
|
||||
client = (ClientBaustein) holeAnwendung();
|
||||
|
||||
tfServerAdresse.setText(client.getZielIPAdresse());
|
||||
tfServerPort.setText("" + client.getZielPort());
|
||||
if (client.istVerbunden()) {
|
||||
btVerbinden.setText(messages.getString("clientbaustein_msg6"));
|
||||
btVerbinden.setActionCommand("trennen");
|
||||
btSenden.setEnabled(true);
|
||||
|
||||
tfServerAdresse.setEditable(false);
|
||||
tfServerPort.setEditable(false);
|
||||
} else {
|
||||
btVerbinden.setText(messages.getString("clientbaustein_msg3"));
|
||||
btVerbinden.setActionCommand("verbinden");
|
||||
btSenden.setEnabled(false);
|
||||
|
||||
tfServerAdresse.setEditable(true);
|
||||
tfServerPort.setEditable(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Diese Methode wird automatisch ausgefuehrt, wenn eine Nachricht an den
|
||||
* Beobachter der Anwendung gesendet wird. Der Parameter arg enthaelt die
|
||||
* Nachricht, die von der Anwendung verschickt wurde.
|
||||
*/
|
||||
public void update(Observable o, Object arg) {
|
||||
if (arg != null) {
|
||||
this.taAusgabe.append(arg.toString() + "\n");
|
||||
}
|
||||
|
||||
aktualisieren();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
** This file is part of Filius, a network construction and simulation software.
|
||||
**
|
||||
** Originally created at the University of Siegen, Institute "Didactics of
|
||||
** Informatics and E-Learning" by a students' project group:
|
||||
** members (2006-2007):
|
||||
** André Asschoff, Johannes Bade, Carsten Dittich, Thomas Gerding,
|
||||
** Nadja Haßler, Ernst Johannes Klebert, Michell Weyer
|
||||
** supervisors:
|
||||
** Stefan Freischlad (maintainer until 2009), Peer Stechert
|
||||
** Project is maintained since 2010 by Christian Eibl <filius@c.fameibl.de>
|
||||
** and Stefan Freischlad
|
||||
** Filius 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) version 3.
|
||||
**
|
||||
** Filius 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 Filius. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package filius.software.clientserver;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import filius.software.transportschicht.Socket;
|
||||
import filius.software.transportschicht.TCPSocket;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* In dieser Klasse wird das Server-Programm einer einfachen Client-Server-Anwendung implementiert. Nachrichten an die
|
||||
* graphische Benutzungsoberflaeche werden durch den Aufruf banachrichtigeBeobachter(Object) versendet.
|
||||
* </p>
|
||||
* <p>
|
||||
* In dieser Klasse wird mit einem eigenen Thread der Server-Socket auf eingehende Verbindungen gewartet. Die
|
||||
* Verarbeitung der eingehenden Nachrichten erfolgt durch einen Mitarbeiter, der in der Methode
|
||||
* <code>neuerMitarbeiter(Socket)</code> erzeugt wird.
|
||||
* </p>
|
||||
* <p>
|
||||
* Die Verarbeitung eingehender Nachrichten wird von einem Mitarbeiter uebernommen, der erzeugt wird, sobald eine neue
|
||||
* Verbindungsanfrage vom Server-Socket empfangen wurde.
|
||||
* </p>
|
||||
* <p>
|
||||
* Einstellungen, die in einer Projektdatei gespeichert werden sollen, muessen in dieser Klasse als Attribute verwaltet
|
||||
* werden und mit Getter- und Setter-Methoden zugaenglich sein (z. B. fuer das Attribut <code>int bspAttr</code> mit
|
||||
* <code>
|
||||
* public int getBspAttr()</code> und <code>public void setBspAttr(int)
|
||||
* </code>). Attribute, die in der Mitarbeiterklasse vorhanden sind, werden nicht gespeichert!
|
||||
* </p>
|
||||
* <p>
|
||||
* Das Server-Programm wird durch Aufruf der Methode der Oberklasse <code>setAktiv(boolean)</code> aktiviert bzw.
|
||||
* deaktiviert (d. h. die Verbindungsannahme wird aktiviert bzw. deaktiviert).
|
||||
* </p>
|
||||
*/
|
||||
public class ServerBaustein extends TCPServerAnwendung {
|
||||
private static Logger LOG = LoggerFactory.getLogger(ServerBaustein.class);
|
||||
|
||||
/**
|
||||
* In dieser Methode wird ein neuer Mitarbeiter zur Verarbeitung von eingehenden Nachrichten erzeugt und der Liste
|
||||
* der zu verwaltenden Mitarbeiter hinzugefuegt.
|
||||
*/
|
||||
protected void neuerMitarbeiter(Socket socket) {
|
||||
LOG.debug("INVOKED (" + this.hashCode() + ", T" + this.getId() + ") " + getClass()
|
||||
+ " (ServerBaustein), neuerMitarbeiter(" + socket + ")");
|
||||
ServerMitarbeiter mitarbeiter;
|
||||
|
||||
if (socket instanceof TCPSocket) {
|
||||
mitarbeiter = new ServerBausteinMitarbeiter(this, (TCPSocket) socket);
|
||||
this.mitarbeiter.add(mitarbeiter);
|
||||
mitarbeiter.starten();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
** This file is part of Filius, a network construction and simulation software.
|
||||
**
|
||||
** Originally created at the University of Siegen, Institute "Didactics of
|
||||
** Informatics and E-Learning" by a students' project group:
|
||||
** members (2006-2007):
|
||||
** André Asschoff, Johannes Bade, Carsten Dittich, Thomas Gerding,
|
||||
** Nadja Haßler, Ernst Johannes Klebert, Michell Weyer
|
||||
** supervisors:
|
||||
** Stefan Freischlad (maintainer until 2009), Peer Stechert
|
||||
** Project is maintained since 2010 by Christian Eibl <filius@c.fameibl.de>
|
||||
** and Stefan Freischlad
|
||||
** Filius 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) version 3.
|
||||
**
|
||||
** Filius 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 Filius. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package filius.gui.anwendungssicht;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Observable;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import filius.software.clientserver.ServerAnwendung;
|
||||
import filius.software.clientserver.ServerBaustein;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Diese Klasse stellt die Benutzungsoberflaeche fuer das Server-Programm einer
|
||||
* einfachen Client-Server-Anwendung zur Verfuegung.
|
||||
* </p>
|
||||
* <p>
|
||||
* Nachrichten von der Anwendung werden nach dem Beobachtermuster durch die
|
||||
* Benachrichtigung der Beobachter angenommen und verarbeitet.
|
||||
* </p>
|
||||
*/
|
||||
public class GUIApplicationServerBausteinWindow extends GUIApplicationWindow {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Textbereich zur Ausgabe von Log-Daten, die vom Server-Programm erzeugt
|
||||
* und durch Benachrichtigung der Beobachter an die graphische
|
||||
* Benutzungsoberflaeche weiter gegeben werden
|
||||
*/
|
||||
private JTextArea taLog;
|
||||
|
||||
/**
|
||||
* Schaltflaeche zum Starten bzw. Stoppen des Server-Programms, d. h. zum
|
||||
* Starten bzw. Beenden der Verbindungsannahme durch den Server
|
||||
*/
|
||||
private JButton bStartStop;
|
||||
|
||||
/**
|
||||
* Textfeld zur Eingabe des Ports, an dem der Server eingehende
|
||||
* Verbindungsanfragen entgegen nimmt.
|
||||
*/
|
||||
private JTextField tfPort;
|
||||
|
||||
/**
|
||||
* Standard-Konstruktor, der automatisch zur Erzeugung der graphischen
|
||||
* Benutzungsoberflaeche fuer diese Anwendung aufgerufen wird.
|
||||
*/
|
||||
public GUIApplicationServerBausteinWindow(GUIDesktopPanel desktop, String appName) {
|
||||
super(desktop, appName);
|
||||
initialisiereKomponenten();
|
||||
}
|
||||
|
||||
/** Methode zur Initialisierung der graphischen Komponenten */
|
||||
private void initialisiereKomponenten() {
|
||||
JPanel hauptPanel;
|
||||
JScrollPane spLogScroller;
|
||||
JLabel lbPort;
|
||||
Box hBox, vBox;
|
||||
|
||||
hauptPanel = new JPanel(new BorderLayout());
|
||||
vBox = Box.createVerticalBox();
|
||||
vBox.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
|
||||
vBox.add(Box.createVerticalStrut(5));
|
||||
|
||||
hBox = Box.createHorizontalBox();
|
||||
|
||||
bStartStop = new JButton();
|
||||
bStartStop.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (e.getActionCommand().equals("start")) {
|
||||
((ServerAnwendung) holeAnwendung()).setPort(Integer.parseInt(tfPort.getText()));
|
||||
((ServerAnwendung) holeAnwendung()).setAktiv(true);
|
||||
((ServerAnwendung) holeAnwendung()).setPort(Integer.parseInt(tfPort.getText()));
|
||||
} else {
|
||||
((ServerAnwendung) holeAnwendung()).setAktiv(false);
|
||||
}
|
||||
aktualisieren();
|
||||
}
|
||||
});
|
||||
hBox.add(bStartStop);
|
||||
hBox.add(Box.createHorizontalStrut(5));
|
||||
|
||||
lbPort = new JLabel(messages.getString("serverbaustein_msg1"));
|
||||
hBox.add(lbPort);
|
||||
tfPort = new JTextField("" + ((ServerAnwendung) holeAnwendung()).getPort());
|
||||
hBox.add(tfPort);
|
||||
|
||||
vBox.add(hBox);
|
||||
vBox.add(Box.createVerticalStrut(5));
|
||||
|
||||
taLog = new JTextArea();
|
||||
taLog.setEditable(false);
|
||||
spLogScroller = new JScrollPane(taLog);
|
||||
spLogScroller.setPreferredSize(new Dimension(400, 400));
|
||||
vBox.add(spLogScroller);
|
||||
vBox.add(Box.createVerticalStrut(5));
|
||||
|
||||
hauptPanel.add(vBox, BorderLayout.CENTER);
|
||||
|
||||
getContentPane().add(hauptPanel);
|
||||
pack();
|
||||
|
||||
aktualisieren();
|
||||
}
|
||||
|
||||
/**
|
||||
* Methode zum aktualisieren der Komponenten der graphischen
|
||||
* Benutzungsoberflaeche in Abhaengigkeit vom Zustand der Anwendung
|
||||
*/
|
||||
public void aktualisieren() {
|
||||
ServerBaustein server;
|
||||
|
||||
server = (ServerBaustein) holeAnwendung();
|
||||
if (server.isAktiv()) {
|
||||
tfPort.setEditable(false);
|
||||
bStartStop.setText(messages.getString("serverbaustein_msg2"));
|
||||
bStartStop.setActionCommand("stop");
|
||||
} else {
|
||||
bStartStop.setText(messages.getString("serverbaustein_msg3"));
|
||||
bStartStop.setActionCommand("start");
|
||||
tfPort.setEditable(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Diese Methode wird automatisch ausgefuehrt, wenn der eine Nachricht an
|
||||
* den Beobachter der Anwendung gesendet wird. Der Parameter arg enthaelt
|
||||
* die Nachricht, die von der Anwendung verschickt wurde.
|
||||
*/
|
||||
public void update(Observable o, Object arg) {
|
||||
taLog.append(arg.toString() + "\n");
|
||||
aktualisieren();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
** This file is part of Filius, a network construction and simulation software.
|
||||
**
|
||||
** Originally created at the University of Siegen, Institute "Didactics of
|
||||
** Informatics and E-Learning" by a students' project group:
|
||||
** members (2006-2007):
|
||||
** André Asschoff, Johannes Bade, Carsten Dittich, Thomas Gerding,
|
||||
** Nadja Haßler, Ernst Johannes Klebert, Michell Weyer
|
||||
** supervisors:
|
||||
** Stefan Freischlad (maintainer until 2009), Peer Stechert
|
||||
** Project is maintained since 2010 by Christian Eibl <filius@c.fameibl.de>
|
||||
** and Stefan Freischlad
|
||||
** Filius 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) version 3.
|
||||
**
|
||||
** Filius 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 Filius. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package filius.software.clientserver;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import filius.software.transportschicht.Socket;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* In dieser Klasse erfolgt die Verarbeitung von eingehenden Nachrichten an einen Server.
|
||||
* </p>
|
||||
* <p>
|
||||
* Die Oberklasse <code>ServerMitarbeiter</code> erbt von der Klasse Thread. In der <code>run()</code>-Methode der
|
||||
* Oberklasse wird der Socket auf eingehende Nachrichten ueberwacht. Sobald eine Nachricht eintrifft, wird diese an die
|
||||
* Methode <code>verarbeiteNachricht(String)</code> zur weiteren Verarbeitung weiter gegeben. Ausserdem wird dort der
|
||||
* Socket automatisch geschlossen, wenn das Client-Programm den Verbindungsabbau initiiert.
|
||||
* </p>
|
||||
* <p>
|
||||
* In dieser Klasse sollte nur die Methode <code>senden(String)</code> des Sockets verwendet werden!
|
||||
* </p>
|
||||
*/
|
||||
public class ServerBausteinMitarbeiter extends ServerMitarbeiter {
|
||||
private static Logger LOG = LoggerFactory.getLogger(ServerBausteinMitarbeiter.class);
|
||||
|
||||
/**
|
||||
* Standard-Konstruktor. Wenn der Server auf einem bestimmten Port auf eingehende Verbindungen warten soll, muss die
|
||||
* Port-Nummer hier mit <code>setPort(int)</code> initialisiert werden!
|
||||
*/
|
||||
public ServerBausteinMitarbeiter(ServerAnwendung server, Socket socket) {
|
||||
super(server, socket);
|
||||
}
|
||||
|
||||
/**
|
||||
* Methode, die automatisch aufgerufen wird, wenn eine neue Nachricht eintrifft. Hier erfolgt die Verarbeitung der
|
||||
* eingehenden Nachricht.
|
||||
*/
|
||||
protected void verarbeiteNachricht(String nachricht) {
|
||||
LOG.debug("INVOKED (" + this.hashCode() + ", T" + this.getId() + ") " + getClass()
|
||||
+ " (ServerBausteinMitarbeiter), verarbeiteNachricht(" + nachricht + ")");
|
||||
try {
|
||||
socket.senden(nachricht);
|
||||
server.benachrichtigeBeobachter("<<" + nachricht);
|
||||
} catch (Exception e) {
|
||||
LOG.debug("", e);
|
||||
server.benachrichtigeBeobachter(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
35
reseau/filius/filius-1.12.5/tmpl/routing_de_DE.html
Normal file
35
reseau/filius/filius-1.12.5/tmpl/routing_de_DE.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
:title:
|
||||
</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>
|
||||
:title:
|
||||
</h1>
|
||||
|
||||
<table border=1>
|
||||
<tr>
|
||||
<th colspan=2>Rechnernetz</th>
|
||||
<th>Hops</th>
|
||||
<th>Gültigkeit</th>
|
||||
<th colspan=2>Nächster Hop</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Adresse</th>
|
||||
<th>Netzmaske</th>
|
||||
<th></th>
|
||||
<th>(sec)</th>
|
||||
<th>Ziel</th>
|
||||
<th>Öffentliche Adresse</th>
|
||||
</tr>
|
||||
|
||||
:routing_entries:
|
||||
|
||||
</table>
|
||||
<p>
|
||||
:hint:
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
35
reseau/filius/filius-1.12.5/tmpl/routing_en_GB.html
Normal file
35
reseau/filius/filius-1.12.5/tmpl/routing_en_GB.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
:title:
|
||||
</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>
|
||||
:title:
|
||||
</h1>
|
||||
|
||||
<table border=1>
|
||||
<tr>
|
||||
<th colspan=2>Network</th>
|
||||
<th>Hops</th>
|
||||
<th>Validity</th>
|
||||
<th colspan=2>Next Hop</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Address</th>
|
||||
<th>Netmask</th>
|
||||
<th></th>
|
||||
<th>(sec)</th>
|
||||
<th>Target</th>
|
||||
<th>Public Address</th>
|
||||
</tr>
|
||||
|
||||
:routing_entries:
|
||||
|
||||
</table>
|
||||
<p>
|
||||
:hint:
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
37
reseau/filius/filius-1.12.5/tmpl/routing_fr_FR.html
Normal file
37
reseau/filius/filius-1.12.5/tmpl/routing_fr_FR.html
Normal file
@@ -0,0 +1,37 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>
|
||||
:title:
|
||||
</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>
|
||||
:title:
|
||||
</h1>
|
||||
|
||||
<table border=1>
|
||||
<tr>
|
||||
<th colspan=2>Réseau</th>
|
||||
<th>Sauts</th>
|
||||
<th>Validité</th>
|
||||
<th colspan=2>Saut suivant</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Adresse</th>
|
||||
<th>Masque</th>
|
||||
<th></th>
|
||||
<th>(sec)</th>
|
||||
<th>Destination</th>
|
||||
<th>Adresse publique</th>
|
||||
</tr>
|
||||
|
||||
:routing_entries:
|
||||
|
||||
</table>
|
||||
<p>
|
||||
:hint:
|
||||
</p>
|
||||
<p><a href="/">Retour au menu principal</a></p>
|
||||
</body>
|
||||
</html>
|
||||
14
reseau/filius/filius-1.12.5/tmpl/vermittlung_index_de_DE.txt
Normal file
14
reseau/filius/filius-1.12.5/tmpl/vermittlung_index_de_DE.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Administration des Vermittlungsrechners</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Firewall-Administration</h1>
|
||||
<p> <a href="konfig">Konfiguration</a> </p>
|
||||
<p> <a href="log">Log-Einträge anzeigen</a> </p>
|
||||
|
||||
<h1> Weiterleitung/Routing </h1>
|
||||
<p> <a href="routes"> Anzeige des aktuellen Status der Weiterleitungs-/Routing-Tabelle </a></p>
|
||||
</body>
|
||||
</html>
|
||||
14
reseau/filius/filius-1.12.5/tmpl/vermittlung_index_en_GB.txt
Normal file
14
reseau/filius/filius-1.12.5/tmpl/vermittlung_index_en_GB.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Router Administration</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Firewall Administration</h1>
|
||||
<p> <a href="konfig">Configuration</a> </p>
|
||||
<p> <a href="log">Show Log</a> </p>
|
||||
|
||||
<h1> Routing/Forwarding </h1>
|
||||
<p> <a href="routes"> Show current routing/forwarding table </a> </p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
20
reseau/filius/filius-1.12.5/tmpl/vermittlung_index_fr_FR.txt
Normal file
20
reseau/filius/filius-1.12.5/tmpl/vermittlung_index_fr_FR.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Administration du routeur</title>
|
||||
<style type="text/css">
|
||||
body { font-family:Helvetica,Arial,sans-serif; margin-left:4px; }
|
||||
h1 { margin-top:20px; margin-bottom:0; }
|
||||
p { margin-left:10px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Parefeu</h1>
|
||||
<p> <a href="konfig">Configurer le parefeu</a> </p>
|
||||
<p> <a href="log">Afficher le journal</a> </p>
|
||||
|
||||
<h1>Routage</h1>
|
||||
<p> <a href="routes">Afficher la table de routage</a> </p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
18
reseau/filius/filius-1.12.5/tmpl/webserver_index_de_DE.txt
Normal file
18
reseau/filius/filius-1.12.5/tmpl/webserver_index_de_DE.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Standardseite</title>
|
||||
</head>
|
||||
<body bgcolor="#ccddff" style="font-family:Verdana; text-align:center;">
|
||||
<h2> FILIUS - Webserver </h2>
|
||||
|
||||
<p>Herzlich Willkommen auf dem Webserver der Anwendung FILIUS!</p>
|
||||
|
||||
<p> Diese Seite wurde automatisch mit der Installation des
|
||||
Webservers eingerichtet, es lassen sich jedoch auch
|
||||
eigene Seiten hier unterbringen. </p>
|
||||
|
||||
<p align="center"> <img src="splashscreen-mini.png"> </p>
|
||||
|
||||
<p> https://www.lernsoftware-filius.de </p>
|
||||
</body>
|
||||
</html>
|
||||
17
reseau/filius/filius-1.12.5/tmpl/webserver_index_en_GB.txt
Normal file
17
reseau/filius/filius-1.12.5/tmpl/webserver_index_en_GB.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Standardseite</title>
|
||||
</head>
|
||||
<body bgcolor="#ccddff" style="font-family:Verdana; text-align:center;">
|
||||
<h2> FILIUS - Webserver </h2>
|
||||
|
||||
<p>Welcome at FILIUS!</p>
|
||||
|
||||
<p> This page has been delivered as default page.
|
||||
Feel free to add your own contents! </p>
|
||||
|
||||
<p align="center"> <img src="splashscreen-mini.png"> </p>
|
||||
|
||||
<p> https://www.lernsoftware-filius.de </p>
|
||||
</body>
|
||||
</html>
|
||||
19
reseau/filius/filius-1.12.5/tmpl/webserver_index_fr_FR.txt
Normal file
19
reseau/filius/filius-1.12.5/tmpl/webserver_index_fr_FR.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Page d’accueil</title>
|
||||
</head>
|
||||
<body bgcolor="#ccddff" style="font-family:Verdana; text-align:center;">
|
||||
<h2> FILIUS - Serveur web </h2>
|
||||
|
||||
<p>Bienvenue sur le serveur web de FILIUS</p>
|
||||
|
||||
<p> Cette page a été créée automatiquement à l’installation du serveur web.
|
||||
Vous pouvez modifier cette page et en ajouter d’autres dans le dossier
|
||||
/webserver du serveur.</p>
|
||||
|
||||
<p align="center"> <img src="splashscreen-mini.png"> </p>
|
||||
|
||||
<p> https://www.lernsoftware-filius.de </p>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user