javanetsim-cvs Mailing List for javaNetSim (Page 31)
Status: Beta
Brought to you by:
darkkey
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(120) |
Dec
(62) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(1) |
Feb
(69) |
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(76) |
Oct
(28) |
Nov
(77) |
Dec
(186) |
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(36) |
Oct
(61) |
Nov
(23) |
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(17) |
Oct
(105) |
Nov
(5) |
Dec
(1) |
2009 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(8) |
Oct
(9) |
Nov
|
Dec
|
From: Alexander B. <da...@us...> - 2005-12-03 19:23:33
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11291/guiUI Modified Files: MainScreen.java Log Message: ARP on siveving lines works! Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** MainScreen.java 3 Dec 2005 12:20:52 -0000 1.17 --- MainScreen.java 3 Dec 2005 19:23:19 -0000 1.18 *************** *** 2244,2250 **** pnlConsole.append("Device " + InNodeName + " reseted.\n"); ! ! ! } --- 2244,2248 ---- pnlConsole.append("Device " + InNodeName + " reseted.\n"); ! } |
From: Alexander B. <da...@us...> - 2005-12-03 19:23:33
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11291/core/protocolsuite/tcp_ip Modified Files: ARP.java Echo_tcp.java ProtocolStack.java Tcp.java Log Message: ARP on siveving lines works! Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** ProtocolStack.java 3 Dec 2005 12:20:52 -0000 1.29 --- ProtocolStack.java 3 Dec 2005 19:23:19 -0000 1.30 *************** *** 267,270 **** --- 267,272 ---- } + + //Create layer info *************** *** 1670,1675 **** boolean flags[]={false,false,false,false,true,false}; /* URG, ACK, PSH, RST, !SYN!, FIN */ rval=mTCPprotocol.ReservePort(application, inDestIPAddress, indestPort); ! if (sendTCPSegment(application, msg, flags,ack_num)) ! return rval; else return -1; } --- 1672,1681 ---- boolean flags[]={false,false,false,false,true,false}; /* URG, ACK, PSH, RST, !SYN!, FIN */ rval=mTCPprotocol.ReservePort(application, inDestIPAddress, indestPort); ! if (sendTCPSegment(application, msg, flags,ack_num)) { ! return rval; ! }else{ ! mTCPprotocol.FreeApplication(application); ! return -1; ! } } Index: Tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Tcp.java 1 Dec 2005 18:37:16 -0000 1.19 --- Tcp.java 3 Dec 2005 19:23:19 -0000 1.20 *************** *** 169,172 **** --- 169,183 ---- public void reset() { + if (timer!=null){ + System.out.println("Timer cancel - part1!"); + try{ + this.timer.cancel(); + }catch(Exception e){ + System.out.println("Timer cancel error."); + } + System.out.println("Timer cancel -part 2!"); + this.timer = null; + } + this.PortStatus=0; this.application=null; *************** *** 234,238 **** this.isFIN_confirmed=false; this.isPassive=false; ! if (timer!=null) this.timer.cancel(); } } --- 245,249 ---- this.isFIN_confirmed=false; this.isPassive=false; ! } } *************** *** 277,282 **** --- 288,299 ---- public void TCPsetTimer(TCP_HashTableElement Elm) { + + + if(Elm.timer==null){ + System.out.println("Timer init!"); Elm.timer=new Timer(); Elm.timer.schedule(new TCPTask(Elm),0,500); + } + } *************** *** 300,306 **** public void run() { ! System.out.println("Timer start!"); if(!Elm.SegmentsToResend.isEmpty()) { Enumeration HTkeys; Integer curkey; --- 317,325 ---- public void run() { ! // System.out.println("Timer start!"); if(!Elm.SegmentsToResend.isEmpty()) { + // this.cancel(); + // Elm.timer.cancel(); Enumeration HTkeys; Integer curkey; *************** *** 314,320 **** } } ! else { ! System.out.println("Timer cancel!"); Elm.timer.cancel(); } } } --- 333,347 ---- } } ! else { ! System.out.println("Timer cancel - part1!"); ! try{ ! Elm.timer.cancel(); ! this.cancel(); ! Elm.timer = null; ! }catch(Exception e){ ! System.out.println("Timer cancel error."); } + System.out.println("Timer cancel - part2!"); + } } } *************** *** 450,455 **** Elm=(TCP_HashTableElement) PortTable.get((Integer)PortToClose); ! if (Elm.PortStatus==1 || (Elm.PortStatus==2 && PortToClose<PORT_START_NUMBER)) { Elm.reset(); } else throw new TransportLayerException("TCP Error: port "+ PortToClose +" is not being LISTENED to by the application: \"" + application.toString() + "\"."); --- 477,483 ---- Elm=(TCP_HashTableElement) PortTable.get((Integer)PortToClose); ! if (Elm.PortStatus==1 || Elm.PortStatus==2) //&& PortToClose<=PORT_START_NUMBER { + System.out.println("!!!"); Elm.reset(); } else throw new TransportLayerException("TCP Error: port "+ PortToClose +" is not being LISTENED to by the application: \"" + application.toString() + "\"."); *************** *** 471,476 **** try{ Integer PortToFree=getApplicationLocalPortNumber(application); ! Elm=(TCP_HashTableElement) PortTable.get((Integer)PortToFree); ! Elm.reset(); }catch(Exception e){} } --- 499,506 ---- try{ Integer PortToFree=getApplicationLocalPortNumber(application); ! Elm=(TCP_HashTableElement) PortTable.get((Integer)PortToFree); ! System.out.println("###"); ! Elm.reset(); ! System.out.println("111"); }catch(Exception e){} } Index: Echo_tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Echo_tcp.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Echo_tcp.java 30 Nov 2005 13:02:32 -0000 1.12 --- Echo_tcp.java 3 Dec 2005 19:23:19 -0000 1.13 *************** *** 169,173 **** Simulation.addLayerInfo(protInfo3); - Disconnect(); --- 169,172 ---- Index: ARP.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ARP.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ARP.java 1 Dec 2005 19:51:53 -0000 1.5 --- ARP.java 3 Dec 2005 19:23:19 -0000 1.6 *************** *** 321,325 **** { ! String output= null; //this cleans out any entries older than 2 minutes --- 321,326 ---- { ! String output= null; ! int tryings = 5; //this cleans out any entries older than 2 minutes *************** *** 347,352 **** //then send ARP Packet to try and find out about IP Address mLastIpRequest = IPAddress; ! String srcMAC = mParentStack.getMACAddress(inInterfaceKey); --- 348,355 ---- //then send ARP Packet to try and find out about IP Address + while(output==null && tryings-->0){ + mLastIpRequest = IPAddress; ! String srcMAC = mParentStack.getMACAddress(inInterfaceKey); *************** *** 398,401 **** --- 401,405 ---- } + } } |
From: Alexander B. <da...@us...> - 2005-12-03 19:23:31
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11291/core Modified Files: ApplicationLayerDevice.java Log Message: ARP on siveving lines works! Index: ApplicationLayerDevice.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/ApplicationLayerDevice.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ApplicationLayerDevice.java 19 Nov 2005 13:07:37 -0000 1.1 --- ApplicationLayerDevice.java 3 Dec 2005 19:23:19 -0000 1.2 *************** *** 30,31 **** --- 30,32 ---- } } + |
From: Alexander B. <da...@us...> - 2005-12-03 12:21:04
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28129/core/protocolsuite/tcp_ip Modified Files: IpV4.java ProtocolStack.java Log Message: Packet Counts for IP and ARP. Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** ProtocolStack.java 1 Dec 2005 19:51:53 -0000 1.28 --- ProtocolStack.java 3 Dec 2005 12:20:52 -0000 1.29 *************** *** 119,122 **** --- 119,126 ---- private Node mParentNode = null; + + private int packetinputIPCounter; // counter for input IP Packets + private int packetoutputIPCounter; // counter for output IP Packets + private int packetARPCounter; // counter for ARP Packets *************** *** 279,282 **** --- 283,288 ---- protocolInfo.setDescription("Sending packet from ProtocolStack (to " + GatewayAddress + ")."); + + Simulation.addLayerInfo(protocolInfo); *************** *** 288,291 **** --- 294,302 ---- temp.sendPacket(destMAC, inPacket, outInterface[0]); + if(inPacket instanceof ARP_packet){ + packetARPCounter++; + }else{ + packetoutputIPCounter++; + } }catch(InvalidNetworkInterfaceNameException ex){ *************** *** 400,403 **** --- 411,416 ---- protocolInfo.setDescription("Forwarding packet from ProtocolStack(to " + GatewayAddress + ")."); + + Simulation.addLayerInfo(protocolInfo); *************** *** 409,412 **** --- 422,431 ---- temp.sendPacket(destMAC, inPacket, outInterface[0] ); + + if(inPacket instanceof ARP_packet){ + packetARPCounter++; + }else{ + packetoutputIPCounter++; + } }catch(InvalidNetworkInterfaceNameException ex){ *************** *** 719,723 **** public void receivePacket(Packet inPacket) throws LowLinkException{ ! IP_packet ipPacket = (IP_packet)inPacket; --- 738,746 ---- public void receivePacket(Packet inPacket) throws LowLinkException{ ! if(inPacket instanceof ARP_packet){ ! packetARPCounter++; ! }else{ ! packetinputIPCounter++; ! } IP_packet ipPacket = (IP_packet)inPacket; *************** *** 1260,1263 **** --- 1283,1310 ---- } + + + //private int packetinputIPCounter; // counter for input IP Packets + //private int packetoutputIPCounter; // counter for output IP Packets + //private int packetARPCounter; + + public int getinputIPCount(){ + return packetinputIPCounter; + } + + public int getoutputIPCount(){ + return packetoutputIPCounter; + } + + public int getARPCount(){ + return packetoutputIPCounter; + } + + public void resetCounters(){ + packetinputIPCounter = 0; + packetoutputIPCounter = 0; + packetARPCounter = 0; + } + /** Index: IpV4.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/IpV4.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** IpV4.java 1 Dec 2005 19:51:53 -0000 1.5 --- IpV4.java 3 Dec 2005 12:20:52 -0000 1.6 *************** *** 55,59 **** private boolean isRoutable = false; private Hashtable routingTable; // route table ! /** * Creates a new IPaddress Hashtable --- 55,60 ---- private boolean isRoutable = false; private Hashtable routingTable; // route table ! ! /** * Creates a new IPaddress Hashtable |
From: Alexander B. <da...@us...> - 2005-12-03 12:21:04
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28129/guiUI Modified Files: MainScreen.java NetworkLayerDevice.java Log Message: Packet Counts for IP and ARP. Index: NetworkLayerDevice.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/NetworkLayerDevice.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NetworkLayerDevice.java 3 Dec 2005 11:28:46 -0000 1.4 --- NetworkLayerDevice.java 3 Dec 2005 12:20:52 -0000 1.5 *************** *** 51,57 **** --- 51,62 ---- private JMenuItem mnuProperties = new JMenuItem("Properties ..."); private JMenu mnuARPMenu = new JMenu("ARP"); + private JMenu mnuCountersMenu = new JMenu("Counters"); + + private JMenuItem mnuShowCounters = new JMenuItem("Show Packet Counters"); + private JMenuItem mnuResetCounters = new JMenuItem("Reset Packet Counters"); private JMenuItem mnuArpStaticAdd = new JMenuItem("Add static entry to ARP table..."); private JMenuItem mnuArpRemove = new JMenuItem("Remove entry from ARP table..."); + private JMenuItem mnuRunCmd = new JMenuItem("Run low-level command..."); private JMenuItem mnuPR = new JMenuItem("Print route table"); *************** *** 123,126 **** --- 128,143 ---- } }); + + + mnuShowCounters.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e){ + controller.showCounters(lblNodeName.getText()); + } + }); + mnuResetCounters.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e){ + controller.resetCounters(lblNodeName.getText()); + } + }); *************** *** 131,134 **** --- 148,154 ---- mnuARPMenu.add(mnuArpRemove); mnuARPMenu.add(mnuArp); + GuiNodePopMenu.add(mnuCountersMenu); + mnuCountersMenu.add(mnuShowCounters); + mnuCountersMenu.add(mnuResetCounters); GuiNodePopMenu.add(mnuRunCmd); GuiNodePopMenu.add(mnuPR); Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** MainScreen.java 3 Dec 2005 11:28:46 -0000 1.16 --- MainScreen.java 3 Dec 2005 12:20:52 -0000 1.17 *************** *** 3039,3042 **** --- 3039,3067 ---- /** + * + * @author Key + * @param String inNodeName Name of node + */ + + public void showCounters(String inNodeName){ + core.protocolsuite.tcp_ip.ProtocolStack PS = Sim.getTCPProtocolStack(inNodeName); + int ARPCount = PS.getARPCount(); + int inIPCount = PS.getinputIPCount(); + int outIPCount= PS.getoutputIPCount(); + + String msg = "Counters: \n\n Recieved IP Packets: " + Integer.valueOf(inIPCount).toString() + + "\n Sent IP Packets: " + Integer.valueOf(outIPCount).toString() + + "\n ARP Packets: " + Integer.valueOf(ARPCount).toString(); + + JOptionPane.showMessageDialog(this,msg,inNodeName + ": packet counters.",JOptionPane.INFORMATION_MESSAGE); + } + + public void resetCounters(String inNodeName){ + core.protocolsuite.tcp_ip.ProtocolStack PS = Sim.getTCPProtocolStack(inNodeName); + PS.resetCounters(); + showCounters(inNodeName); + } + + /** * Runs network configure command on the target host. (route, et cetera) |
From: Alexander B. <da...@us...> - 2005-12-03 12:21:04
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28129/core Modified Files: Node.java Simulation.java Log Message: Packet Counts for IP and ARP. Index: Node.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Node.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Node.java 19 Nov 2005 21:53:51 -0000 1.5 --- Node.java 3 Dec 2005 12:20:52 -0000 1.6 *************** *** 123,127 **** protected java.util.Hashtable NetworkInterfacetable = null; //Hashtable of network interfaces ! protected ProtocolStack NodeProtocolStack; protected String name; --- 123,127 ---- protected java.util.Hashtable NetworkInterfacetable = null; //Hashtable of network interfaces ! public ProtocolStack NodeProtocolStack; protected String name; Index: Simulation.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Simulation.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Simulation.java 20 Nov 2005 20:30:53 -0000 1.5 --- Simulation.java 3 Dec 2005 12:20:52 -0000 1.6 *************** *** 175,178 **** --- 175,182 ---- + public core.protocolsuite.tcp_ip.ProtocolStack getTCPProtocolStack(String inNodeName) { + Node temp = (Node)nodeTable.get(inNodeName); + return (core.protocolsuite.tcp_ip.ProtocolStack)temp.NodeProtocolStack; + } /** * This method is called from the GUI. Checks to see if inNodeName is an instance of networkLayerDevice, |
From: Alexander B. <da...@us...> - 2005-12-03 11:28:54
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19223/guiUI Modified Files: MainScreen.java MenuBar.java NetworkLayerDevice.java Log Message: Filters for messages... + Print routes table menu element. Index: NetworkLayerDevice.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/NetworkLayerDevice.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NetworkLayerDevice.java 19 Nov 2005 16:16:32 -0000 1.3 --- NetworkLayerDevice.java 3 Dec 2005 11:28:46 -0000 1.4 *************** *** 55,58 **** --- 55,59 ---- private JMenuItem mnuArpRemove = new JMenuItem("Remove entry from ARP table..."); private JMenuItem mnuRunCmd = new JMenuItem("Run low-level command..."); + private JMenuItem mnuPR = new JMenuItem("Print route table"); private JMenuItem mnuArp = new JMenuItem("Print ARP Table"); private JMenuItem mnuLink = new JMenuItem("Links properties"); *************** *** 112,115 **** --- 113,121 ---- } }); + mnuPR.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e){ + controller.PrintRouteTable(lblNodeName.getText()); + } + }); mnuLink.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ *************** *** 126,129 **** --- 132,136 ---- mnuARPMenu.add(mnuArp); GuiNodePopMenu.add(mnuRunCmd); + GuiNodePopMenu.add(mnuPR); GuiNodePopMenu.add(mnuBreakLink); GuiNodePopMenu.add(mnuLink); Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** MainScreen.java 1 Dec 2005 19:51:53 -0000 1.15 --- MainScreen.java 3 Dec 2005 11:28:46 -0000 1.16 *************** *** 176,180 **** private JPanel pContentPane = (JPanel)getContentPane(); ! //Toolbar --- 176,181 ---- private JPanel pContentPane = (JPanel)getContentPane(); ! //filters ! private boolean[] filters = new boolean[8]; //Toolbar *************** *** 252,256 **** public MainScreen() { ! Sim = new Simulation(core.ProtocolStack.TCP_IP); buildGUI(); --- 253,260 ---- public MainScreen() { ! Sim = new Simulation(core.ProtocolStack.TCP_IP); ! ! for(int i= 0; i<=7; i++) ! filters[i] =true; buildGUI(); *************** *** 386,390 **** --- 390,415 ---- } + + /* + * This method set value of filter. + * @author Key + * @param filter index + * @param filter value + * + */ + public void setFilter(int i, boolean value){ + filters[i] = value; + } + /* + * This method get value of filter. + * @author Key + * @param filter index + * @returns filter value + * + */ + public boolean getFilter(int i){ + return filters[i]; + } /** *************** *** 1048,1052 **** String recording[] = (String[])it.next(); ! pnlConsole.append(pad(recording[1],15,' ')+pad(recording[2],25,' ')+pad(recording[3],15,' ')+pad(recording[4],10,' ')+recording[5]+ "\n"); } --- 1073,1081 ---- String recording[] = (String[])it.next(); ! //Very UGLY but works. ;) ! if(!(((String)recording[4]).contains("Network") && !filters[2]) && !(((String)recording[4]).contains("Link") && !filters[0]) && !(((String)recording[4]).contains("Transport") && !filters[3]) && !(((String)recording[4]).contains("Application") && !filters[4])){ ! // && !(((String)recording[4]).contains("ARP") && !filters[1]) ! pnlConsole.append(pad(recording[1],15,' ')+pad(recording[2],25,' ')+pad(recording[3],15,' ')+pad(recording[4],10,' ')+recording[5]+ "\n"); ! } } *************** *** 2988,2991 **** --- 3017,3040 ---- } + + /** + * Print routes table on throws node + * @author Key + * @param String inNodeName Name of node to run command on + */ + + public void PrintRouteTable(String inNodeName){ + String routes[] = Sim.getRouteTableEntries(inNodeName); + + this.addToConsole("IP routing table:\n" + "Destination" + "\t" + "Gateway" + "\t" + "Genmask" + "\t" + "Type" + "\t" + "Iface\n"); + + for(int i=0; i<routes.length - 1; i++){ + + Route_entry r = Sim.getRouteEntry(inNodeName, routes[i]); + + this.addToConsole(routes[i] + "\t" + r.gateway + "\t" + r.genMask + "\t" + r.Type + "\t" + r.iFace + "\n"); + + } + } /** Index: MenuBar.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MenuBar.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** MenuBar.java 8 Nov 2005 04:04:28 -0000 1.1.1.1 --- MenuBar.java 3 Dec 2005 11:28:46 -0000 1.2 *************** *** 33,37 **** private JMenuItem mnuClearConsole = new JMenuItem("Clear Console"); private JMenuItem mnuClearNodeInformation = new JMenuItem("Clear Node Information"); ! //Add submenu private JMenu mnuAdd = new JMenu("Add"); //For Adding objects to simulation --- 33,46 ---- private JMenuItem mnuClearConsole = new JMenuItem("Clear Console"); private JMenuItem mnuClearNodeInformation = new JMenuItem("Clear Node Information"); ! private JMenu mnuFilters = new JMenu("Show simulation messages for:"); ! ! //Filters menu ! private JCheckBoxMenuItem mnuMsgLinkLayer = new JCheckBoxMenuItem("Link and DataLink Layers",true); ! private JCheckBoxMenuItem mnuMsgARP = new JCheckBoxMenuItem("ARP",true); ! private JCheckBoxMenuItem mnuMsgNetwork = new JCheckBoxMenuItem("Network Layer",true); ! private JCheckBoxMenuItem mnuMsgTransport = new JCheckBoxMenuItem("Transport Layer",true); ! private JCheckBoxMenuItem mnuMsgApplication = new JCheckBoxMenuItem("Application Layer",true); ! ! //Add submenu private JMenu mnuAdd = new JMenu("Add"); //For Adding objects to simulation *************** *** 99,102 **** --- 108,118 ---- mnuEnvironment.add(mnuClearConsole); mnuEnvironment.add(mnuClearNodeInformation); + mnuEnvironment.add(mnuFilters); + + mnuFilters.add(mnuMsgLinkLayer); + //mnuFilters.add(mnuMsgARP); + mnuFilters.add(mnuMsgNetwork); + mnuFilters.add(mnuMsgTransport); + mnuFilters.add(mnuMsgApplication); //Add items to help *************** *** 163,167 **** --- 179,213 ---- } }); + + mnuMsgLinkLayer.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e){ + controller.setFilter(0,!controller.getFilter(0)); + } + }); + + mnuMsgARP.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e){ + controller.setFilter(1,!controller.getFilter(1)); + } + }); + + mnuMsgNetwork.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e){ + controller.setFilter(2,!controller.getFilter(2)); + } + }); + mnuMsgTransport.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e){ + controller.setFilter(3,!controller.getFilter(3)); + } + }); + + mnuMsgApplication.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e){ + controller.setFilter(4,!controller.getFilter(4)); + } + }); + //Add action listener to new switch /* |
From: Alexander B. <da...@us...> - 2005-12-01 19:52:04
|
Update of /cvsroot/javanetsim/javaNetSim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22380 Modified Files: TODO.txt Log Message: Index: TODO.txt =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/TODO.txt,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** TODO.txt 1 Dec 2005 16:54:54 -0000 1.15 --- TODO.txt 1 Dec 2005 19:51:53 -0000 1.16 *************** *** 12,16 **** *** GUI Related ! 1. Need to save MACs. 2. Create _normal_ route table edit form (instead of route command). Use as template EditRoutesDialog.java. Note, --- 12,16 ---- *** GUI Related ! 1. Need to save MACs. 2. Create _normal_ route table edit form (instead of route command). Use as template EditRoutesDialog.java. Note, |
From: Alexander B. <da...@us...> - 2005-12-01 19:52:02
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22380/core/protocolsuite/tcp_ip Modified Files: ARP.java IpV4.java ProtocolStack.java Log Message: Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ProtocolStack.java 1 Dec 2005 18:37:16 -0000 1.27 --- ProtocolStack.java 1 Dec 2005 19:51:53 -0000 1.28 *************** *** 249,252 **** --- 249,253 ---- if(outIface!=null) outInterface[0] = outIface; + if(GatewayAddress.contains("*")) GatewayAddress = inPacket.getDestIPAddress(); destMAC = mARPprotocol.getMACAddress(GatewayAddress,outInterface[0]); *************** *** 359,362 **** --- 360,366 ---- if(outIface!=null) outInterface[0] = outIface; + + if(GatewayAddress.contains("*")) GatewayAddress = inPacket.getDestIPAddress(); + }catch(Exception e){} //UGLY!!! FIXME!!! Index: IpV4.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/IpV4.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IpV4.java 1 Dec 2005 15:04:55 -0000 1.4 --- IpV4.java 1 Dec 2005 19:51:53 -0000 1.5 *************** *** 315,318 **** --- 315,320 ---- curdestNetwork = (String)keys1.nextElement(); r = (Route_entry)routingTable.get(curdestNetwork); + if(r.gateway.contains("*") && curdestNetwork.contains(inIPAddress)) + return "*"; binMask = IPV4Address.toBinaryString(r.genMask); destNetwork = IPV4Address.toDecimalString(IPV4Address.IPandMask(binIP,binMask)); *************** *** 343,346 **** --- 345,350 ---- curdestNetwork = (String)keys1.nextElement(); r = (Route_entry)routingTable.get(curdestNetwork); + if(r.gateway.contains("*") && curdestNetwork.contains(inIPAddress)) + return r.iFace; binMask = IPV4Address.toBinaryString(r.genMask); destNetwork = IPV4Address.toDecimalString(IPV4Address.IPandMask(binIP,binMask)); Index: ARP.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ARP.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ARP.java 19 Nov 2005 21:53:51 -0000 1.4 --- ARP.java 1 Dec 2005 19:51:53 -0000 1.5 *************** *** 428,432 **** // test if this packet is for a local Address. ! if(mParentStack.isInternalIP(inARPpacket.getDestIPAddress())){ --- 428,433 ---- // test if this packet is for a local Address. ! //mParentStack.isInternalIP(inARPpacket.getDestIPAddress()) ! if(mParentStack.isInternalIP(inARPpacket.getDestIPAddress())){ |
From: Alexander B. <da...@us...> - 2005-12-01 19:52:01
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22380/guiUI Modified Files: ApplicationLayerDevice.java MainScreen.java Log Message: Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** MainScreen.java 1 Dec 2005 14:54:37 -0000 1.14 --- MainScreen.java 1 Dec 2005 19:51:53 -0000 1.15 *************** *** 3057,3061 **** this.addToConsole("Unknown route command. Usage:\n"); ! this.addToConsole("route add (host_ip|network_ip) target_interface netmask [gateway] \n"); this.addToConsole("route del (host_ip|network_ip) \n"); --- 3057,3061 ---- this.addToConsole("Unknown route command. Usage:\n"); ! this.addToConsole("route add (host_ip|network_ip) target_interface netmask (gateway|*) \n"); this.addToConsole("route del (host_ip|network_ip) \n"); *************** *** 3069,3073 **** this.addToConsole("Unknown route command. Usage:\n"); ! this.addToConsole("route add (host_ip|network_ip) target_interface netmask [gateway] \n"); this.addToConsole("route del (host_ip|network_ip) \n"); --- 3069,3073 ---- this.addToConsole("Unknown route command. Usage:\n"); ! this.addToConsole("route add (host_ip|network_ip) target_interface netmask (gateway|*) \n"); this.addToConsole("route del (host_ip|network_ip) \n"); Index: ApplicationLayerDevice.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/ApplicationLayerDevice.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ApplicationLayerDevice.java 26 Nov 2005 16:48:25 -0000 1.4 --- ApplicationLayerDevice.java 1 Dec 2005 19:51:53 -0000 1.5 *************** *** 14,17 **** --- 14,18 ---- import javax.swing.JMenuItem; + import javax.swing.JMenu; /** *************** *** 25,33 **** private JMenuItem mnuEchotcpListen = new JMenuItem("Start tcp echo server to listen."); private JMenuItem mnuEchotcpSend = new JMenuItem("Send data via tcp echo client."); /** Creates a new instance of ApplicationLayerDevice */ public ApplicationLayerDevice(String inName, MainScreen inMainScreen, String imageLocation) { super(inName, inMainScreen, imageLocation); ! mnuEchoListen.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ --- 26,37 ---- private JMenuItem mnuEchotcpListen = new JMenuItem("Start tcp echo server to listen."); private JMenuItem mnuEchotcpSend = new JMenuItem("Send data via tcp echo client."); + private JMenu mnuAppLayer = new JMenu("Applications"); /** Creates a new instance of ApplicationLayerDevice */ public ApplicationLayerDevice(String inName, MainScreen inMainScreen, String imageLocation) { super(inName, inMainScreen, imageLocation); ! ! ! mnuEchoListen.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ *************** *** 56,63 **** }); ! GuiNodePopMenu.add(mnuEchoListen); ! GuiNodePopMenu.add(mnuEchoSend); ! GuiNodePopMenu.add(mnuEchotcpListen); ! GuiNodePopMenu.add(mnuEchotcpSend); } } --- 60,69 ---- }); ! GuiNodePopMenu.add(mnuAppLayer); ! mnuAppLayer.add(mnuEchoListen); ! mnuAppLayer.add(mnuEchoSend); ! mnuAppLayer.addSeparator(); ! mnuAppLayer.add(mnuEchotcpListen); ! mnuAppLayer.add(mnuEchotcpSend); } } |
From: gift <gi...@us...> - 2005-12-01 18:37:25
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4473/core/protocolsuite/tcp_ip Modified Files: ProtocolStack.java Tcp.java Log Message: BUGGGGED timer Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** ProtocolStack.java 1 Dec 2005 15:03:28 -0000 1.26 --- ProtocolStack.java 1 Dec 2005 18:37:16 -0000 1.27 *************** *** 152,156 **** mICMPprotocol = new ICMP(this); ! mTCPprotocol = new Tcp(this); //gift (sourceforge.net user) 25 Nov 2005 --- 152,156 ---- mICMPprotocol = new ICMP(this); ! mTCPprotocol = new Tcp(this); //gift (sourceforge.net user) 25 Nov 2005 Index: Tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Tcp.java 1 Dec 2005 16:54:54 -0000 1.18 --- Tcp.java 1 Dec 2005 18:37:16 -0000 1.19 *************** *** 78,81 **** --- 78,84 ---- import core.protocolsuite.tcp_ip.ProtocolStack; + import java.util.Timer; + + import java.util.TimerTask; *************** *** 160,164 **** public boolean isFIN_sent; public boolean isFIN_confirmed; ! public boolean isPassive; public void reset() --- 163,169 ---- public boolean isFIN_sent; public boolean isFIN_confirmed; ! public boolean isPassive; ! ! public Timer timer=null; //our timer for this connection public void reset() *************** *** 228,232 **** this.isFIN_sent=false; this.isFIN_confirmed=false; ! this.isPassive=false; } } --- 233,238 ---- this.isFIN_sent=false; this.isFIN_confirmed=false; ! this.isPassive=false; ! if (timer!=null) this.timer.cancel(); } } *************** *** 242,246 **** private static final int TOTAL_TIME = 10; //seconds to send all data private static final int ACCELER_KOEFF=2; //coeff depends on line quality, in practise >=2 ! /** * This method assigns the ParentStack --- 248,253 ---- private static final int TOTAL_TIME = 10; //seconds to send all data private static final int ACCELER_KOEFF=2; //coeff depends on line quality, in practise >=2 ! private static final double TCP_TIME= 0.1; //sec ! /** * This method assigns the ParentStack *************** *** 259,266 **** Elm.reset(); PortTable.put(new Integer((PORT_START_NUMBER+i)),Elm); // DANGEROUS PLACE! Check before change. ! } } /** * This method reserves LOCAL port number for an application in case reserved. Port number range: [PORT_START_NUMBER; PORT_START_NUMBER+PORT_QUANT] --- 266,323 ---- Elm.reset(); PortTable.put(new Integer((PORT_START_NUMBER+i)),Elm); // DANGEROUS PLACE! Check before change. ! } } + /** + * This method defines TCP timer + * @author gift (sourceforge.net user) + * @param Elm TCP_HashTableElement + * @version v0.10 + */ + public void TCPsetTimer(TCP_HashTableElement Elm) + { + Elm.timer=new Timer(); + Elm.timer.schedule(new TCPTask(Elm),0,500); + } + + public class TCPTask extends TimerTask + { + private TCP_HashTableElement Elm; + + public TCPTask (TCP_HashTableElement inElm) + { + this.Elm=inElm; + } + + + /** + * This methos implements TCP timer + * @author gift (sourceforge.net user) + * @param Elm TCP_HashTableElement + * @version v0.10 + */ + public void run() + { + System.out.println("Timer start!"); + if(!Elm.SegmentsToResend.isEmpty()) + { + Enumeration HTkeys; + Integer curkey; + HTkeys = Elm.SegmentsToResend.keys(); + while (HTkeys.hasMoreElements()) + { + curkey= (Integer) HTkeys.nextElement(); + try{ + mParentStack.sendPacket((TCP_packet)Elm.SegmentsToResend.get(curkey)); + } catch (Exception e) {} + } + } + else { + System.out.println("Timer cancel!"); Elm.timer.cancel(); + } + } + } + /** * This method reserves LOCAL port number for an application in case reserved. Port number range: [PORT_START_NUMBER; PORT_START_NUMBER+PORT_QUANT] *************** *** 688,691 **** --- 745,750 ---- if (flags[5]) Elm.isFIN_sent=true; + TCPsetTimer(Elm); + Elm=null; //Create Layer info *************** *** 703,706 **** --- 762,766 ---- Simulation.addLayerInfo(TCP_Info); + return tosend; } else{ *************** *** 1123,1126 **** --- 1183,1188 ---- return tosend_clone; } + + |
From: gift <gi...@us...> - 2005-12-01 16:55:03
|
Update of /cvsroot/javanetsim/javaNetSim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5024 Modified Files: TODO.txt Log Message: TCP Elm.reset correction Index: TODO.txt =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/TODO.txt,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TODO.txt 1 Dec 2005 14:54:37 -0000 1.14 --- TODO.txt 1 Dec 2005 16:54:54 -0000 1.15 *************** *** 36,40 **** pretty done 16. TCP(Gift && Key) ! TCP Element reset discussion. 17. SNMP (QweR, Key, Gift) 18. Telnet (QweR) --- 36,40 ---- pretty done 16. TCP(Gift && Key) ! TCP timer implementation 17. SNMP (QweR, Key, Gift) 18. Telnet (QweR) |
From: gift <gi...@us...> - 2005-12-01 16:55:02
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5024/core/protocolsuite/tcp_ip Modified Files: Tcp.java Log Message: TCP Elm.reset correction Index: Tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Tcp.java 30 Nov 2005 13:02:32 -0000 1.17 --- Tcp.java 1 Dec 2005 16:54:54 -0000 1.18 *************** *** 181,189 **** if (!this.SentACKs.isEmpty()) { ! Set set = this.SentACKs.keySet(); Iterator itr = set.iterator(); while (itr.hasNext()) { this.SentACKs.remove(itr.next()); } } --- 181,197 ---- if (!this.SentACKs.isEmpty()) { ! /* Set set = this.SentACKs.keySet(); Iterator itr = set.iterator(); while (itr.hasNext()) { this.SentACKs.remove(itr.next()); + }*/ + Enumeration HTkeys; + Integer curkey; + HTkeys = SentACKs.keys(); + while (HTkeys.hasMoreElements()) + { + curkey= (Integer) HTkeys.nextElement(); + this.SentACKs.remove(curkey); } } *************** *** 197,205 **** if (!this.SegmentsToResend.isEmpty()) { ! Set set = this.SegmentsToResend.keySet(); Iterator itr = set.iterator(); while (itr.hasNext()) { this.SegmentsToResend.remove(itr.next()); } } --- 205,221 ---- if (!this.SegmentsToResend.isEmpty()) { ! /*Set set = this.SegmentsToResend.keySet(); Iterator itr = set.iterator(); while (itr.hasNext()) { this.SegmentsToResend.remove(itr.next()); + }*/ + Enumeration HTkeys; + Integer curkey; + HTkeys = SegmentsToResend.keys(); + while (HTkeys.hasMoreElements()) + { + curkey= (Integer) HTkeys.nextElement(); + this.SegmentsToResend.remove(curkey); } } |
From: Alexander B. <da...@us...> - 2005-12-01 15:05:10
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11067/core/protocolsuite/tcp_ip Modified Files: IPV4Address.java IpV4.java Log Message: Index: IpV4.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/IpV4.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IpV4.java 1 Dec 2005 14:54:37 -0000 1.3 --- IpV4.java 1 Dec 2005 15:04:55 -0000 1.4 *************** *** 324,328 **** /* ! * Return the route interface for this packet... * @param Destination IP * @author Key --- 324,328 ---- /* ! * Return the interface to route through for this packet... * @param Destination IP * @author Key *************** *** 337,341 **** String curdestNetwork; Route_entry r; ! Enumeration keys1 = routingTable.keys(); while(keys1.hasMoreElements()){ --- 337,342 ---- String curdestNetwork; Route_entry r; ! //many vars :) ! Enumeration keys1 = routingTable.keys(); while(keys1.hasMoreElements()){ Index: IPV4Address.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/IPV4Address.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IPV4Address.java 1 Dec 2005 14:54:37 -0000 1.3 --- IPV4Address.java 1 Dec 2005 15:04:55 -0000 1.4 *************** *** 188,192 **** return NO_CLASS; } ! //return 0; } --- 188,192 ---- return NO_CLASS; } ! //return 0; UGLY FIX } *************** *** 570,574 **** } return false; ! } catch (Exception e) {} return false; } --- 570,574 ---- } return false; ! } catch (Exception e) { } return false; } |
From: Alexander B. <da...@us...> - 2005-12-01 15:03:44
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10777/core Modified Files: ProtocolStack.java Log Message: Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/ProtocolStack.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ProtocolStack.java 20 Nov 2005 20:30:53 -0000 1.5 --- ProtocolStack.java 1 Dec 2005 15:03:28 -0000 1.6 *************** *** 8,12 **** ! Redistribution and use in source and binary forms, with or without modification, are --- 8,12 ---- ! Redistribution and use in source and binary forms, with or without modification, are |
From: Alexander B. <da...@us...> - 2005-12-01 15:03:43
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10777/core/protocolsuite/tcp_ip Modified Files: ProtocolStack.java Log Message: Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** ProtocolStack.java 1 Dec 2005 14:54:37 -0000 1.25 --- ProtocolStack.java 1 Dec 2005 15:03:28 -0000 1.26 *************** *** 400,410 **** ! try{ NetworkLayerDevice temp = (NetworkLayerDevice)mParentNode; ! temp.sendPacket(destMAC, inPacket, outInterface[0]); ! }catch(InvalidNetworkInterfaceNameException ex){ throw new CommunicationException("The Interface " + outInterface + " was unable to send the Packet."); --- 400,410 ---- ! try{ NetworkLayerDevice temp = (NetworkLayerDevice)mParentNode; ! temp.sendPacket(destMAC, inPacket, outInterface[0] ); ! }catch(InvalidNetworkInterfaceNameException ex){ throw new CommunicationException("The Interface " + outInterface + " was unable to send the Packet."); |
From: Alexander B. <da...@us...> - 2005-12-01 14:59:18
|
Update of /cvsroot/javanetsim/javaNetSim/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9491 Added Files: lab1_v1.jfst lab1_v1_ready.jfst rtest.jfst tes10.jfst test1.jfst test2.jfst test3.jfst test4.jfst test5.jfst test6.jfst test7.jfst test8.jfst Log Message: Common files to test your system on :). For routers see rtest.jfst, for app level/transport level use test1 and/or test2, test6. --- NEW FILE: lab1_v1.jfst --- hub2 GuiHub 187,286 5 eth0|hub2-TO-Hub1||| eth1|hub2-TO-hub3||| eth2|null||| eth3|null||| eth4|null||| r3 GuiRouter 430,212 2 eth0|Hub1-TO-r3|129.64.128.3|255.255.128.0|null eth1|r3-TO-pc4|null|0.0.0.0|null R2 GuiRouter 512,92 2 eth0|R1-TO-R2|192.168.100.1|255.255.255.0|192.168.100.2 eth1|R2-TO-PC2|129.64.127.253|255.255.0.0|192.168.100.2 R1 GuiRouter 363,69 2 eth0|Hub1-TO-R1|129.64.128.7|255.255.0.0|192.168.100.1 eth1|R1-TO-R2|192.168.100.2|255.255.255.0|192.168.100.1 Hub1 GuiHub 230,181 5 eth0|PC1-TO-Hub1||| eth1|Hub1-TO-R1||| eth2|hub2-TO-Hub1||| eth3|Hub1-TO-hub3||| eth4|Hub1-TO-r3||| pc4 GuiPC 612,213 1 eth0|r3-TO-pc4|null|0.0.0.0|null PC3 GuiPC 385,355 1 eth0|hub3-TO-PC3|129.64.128.2|255.255.0.0|null PC2 GuiPC 628,31 1 eth0|R2-TO-PC2|128.64.127.254|255.255.0.0|10.0.0.1 PC1 GuiPC 97,178 1 eth0|PC1-TO-Hub1|129.64.128.1|255.255.0.0|129.64.128.7 hub3 GuiHub 333,287 5 eth0|Hub1-TO-hub3||| eth1|hub2-TO-hub3||| eth2|hub3-TO-PC3||| eth3|null||| eth4|null||| --- NEW FILE: test8.jfst --- Router1 GuiRouter 351,154 2 eth0|Hub1-TO-Router1|192.168.0.1|255.255.255.0|192.168.0.1 eth1|Router1-TO-Hub2|10.0.0.1|255.0.0.0|192.168.0.1 Hub2 GuiHub 450,200 4 eth0|Router1-TO-Hub2||| eth1|Hub2-TO-PC4||| eth2|Hub2-TO-PC5||| eth3|Hub2-TO-PC6||| Hub1 GuiHub 250,200 4 eth0|PC1-TO-Hub1||| eth1|PC2-TO-Hub1||| eth2|PC3-TO-Hub1||| eth3|Hub1-TO-Router1||| PC6 GuiPC 600,300 1 eth0|Hub2-TO-PC6|10.0.0.4|255.0.0.0|10.0.0.1 PC5 GuiPC 600,200 1 eth0|Hub2-TO-PC5|10.0.0.3|255.0.0.0|10.0.0.1 PC4 GuiPC 444,47 1 eth0|Hub2-TO-PC4|10.0.0.2|255.0.0.0|10.0.0.1 PC3 GuiPC 100,300 1 eth0|PC3-TO-Hub1|192.168.0.4|255.255.255.0|192.168.0.1 PC2 GuiPC 100,200 1 eth0|PC2-TO-Hub1|192.168.0.3|255.255.255.0|192.168.0.1 PC1 GuiPC 100,100 1 eth0|PC1-TO-Hub1|192.168.0.2|255.255.255.0|192.168.0.1 --- NEW FILE: test2.jfst --- Hub1 GuiHub 228,191 4 eth0|PC1-TO-Hub1||| eth1|Hub1-TO-R1||| eth2|null||| eth3|null||| R2 GuiRouter 512,92 2 eth0|R1-TO-R2|192.168.100.1|255.255.255.0|192.168.100.2 eth1|R2-TO-PC2|10.0.0.1|255.0.0.0|192.168.100.2 R1 GuiRouter 363,69 2 eth0|Hub1-TO-R1|172.168.0.1|255.254.0.0|192.168.100.1 eth1|R1-TO-R2|192.168.100.2|255.255.255.0|192.168.100.1 PC2 GuiPC 623,198 1 eth0|R2-TO-PC2|10.0.0.2|255.0.0.0|10.0.0.1 PC1 GuiPC 97,178 1 eth0|PC1-TO-Hub1|172.168.0.2|255.254.0.0|172.168.0.1 --- NEW FILE: test5.jfst --- r3 GuiRouter 357,330 2 eth0|Hub1-TO-r3|172.168.0.10|255.255.0.0|172.168.0.10 eth1|r3-TO-pc3|192.168.6.1|255.255.255.0|172.168.0.10 Hub1 GuiHub 246,171 5 eth0|PC1-TO-Hub1||| eth1|Hub1-TO-R1||| eth2|Hub1-TO-r3||| eth3|null||| eth4|null||| R2 GuiRouter 544,78 2 eth0|R1-TO-R2|192.168.100.1|255.255.255.0|192.168.100.2 eth1|R2-TO-PC2|10.0.0.1|255.0.0.0|192.168.100.2 R1 GuiRouter 362,79 2 eth0|Hub1-TO-R1|172.168.0.1|255.254.0.0|192.168.100.1 eth1|R1-TO-R2|192.168.100.2|255.255.255.0|192.168.100.1 PC2 GuiPC 623,198 1 eth0|R2-TO-PC2|10.0.0.2|255.0.0.0|10.0.0.1 pc3 GuiPC 545,360 1 eth0|r3-TO-pc3|192.168.6.2|255.255.255.0|192.168.6.1 PC1 GuiPC 97,178 1 eth0|PC1-TO-Hub1|172.168.0.2|255.254.0.0|172.168.0.1 --- NEW FILE: rtest.jfst --- Hub2 GuiHub 519,213 5 eth0|R2-TO-Hub2||| eth1|PC2-TO-Hub2||| eth2|R3-TO-Hub2||| eth3|null||| eth4|null||| Hub1 GuiHub 228,191 5 eth0|PC1-TO-Hub1||| eth1|Hub1-TO-R1||| eth2|Hub1-TO-R3||| eth3|null||| eth4|null||| R3 GuiRouter 392,219 2 eth0|Hub1-TO-R3|172.168.0.3|255.254.0.0|10.0.0.3 eth1|R3-TO-Hub2|10.0.0.3|255.0.0.0|10.0.0.3 R2 GuiRouter 512,92 2 eth0|R1-TO-R2|192.168.100.1|255.255.255.0|192.168.100.2 eth1|R2-TO-Hub2|10.0.0.1|255.0.0.0|192.168.100.2 R1 GuiRouter 363,69 2 eth0|Hub1-TO-R1|172.168.0.1|255.254.0.0|192.168.100.1 eth1|R1-TO-R2|192.168.100.2|255.255.255.0|192.168.100.1 PC2 GuiPC 657,157 1 eth0|PC2-TO-Hub2|10.0.0.2|255.0.0.0|10.0.0.1 PC1 GuiPC 97,178 1 eth0|PC1-TO-Hub1|172.168.0.2|255.254.0.0|172.168.0.1 --- NEW FILE: tes10.jfst --- MyPC GuiPC 120,95 1 eth0|MyPC-TO-D-Link|10.0.0.12|255.255.255.240|10.0.0.1 MyPcNb GuiPC 117,285 1 eth0|MyPcNb-TO-D-Link|10.0.0.10|255.255.255.240|null Server GuiPC 546,125 1 eth0|D-Link-TO-Server|10.0.0.1|255.255.255.240|null D-Link GuiHub 314,156 5 eth0|MyPC-TO-D-Link||| eth1|D-Link-TO-Server||| eth2|MyPcNb-TO-D-Link||| eth3|null||| eth4|null||| --- NEW FILE: test1.jfst --- pc2 GuiPC 447,157 1 eth0|pc1-TO-pc2|192.168.0.2|255.255.255.0|null pc1 GuiPC 156,126 1 eth0|pc1-TO-pc2|192.168.0.1|255.255.255.0|null --- NEW FILE: lab1_v1_ready.jfst --- r3 GuiRouter 430,212 2 eth0|Hub1-TO-r3|129.64.128.3|255.255.128.0|null eth1|r3-TO-pc4|null|0.0.0.0|null R2 GuiRouter 512,92 2 eth0|R1-TO-R2|192.168.100.1|255.255.255.0|192.168.100.2 eth1|R2-TO-PC2|129.64.127.253|255.255.128.0|192.168.100.2 R1 GuiRouter 363,69 2 eth0|Hub1-TO-R1|129.64.128.7|255.255.128.0|192.168.100.1 eth1|R1-TO-R2|192.168.100.2|255.255.255.0|192.168.100.1 Hub1 GuiHub 230,181 5 eth0|PC1-TO-Hub1||| eth1|Hub1-TO-R1||| eth2|null||| eth3|Hub1-TO-hub3||| eth4|Hub1-TO-r3||| pc4 GuiPC 612,213 1 eth0|r3-TO-pc4|null|0.0.0.0|null PC3 GuiPC 385,355 1 eth0|hub3-TO-PC3|129.64.128.2|255.255.128.0|null PC2 GuiPC 628,31 1 eth0|R2-TO-PC2|129.64.127.254|255.255.128.0|129.64.127.253 PC1 GuiPC 97,178 1 eth0|PC1-TO-Hub1|129.64.128.1|255.255.128.0|129.64.128.7 hub3 GuiHub 333,287 5 eth0|Hub1-TO-hub3||| eth1|null||| eth2|hub3-TO-PC3||| eth3|null||| eth4|null||| --- NEW FILE: test6.jfst --- bug2 GuiPC 117,101 1 eth0|null|null|0.0.0.0|0.0.0.0 --- NEW FILE: test7.jfst --- hub2 GuiHub 202,287 5 eth0|Hub1-TO-hub2||| eth1|hub2-TO-hub3||| eth2|null||| eth3|null||| eth4|null||| r3 GuiRouter 430,212 2 eth0|Hub1-TO-r3|129.64.128.3|255.255.128.0|null eth1|r3-TO-pc4|null|0.0.0.0|null R2 GuiRouter 512,92 2 eth0|R1-TO-R2|192.168.100.1|255.255.255.0|192.168.100.2 eth1|R2-TO-PC2|10.0.0.1|255.0.0.0|192.168.100.2 R1 GuiRouter 363,69 2 eth0|Hub1-TO-R1|129.64.128.7|255.255.0.0|192.168.100.1 eth1|R1-TO-R2|192.168.100.2|255.255.255.0|192.168.100.1 Hub1 GuiHub 230,181 5 eth0|PC1-TO-Hub1||| eth1|Hub1-TO-R1||| eth2|Hub1-TO-hub2||| eth3|Hub1-TO-hub3||| eth4|Hub1-TO-r3||| pc4 GuiPC 612,213 1 eth0|r3-TO-pc4|null|0.0.0.0|null PC3 GuiPC 385,355 1 eth0|hub3-TO-PC3|129.64.128.2|255.255.128.0|null PC2 GuiPC 628,31 1 eth0|R2-TO-PC2|10.0.0.2|255.0.0.0|10.0.0.1 PC1 GuiPC 97,178 1 eth0|PC1-TO-Hub1|129.64.128.1|255.255.128.0|129.64.128.7 hub3 GuiHub 333,287 5 eth0|Hub1-TO-hub3||| eth1|hub2-TO-hub3||| eth2|hub3-TO-PC3||| eth3|null||| eth4|null||| --- NEW FILE: test3.jfst --- Hub2 GuiHub 603,178 5 eth0|R1-TO-Hub2||| eth1|R2-TO-Hub2||| eth2|Hub2-TO-pc2||| eth3|null||| eth4|null||| Hub1 GuiHub 307,176 5 eth0|PC1-TO-Hub1||| eth1|Hub1-TO-R1||| eth2|Hub1-TO-R2||| eth3|null||| eth4|null||| R2 GuiRouter 472,264 2 eth0|Hub1-TO-R2|10.0.0.2|255.0.0.0|192.168.1.2 eth1|R2-TO-Hub2|192.168.1.2|255.255.255.0|192.168.1.2 R1 GuiRouter 464,80 2 eth0|Hub1-TO-R1|10.0.0.1|255.0.0.0|192.168.1.1 eth1|R1-TO-Hub2|192.168.1.1|255.255.255.0|192.168.1.1 PC1 GuiPC 151,212 1 eth0|PC1-TO-Hub1|10.0.0.3|255.0.0.0|10.0.0.1 pc2 GuiPC 793,190 1 eth0|Hub2-TO-pc2|192.168.1.3|255.255.255.0|192.168.1.2 --- NEW FILE: test4.jfst --- r1 GuiRouter 457,179 2 eth0|pc1-TO-r1|129.64.127.254|255.255.128.0|129.64.128.1 eth1|r1-TO-pc2|129.64.128.1|255.255.128.0|129.64.128.1 pc2 GuiPC 309,23 1 eth0|r1-TO-pc2|129.64.128.2|255.255.128.0|129.64.128.1 pc1 GuiPC 192,197 1 eth0|pc1-TO-r1|129.64.127.253|255.255.128.0|129.64.127.254 |
From: Alexander B. <da...@us...> - 2005-12-01 14:56:53
|
Update of /cvsroot/javanetsim/javaNetSim/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9162/tests Log Message: Directory /cvsroot/javanetsim/javaNetSim/tests added to the repository |
From: Alexander B. <da...@us...> - 2005-12-01 14:54:53
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8407/core/protocolsuite/tcp_ip Modified Files: IPV4Address.java IpV4.java ProtocolStack.java Route_entry.java Log Message: Rout tables almost done! Please test them and send me bugs ;). Index: Route_entry.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Route_entry.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Route_entry.java 16 Nov 2005 20:25:40 -0000 1.3 --- Route_entry.java 1 Dec 2005 14:54:37 -0000 1.4 *************** *** 24,27 **** --- 24,29 ---- /** Creates a new instance of Route_entry */ + public Route_entry() {} + public Route_entry(String destIP, String gateway, String genMask, String iFace, int Type) { this.destIP = destIP; Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** ProtocolStack.java 30 Nov 2005 13:02:32 -0000 1.24 --- ProtocolStack.java 1 Dec 2005 14:54:37 -0000 1.25 *************** *** 231,234 **** --- 231,236 ---- inPacket.setSourceIPAddress(sourceIP); + + String GatewayAddress = null; // test if on local of remote network *************** *** 240,245 **** }else{ ! String GatewayAddress = mIPprotocol.getDefaultGateway(); destMAC = mARPprotocol.getMACAddress(GatewayAddress,outInterface[0]); --- 242,253 ---- }else{ ! //String GatewayAddress = mIPprotocol.getDefaultGateway(); ! ! GatewayAddress = mIPprotocol.getGateway(inPacket.getDestIPAddress()); + String outIface = mIPprotocol.getInterface(inPacket.getDestIPAddress()); + + if(outIface!=null) outInterface[0] = outIface; + destMAC = mARPprotocol.getMACAddress(GatewayAddress,outInterface[0]); *************** *** 266,270 **** protocolInfo.setLayer("Network"); ! protocolInfo.setDescription("Sending packet from ProtocolStack."); Simulation.addLayerInfo(protocolInfo); --- 274,280 ---- protocolInfo.setLayer("Network"); ! if(GatewayAddress==null) GatewayAddress=inPacket.getDestIPAddress(); ! ! protocolInfo.setDescription("Sending packet from ProtocolStack (to " + GatewayAddress + ")."); Simulation.addLayerInfo(protocolInfo); *************** *** 294,298 **** }catch(CommunicationException ex){ throw ex; ! } } --- 304,310 ---- }catch(CommunicationException ex){ throw ex; ! }catch(InvalidIPAddressException e){ //UGLY!!! FIXME!!! ! System.out.println(e.toString()); ! } } *************** *** 332,336 **** String outInterface[] = mIPprotocol.router(inPacket.getDestIPAddress()); ! //test if on local of remote network --- 344,348 ---- String outInterface[] = mIPprotocol.router(inPacket.getDestIPAddress()); ! String GatewayAddress = null; //test if on local of remote network *************** *** 341,348 **** }else{ ! String GatewayAddress = mIPprotocol.getDefaultGateway(); ! ! destMAC = mARPprotocol.getMACAddress(GatewayAddress,outInterface[0]); } --- 353,369 ---- }else{ + try{ + GatewayAddress = mIPprotocol.getGateway(inPacket.getDestIPAddress()); ! String outIface = mIPprotocol.getInterface(inPacket.getDestIPAddress()); ! ! if(outIface!=null) outInterface[0] = outIface; ! }catch(Exception e){} //UGLY!!! FIXME!!! ! ! ! destMAC = mARPprotocol.getMACAddress(GatewayAddress,outInterface[0]); ! ! //String GatewayAddress = mIPprotocol.getDefaultGateway(); ! //destMAC = mARPprotocol.getMACAddress(GatewayAddress,outInterface[0]); } *************** *** 371,375 **** protocolInfo.setLayer("Network"); ! protocolInfo.setDescription("Forwarding packet from ProtocolStack."); Simulation.addLayerInfo(protocolInfo); --- 392,398 ---- protocolInfo.setLayer("Network"); ! if(GatewayAddress==null) GatewayAddress=inPacket.getDestIPAddress(); ! ! protocolInfo.setDescription("Forwarding packet from ProtocolStack(to " + GatewayAddress + ")."); Simulation.addLayerInfo(protocolInfo); Index: IpV4.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/IpV4.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IpV4.java 8 Nov 2005 20:58:14 -0000 1.2 --- IpV4.java 1 Dec 2005 14:54:37 -0000 1.3 *************** *** 283,291 **** public void setDefaultGateway(String inGatewayIPAddress)throws InvalidDefaultGatewayException { try { ! defaultGateway = IPV4Address.toBinaryString(inGatewayIPAddress); } catch (InvalidIPAddressException e) { throw new InvalidDefaultGatewayException("Invaild Default Gateway Address."); } } /** * Gets the defaultgateway. --- 283,353 ---- public void setDefaultGateway(String inGatewayIPAddress)throws InvalidDefaultGatewayException { try { ! defaultGateway = IPV4Address.toBinaryString(inGatewayIPAddress); ! Route_entry r = new Route_entry(); ! r.destIP = "default"; ! r.gateway = inGatewayIPAddress; ! r.genMask = IPV4Address.getDefaultSubnetMask(inGatewayIPAddress); ! r.iFace = "eth0"; ! r.Type = 0; ! addRoute(r); } catch (InvalidIPAddressException e) { throw new InvalidDefaultGatewayException("Invaild Default Gateway Address."); } } + + /** + * Return the route gateway for this packet... + * @param Destination IP + * @author Key + * @return gateway IP + * @throws InvalidDefaultGatewayException + * @version 0.20 + */ + public String getGateway(String inIPAddress)throws InvalidIPAddressException{ + String binIP = IPV4Address.toBinaryString(inIPAddress); + String binMask; + String destNetwork; + String curdestNetwork; + Route_entry r; + + Enumeration keys1 = routingTable.keys(); + while(keys1.hasMoreElements()){ + curdestNetwork = (String)keys1.nextElement(); + r = (Route_entry)routingTable.get(curdestNetwork); + binMask = IPV4Address.toBinaryString(r.genMask); + destNetwork = IPV4Address.toDecimalString(IPV4Address.IPandMask(binIP,binMask)); + if(destNetwork.contains(curdestNetwork)) return r.gateway; + } + + return getDefaultGateway(); + } + + /* + * Return the route interface for this packet... + * @param Destination IP + * @author Key + * @return gateway IP + * @throws InvalidDefaultGatewayException + * @version 0.20 + */ + public String getInterface(String inIPAddress)throws InvalidIPAddressException{ + String binIP = IPV4Address.toBinaryString(inIPAddress); + String binMask; + String destNetwork; + String curdestNetwork; + Route_entry r; + + Enumeration keys1 = routingTable.keys(); + while(keys1.hasMoreElements()){ + curdestNetwork = (String)keys1.nextElement(); + r = (Route_entry)routingTable.get(curdestNetwork); + binMask = IPV4Address.toBinaryString(r.genMask); + destNetwork = IPV4Address.toDecimalString(IPV4Address.IPandMask(binIP,binMask)); + if(destNetwork.contains(curdestNetwork)) return r.iFace; + } + + return null; + } + /** * Gets the defaultgateway. *************** *** 297,304 **** */ public String getDefaultGateway(){ ! if(defaultGateway != null){ return IPV4Address.toDecimalString(defaultGateway); } ! return null; } --- 359,374 ---- */ public String getDefaultGateway(){ ! /* ! if(defaultGateway != null){ return IPV4Address.toDecimalString(defaultGateway); } ! return null; ! */ ! try{ ! Route_entry r = getRouteTableEntry("default"); ! return r.gateway; ! }catch(Exception e){ ! return null; ! } } Index: IPV4Address.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/IPV4Address.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IPV4Address.java 20 Nov 2005 20:30:53 -0000 1.2 --- IPV4Address.java 1 Dec 2005 14:54:37 -0000 1.3 *************** *** 531,535 **** } ! public String IPandMask(String binIP, String binMask){ String b1, b2, b3; String result = ""; --- 531,535 ---- } ! public static String IPandMask(String binIP, String binMask){ String b1, b2, b3; String result = ""; |
From: Alexander B. <da...@us...> - 2005-12-01 14:54:52
|
Update of /cvsroot/javanetsim/javaNetSim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8407 Modified Files: TODO.txt Log Message: Rout tables almost done! Please test them and send me bugs ;). Index: TODO.txt =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/TODO.txt,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** TODO.txt 30 Nov 2005 13:02:31 -0000 1.13 --- TODO.txt 1 Dec 2005 14:54:37 -0000 1.14 *************** *** 15,19 **** 1. Need to save MACs. 2. Create _normal_ route table edit form (instead of route command). Use as template EditRoutesDialog.java. Note, ! that "route" command is only for ugly testing purposes! 3. Routing tables save/load. 4. Dirty Lines SAVE/LOAD!!!!! --- 15,19 ---- 1. Need to save MACs. 2. Create _normal_ route table edit form (instead of route command). Use as template EditRoutesDialog.java. Note, ! that "route" command is only for ugly testing purposes! 3. Routing tables save/load. 4. Dirty Lines SAVE/LOAD!!!!! *************** *** 24,39 **** *** Simulation Related - 5. The routing tables do not support netID's or subnetID's. In fact nothing in the simulation supports net or subnet - IDs. 8. Cannot route to another Node if sending from the Application layer of a Router (SENDAPPDATA router1 pc2 message1 data). This would be because there's no IP Forwarding decisions on the receivePacket() method in IP when receiving a Packet from the upper layer (UDP). The Routing table needs to be checked and a decision made as to which interface to send the data to. - 9. Routing tables do not contain default routes. 10. The deleteNode() and deleteLink() methods need to be tested. The deleteNode() definitely needs changing, see the Simulation.java source file for more details. - 11. Need to design __normal__ routing tables with any number of entries. 12. 2Fedor: OSPF. ! 13. FDDI (Key && Gift(?)) 14. Switches (?) 15. UDP (Gift) --- 24,35 ---- *** Simulation Related 8. Cannot route to another Node if sending from the Application layer of a Router (SENDAPPDATA router1 pc2 message1 data). This would be because there's no IP Forwarding decisions on the receivePacket() method in IP when receiving a Packet from the upper layer (UDP). The Routing table needs to be checked and a decision made as to which interface to send the data to. 10. The deleteNode() and deleteLink() methods need to be tested. The deleteNode() definitely needs changing, see the Simulation.java source file for more details. 12. 2Fedor: OSPF. ! 13. FDDI (Key && Gift(?)) (??) 14. Switches (?) 15. UDP (Gift) *************** *** 41,47 **** 16. TCP(Gift && Key) TCP Element reset discussion. ! ! ! 17. 2Fedor: RIP (over IP) --- 37,42 ---- 16. TCP(Gift && Key) TCP Element reset discussion. ! 17. SNMP (QweR, Key, Gift) ! 18. Telnet (QweR) |
From: Alexander B. <da...@us...> - 2005-12-01 14:54:51
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8407/guiUI Modified Files: MainScreen.java Log Message: Rout tables almost done! Please test them and send me bugs ;). Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** MainScreen.java 26 Nov 2005 16:48:25 -0000 1.13 --- MainScreen.java 1 Dec 2005 14:54:37 -0000 1.14 *************** *** 3025,3029 **** String routes[] = Sim.getRouteTableEntries(inNodeName); ! this.addToConsole("IP routing table:\n" + "Destination" + "\t" + "Gateway" + "\t" + "Genmask" + "\t" + "Type" + "\t" + "Iface"); for(int i=0; i<routes.length - 1; i++){ --- 3025,3029 ---- String routes[] = Sim.getRouteTableEntries(inNodeName); ! this.addToConsole("IP routing table:\n" + "Destination" + "\t" + "Gateway" + "\t" + "Genmask" + "\t" + "Type" + "\t" + "Iface\n"); for(int i=0; i<routes.length - 1; i++){ |
From: gift <gi...@us...> - 2005-11-30 13:02:40
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14143/core/protocolsuite/tcp_ip Modified Files: Echo_tcp.java ProtocolStack.java Tcp.java Log Message: TCP working v.2.0 Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** ProtocolStack.java 29 Nov 2005 23:31:58 -0000 1.23 --- ProtocolStack.java 30 Nov 2005 13:02:32 -0000 1.24 *************** *** 1759,1763 **** SourceIPAddress=getIPAddress(FirstInterfaceName); ! TCP_packet tosend = mTCPprotocol.sendTCPPacket(DestIPAddress,SourceIPAddress,destPort,srcPort,inTCPMessage,flags,acknow_num); return tosend; --- 1759,1763 ---- SourceIPAddress=getIPAddress(FirstInterfaceName); ! TCP_packet tosend = mTCPprotocol.getTCPPacket_clone(DestIPAddress,SourceIPAddress,destPort,srcPort,inTCPMessage,flags,acknow_num); return tosend; Index: Tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Tcp.java 29 Nov 2005 23:31:59 -0000 1.16 --- Tcp.java 30 Nov 2005 13:02:32 -0000 1.17 *************** *** 174,188 **** this.sent_duplicates=0; this.seq_number=0; if (!this.ReceivedSegments.isEmpty()) this.ReceivedSegments.removeAllElements(); ! if (!this.SentACKs.isEmpty()) ! { ! Set set = this.SentACKs.keySet(); ! Iterator itr = set.iterator(); ! while (itr.hasNext()) { ! this.SentACKs.remove(itr.next()); } ! } ! if (!this.ReceivedACKs.isEmpty()) this.ReceivedACKs.removeAllElements(); if (!this.SegmentsToResend.isEmpty()) { --- 174,198 ---- this.sent_duplicates=0; this.seq_number=0; + if (!this.ReceivedSegments.isEmpty()) this.ReceivedSegments.removeAllElements(); ! if (!this.ReceivedACKs.isEmpty()) this.ReceivedACKs.removeAllElements(); ! ! try { ! if (!this.SentACKs.isEmpty()) { ! Set set = this.SentACKs.keySet(); ! Iterator itr = set.iterator(); ! while (itr.hasNext()) ! { ! this.SentACKs.remove(itr.next()); ! } } ! } catch(Exception e) ! { ! System.out.println("TCP Element.SentACKs reset error: " + e.toString()); ! } ! ! ! try { if (!this.SegmentsToResend.isEmpty()) { *************** *** 194,200 **** } } this.isFIN_sent=false; this.isFIN_confirmed=false; ! this.isPassive=false; } } --- 204,216 ---- } } + + } catch(Exception e) + { + System.out.println("TCP Element.SegmentsToResend reset error: " + e.toString()); + } + this.isFIN_sent=false; this.isFIN_confirmed=false; ! this.isPassive=false; } } *************** *** 468,472 **** newElm.connectedtoPort=0; ! PortTable.put(inPort,newElm); //hash table update } } else // --- 484,488 ---- newElm.connectedtoPort=0; ! PortTable.put(new Integer (inPort),newElm); //hash table update } } else // *************** *** 645,649 **** //pushing a copy into Hashtable ! Elm.SegmentsToResend.put((Integer)s_num, tosend_clone); if (a_num==0 && flags[4]) //first SYN packet was sent => now he have to change port status to busy, as we will get reply to this port --- 661,665 ---- //pushing a copy into Hashtable ! Elm.SegmentsToResend.put(new Integer(s_num), tosend_clone); if (a_num==0 && flags[4]) //first SYN packet was sent => now he have to change port status to busy, as we will get reply to this port *************** *** 656,661 **** if (flags[5]) Elm.isFIN_sent=true; ! Elm=null; ! /* URG, ACK, PSH, RST, SYN, FIN */ //Create Layer info LayerInfo TCP_Info = new LayerInfo(getClass().getName()); --- 672,676 ---- if (flags[5]) Elm.isFIN_sent=true; ! Elm=null; //Create Layer info LayerInfo TCP_Info = new LayerInfo(getClass().getName()); *************** *** 667,671 **** if (flags[4]) s="Created TCP SYN-packet for " + inDestIPAddress + ":" + indestPort +"."; if (flags[5]) s="Created TCP FIN-packet for " + inDestIPAddress + ":" + indestPort +"."; ! if (! (flags[4] || flags[5]) ) s="Created TCP packet for " + inDestIPAddress + ":" + indestPort +"."; TCP_Info.setDescription(s); Simulation.addLayerInfo(TCP_Info); --- 682,687 ---- if (flags[4]) s="Created TCP SYN-packet for " + inDestIPAddress + ":" + indestPort +"."; if (flags[5]) s="Created TCP FIN-packet for " + inDestIPAddress + ":" + indestPort +"."; ! if (!(flags[4] || flags[5])) s="Created TCP data packet for " + inDestIPAddress + ":" + indestPort +"."; ! if (!(flags[4] || flags[5]) && flags[1]) s="Created TCP acknowledgement packet for " + inDestIPAddress + ":" + indestPort +"."; TCP_Info.setDescription(s); Simulation.addLayerInfo(TCP_Info); *************** *** 762,766 **** { //we have sent ACK for received segment => adding it to SentACKs ! Elm.SentACKs.put((Integer)inPacket.get_sequence_number(), (TCP_packet) mParentStack.getTCPSegment_clone(listener,msg,flags,ack_num)); } //listener.RecvData(inPacket.getTCP_message()); we do not receive segment because this is a SYN-packet --- 778,782 ---- { //we have sent ACK for received segment => adding it to SentACKs ! Elm.SentACKs.put(new Integer(inPacket.get_sequence_number()), (TCP_packet) mParentStack.getTCPSegment_clone(listener,msg,flags,ack_num)); } //listener.RecvData(inPacket.getTCP_message()); we do not receive segment because this is a SYN-packet *************** *** 809,812 **** --- 825,829 ---- //deleting from SegmentsToResend the segmet with the acknowledgment number we have received NOTE: dec by 1 is used see RFC Elm.SegmentsToResend.remove((Integer)our_ack-1); + // if (Elm.SegmentsToResend.remove((Integer)our_ack-1)==null) {System.out.println("Error here");} //now we have to send last ACK-segment (with SYN=false, seq_num=1, ack_num=1) *************** *** 820,824 **** { //we have sent ACK for received segment => adding it to SentACKs ! Elm.SentACKs.put((Integer)inPacket.get_sequence_number(), (TCP_packet) mParentStack.getTCPSegment_clone(listener,msg,flags,ack_num)); } //listener.RecvData(inPacket.getTCP_message()); we do not receive segment because this is a SYN-packet --- 837,841 ---- { //we have sent ACK for received segment => adding it to SentACKs ! Elm.SentACKs.put(new Integer(inPacket.get_sequence_number()), (TCP_packet) mParentStack.getTCPSegment_clone(listener,msg,flags,ack_num)); } //listener.RecvData(inPacket.getTCP_message()); we do not receive segment because this is a SYN-packet *************** *** 871,878 **** //deleting from SegmentsToResend the segmet with the acknowledgment number we have received NOTE: dec by 1 is used see RFC ! Elm.SegmentsToResend.remove((Integer)our_ack-1); //now we have to send ACK-segment (with SYN=false, seq_num=XX, ack_num=XX) ! if (Elm.isFIN_sent==false) { Elm.isPassive=true; --- 888,895 ---- //deleting from SegmentsToResend the segmet with the acknowledgment number we have received NOTE: dec by 1 is used see RFC ! //if (Elm.SegmentsToResend.remove((Integer)our_ack-1)==null) {System.out.println("Error here");} //now we have to send ACK-segment (with SYN=false, seq_num=XX, ack_num=XX) ! if (!Elm.isFIN_sent) { Elm.isPassive=true; *************** *** 886,894 **** { //we have sent ACK for received segment => adding it to SentACKs ! Elm.SentACKs.put((Integer)inPacket.get_sequence_number(), (TCP_packet) mParentStack.getTCPSegment_clone(listener,msg,flags,ack_num)); } } else { ! if (Elm.isFIN_confirmed==false) { String msg=""; --- 903,911 ---- { //we have sent ACK for received segment => adding it to SentACKs ! Elm.SentACKs.put(new Integer(inPacket.get_sequence_number()), (TCP_packet) mParentStack.getTCPSegment_clone(listener,msg,flags,ack_num)); } } else { ! if (!Elm.isFIN_confirmed) { String msg=""; *************** *** 901,905 **** { //we have sent ACK for received segment => adding it to SentACKs ! Elm.SentACKs.put((Integer)inPacket.get_sequence_number(), (TCP_packet) mParentStack.getTCPSegment_clone(listener,msg,flags,ack_num)); } } else --- 918,922 ---- { //we have sent ACK for received segment => adding it to SentACKs ! Elm.SentACKs.put(new Integer(inPacket.get_sequence_number()), (TCP_packet) mParentStack.getTCPSegment_clone(listener,msg,flags,ack_num)); } } else *************** *** 914,921 **** { //we have sent ACK for received segment => adding it to SentACKs ! Elm.SentACKs.put((Integer)inPacket.get_sequence_number(), (TCP_packet) mParentStack.getTCPSegment_clone(listener,msg,flags,ack_num)); ! } } ! ClosePort((Application)Elm.application); //FIN sent and confirmed!!! Closing connection } --- 931,942 ---- { //we have sent ACK for received segment => adding it to SentACKs ! Elm.SentACKs.put(new Integer(inPacket.get_sequence_number()), (TCP_packet) mParentStack.getTCPSegment_clone(listener,msg,flags,ack_num)); ! } ! } else ! { ! ClosePort((Application)Elm.application); //FIN sent and confirmed!!! Closing connection in case isPassive==true } ! // Active application has to disconnect by calling Application.Disconnect(); ! } *************** *** 971,974 **** --- 992,996 ---- //deleting from SegmentsToResend the segmet with the acknowledgment number we have received NOTE: dec by 1 is used see RFC Elm.SegmentsToResend.remove((Integer)our_ack-1); + // if (Elm.SegmentsToResend.remove((Integer)our_ack-1)==null) {System.out.println("Error here");} } else *************** *** 983,991 **** //our_ack==2 when connection is established // if ((our_ack!=2 || Elm.sent_segments!=2) && Elm.PortStatus!=1) ! //{ if (mParentStack.sendTCPSegment(listener,msg,flags,ack_num)) { //we have sent ACK for received segment => adding it to SentACKs ! Elm.SentACKs.put((Integer)inPacket.get_sequence_number(), (TCP_packet) mParentStack.getTCPSegment_clone(listener,msg,flags,ack_num)); } //} --- 1005,1013 ---- //our_ack==2 when connection is established // if ((our_ack!=2 || Elm.sent_segments!=2) && Elm.PortStatus!=1) ! //{ if (mParentStack.sendTCPSegment(listener,msg,flags,ack_num)) { //we have sent ACK for received segment => adding it to SentACKs ! Elm.SentACKs.put(new Integer(inPacket.get_sequence_number()), (TCP_packet) mParentStack.getTCPSegment_clone(listener,msg,flags,ack_num)); } //} *************** *** 1004,1009 **** Simulation.addLayerInfo(TCP_Info); ! //if (Elm.received_segments>2) ! listener.RecvData(inPacket.getTCP_message()); } --- 1026,1031 ---- Simulation.addLayerInfo(TCP_Info); ! // if (Elm.received_segments>2) ! listener.RecvData(inPacket.getTCP_message()); } *************** *** 1035,1038 **** --- 1057,1110 ---- } } + + + + /** + * This method returns the TCP packet + * @author gift (sourceforge.net user) + * @param inDestIPAddress destination IP address + * @param inSourceIPAddress our IP address + * @param indestPort destination port number + * @param insrcPort our port number + * @param inMessage TCP message to send + * @param flags[] 6 flags to set in segment + * @param acknow_num int ack number of the segment we want to send + * @return TCP_packet to send in Network Layer + * @exception TransportLayerException + * @version v0.30 + * @see TransportLayerException + */ + + public TCP_packet getTCPPacket_clone(String inDestIPAddress,String inSourceIPAddress, int indestPort, int insrcPort, String inMessage, boolean flags[], int acknow_num) throws TransportLayerException, LowLinkException + { + //check if window is available + TCP_HashTableElement Elm; + Elm = (TCP_HashTableElement) PortTable.get(insrcPort); + + int s_num; + int a_num; + TCP_packet tosend_clone = new TCP_packet(inDestIPAddress,inSourceIPAddress,indestPort,insrcPort); + + tosend_clone.setTCP_message(inMessage); + //now we set all the flags + /* URG, ACK, PSH, RST, SYN, FIN */ + tosend_clone.set_URG_flag(flags[0]); + tosend_clone.set_ACK_flag(flags[1]); + tosend_clone.set_PSH_flag(flags[2]); + tosend_clone.set_RST_flag(flags[3]); + tosend_clone.set_SYN_flag(flags[4]); + tosend_clone.set_FIN_flag(flags[5]); + + //here we push out segment in Hashtable SegmentsToResend and increment counters + s_num=Elm.seq_number; //getting sequence number 0-for SYN + if (Elm.ReceivedSegments.isEmpty()) a_num=0; else a_num=acknow_num; //(Integer)Elm.ReceivedSegments.lastElement()+1; //getting ACK number 0 - for SYN, 1 - as a reply for SYN ... so on + + tosend_clone.set_sequence_number(s_num); + tosend_clone.set_acknowledgment_number(a_num); + + Elm=null; + + return tosend_clone; + } Index: Echo_tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Echo_tcp.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Echo_tcp.java 29 Nov 2005 23:31:58 -0000 1.11 --- Echo_tcp.java 30 Nov 2005 13:02:32 -0000 1.12 *************** *** 25,28 **** --- 25,29 ---- * * @author key + * @author gift (sourceforge.net user) */ public class Echo_tcp extends Application{ *************** *** 159,163 **** SendData(Data); ! mParentStack.FinalizeTCP(this); //will close both connections LayerInfo protInfo3 = new LayerInfo(getClass().getName()); --- 160,164 ---- SendData(Data); ! mParentStack.FinalizeTCP(this); //will close client connection LayerInfo protInfo3 = new LayerInfo(getClass().getName()); *************** *** 167,173 **** protInfo3.setDescription("Server closing connection. Now listening on " + listenPort + "."); Simulation.addLayerInfo(protInfo3); - // Disconnect(); Listen(); }catch(Exception e){ ///*TODO*: here to catch --- 168,177 ---- protInfo3.setDescription("Server closing connection. Now listening on " + listenPort + "."); Simulation.addLayerInfo(protInfo3); + + + Disconnect(); Listen(); + }catch(Exception e){ ///*TODO*: here to catch *************** *** 196,200 **** Simulation.addLayerInfo(protInfo); ! SendData(Data); } else { --- 200,206 ---- Simulation.addLayerInfo(protInfo); ! SendData(Data); ! ! //SendData("CLIENTTTTT-Botva"); } else { |
From: gift <gi...@us...> - 2005-11-30 13:02:39
|
Update of /cvsroot/javanetsim/javaNetSim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14143 Modified Files: TODO.txt Log Message: TCP working v.2.0 Index: TODO.txt =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/TODO.txt,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TODO.txt 27 Nov 2005 20:36:05 -0000 1.12 --- TODO.txt 30 Nov 2005 13:02:31 -0000 1.13 *************** *** 40,45 **** pretty done 16. TCP(Gift && Key) ! TCP application clarification. ! !!!!!! FATAL: See line 159 Echo_TCP!!!!! --- 40,44 ---- pretty done 16. TCP(Gift && Key) ! TCP Element reset discussion. |
From: Alouette <alo...@us...> - 2005-11-30 08:44:59
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ospf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16506/core/protocolsuite/tcp_ip/ospf Modified Files: OSPFDTBdescription_packet.java Log Message: Index: OSPFDTBdescription_packet.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ospf/OSPFDTBdescription_packet.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OSPFDTBdescription_packet.java 28 Nov 2005 13:47:37 -0000 1.2 --- OSPFDTBdescription_packet.java 30 Nov 2005 08:44:51 -0000 1.3 *************** *** 11,15 **** package core.protocolsuite.tcp_ip.ospf; import core.protocolsuite.tcp_ip.ospf.ospf_packetheader; ! /** * --- 11,16 ---- package core.protocolsuite.tcp_ip.ospf; import core.protocolsuite.tcp_ip.ospf.ospf_packetheader; ! import core.protocolsuite.tcp_ip.ospf.OSPF_lsaheader; ! import java.util.*; /** * *************** *** 17,28 **** */ public class OSPFDTBdescription_packet extends ospf_packetheader { ! private int[] options; private int[] IMMS ; private int DDSequenceNumber; ! private String LSAheader; ! /** Creates a new instance of OSPFDTBdescription_packet */ ! public OSPFDTBdescription_packet() { int i; --- 18,29 ---- */ public class OSPFDTBdescription_packet extends ospf_packetheader { ! private int[] options; private int[] IMMS ; private int DDSequenceNumber; ! private Vector LSAheader_list = new Vector(); /** Creates a new instance of OSPFDTBdescription_packet */ ! public OSPFDTBdescription_packet(int Initialize, int More, int master, int ddsn ) { ! super(2); int i; *************** *** 34,37 **** --- 35,50 ---- IMMS[i]=0; } + IMMS[5]=Initialize; + IMMS[6]=More; + IMMS[7]=master; + DDSequenceNumber=ddsn; + //LSAheader=""; + + } + + public void OSPFAddHeader(OSPF_lsaheader inOSPFlsaHeader) + { + + this.LSAheader_list.addElement(inOSPFlsaHeader); } |
From: gift <gi...@us...> - 2005-11-29 23:32:08
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30279/core/protocolsuite/tcp_ip Modified Files: Echo_tcp.java ProtocolStack.java Tcp.java Log Message: TCP vXXXXX :) Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** ProtocolStack.java 28 Nov 2005 20:29:49 -0000 1.22 --- ProtocolStack.java 29 Nov 2005 23:31:58 -0000 1.23 *************** *** 1717,1721 **** } return true; ! } }//EOF --- 1717,1767 ---- } return true; ! } ! ! /** ! * This method returns the TCP segments with certain flags ! * NOTE: DO <b>NOT</b> CALL this method from application use only <i>SendTCP(Object application, String inTCPMessage)</i> in the application to send TCP segments ! * @author gift (sourceforge.net user) ! * @param application the application that sends the message ! * @param inTCPMessage TCP message to send ! * @param flags[] 6 flags to set in segment ! * @param acknow_num int number of TCP segment that we want to confirm (-1 if we do not send ACK segment) ! * @return TCP_packet ! * @exception CommunicationException ! * @exception LowLinkException ! * @exception TransportLayerException ! * @version v0.40 ! * @see CommunicationException ! * @see LowLinkException ! * @see TransportLayerException ! */ ! ! public TCP_packet getTCPSegment_clone(Object application, String inTCPMessage, boolean flags[], int acknow_num) throws LowLinkException, CommunicationException, TransportLayerException ! { ! String FirstInterfaceName; ! String DestIPAddress; ! String SourceIPAddress; ! int srcPort; ! int destPort; ! ! //lets get first network interface name ! Node temp = (Node)mParentNode; ! FirstInterfaceName = temp.getFirstInterfaceName(); ! ! // try{ ! //let's get a reserved local port number for this application ! srcPort=mTCPprotocol.getApplicationLocalPortNumber(application); ! //and destination IP of the other host ! DestIPAddress=mTCPprotocol.getApplicationDestIP(srcPort); ! //and destination port of the other host ! destPort=mTCPprotocol.getApplicationDestPortNumber(srcPort); ! ! ! SourceIPAddress=getIPAddress(FirstInterfaceName); ! TCP_packet tosend = mTCPprotocol.sendTCPPacket(DestIPAddress,SourceIPAddress,destPort,srcPort,inTCPMessage,flags,acknow_num); ! return tosend; ! ! // }catch(Exception e){} ! } }//EOF Index: Tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Tcp.java 28 Nov 2005 21:50:37 -0000 1.15 --- Tcp.java 29 Nov 2005 23:31:59 -0000 1.16 *************** *** 127,135 **** public int seq_number; /*database*/ ! public Vector ReceivedSegments = new Vector(); //contains received segments ONLY sequence_number for each segment is stored ! //Integer type is used NOTE: Do remember about special "Integer" use by "Vector" ! public Vector ReceivedACKs = new Vector(); //contains received acknowledgments from destination computer ONLY sequence_number for each ACK segment is stored ! //Integer type is used NOTE: Do remember about special "Integer" use by "Vector" ! public Hashtable SegmentsToResend = new Hashtable(); //contains segments that will be resent in case no ACK for them will be received /*end of database*/ --- 127,159 ---- public int seq_number; /*database*/ ! ! /** ! * Contains received segments ONLY sequence_number for each segment is stored ! * Integer type is used NOTE: Do remember about special "Integer" use by "Vector" ! */ ! public Vector ReceivedSegments = new Vector(); ! ! /** ! * Here we store sent acknowledgements. ! * <p>Key: Sequence number of the segment that we have received and acknowledged</p> ! * <p>Object: Our ACK segment that we have received/<p> ! * <p>Aim of this hashtable: if we receive a duplicate of the segment that we have received, we get this duplicate sequenece number ! * then we get from this hashtable a copy of ACK segment we have sent and send it again.</p> ! */ ! public Hashtable SentACKs = new Hashtable(); ! ! /** ! * Contains received acknowledgments from destination computer ONLY sequence_number for each ACK segment is stored ! * Integer type is used NOTE: Do remember about special "Integer" use by "Vector" ! */ ! public Vector ReceivedACKs = new Vector(); ! ! /** ! * Contains segments that will be resent in case no ACK for them will be received ! * <p>Key: Sequence number of the segment that we are sending</p> ! * <p>Object: The copy of the segment we have sent</p> ! * <p>Aim of this hashtable: necessarily to have</p> ! */ ! public Hashtable SegmentsToResend = new Hashtable(); /*end of database*/ *************** *** 151,154 **** --- 175,187 ---- this.seq_number=0; if (!this.ReceivedSegments.isEmpty()) this.ReceivedSegments.removeAllElements(); + if (!this.SentACKs.isEmpty()) + { + Set set = this.SentACKs.keySet(); + Iterator itr = set.iterator(); + while (itr.hasNext()) + { + this.SentACKs.remove(itr.next()); + } + } if (!this.ReceivedACKs.isEmpty()) this.ReceivedACKs.removeAllElements(); if (!this.SegmentsToResend.isEmpty()) *************** *** 597,601 **** //here we push out segment in Hashtable SegmentsToResend and increment counters s_num=Elm.seq_number; //getting sequence number 0-for SYN ! if (Elm.ReceivedSegments.isEmpty()) a_num=0; else a_num=(Integer)Elm.ReceivedSegments.lastElement()+1; //getting ACK number 0 - for SYN, 1 - as a reply for SYN ... so on tosend.set_sequence_number(s_num); --- 630,634 ---- //here we push out segment in Hashtable SegmentsToResend and increment counters s_num=Elm.seq_number; //getting sequence number 0-for SYN ! if (Elm.ReceivedSegments.isEmpty()) a_num=0; else a_num=acknow_num; //(Integer)Elm.ReceivedSegments.lastElement()+1; //getting ACK number 0 - for SYN, 1 - as a reply for SYN ... so on tosend.set_sequence_number(s_num); *************** *** 726,739 **** Application listener;int ack_num=1; listener = (Application)Elm.application; ! mParentStack.sendTCPSegment(listener,msg,flags,ack_num); //listener.RecvData(inPacket.getTCP_message()); we do not receive segment because this is a SYN-packet - } else { //we have already received this segment ! Elm.received_duplicates++; ! String msg=""; ! boolean flags[]={false,true,false,false,true,false}; /* URG, !ACK!, PSH, RST, !SYN!, FIN */ ! Application listener;int ack_num=1; ! listener = (Application)Elm.application; ! mParentStack.sendTCPSegment(listener,msg,flags,ack_num); } } else { //not a SYN packet - have to wait until SYN packet will come --- 759,770 ---- Application listener;int ack_num=1; listener = (Application)Elm.application; ! if (mParentStack.sendTCPSegment(listener,msg,flags,ack_num)) ! { ! //we have sent ACK for received segment => adding it to SentACKs ! Elm.SentACKs.put((Integer)inPacket.get_sequence_number(), (TCP_packet) mParentStack.getTCPSegment_clone(listener,msg,flags,ack_num)); ! } //listener.RecvData(inPacket.getTCP_message()); we do not receive segment because this is a SYN-packet } else { //we have already received this segment ! //but we will never enter here :) } } else { //not a SYN packet - have to wait until SYN packet will come *************** *** 751,755 **** //we have received an answer for our SYN-segment //a little test ! if (!(inPacket.get_ACK_flag())) throw new TransportLayerPortException("TCP Error: No ACK flag set in segment!"); //in case this is not duplicate --- 782,786 ---- //we have received an answer for our SYN-segment //a little test ! if (!(inPacket.get_ACK_flag())) throw new TransportLayerPortException("TCP Error: No ACK flag in answer for SYN packet is set in the segment!"); //in case this is not duplicate *************** *** 784,799 **** boolean flags[]={false,true,false,false,false,false}; /* URG, !ACK!, PSH, RST, SYN, FIN */ Application listener; ! listener = (Application)Elm.application; ! mParentStack.sendTCPSegment(listener,msg,flags, ack_num); //listener.RecvData(inPacket.getTCP_message()); we do not receive segment because this is a SYN-packet } else { //we have already received this segment Elm.received_duplicates++; ! String msg=""; ! boolean flags[]={false,true,false,false,true,false}; /* URG, !ACK!, PSH, RST, !SYN!, FIN */ ! Application listener;int ack_num=1; ! listener = (Application)Elm.application; ! mParentStack.sendTCPSegment(listener,msg,flags,ack_num); ! } } else --- 815,832 ---- boolean flags[]={false,true,false,false,false,false}; /* URG, !ACK!, PSH, RST, SYN, FIN */ Application listener; ! listener = (Application)Elm.application; ! ! if (mParentStack.sendTCPSegment(listener,msg,flags,ack_num)) ! { ! //we have sent ACK for received segment => adding it to SentACKs ! Elm.SentACKs.put((Integer)inPacket.get_sequence_number(), (TCP_packet) mParentStack.getTCPSegment_clone(listener,msg,flags,ack_num)); ! } //listener.RecvData(inPacket.getTCP_message()); we do not receive segment because this is a SYN-packet } else { //we have already received this segment Elm.received_duplicates++; ! //now we have to resend our ACK again ! mParentStack.sendPacket((TCP_packet) Elm.SentACKs.get((Integer)inPacket.get_sequence_number())); ! } } else *************** *** 804,812 **** { //FIN flag! Last segment was received. ! //a little test ! if (!(inPacket.get_ACK_flag())) throw new TransportLayerPortException("TCP Error: No ACK flag set in segment!"); ! ! //Elm=(TCP_HashTableElement)PortTable.get(inPacket.get_destPort()); ! Integer chk = (Integer)inPacket.get_sequence_number(); if (!(Elm.ReceivedSegments.contains(chk))) --- 837,841 ---- { //FIN flag! Last segment was received. ! //Elm=(TCP_HashTableElement)PortTable.get(inPacket.get_destPort()); Integer chk = (Integer)inPacket.get_sequence_number(); if (!(Elm.ReceivedSegments.contains(chk))) *************** *** 844,858 **** Elm.SegmentsToResend.remove((Integer)our_ack-1); ! //now we have to send ACK-segment (with SYN=false, seq_num=XX, ack_num=XX) ! //we have one received segment so everything we have to do is just to call "mParentStack.sendTCPSegment(listener,msg,flags);" if (Elm.isFIN_sent==false) { Elm.isPassive=true; String msg=""; ! boolean flags[]={false,false,false,false,false,true}; /* URG, !ACK!, PSH, RST, SYN, !FIN! */ //maybe not like in RFC page 37 p3.5 Application listener; listener = (Application)Elm.application; //Elm.isFIN_sent=true; - will be set in "sendTCPSegment" ! // mParentStack.sendTCPSegment(listener,msg,flags); } else { --- 873,891 ---- Elm.SegmentsToResend.remove((Integer)our_ack-1); ! //now we have to send ACK-segment (with SYN=false, seq_num=XX, ack_num=XX) if (Elm.isFIN_sent==false) { Elm.isPassive=true; String msg=""; ! boolean flags[]={false,true,false,false,false,true}; /* URG, !ACK!, PSH, RST, SYN, !FIN! */ //maybe not like in RFC page 37 p3.5 Application listener; + int ack_num=chk+1; listener = (Application)Elm.application; //Elm.isFIN_sent=true; - will be set in "sendTCPSegment" ! if (mParentStack.sendTCPSegment(listener,msg,flags,ack_num)) ! { ! //we have sent ACK for received segment => adding it to SentACKs ! Elm.SentACKs.put((Integer)inPacket.get_sequence_number(), (TCP_packet) mParentStack.getTCPSegment_clone(listener,msg,flags,ack_num)); ! } } else { *************** *** 864,868 **** listener = (Application)Elm.application; Elm.isFIN_confirmed=true; ! // mParentStack.sendTCPSegment(listener,msg,flags); } else { --- 897,906 ---- listener = (Application)Elm.application; Elm.isFIN_confirmed=true; ! int ack_num=chk+1; ! if (mParentStack.sendTCPSegment(listener,msg,flags,ack_num)) ! { ! //we have sent ACK for received segment => adding it to SentACKs ! Elm.SentACKs.put((Integer)inPacket.get_sequence_number(), (TCP_packet) mParentStack.getTCPSegment_clone(listener,msg,flags,ack_num)); ! } } else { *************** *** 872,877 **** boolean flags[]={false,true,false,false,false,true}; /* URG, !ACK!, PSH, RST, SYN, !FIN! */ //maybe not like in RFC page 37 p3.5 Application listener; ! listener = (Application)Elm.application; ! // mParentStack.sendTCPSegment(listener,msg,flags); } ClosePort((Application)Elm.application); //FIN sent and confirmed!!! Closing connection --- 910,919 ---- boolean flags[]={false,true,false,false,false,true}; /* URG, !ACK!, PSH, RST, SYN, !FIN! */ //maybe not like in RFC page 37 p3.5 Application listener; ! listener = (Application)Elm.application; int ack_num=chk+1; ! if (mParentStack.sendTCPSegment(listener,msg,flags,ack_num)) ! { ! //we have sent ACK for received segment => adding it to SentACKs ! Elm.SentACKs.put((Integer)inPacket.get_sequence_number(), (TCP_packet) mParentStack.getTCPSegment_clone(listener,msg,flags,ack_num)); ! } } ClosePort((Application)Elm.application); //FIN sent and confirmed!!! Closing connection *************** *** 882,941 **** } else { //we have already received this segment Elm.received_duplicates++; ! } ! ! } else { // no FIN flag, no SYN flag ! //just normal mode. Have to check ACK flag, decompose, send acknowledgement ! ! //a little test ! if (!(inPacket.get_ACK_flag())) throw new TransportLayerPortException("TCP Error: No ACK flag set in segment!"); ! Integer chk = (Integer)inPacket.get_sequence_number(); if (!(Elm.ReceivedSegments.contains(chk))) ! { ! Elm.received_segments++; Elm.ReceivedSegments.addElement(chk); //adding seq_number that we have received ! Integer our_ack = (Integer)inPacket.get_acknowledgment_number(); ! Elm.ReceivedACKs.addElement(our_ack); //adding ACK that we have received ! // everything is OK now we decompose TCP datagram ! //Create Layer info ! LayerInfo TCP_Info = new LayerInfo(getClass().getName()); ! TCP_Info.setObjectName(mParentStack.getParentNodeName()); ! TCP_Info.setDataType("TCP Protocol"); ! TCP_Info.setLayer("Transport"); ! ! String s; ! int rs = Elm.received_segments; ! if (rs>2) s="TCP packet with data ACK received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + "."; else s="TCP packet with establishing connection ACK received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + ". Connection confirmed!"; ! ! //deleting from SegmentsToResend the segmet with the acknowledgment number we have received NOTE: dec by 1 is used see RFC ! Elm.SegmentsToResend.remove((Integer)our_ack-1); ! ! if (our_ack==1 && (Integer)inPacket.get_sequence_number()==1) s=s + " New TCP connection established!"; ! TCP_Info.setDescription(s); ! Simulation.addLayerInfo(TCP_Info); ! //now we have to send ACK-segment (with SYN=false, seq_num=XX, ack_num=XX) ! //we have one received segment so everything we have to do is just to call "mParentStack.sendTCPSegment(listener,msg,flags);" ! String msg=""; ! boolean flags[]={false,true,false,false,false,false}; /* URG, !ACK!, PSH, RST, SYN, FIN */ ! Application listener; ! listener = (Application)Elm.application; ! ! if (rs>2) listener.RecvData(inPacket.getTCP_message()); ! // if ((our_ack!=2 || Elm.sent_segments!=2) && Elm.PortStatus!=1) mParentStack.sendTCPSegment(listener,msg,flags); //our_ack==2 when connection is established ! //we have sent last ACK and we can close TCP port now ! ! } else { //we have already received this segment Elm.received_duplicates++; ! } } } --- 924,1017 ---- } else { //we have already received this segment Elm.received_duplicates++; ! //now we have to resend our ACK again ! mParentStack.sendPacket((TCP_packet) Elm.SentACKs.get((Integer)inPacket.get_sequence_number())); ! } ! ! ! ! } else { // no FIN flag, no SYN flag ! //just normal mode. Have to check ACK flag, decompose, send acknowledgement ! Integer chk = (Integer)inPacket.get_sequence_number(); ! Integer our_ack = (Integer)inPacket.get_acknowledgment_number(); if (!(Elm.ReceivedSegments.contains(chk))) ! { ! Elm.received_segments++; Elm.ReceivedSegments.addElement(chk); //adding seq_number that we have received ! ! ! if (inPacket.get_ACK_flag()) ! { ! // we have received an ACK for our segment!!! ! Elm.ReceivedACKs.addElement(our_ack); //adding ACK that we have received ! // everything is OK now we decompose TCP datagram ! ! //Create Layer info ! LayerInfo TCP_Info = new LayerInfo(getClass().getName()); ! TCP_Info.setObjectName(mParentStack.getParentNodeName()); ! TCP_Info.setDataType("TCP Protocol"); ! TCP_Info.setLayer("Transport"); ! String s; ! if (Elm.received_segments>2) s="TCP packet with data ACK received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + "."; ! else s="TCP packet with establishing connection ACK received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + ". Connection confirmed!"; ! ! if (our_ack==1 && (Integer)inPacket.get_sequence_number()==1) s=s + " New TCP connection established!"; ! ! TCP_Info.setDescription(s); ! Simulation.addLayerInfo(TCP_Info); ! //we do not have to send ACK for ACK-segment ! ! //deleting from SegmentsToResend the segmet with the acknowledgment number we have received NOTE: dec by 1 is used see RFC ! Elm.SegmentsToResend.remove((Integer)our_ack-1); ! ! } else ! { ! //we have received non ACK-segment ! //now we have to send our ACK-segment (with SYN=false, seq_num=XX, ack_num=XX) ! String msg=""; ! boolean flags[]={false,true,false,false,false,false}; /* URG, !ACK!, PSH, RST, SYN, FIN */ ! Application listener; ! listener = (Application)Elm.application; int ack_num=chk+1; ! ! //our_ack==2 when connection is established ! // if ((our_ack!=2 || Elm.sent_segments!=2) && Elm.PortStatus!=1) ! //{ ! if (mParentStack.sendTCPSegment(listener,msg,flags,ack_num)) ! { ! //we have sent ACK for received segment => adding it to SentACKs ! Elm.SentACKs.put((Integer)inPacket.get_sequence_number(), (TCP_packet) mParentStack.getTCPSegment_clone(listener,msg,flags,ack_num)); ! } ! //} ! ! //Create Layer info ! LayerInfo TCP_Info = new LayerInfo(getClass().getName()); ! TCP_Info.setObjectName(mParentStack.getParentNodeName()); ! TCP_Info.setDataType("TCP Protocol"); ! ! TCP_Info.setLayer("Transport"); ! ! TCP_Info.setDescription("TCP packet with data received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + ". Passing data to application program."); ! ! Simulation.addLayerInfo(TCP_Info); ! ! //if (Elm.received_segments>2) ! listener.RecvData(inPacket.getTCP_message()); ! } ! } else { //we have already received this segment Elm.received_duplicates++; ! //now we have to resend our ACK again ! mParentStack.sendPacket((TCP_packet) Elm.SentACKs.get((Integer)inPacket.get_sequence_number())); ! } ! } } Index: Echo_tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Echo_tcp.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Echo_tcp.java 28 Nov 2005 21:50:37 -0000 1.10 --- Echo_tcp.java 29 Nov 2005 23:31:58 -0000 1.11 *************** *** 108,112 **** { ! // mParentStack.SendTCP(this, Data); //processing the protocol doings. --- 108,112 ---- { ! mParentStack.SendTCP(this, Data,-1); //processing the protocol doings. |