Faut toter dans la vie ajoute des fichiers dev et src
This commit is contained in:
BIN
TP_DEV3.2/File/Fusion.class
Normal file
BIN
TP_DEV3.2/File/Fusion.class
Normal file
Binary file not shown.
82
TP_DEV3.2/File/Fusion.java
Normal file
82
TP_DEV3.2/File/Fusion.java
Normal file
@@ -0,0 +1,82 @@
|
||||
import java.util.*;
|
||||
|
||||
public class Fusion<T extends Comparable<T>> {
|
||||
|
||||
|
||||
private Queue<T> scinder(Queue<T> file){
|
||||
|
||||
Queue<T> moitie = new LinkedList<>();
|
||||
|
||||
int taille = file.size()/2;
|
||||
|
||||
for(int i=0; i<taille; i++){
|
||||
|
||||
|
||||
moitie.add(file.remove());
|
||||
|
||||
}
|
||||
|
||||
return moitie;
|
||||
|
||||
}
|
||||
|
||||
private Queue<T> fusionner(Queue<T> file1, Queue<T> file2){
|
||||
|
||||
Queue<T> fusion = new LinkedList<>();
|
||||
|
||||
while(!file1.isEmpty()&&!file2.isEmpty()){
|
||||
|
||||
if (file1.peek().compareTo(file2.peek()) <= 0){
|
||||
|
||||
fusion.add(file1.remove());
|
||||
|
||||
}
|
||||
|
||||
else{
|
||||
|
||||
fusion.add(file2.remove());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fusion.addAll(file1);
|
||||
fusion.addAll(file2);
|
||||
|
||||
return fusion;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private Queue<T> trier(Queue<T> file){
|
||||
|
||||
if(file.size()<=1){
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
Queue<T> moitie = scinder(file);
|
||||
Queue<T> gauche = trier(moitie);
|
||||
Queue<T> droite = trier(file);
|
||||
|
||||
return fusionner(gauche,droite);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Queue<Integer> file = new LinkedList<>();
|
||||
file.add(5);
|
||||
file.add(2);
|
||||
file.add(9);
|
||||
file.add(1);
|
||||
|
||||
Fusion<Integer> tri = new Fusion<>();
|
||||
Queue<Integer> resultat = tri.trier(file);
|
||||
|
||||
System.out.println("File triée : " + resultat);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
59
TP_DEV3.2/File/MaFileChainee.java
Normal file
59
TP_DEV3.2/File/MaFileChainee.java
Normal file
@@ -0,0 +1,59 @@
|
||||
public class MaFileChainee<E> extends AbstractQueue<E> implements Queue<E> {
|
||||
|
||||
private static class Node<E> {
|
||||
E valeur;
|
||||
Node<E> suivant;
|
||||
|
||||
|
||||
Node(E valeur){
|
||||
|
||||
this.valeur=valeur;
|
||||
}
|
||||
|
||||
private Node<E> tete = null;
|
||||
private Node<E> queue = null;
|
||||
private taille = 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
private boolean offer(E e){
|
||||
|
||||
|
||||
Node<E> nouveau= new Node<>(e);
|
||||
|
||||
|
||||
if(queue==null){
|
||||
|
||||
|
||||
tete=nouveau;
|
||||
queue=nouveau;
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
queue=nouveau;
|
||||
queue.suivant=nouveau;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
taille++;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
BIN
TP_SCR3.2/TP00(1).tar
Normal file
BIN
TP_SCR3.2/TP00(1).tar
Normal file
Binary file not shown.
267
TP_SCR3.2/TP01/one-gateway.imn
Normal file
267
TP_SCR3.2/TP01/one-gateway.imn
Normal file
@@ -0,0 +1,267 @@
|
||||
node n0 {
|
||||
type pc
|
||||
network-config {
|
||||
hostname pc2-1
|
||||
!
|
||||
interface eth0
|
||||
mac address 42:00:aa:00:00:04
|
||||
ip address 172.16.2.1/24
|
||||
!
|
||||
interface lo0
|
||||
type lo
|
||||
ip address 127.0.0.1/8
|
||||
ipv6 address ::1/128
|
||||
!
|
||||
}
|
||||
canvas c0
|
||||
iconcoords {144 120}
|
||||
labelcoords {144 151}
|
||||
interface-peer {eth0 n3}
|
||||
custom-configs {
|
||||
custom-config-id default {
|
||||
custom-command /bin/sh
|
||||
config {
|
||||
ip addr add 127.0.0.1/8 dev lo0
|
||||
ip addr add 172.16.2.1/24 dev eth0
|
||||
ip -6 addr add ::1/128 dev lo0
|
||||
ip addr add 172.16.2.1/24 dev eth0
|
||||
ip route add default via 172.16.2.254
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
custom-selected default
|
||||
}
|
||||
|
||||
node n2 {
|
||||
type host
|
||||
network-config {
|
||||
hostname host1
|
||||
!
|
||||
interface eth1
|
||||
mac address 42:00:aa:00:00:03
|
||||
ip address 172.16.2.254/24
|
||||
!
|
||||
interface eth0
|
||||
mac address 42:00:aa:00:00:02
|
||||
ip address 172.16.1.254/24
|
||||
!
|
||||
interface lo0
|
||||
type lo
|
||||
ip address 127.0.0.1/8
|
||||
ipv6 address ::1/128
|
||||
!
|
||||
}
|
||||
canvas c0
|
||||
iconcoords {336 336}
|
||||
labelcoords {336 372}
|
||||
interface-peer {eth0 n1}
|
||||
interface-peer {eth1 n3}
|
||||
custom-configs {
|
||||
custom-config-id default {
|
||||
custom-command /bin/sh
|
||||
config {
|
||||
ip addr add 127.0.0.1/8 dev lo0
|
||||
ip addr add 172.16.1.254/24 dev eth0
|
||||
ip addr add 172.16.2.254/24 dev eth1
|
||||
ip -6 addr add ::1/128 dev lo0
|
||||
iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 172.16.2.254
|
||||
|
||||
rpcbind
|
||||
inetd
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
custom-enabled true
|
||||
custom-selected default
|
||||
}
|
||||
|
||||
node n4 {
|
||||
type pc
|
||||
network-config {
|
||||
hostname pc2-2
|
||||
!
|
||||
interface eth0
|
||||
mac address 42:00:aa:00:00:05
|
||||
ip address 172.16.2.2/24
|
||||
!
|
||||
interface lo0
|
||||
type lo
|
||||
ip address 127.0.0.1/8
|
||||
ipv6 address ::1/128
|
||||
!
|
||||
}
|
||||
canvas c0
|
||||
iconcoords {384 48}
|
||||
labelcoords {384 79}
|
||||
interface-peer {eth0 n3}
|
||||
custom-configs {
|
||||
custom-config-id default {
|
||||
custom-command /bin/sh
|
||||
config {
|
||||
ip addr add 127.0.0.1/8 dev lo0
|
||||
ip addr add 172.16.2.2/24 dev eth0
|
||||
ip -6 addr add ::1/128 dev lo0
|
||||
ip addr add 172.16.2.2/24 dev eth0
|
||||
ip route add default via 172.16.2.254
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
custom-selected default
|
||||
}
|
||||
|
||||
node n5 {
|
||||
type pc
|
||||
network-config {
|
||||
hostname pc1-1
|
||||
!
|
||||
interface eth0
|
||||
mac address 42:00:aa:00:00:00
|
||||
ip address 172.16.1.1/24
|
||||
!
|
||||
interface lo0
|
||||
type lo
|
||||
ip address 127.0.0.1/8
|
||||
ipv6 address ::1/128
|
||||
!
|
||||
ip route 172.16.2.0/24 172.16.1.254
|
||||
!
|
||||
}
|
||||
canvas c0
|
||||
iconcoords {48 528}
|
||||
labelcoords {48 559}
|
||||
interface-peer {eth0 n1}
|
||||
custom-configs {
|
||||
custom-config-id default {
|
||||
custom-command /bin/sh
|
||||
config {
|
||||
ip addr add 127.0.0.1/8 dev lo0
|
||||
ip addr add 172.16.1.1/24 dev eth0
|
||||
ip -6 addr add ::1/128 dev lo0
|
||||
ip addr add 172.16.1.1/24 dev eth0
|
||||
ip route add default via 172.16.1.254
|
||||
ip route append 172.16.2.0/24 via 172.16.1.254
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
custom-selected default
|
||||
}
|
||||
|
||||
node n6 {
|
||||
type pc
|
||||
network-config {
|
||||
hostname pc1-2
|
||||
!
|
||||
interface eth0
|
||||
mac address 42:00:aa:00:00:01
|
||||
ip address 172.16.1.2/24
|
||||
!
|
||||
interface lo0
|
||||
type lo
|
||||
ip address 127.0.0.1/8
|
||||
ipv6 address ::1/128
|
||||
!
|
||||
ip route 172.16.2.0/24 172.16.1.254
|
||||
!
|
||||
}
|
||||
canvas c0
|
||||
iconcoords {240 504}
|
||||
labelcoords {240 535}
|
||||
interface-peer {eth0 n1}
|
||||
custom-configs {
|
||||
custom-config-id default {
|
||||
custom-command /bin/sh
|
||||
config {
|
||||
ip addr add 127.0.0.1/8 dev lo0
|
||||
ip addr add 172.16.1.2/24 dev eth0
|
||||
ip -6 addr add ::1/128 dev lo0
|
||||
ip addr add 172.16.1.2/24 dev eth0
|
||||
ip route add default via 172.16.1.254
|
||||
ip route append 172.16.2.0/24 via 172.16.1.254
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
custom-selected default
|
||||
}
|
||||
|
||||
node n1 {
|
||||
type lanswitch
|
||||
network-config {
|
||||
hostname switch1
|
||||
!
|
||||
}
|
||||
canvas c0
|
||||
iconcoords {48 360}
|
||||
labelcoords {48 383}
|
||||
interface-peer {e0 n5}
|
||||
interface-peer {e1 n6}
|
||||
interface-peer {e2 n2}
|
||||
}
|
||||
|
||||
node n3 {
|
||||
type lanswitch
|
||||
network-config {
|
||||
hostname switch2
|
||||
!
|
||||
}
|
||||
canvas c0
|
||||
iconcoords {360 192}
|
||||
labelcoords {360 215}
|
||||
interface-peer {e0 n2}
|
||||
interface-peer {e1 n0}
|
||||
interface-peer {e2 n4}
|
||||
}
|
||||
|
||||
link l0 {
|
||||
nodes {n5 n1}
|
||||
bandwidth 0
|
||||
}
|
||||
|
||||
link l1 {
|
||||
nodes {n6 n1}
|
||||
bandwidth 0
|
||||
}
|
||||
|
||||
link l2 {
|
||||
nodes {n2 n1}
|
||||
bandwidth 0
|
||||
}
|
||||
|
||||
link l3 {
|
||||
nodes {n2 n3}
|
||||
bandwidth 0
|
||||
}
|
||||
|
||||
link l4 {
|
||||
nodes {n0 n3}
|
||||
bandwidth 0
|
||||
}
|
||||
|
||||
link l5 {
|
||||
nodes {n4 n3}
|
||||
bandwidth 0
|
||||
}
|
||||
|
||||
canvas c0 {
|
||||
name {Canvas0}
|
||||
}
|
||||
|
||||
option show {
|
||||
interface_names yes
|
||||
ip_addresses yes
|
||||
ipv6_addresses yes
|
||||
node_labels yes
|
||||
link_labels yes
|
||||
background_images no
|
||||
annotations yes
|
||||
hostsAutoAssign no
|
||||
grid yes
|
||||
iconSize normal
|
||||
zoom 1.0
|
||||
}
|
||||
|
||||
7
TP_SCR3.2/TP01/tp01-reponse.txt
Normal file
7
TP_SCR3.2/TP01/tp01-reponse.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
TP01
|
||||
|
||||
|
||||
1.
|
||||
|
||||
1) Dans le host on doit ajouté une regle chain iptables
|
||||
2) iptables -t nat(pour router) -A POSTROUTING -o eth1 -j SNAT --to-source 172.16.2.254(pour dire que c'est uen adresse son reseau qui le ping)
|
||||
325
TP_SCR3.2/TP01/two-gateway.imn
Normal file
325
TP_SCR3.2/TP01/two-gateway.imn
Normal file
@@ -0,0 +1,325 @@
|
||||
node n0 {
|
||||
type pc
|
||||
network-config {
|
||||
hostname pc2-1
|
||||
!
|
||||
interface eth0
|
||||
mac address 42:00:aa:00:00:04
|
||||
ip address 172.16.2.1/24
|
||||
!
|
||||
interface lo0
|
||||
type lo
|
||||
ip address 127.0.0.1/8
|
||||
ipv6 address ::1/128
|
||||
!
|
||||
ip route 0.0.0.0/0 172.16.2.252
|
||||
!
|
||||
}
|
||||
canvas c0
|
||||
iconcoords {408 552}
|
||||
labelcoords {408 583}
|
||||
interface-peer {eth0 n3}
|
||||
custom-configs {
|
||||
custom-config-id default {
|
||||
custom-command /bin/sh
|
||||
config {
|
||||
ip addr add 127.0.0.1/8 dev lo0
|
||||
ip addr add 172.16.2.1/24 dev eth0
|
||||
ip -6 addr add ::1/128 dev lo0
|
||||
ip addr add 172.16.2.1/24 dev eth0
|
||||
ip route add default via 172.16.2.254
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
custom-selected default
|
||||
}
|
||||
|
||||
node n2 {
|
||||
type host
|
||||
network-config {
|
||||
hostname host1
|
||||
!
|
||||
interface eth1
|
||||
mac address 42:00:aa:00:00:03
|
||||
ip address 172.16.2.254/24
|
||||
!
|
||||
interface eth0
|
||||
mac address 42:00:aa:00:00:02
|
||||
ip address 172.16.1.254/24
|
||||
!
|
||||
interface lo0
|
||||
type lo
|
||||
ip address 127.0.0.1/8
|
||||
ipv6 address ::1/128
|
||||
!
|
||||
}
|
||||
canvas c0
|
||||
iconcoords {216 24}
|
||||
labelcoords {216 60}
|
||||
interface-peer {eth0 n1}
|
||||
interface-peer {eth1 n3}
|
||||
custom-configs {
|
||||
custom-config-id default {
|
||||
custom-command /bin/sh
|
||||
config {
|
||||
ip addr add 127.0.0.1/8 dev lo0
|
||||
ip addr add 172.16.1.254/24 dev eth0
|
||||
ip addr add 172.16.2.254/24 dev eth1
|
||||
ip -6 addr add ::1/128 dev lo0
|
||||
iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 172.16.2.254
|
||||
ip route add 0.0.0.0/0 via 172.16.2.252
|
||||
|
||||
rpcbind
|
||||
inetd
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
custom-enabled true
|
||||
custom-selected default
|
||||
}
|
||||
|
||||
node n5 {
|
||||
type pc
|
||||
network-config {
|
||||
hostname pc1-1
|
||||
!
|
||||
interface eth0
|
||||
mac address 42:00:aa:00:00:00
|
||||
ip address 172.16.1.1/24
|
||||
!
|
||||
interface lo0
|
||||
type lo
|
||||
ip address 127.0.0.1/8
|
||||
ipv6 address ::1/128
|
||||
!
|
||||
ip route 0.0.0.0/0 172.16.1.254
|
||||
!
|
||||
}
|
||||
canvas c0
|
||||
iconcoords {48 528}
|
||||
labelcoords {48 559}
|
||||
interface-peer {eth0 n1}
|
||||
custom-configs {
|
||||
custom-config-id default {
|
||||
custom-command /bin/sh
|
||||
config {
|
||||
ip addr add 127.0.0.1/8 dev lo0
|
||||
ip addr add 172.16.1.1/24 dev eth0
|
||||
ip -6 addr add ::1/128 dev lo0
|
||||
ip addr add 172.16.1.1/24 dev eth0
|
||||
ip route add default via 172.16.1.254
|
||||
ip route append 172.16.2.0/24 via 172.16.1.254
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
custom-selected default
|
||||
}
|
||||
|
||||
node n1 {
|
||||
type lanswitch
|
||||
network-config {
|
||||
hostname switch1
|
||||
!
|
||||
}
|
||||
canvas c0
|
||||
iconcoords {48 288}
|
||||
labelcoords {48 311}
|
||||
interface-peer {e0 n5}
|
||||
interface-peer {e2 n2}
|
||||
}
|
||||
|
||||
node n3 {
|
||||
type lanswitch
|
||||
network-config {
|
||||
hostname switch2
|
||||
!
|
||||
}
|
||||
canvas c0
|
||||
iconcoords {408 312}
|
||||
labelcoords {408 335}
|
||||
interface-peer {e0 n2}
|
||||
interface-peer {e1 n0}
|
||||
interface-peer {e3 n7}
|
||||
}
|
||||
|
||||
node n7 {
|
||||
type host
|
||||
network-config {
|
||||
hostname host2
|
||||
!
|
||||
interface eth2
|
||||
mac address 42:00:aa:00:00:0b
|
||||
ip address 10.0.0.250/8
|
||||
!
|
||||
interface eth0
|
||||
mac address 42:00:aa:00:00:06
|
||||
ip address 172.16.2.252/24
|
||||
!
|
||||
interface eth1
|
||||
mac address 42:00:aa:00:00:09
|
||||
ip address 172.16.3.251/24
|
||||
!
|
||||
interface lo0
|
||||
type lo
|
||||
ip address 127.0.0.1/8
|
||||
ipv6 address ::1/128
|
||||
!
|
||||
}
|
||||
canvas c0
|
||||
iconcoords {744 288}
|
||||
labelcoords {744 324}
|
||||
interface-peer {eth0 n3}
|
||||
interface-peer {eth1 n10}
|
||||
interface-peer {eth2 n11}
|
||||
custom-configs {
|
||||
custom-config-id default {
|
||||
custom-command /bin/sh
|
||||
config {
|
||||
ip addr add 127.0.0.1/8 dev lo0
|
||||
ip addr add 172.16.2.252/24 dev eth0
|
||||
ip addr add 172.16.3.251/24 dev eth1
|
||||
ip addr add 10.0.0.250/8 dev eth2
|
||||
ip -6 addr add ::1/128 dev lo0
|
||||
iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 172.16.3.251
|
||||
iptables -t nat -A POSTROUTING -o eth2 -j SNAT --to-source 10.0.0.250
|
||||
rpcbind
|
||||
inetd
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
custom-enabled true
|
||||
custom-selected default
|
||||
}
|
||||
|
||||
node n8 {
|
||||
type pc
|
||||
network-config {
|
||||
hostname pc3-1
|
||||
!
|
||||
interface eth0
|
||||
mac address 42:00:aa:00:00:07
|
||||
ip address 172.16.3.1/24
|
||||
!
|
||||
interface lo0
|
||||
type lo
|
||||
ip address 127.0.0.1/8
|
||||
ipv6 address ::1/128
|
||||
!
|
||||
}
|
||||
auto_default_routes enabled
|
||||
canvas c0
|
||||
iconcoords {672 24}
|
||||
labelcoords {672 55}
|
||||
interface-peer {eth0 n10}
|
||||
}
|
||||
|
||||
node n10 {
|
||||
type lanswitch
|
||||
network-config {
|
||||
hostname switch3
|
||||
!
|
||||
}
|
||||
canvas c0
|
||||
iconcoords {840 168}
|
||||
labelcoords {890 202}
|
||||
interface-peer {e0 n8}
|
||||
interface-peer {e2 n7}
|
||||
}
|
||||
|
||||
node n11 {
|
||||
type router
|
||||
model quagga
|
||||
network-config {
|
||||
hostname WideNet
|
||||
!
|
||||
interface eth0
|
||||
mac address 42:00:aa:00:00:0a
|
||||
ip address 10.0.0.0/8
|
||||
!
|
||||
interface lo0
|
||||
type lo
|
||||
ip address 127.0.0.1/8
|
||||
ipv6 address ::1/128
|
||||
!
|
||||
router rip
|
||||
redistribute static
|
||||
redistribute connected
|
||||
redistribute ospf
|
||||
network 0.0.0.0/0
|
||||
!
|
||||
router ripng
|
||||
redistribute static
|
||||
redistribute connected
|
||||
redistribute ospf6
|
||||
network ::/0
|
||||
!
|
||||
}
|
||||
auto_default_routes enabled
|
||||
canvas c0
|
||||
iconcoords {816 552}
|
||||
labelcoords {816 577}
|
||||
interface-peer {eth0 n7}
|
||||
}
|
||||
|
||||
link l0 {
|
||||
nodes {n5 n1}
|
||||
bandwidth 0
|
||||
}
|
||||
|
||||
link l2 {
|
||||
nodes {n2 n1}
|
||||
bandwidth 0
|
||||
}
|
||||
|
||||
link l3 {
|
||||
nodes {n2 n3}
|
||||
bandwidth 0
|
||||
}
|
||||
|
||||
link l4 {
|
||||
nodes {n0 n3}
|
||||
bandwidth 0
|
||||
}
|
||||
|
||||
link l6 {
|
||||
nodes {n7 n3}
|
||||
bandwidth 0
|
||||
}
|
||||
|
||||
link l7 {
|
||||
nodes {n10 n8}
|
||||
bandwidth 0
|
||||
}
|
||||
|
||||
link l9 {
|
||||
nodes {n7 n10}
|
||||
bandwidth 0
|
||||
}
|
||||
|
||||
link l10 {
|
||||
nodes {n11 n7}
|
||||
bandwidth 0
|
||||
}
|
||||
|
||||
canvas c0 {
|
||||
name {Canvas0}
|
||||
}
|
||||
|
||||
option show {
|
||||
interface_names yes
|
||||
ip_addresses yes
|
||||
ipv6_addresses yes
|
||||
node_labels yes
|
||||
link_labels yes
|
||||
background_images no
|
||||
annotations yes
|
||||
hostsAutoAssign no
|
||||
grid yes
|
||||
iconSize normal
|
||||
zoom 1.0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user