javanetsim-cvs Mailing List for javaNetSim (Page 29)
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: Alouette <alo...@us...> - 2006-02-10 13:01:11
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10149/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.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** ProtocolStack.java 5 Feb 2006 14:01:51 -0000 1.36 --- ProtocolStack.java 10 Feb 2006 13:00:57 -0000 1.37 *************** *** 79,82 **** --- 79,83 ---- + /** *************** *** 122,125 **** --- 123,128 ---- private Node mParentNode = null; + + private Ospf mOspfprotocol = null; *************** *** 851,855 **** } ! }else{ //need to insert tests for all other packet types --- 854,892 ---- } ! } else if (ipPacket instanceof ospf_packetheader) ! { ! // call receiveing ! if (((ospf_packetheader)ipPacket).GetPackettype()==1) ! { ! // initialize ! } ! else if (((ospf_packetheader)ipPacket).GetPackettype()==2) ! { ! // Database description ! } ! else if (((ospf_packetheader)ipPacket).GetPackettype()==3) ! { ! // Link state request ! } ! else if (((ospf_packetheader)ipPacket).GetPackettype()==4) ! { ! // Link update ! } ! else if (((ospf_packetheader)ipPacket).GetPackettype()==5) ! { ! // Link acknowlogdgement ! } ! ! } ! ! ! ! ! ! ! ! ! ! else{ //need to insert tests for all other packet types *************** *** 1892,1895 **** --- 1929,1937 ---- // }catch(Exception e){} } + + public void Sendospf(ospf_packetheader tosend) + { + sendPacket(tosend); + } }//EOF |
From: QweR <qw...@us...> - 2006-02-09 23:18:34
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5906/guiUI Added Files: SNMPSendDataDialog.java Log Message: --- NEW FILE: SNMPSendDataDialog.java --- /* Java Firewall Simulator (jFirewallSim) Copyright (c) 2004, jFirewallSim development team All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the Canberra Institute of Technology nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package guiUI; import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.GridBagLayout; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JTextField; import java.awt.Insets; import java.awt.GridBagConstraints; import java.awt.BorderLayout; import javax.swing.JButton; import java.awt.Dimension; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JComboBox; import core.Simulation; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.Color; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.util.Arrays; import java.awt.Component; import javax.swing.SwingConstants; import java.util.Vector; import core.protocolsuite.tcp_ip.SNMP; /** * * @author QweR * * This class is a dialog that enables the user to be able to set the TCP/IP setting * on a selected node. eg: set IP address, subnet mask and default gateway address. * */ public class SNMPSendDataDialog extends javax.swing.JDialog { private JPanel backpanel; private JLabel lblIPAddress; private JLabel lblPort; private JLabel lblMessage; private JLabel lblVariables; private JLabel lblPassword; private JLabel lblError; private JTextField txtIPAddress; private JTextField txtPort; private JTextField txtMessage; private JTextField txtVariables; private JTextField txtPassword; private JButton btnOk; private MainScreen controller; private Simulation Sim; private String NodeName; public SNMPSendDataDialog(JFrame frame, Simulation s, String inNodeName) { super(frame); setResizable(false); controller = (MainScreen)frame; Sim = s; NodeName = inNodeName; setTitle("SNMP Send Data"); initGUI(); final JPanel panel = new JPanel(); getContentPane().add(panel, BorderLayout.SOUTH); btnOk = new JButton(); btnOk.setEnabled(true); btnOk.setToolTipText("Send SNMP message"); btnOk.setName("btnOK"); btnOk.setText("OK"); btnOk.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { okButton(); } }); panel.add(btnOk); final JButton btnCancel = new JButton(); btnCancel.setToolTipText("Cancel changes"); btnCancel.setName("btnCancel"); btnCancel.setText("Cancel"); btnCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { cancelButton(); } }); panel.add(btnCancel); this.getRootPane().setDefaultButton(btnOk); this.setDefaultCloseOperation(JDialog.EXIT_ON_CLOSE); this.setLocationRelativeTo(null); this.setModal(true); this.setVisible(true); } private void initGUI() { try { setSize(350, 225); backpanel = new JPanel(); backpanel.setMinimumSize(new Dimension(200, 10)); this.getContentPane().add(backpanel, BorderLayout.CENTER); GridBagLayout backpanelLayout = new GridBagLayout(); backpanel.setPreferredSize(new java.awt.Dimension(264, 213)); backpanelLayout.columnWeights = new double[] {}; backpanelLayout.columnWidths = new int[] {100,150}; backpanelLayout.rowWeights = new double[] {0.0}; backpanelLayout.rowHeights = new int[] {5,5,5,5}; backpanel.setLayout(backpanelLayout); // ***** IP address ***** lblIPAddress = new JLabel(); lblIPAddress.setText("IP Address:"); backpanel.add(lblIPAddress, new GridBagConstraints(0,0,1,1,0.0,1.0,GridBagConstraints.LINE_END, GridBagConstraints.HORIZONTAL,new Insets(0, 0, 0, 16),0,0)); txtIPAddress = new JTextField(); txtIPAddress.setEnabled(true); backpanel.add(txtIPAddress, new GridBagConstraints(1,0,1,1,0.0,1.0,GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL,new Insets(0, 0, 0, 16),0,0)); // txtIPAddress.addFocusListener(new FocusAdapter() { // public void focusLost(FocusEvent e) { // lblError.setVisible(false); // } // }); // ***** Port ***** lblPort = new JLabel(); lblPort.setText("Destination port:"); backpanel.add(lblPort, new GridBagConstraints(0,1,1,1,0.0,1.0,GridBagConstraints.LINE_END, GridBagConstraints.HORIZONTAL,new Insets(0, 0, 0, 16),0,0)); txtPort = new JTextField(); txtPort.setEnabled(true); backpanel.add(txtPort, new GridBagConstraints(1,1,1,1,0.0,1.0,GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL,new Insets(0, 0, 0, 16),0,0)); // ***** Message ***** lblMessage = new JLabel(); lblMessage.setText("SNMP message"); backpanel.add(lblMessage, new GridBagConstraints(0,2,1,1,0.0,1.0,GridBagConstraints.LINE_END, GridBagConstraints.HORIZONTAL,new Insets(0, 0, 0, 16),0,0)); txtMessage = new JTextField(); txtMessage.setEnabled(true); backpanel.add(txtMessage, new GridBagConstraints(1,2,1,1,0.0,1.0,GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL,new Insets(0, 0, 0, 16),0,0)); // ***** Variables ***** lblVariables = new JLabel(); lblVariables.setText("Variables"); backpanel.add(lblVariables, new GridBagConstraints(0,3,1,1,0.0,1.0,GridBagConstraints.LINE_END, GridBagConstraints.HORIZONTAL,new Insets(0, 0, 0, 16),0,0)); txtVariables = new JTextField(); txtVariables.setEnabled(true); backpanel.add(txtVariables, new GridBagConstraints(1,3,1,1,0.0,1.0,GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL,new Insets(0, 0, 0, 16),0,0)); // ***** Password ***** lblPassword = new JLabel(); lblPassword.setText("Password"); backpanel.add(lblPassword, new GridBagConstraints(0,4,1,1,0.0,1.0,GridBagConstraints.LINE_END, GridBagConstraints.HORIZONTAL,new Insets(0, 0, 0, 16),0,0)); txtPassword = new JTextField(); txtPassword.setEnabled(true); backpanel.add(txtPassword, new GridBagConstraints(1,4,1,1,0.0,1.0,GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL,new Insets(0, 0, 0, 16),0,0)); // ***** ERROR ***** lblError = new JLabel(); lblError.setVisible(false); lblError.setForeground(Color.RED); lblError.setText(" "); backpanel.add(lblError, new GridBagConstraints(0,5,2,1,0.0,1.0,GridBagConstraints.LINE_END, GridBagConstraints.HORIZONTAL,new Insets(0, 0, 0, 16),0,0)); } catch (Exception e) { e.printStackTrace(); } } /** * This method is executed when the user hit's the enter button. * It will then test if the IP address can be set, or if the subnetmask * can be set and if the default gateway can be set. * * @author QweR * */ private void okButton(){ try { if(txtIPAddress.getText()==null || txtIPAddress.getText().compareTo("")==0) { lblError.setText("Enter IP address!"); lblError.setVisible(true); } else if(txtPort.getText()==null || txtPort.getText().compareTo("")==0) { lblError.setText("Enter port!"); lblError.setVisible(true); } else if(txtMessage.getText()==null || txtMessage.getText().compareTo("")==0) { lblError.setText("Enter SNMP message!"); lblError.setVisible(true); } else if(txtVariables.getText()==null || txtVariables.getText().compareTo("")==0) { lblError.setText("Enter varibles!"); lblError.setVisible(true); } else if(txtPassword.getText()==null || txtPassword.getText().compareTo("")==0) { lblError.setText("Enter password!"); lblError.setVisible(true); } else { Vector<String> vars = new Vector<String>(0); Vector<String> vals = new Vector<String>(0); if(parseVariablesList(txtVariables.getText(),vars,vals)) { String s = txtMessage.getText().toLowerCase(); if(s.compareTo("get")==0) { controller.addToConsole("Trying to send get-Request '" + txtMessage.getText() + "' from " + NodeName + " to " + txtIPAddress.getText() + ":" + txtPort.getText() + "\n"); ((SNMP)((core.ApplicationLayerDevice)Sim.getNode(NodeName)).getApp(30161)).getRequest(txtIPAddress.getText(), Integer.valueOf(txtPort.getText()).intValue(), vars, txtPassword.getText()); this.dispose(); } else if(s.compareTo("getnext")==0) { controller.addToConsole("Trying to send getnext-Request '" + txtMessage.getText() + "' from " + NodeName + " to " + txtIPAddress.getText() + ":" + txtPort.getText() + "\n"); ((SNMP)((core.ApplicationLayerDevice)Sim.getNode(NodeName)).getApp(30161)).getNextRequest(txtIPAddress.getText(), Integer.valueOf(txtPort.getText()).intValue(), vars, txtPassword.getText()); this.dispose(); } else if(s.compareTo("set")==0) { controller.addToConsole("Trying to send set-Request '" + txtMessage.getText() + "' from " + NodeName + " to " + txtIPAddress.getText() + ":" + txtPort.getText() + "\n"); ((SNMP)((core.ApplicationLayerDevice)Sim.getNode(NodeName)).getApp(30161)).setRequest(txtIPAddress.getText(), Integer.valueOf(txtPort.getText()).intValue(), vars, vals, txtPassword.getText()); this.dispose(); } else { lblError.setText("unsupported SNMP message!"); lblError.setVisible(true); } } } } catch (Exception e) { e.printStackTrace(); } } /** * This method is executed when the user hits the cancel button * @author QweR * */ private void cancelButton(){ this.dispose(); } private boolean parseVariablesList(String s, Vector<String> vars, Vector<String> vals) { vars.clear(); vals.clear(); String[] onevar = s.split(";"); for(int i=0;i<onevar.length;i++) { String[] var_value = onevar[i].split("="); if(var_value.length==1) { String vari = deleteSpaces(var_value[0]); vars.add(vari); } else if(var_value.length==2) { String vari = deleteSpaces(var_value[0]); String valuei = deleteSpaces(var_value[1]); if(valuei.startsWith("\"") && valuei.endsWith("\"")) { vars.add(vari); vals.add(valuei.substring(1, valuei.length()-1)); } else return false; } else return false; } return true; } private String deleteSpaces(String s) { while(s.startsWith(" ")) s = s.substring(1); while(s.endsWith(" ")) s = s.substring(0, s.length()-1); return s; } } |
From: QweR <qw...@us...> - 2006-02-09 23:12:47
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2985/guiUI Modified Files: ApplicationLayerDevice.java MainScreen.java Log Message: Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** MainScreen.java 5 Feb 2006 14:01:51 -0000 1.28 --- MainScreen.java 9 Feb 2006 23:12:39 -0000 1.29 *************** *** 121,124 **** --- 121,125 ---- import core.protocolsuite.tcp_ip.Echo; import core.protocolsuite.tcp_ip.Echo_tcp; + import core.protocolsuite.tcp_ip.SNMP; *************** *** 3046,3049 **** --- 3047,3076 ---- } + public void SNMPStartAgent(String inNodeName) { + String port = JOptionPane.showInputDialog(this, "Port:", "Set SNMP agent listening on port.", JOptionPane.QUESTION_MESSAGE); + if(port!=null){ + String password = JOptionPane.showInputDialog(this, "Password:","Set SNMP password for agent", JOptionPane.QUESTION_MESSAGE); + if(password!=null) { + try{ + SNMP snmpa = (SNMP)((core.ApplicationLayerDevice)Sim.getNode(inNodeName)).getApp(161); + snmpa.setPassword(password); + snmpa.setPort(Integer.valueOf(port).intValue()); + snmpa.Listen(); + printLayerInfo(true); + } + catch(Exception e){ + addToConsole(e.toString()); + } + printLayerInfo(true); + } + } + } + + public void SNMPSendMessage(String inNodeName) { + // printNetworkStart(); + new SNMPSendDataDialog(this, Sim, inNodeName); + printLayerInfo(true); + } + Index: ApplicationLayerDevice.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/ApplicationLayerDevice.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ApplicationLayerDevice.java 1 Dec 2005 19:51:53 -0000 1.5 --- ApplicationLayerDevice.java 9 Feb 2006 23:12:39 -0000 1.6 *************** *** 27,30 **** --- 27,32 ---- private JMenuItem mnuEchotcpSend = new JMenuItem("Send data via tcp echo client."); private JMenu mnuAppLayer = new JMenu("Applications"); + private JMenuItem mnuSNMPAgent = new JMenuItem("Start SNMP agent"); + private JMenuItem mnuSNMPManager = new JMenuItem("Send SNMP message"); /** Creates a new instance of ApplicationLayerDevice */ *************** *** 66,69 **** --- 68,86 ---- mnuAppLayer.add(mnuEchotcpListen); mnuAppLayer.add(mnuEchotcpSend); + + mnuSNMPAgent.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e){ + controller.SNMPStartAgent(lblNodeName.getText()); + } + }); + + mnuSNMPManager.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e){ + controller.SNMPSendMessage(lblNodeName.getText()); + } + }); + mnuAppLayer.addSeparator(); + mnuAppLayer.add(mnuSNMPAgent); + mnuAppLayer.add(mnuSNMPManager); } } |
From: QweR <qw...@us...> - 2006-02-09 23:12:47
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2985/core Modified Files: PC.java Log Message: Index: PC.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/PC.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PC.java 27 Nov 2005 14:28:22 -0000 1.6 --- PC.java 9 Feb 2006 23:12:39 -0000 1.7 *************** *** 1,67 **** ! package core; ! /* ! Java Firewall Simulator (jFirewallSim) ! ! Copyright (c) 2004, jFirewallSim development team All rights reserved. ! ! Redistribution and use in source and binary forms, with or without modification, are ! permitted provided that the following conditions are met: ! ! - Redistributions of source code must retain the above copyright notice, this list ! of conditions and the following disclaimer. ! - Redistributions in binary form must reproduce the above copyright notice, this list ! of conditions and the following disclaimer in the documentation and/or other ! materials provided with the distribution. ! - Neither the name of the Canberra Institute of Technology nor the names of its ! contributors may be used to endorse or promote products derived from this software ! without specific prior written permission. ! ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY ! EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ! OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ! THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ! EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ! HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ! TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ! EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ! */ ! ! import core.protocolsuite.tcp_ip.Echo; ! import core.protocolsuite.tcp_ip.Echo_tcp; ! ! /** ! * A PC is considered to be a client PC in a network which only has one NetworkInterface. The addInterface ! * method of the inherited Node class is overridden to only allow one NetworkInterface to be added. ! * @author tristan_veness ! * @since 13 June 2004 ! * @version v0.10 ! */ ! ! class PC extends ApplicationLayerDevice { ! ! ! /** ! * Constructs a PC with the specified name. ! * @author tristan_veness ! * @param inName - A name to give the new PC Node. eg: PC1 ! * @version v0.10 ! */ ! protected PC(String inName) { ! super(inName,7); ! ! Echo echoServer = new Echo(NodeProtocolStack, 7, 1, core.ProtocolStack.UIDGen++); ! Echo echoClient = new Echo(NodeProtocolStack, 0, 0, core.ProtocolStack.UIDGen++); ! ! Echo_tcp echotcpServer = new Echo_tcp(NodeProtocolStack, 17, 1, core.ProtocolStack.UIDGen++); ! Echo_tcp echotcpClient = new Echo_tcp(NodeProtocolStack, 0, 0, core.ProtocolStack.UIDGen++); ! ! addApp(echoServer, 7); ! addApp(echoClient, 30007); ! ! addApp(echotcpServer, 17); ! addApp(echotcpClient, 30017); ! ! addNetworkInterface("eth0"); ! } ! }//EOF --- 1,141 ---- ! package core; ! ! /* ! ! Java Firewall Simulator (jFirewallSim) ! ! ! ! Copyright (c) 2004, jFirewallSim development team All rights reserved. ! ! ! ! Redistribution and use in source and binary forms, with or without modification, are ! ! permitted provided that the following conditions are met: ! ! ! ! - Redistributions of source code must retain the above copyright notice, this list ! ! of conditions and the following disclaimer. ! ! - Redistributions in binary form must reproduce the above copyright notice, this list ! ! of conditions and the following disclaimer in the documentation and/or other ! ! materials provided with the distribution. ! ! - Neither the name of the Canberra Institute of Technology nor the names of its ! ! contributors may be used to endorse or promote products derived from this software ! ! without specific prior written permission. ! ! ! ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY ! ! EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ! ! OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ! ! THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ! ! EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ! ! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ! ! HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR ! ! TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ! ! EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ! ! */ ! ! ! ! import core.protocolsuite.tcp_ip.Echo; ! ! import core.protocolsuite.tcp_ip.Echo_tcp; ! import core.protocolsuite.tcp_ip.SNMP; ! ! ! ! /** ! ! * A PC is considered to be a client PC in a network which only has one NetworkInterface. The addInterface ! ! * method of the inherited Node class is overridden to only allow one NetworkInterface to be added. ! ! * @author tristan_veness ! ! * @since 13 June 2004 ! ! * @version v0.10 ! ! */ ! ! ! ! class PC extends ApplicationLayerDevice { ! ! ! ! ! ! /** ! ! * Constructs a PC with the specified name. ! ! * @author tristan_veness ! ! * @param inName - A name to give the new PC Node. eg: PC1 ! ! * @version v0.10 ! ! */ ! ! protected PC(String inName) { ! ! super(inName,7); ! ! ! ! Echo echoServer = new Echo(NodeProtocolStack, 7, 1, core.ProtocolStack.UIDGen++); ! ! Echo echoClient = new Echo(NodeProtocolStack, 0, 0, core.ProtocolStack.UIDGen++); ! ! ! ! Echo_tcp echotcpServer = new Echo_tcp(NodeProtocolStack, 17, 1, core.ProtocolStack.UIDGen++); ! ! Echo_tcp echotcpClient = new Echo_tcp(NodeProtocolStack, 0, 0, core.ProtocolStack.UIDGen++); ! ! SNMP snmpAgent = new SNMP(NodeProtocolStack, 161, 0, core.ProtocolStack.UIDGen++); ! SNMP snmpManager = new SNMP(NodeProtocolStack, 0, 1, core.ProtocolStack.UIDGen++); ! ! ! ! addApp(echoServer, 7); ! ! addApp(echoClient, 30007); ! ! ! ! addApp(echotcpServer, 17); ! ! addApp(echotcpClient, 30017); ! ! addApp(snmpAgent, 161); ! addApp(snmpManager, 30161); ! ! ! ! addNetworkInterface("eth0"); ! ! } ! ! }//EOF ! |
From: QweR <qw...@us...> - 2006-02-09 23:12:47
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2985/core/protocolsuite/tcp_ip Modified Files: SNMP.java Log Message: Index: SNMP.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/SNMP.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SNMP.java 1 Feb 2006 21:38:59 -0000 1.7 --- SNMP.java 9 Feb 2006 23:12:39 -0000 1.8 *************** *** 48,53 **** public class SNMP extends Application{ ! public final static int SNMP_ERROR_DPI_noError = 0; ! public final static int SNMP_ERROR_DPI_notFound = 102; public final static int SNMP_GET = 1; public final static int SNMP_GETNEXT = 2; --- 48,61 ---- public class SNMP extends Application{ ! public final static int SNMP_ERROR_noError = 0; [...1142 lines suppressed...] - * @author gift (sourceforge.net user) - * @version v0.01 - */ - public void RecvIP(String IP) throws LowLinkException, TransportLayerException - { - - } - - /** - * This method recieves source port number of a packet - * @param data to receive - * @author gift (sourceforge.net user) - * @version v0.01 - */ - public void RecvPrt(int port_num) throws LowLinkException, TransportLayerException - { - - } } --- 1069,1071 ---- |
From: Alexander B. <da...@us...> - 2006-02-05 14:02:00
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18260/guiUI Modified Files: MainScreen.java Log Message: Minor fixes and Forward ARP packet FIX. Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** MainScreen.java 8 Dec 2005 20:56:48 -0000 1.27 --- MainScreen.java 5 Feb 2006 14:01:51 -0000 1.28 *************** *** 3029,3033 **** printNetworkStart(); ! ((Echo)((core.ApplicationLayerDevice)Sim.getNode(inNodeName)).getApp(30007)).SendEcho(msg, ip, Integer.valueOf(port).intValue(), Integer.valueOf(cnt).intValue()); --- 3029,3033 ---- printNetworkStart(); ! //=<150 ((Echo)((core.ApplicationLayerDevice)Sim.getNode(inNodeName)).getApp(30007)).SendEcho(msg, ip, Integer.valueOf(port).intValue(), Integer.valueOf(cnt).intValue()); *************** *** 3102,3106 **** timer=new Timer(); timer.schedule(new TTask(this, 1),4000,4000); ! ((Echo_tcp)((core.ApplicationLayerDevice)Sim.getNode(inNodeName)).getApp(30017)).SendEcho(msg, ip, Integer.valueOf(port).intValue(), Integer.valueOf(cnt).intValue()); --- 3102,3106 ---- timer=new Timer(); timer.schedule(new TTask(this, 1),4000,4000); ! //=<150 ((Echo_tcp)((core.ApplicationLayerDevice)Sim.getNode(inNodeName)).getApp(30017)).SendEcho(msg, ip, Integer.valueOf(port).intValue(), Integer.valueOf(cnt).intValue()); |
From: Alexander B. <da...@us...> - 2006-02-05 14:01:59
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18260/core/protocolsuite/tcp_ip Modified Files: ProtocolStack.java Udp.java Log Message: Minor fixes and Forward ARP packet FIX. Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** ProtocolStack.java 8 Dec 2005 20:56:48 -0000 1.35 --- ProtocolStack.java 5 Feb 2006 14:01:51 -0000 1.36 *************** *** 356,360 **** String destMAC = null; ! // --- 356,360 ---- String destMAC = null; ! if(!(inPacket instanceof ARP_packet)){ // *************** *** 440,444 **** } ! } --- 440,444 ---- } ! } } Index: Udp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Udp.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** Udp.java 1 Feb 2006 21:38:59 -0000 1.33 --- Udp.java 5 Feb 2006 14:01:51 -0000 1.34 *************** *** 616,622 **** UDP_Info.setDescription("UDP application is now listening on UDP port "+ inPort +"."); Simulation.addLayerInfo(UDP_Info); */ ! } ! ! /** * This method finds destination IP (host) for an application. --- 616,624 ---- UDP_Info.setDescription("UDP application is now listening on UDP port "+ inPort +"."); Simulation.addLayerInfo(UDP_Info); */ ! } ! ! ! ! /** * This method finds destination IP (host) for an application. |
From: gift <gi...@us...> - 2006-02-01 21:39:18
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6767/core/protocolsuite/tcp_ip Modified Files: Echo.java Echo_tcp.java SNMP.java Udp.java Log Message: UDP counter bug fixed Index: Echo_tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Echo_tcp.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Echo_tcp.java 8 Dec 2005 20:32:52 -0000 1.19 --- Echo_tcp.java 1 Feb 2006 21:38:59 -0000 1.20 *************** *** 254,257 **** --- 254,279 ---- } + /** + * This method recieves source IP of a packet + * @param data to receive + * @author gift (sourceforge.net user) + * @version v0.01 + */ + public void RecvIP(String IP) throws LowLinkException, TransportLayerException + { + + } + + /** + * This method recieves source port number of a packet + * @param data to receive + * @author gift (sourceforge.net user) + * @version v0.01 + */ + public void RecvPrt(int port_num) throws LowLinkException, TransportLayerException + { + + } + } Index: Udp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Udp.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** Udp.java 10 Jan 2006 16:23:01 -0000 1.32 --- Udp.java 1 Feb 2006 21:38:59 -0000 1.33 *************** *** 254,257 **** --- 254,259 ---- Simulation.addLayerInfo(UDP_Info); + IncReceivedDatagrammsNumber(); + listener = (Application)Elm.application; listener.RecvIP(inPacket.getSourceIPAddress()); Index: Echo.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Echo.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Echo.java 8 Dec 2005 20:10:56 -0000 1.17 --- Echo.java 1 Feb 2006 21:38:59 -0000 1.18 *************** *** 208,211 **** --- 208,236 ---- } + /** + * This method recieves source IP of a packet + * @param data to receive + * @author gift (sourceforge.net user) + * @version v0.01 + */ + public void RecvIP(String IP) throws LowLinkException, TransportLayerException + { + + } + + /** + * This method recieves source port number of a packet + * @param data to receive + * @author gift (sourceforge.net user) + * @version v0.01 + */ + public void RecvPrt(int port_num) throws LowLinkException, TransportLayerException + { + + } + + + + } Index: SNMP.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/SNMP.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SNMP.java 9 Dec 2005 23:30:33 -0000 1.6 --- SNMP.java 1 Feb 2006 21:38:59 -0000 1.7 *************** *** 778,780 **** --- 778,802 ---- } } + + /** + * This method recieves source IP of a packet + * @param data to receive + * @author gift (sourceforge.net user) + * @version v0.01 + */ + public void RecvIP(String IP) throws LowLinkException, TransportLayerException + { + + } + + /** + * This method recieves source port number of a packet + * @param data to receive + * @author gift (sourceforge.net user) + * @version v0.01 + */ + public void RecvPrt(int port_num) throws LowLinkException, TransportLayerException + { + + } } |
From: gift <gi...@us...> - 2006-01-10 16:23:14
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14875/core/protocolsuite/tcp_ip Modified Files: Application.java Udp.java Log Message: nnn Index: Application.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Application.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Application.java 8 Dec 2005 19:35:07 -0000 1.14 --- Application.java 10 Jan 2006 16:23:01 -0000 1.15 *************** *** 91,94 **** --- 91,110 ---- */ public abstract void RecvData(String Data) throws LowLinkException, TransportLayerException; + + /** + * This method recieves source IP of a packet + * @param data to receive + * @author gift (sourceforge.net user) + * @version v0.01 + */ + public abstract void RecvIP(String IP) throws LowLinkException, TransportLayerException; + + /** + * This method recieves source port number of a packet + * @param data to receive + * @author gift (sourceforge.net user) + * @version v0.01 + */ + public abstract void RecvPrt(int port_num) throws LowLinkException, TransportLayerException; Index: Udp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Udp.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** Udp.java 7 Dec 2005 13:24:51 -0000 1.31 --- Udp.java 10 Jan 2006 16:23:01 -0000 1.32 *************** *** 255,258 **** --- 255,260 ---- listener = (Application)Elm.application; + listener.RecvIP(inPacket.getSourceIPAddress()); + listener.RecvPrt(inPacket.get_srcPort()); listener.RecvData(inPacket.getUDP_message()); |
From: QweR <qw...@us...> - 2005-12-09 23:30:48
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11743/core/protocolsuite/tcp_ip Modified Files: SNMP.java Log Message: Index: SNMP.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/SNMP.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SNMP.java 8 Dec 2005 16:45:10 -0000 1.5 --- SNMP.java 9 Dec 2005 23:30:33 -0000 1.6 *************** *** 47,53 **** public class SNMP extends Application{ ! private static int SNMPID = 0; ! private static Vector<SNMPInstance> SNMPgroups; public SNMP(ProtocolStack inParentStack, int listenPort, int appType, int UID) { --- 47,74 ---- public class SNMP extends Application{ ! ! public final static int SNMP_ERROR_DPI_noError = 0; ! public final static int SNMP_ERROR_DPI_notFound = 102; ! public final static int SNMP_GET = 1; ! public final static int SNMP_GETNEXT = 2; ! public final static int SNMP_SET = 3; ! public final static int SNMP_TRAP = 4; ! public final static int SNMP_RESPONSE = 5; private static int SNMPID = 0; ! private Vector<SNMPInstance> SNMPgroups; ! //following variables be actual temporality ! private int m_len=0; ! private int m_majorver=0; ! private int m_minorver=0; ! private int m_release=0; ! private int m_id=0; ! private int m_type=0; ! private int m_errorstatus=0; ! private int m_errorindex=0; ! private int m_generictrap=0; ! private int m_specifictrap=0; ! private String m_password=""; ! private Vector<String> m_vars = new Vector<String>(0); ! private Vector<String> m_values = new Vector<String>(0); public SNMP(ProtocolStack inParentStack, int listenPort, int appType, int UID) { *************** *** 67,71 **** * This method start to listen on application port * @author QweR - * @return Nothing. * @version v0.01 */ --- 88,91 ---- *************** *** 82,86 **** * This method stop listening on application port * @author QweR - * @return Nothing. * @version v0.01 */ --- 102,105 ---- *************** *** 129,133 **** */ public void RecvData(String Data) throws LowLinkException, TransportLayerException { ! } --- 148,190 ---- */ public void RecvData(String Data) throws LowLinkException, TransportLayerException { ! try { ! if(parse(Data)==0) { ! updateValues(); ! switch(m_type) { ! case SNMP_GET: { ! if(appType==0) { ! getResponse(m_vars, m_values, m_errorstatus, m_errorindex); ! } ! break; ! } ! case SNMP_GETNEXT: { ! if(appType==0) { ! // some actions ! getResponse(m_vars, m_values, m_errorstatus, m_errorindex); ! } ! break; ! } ! case SNMP_SET: { ! if(appType==0) { ! getResponse(m_vars, m_values, m_errorstatus, m_errorindex); ! } ! break; ! } ! case SNMP_TRAP: { ! ! break; ! } ! case SNMP_RESPONSE: { ! ! break; ! } ! default: break; ! } ! } ! else printInfo("invalid(corrupted?) packet!!!"); ! } ! catch (CommunicationException e) { ! //print anything...? ! } } *************** *** 135,144 **** * This method realize Get-request function of SNMPv2. * @param r vector of String. String as 'group.instance' * @author QweR * @version v0.01 */ ! public void GetRequest(Vector<String> r) throws LowLinkException, TransportLayerException, CommunicationException { ! String pack = CreateSNMPHeader(getNextID(),0); ! SendData(pack); } --- 192,208 ---- * This method realize Get-request function of SNMPv2. * @param r vector of String. String as 'group.instance' + * @return false if one or more variables not exist * @author QweR * @version v0.01 */ ! public boolean getRequest(Vector<String> r,String password) throws LowLinkException, TransportLayerException, CommunicationException { ! String pack = createSNMPHeader(getNextID(),SNMP_GET); ! pack += createSNMPPassword(password); ! String tmp = createSNMPVars(r); ! if(tmp.compareTo("")==0) { ! return false; ! } ! SendData(pack+tmp); ! return true; } *************** *** 146,155 **** * This method realize Get-next-request function of SNMPv2. * @param r vector of String. String as 'group.instance' * @author QweR * @version v0.01 */ ! public void GetNextRequest(Vector<String> r) throws LowLinkException, TransportLayerException, CommunicationException { ! String pack = CreateSNMPHeader(getNextID(),1); ! SendData(pack); } --- 210,226 ---- * This method realize Get-next-request function of SNMPv2. * @param r vector of String. String as 'group.instance' + * @return false if one or more variables not exist * @author QweR * @version v0.01 */ ! public boolean getNextRequest(Vector<String> r,String password) throws LowLinkException, TransportLayerException, CommunicationException { ! String pack = createSNMPHeader(getNextID(),SNMP_GETNEXT); ! pack += createSNMPPassword(password); ! String tmp = createSNMPVars(r); ! if(tmp.compareTo("")==0) { ! return false; ! } ! SendData(pack+tmp); ! return true; } *************** *** 158,167 **** * @param r vector of String. String as 'group.instance' * @param v vector of String. String as 'value' * @author QweR * @version v0.01 */ ! public void SetRequest(Vector<String> r,Vector<String> v) throws LowLinkException, TransportLayerException, CommunicationException { ! String pack = CreateSNMPHeader(getNextID(),2); ! SendData(pack); } --- 229,245 ---- * @param r vector of String. String as 'group.instance' * @param v vector of String. String as 'value' + * @return false if one or more variables not exist * @author QweR * @version v0.01 */ ! public boolean setRequest(Vector<String> r,Vector<String> v,String password) throws LowLinkException, TransportLayerException, CommunicationException { ! String pack = createSNMPHeader(getNextID(),SNMP_SET); ! pack += createSNMPPassword(password); ! String tmp = createSNMPVarsValues(r,v); ! if(tmp.compareTo("")==0) { ! return false; ! } ! SendData(pack+tmp); ! return true; } *************** *** 170,179 **** * @param r vector of String. String as 'group.instance' * @param v vector of String. String as 'value' * @author QweR * @version v0.01 */ ! public void GetResponse(Vector<String> r,Vector<String> v) throws LowLinkException, TransportLayerException, CommunicationException { ! String pack = CreateSNMPHeader(getNextID(),3); ! SendData(pack); } --- 248,264 ---- * @param r vector of String. String as 'group.instance' * @param v vector of String. String as 'value' + * @return false if one or more variables not exist * @author QweR * @version v0.01 */ ! public boolean getResponse(Vector<String> r,Vector<String> v,int es,int ei) throws LowLinkException, TransportLayerException, CommunicationException { ! String pack = createSNMPHeader(getNextID(),SNMP_RESPONSE); ! pack += createSNMPError(es,ei); ! String tmp = createSNMPVarsValues(r,v); ! if(tmp.compareTo("")==0) { ! return false; ! } ! SendData(pack+tmp); ! return true; } *************** *** 182,199 **** * @param r vector of String. String as 'group.instance' * @param v vector of String. String as 'value' * @author QweR * @version v0.01 */ ! public void Trap(Vector<String> r,Vector<String> v) throws LowLinkException, TransportLayerException, CommunicationException { } /** ! * This method create a SNMP header for all type packets. ! * @param Data to recv * @author QweR * @version v0.01 */ ! protected static String CreateSNMPHeader(int id,int type) { char[] c = new char[8]; --- 267,443 ---- * @param r vector of String. String as 'group.instance' * @param v vector of String. String as 'value' + * @return false if one or more variables not exist * @author QweR * @version v0.01 */ ! public boolean trap(Vector<String> r,Vector<String> v,int gtc,int stc) throws LowLinkException, TransportLayerException, CommunicationException { ! String pack = createSNMPHeader(getNextID(),SNMP_TRAP); ! pack += createSNMPTrap(gtc,stc); ! String tmp = createSNMPVarsValues(r,v); ! if(tmp.compareTo("")==0) { ! return false; ! } ! SendData(pack+tmp); ! return true; ! } ! ! /** ! * This method parse incoming packet. ! * @param in incoming packet ! * @return result of parsing: ! * if 0 then successful pasre ! * if 1 then error in main header ! * if 2 then error in password block ! * if 3 then error in error block ! * if 4 then error in trap block ! * if 5 then error in variables block ! * if 6 then error in values block ! * @author QweR ! * @version v0.01 ! */ ! public int parse(String in) { ! String out=""; + if(parseSNMPHeader(in,out)) { + in=out; + switch(m_type) { + case SNMP_GET: { + if(parseSNMPPassword(in, out)) { + if(parseSNMPVars(out)) { + //printInfo("recieved GET"); + } + else return 5; + } + else return 2; + break; + } + case SNMP_GETNEXT: { + if(parseSNMPPassword(in, out)) { + if(parseSNMPVars(out)) { + //printInfo("recieved GETNEXT"); + } + else return 5; + } + else return 2; + break; + } + case SNMP_SET: { + if(parseSNMPPassword(in, out)) { + if(parseSNMPVarsValues(out)) { + //printInfo("recieved SET"); + } + else return 6; + } + else return 2; + break; + } + case SNMP_TRAP: { + if(parseSNMPTrap(in, out)) { + if(parseSNMPVars(out)) { + //printInfo("recieved GET."); + } + else return 5; + } + else return 4; + break; + } + case SNMP_RESPONSE: { + if(parseSNMPError(in, out)) { + if(parseSNMPVarsValues(out)) { + //printInfo("recieved RESPONSE"); + } + else return 6; + } + else return 3; + break; + } + default: return 1; + } + } + else return 1; + return 0; } /** ! * This method update SNMP values. * @author QweR * @version v0.01 */ ! protected void updateValues() { ! ! } ! ! /** ! * This method gets values from vector of 'group.instance'. ! * @param r vector of String. String as 'group.instance' ! * @param v vector of String. String as 'value' ! * return if result equals zero then function successful complete ! * if result == 1 then invalid variable name (without dots). ! * if result == 2 then not found groupID. ! * if result == 3 then not found instenceID ! * @author QweR ! * @version v0.01 ! */ ! protected int getValues(Vector<String> r,Vector<String> v) { ! v = new Vector<String>(0); ! String[] a; ! int i,g,h; ! ! for(i=0;i<r.size();i++) { ! a = r.get(i).split("."); ! if(a.length>=2) { ! if((g=getGroupID(a[0]))!=-1) { ! if((h=SNMPgroups.get(g).getInstanceID(a[1]))!=-1) { ! v.add(SNMPgroups.get(g).value.get(h)); ! } ! else return 3; ! } ! else return 2; ! } ! else return 1; ! } ! return 0; ! } ! ! /** ! * This method sets values from vector of 'group.instance' and 'value'. ! * @param r vector of String. String as 'group.instance' ! * @param v vector of String. String as 'value' ! * return if result equals zero then function successful complete ! * if result == 1 then invalid variable name (without dots) ! * if result == 2 then not found groupID ! * if result == 3 then not found instenceID ! * @author QweR ! * @version v0.01 ! */ ! protected int setValues(Vector<String> r,Vector<String> v) { ! String[] a; ! int i,g,h; ! ! for(i=0;i<r.size();i++) { ! a = r.get(i).split("."); ! if(a.length>=2) { ! if((g=getGroupID(a[0]))!=-1) { ! if((h=SNMPgroups.get(g).getInstanceID(a[1]))!=-1) { ! SNMPgroups.get(g).value.set(h,v.get(i)); ! } ! else return 3; ! } ! else return 2; ! } ! else return 1; ! } ! return 0; ! } ! ! /** ! * This method create SNMP header for all type packets. ! * @param id identifier of message ! * @param type type of message ! * @return string SNMP header ! * @author QweR ! * @version v0.01 ! */ ! protected String createSNMPHeader(int id,int type) { char[] c = new char[8]; *************** *** 209,249 **** /** ! * This method recieves data from the other side. ! * @param Data to recv * @author QweR * @version v0.01 */ ! //protected static String CreateSNMPVars(Vector<String> r) { ! //} /** ! * This method recieves data from the other side. ! * @param Data to recv * @author QweR * @version v0.01 */ ! //protected static String CreateSNMPVarsValue(Vector<String> r,Vector<String> v) { ! //} /** ! * This method parse incomimg packet and return readable data. ! * @param Data to recv * @author QweR * @version v0.01 */ ! protected static boolean ParseSNMPMessage(int ver,String pass,int type,int id,int er,int erindex,Vector<String> r) { return true; } /** * This method gets next value of SNMPID modulo 2^16. - * @param Data to recv * @author QweR * @version v0.01 */ ! protected static int getNextID() { if(SNMPID>=65535) SNMPID=0; else SNMPID++; --- 453,714 ---- /** ! * This method create SNMP password header. ! * @param pass password ! * @return string SNMP password header * @author QweR * @version v0.01 */ ! protected String createSNMPPassword(String pass) { ! char[] c = new char[2]; ! c[0]=(char)(pass.length()/256); ! c[1]=(char)(pass.length()%256); ! return (String.copyValueOf(c)+pass); ! } /** ! * This method create SNMP array of group+instance. ! * @param r vector of variables ! * @return string SNMP variables * @author QweR * @version v0.01 */ ! protected String createSNMPVars(Vector<String> r) { ! int i,g,h; ! String[] gi; ! String out = null; ! char[] c = new char[4]; ! for(i=0;i<r.size();i++) { ! gi = r.get(i).split("."); ! ! if((g=getGroupID(gi[0]))!=-1) { ! if((h=SNMPgroups.get(g).getInstanceID(gi[1]))!=-1) { ! c[0]=(char) g; ! c[1]=0; ! c[2]=(char) h; ! c[3]=0; ! out+=String.copyValueOf(c); ! } ! else return ""; ! } ! else return ""; ! } ! return out; ! } /** ! * This method create SNMP array of group+instance+value. ! * @param r vector of variables ! * @param v vector of values conform variables ! * @return string SNMP variables with values * @author QweR * @version v0.01 */ ! protected String createSNMPVarsValues(Vector<String> r,Vector<String> v) { ! int i,g,h; ! String[] gi; ! String out = null; ! char[] c = new char[4]; ! char[] cv = null; + if(r.size()!=v.size()) return ""; + for(i=0;i<r.size();i++) { + gi = r.get(i).split("."); + + if((g=getGroupID(gi[0]))!=-1) { + if((h=SNMPgroups.get(g).getInstanceID(gi[1]))!=-1) { + c[0]=(char) g; + c[1]=0; + c[2]=(char) h; + c[3]=0; + cv = new char[3]; + cv[0]=2; + cv[1]=(char)(v.get(i).length()/256); + cv[2]=(char)(v.get(i).length()%256); + out+=String.copyValueOf(c)+String.copyValueOf(cv)+v.get(i); + } + else return ""; + } + else return ""; + } + return out; + } + + /** + * This method create SNMP error body for packet. + * @param es error status + * @param ei error index + * @return string SNMP error body + * @author QweR + * @version v0.01 + */ + protected String createSNMPError(int es,int ei) { + char[] c = new char[7]; + + c[0]=(char) es; + c[1]=(char)(ei/16777216); + c[2]=(char)((ei%16777216)/65536); + c[3]=(char)((ei%65536)/256); + c[4]=(char)(ei%256); + c[5]=0; + c[6]=0; + return (String.copyValueOf(c)); + } + + /** + * This method create SNMP trap body for packet. + * @param g generic trap code + * @param s specific trap code + * @return string SNMP trap body + * @author QweR + * @version v0.01 + */ + protected String createSNMPTrap(int g,int s) { + char[] c = new char[6]; + + c[0]=(char)(g/16777216); + c[1]=(char)((g%16777216)/65536); + c[2]=(char)((g%65536)/256); + c[3]=(char)(g%256); + c[4]=(char)(s/256); + c[5]=(char)(s%256); + return (String.copyValueOf(c)); + } + + /** + * This method parse a SNMP header to normal data. + * @param in packet + * @param last last piece of packet + * @return result of parsing: if false then error + * @author QweR + * @version v0.01 + */ + protected boolean parseSNMPHeader(String in,String last) { + m_len=in.charAt(0)*256+in.charAt(1); + m_majorver=in.charAt(2); + m_minorver=in.charAt(3); + m_release=in.charAt(4); + m_id=in.charAt(5)*256+in.charAt(6); + m_type=in.charAt(7); + last=in.substring(8); + return (m_len==in.length()-2); + } + + /** + * This method parse SNMP password header to Password. + * @param in packet, incipient from password + * @param last last piece of packet + * @return result of parsing: if false then error + * @author QweR + * @version v0.01 + */ + protected boolean parseSNMPPassword(String in,String last) { + int l; + l=in.charAt(0)*256+in.charAt(1); + if(l+2<in.length()) { + m_password=in.substring(2, l+2); + last=in.substring(l+2); + return true; + } + return false; + } + + /** + * This method parse SNMP body to array of group+instance. + * @param r packet body + * @return result of parsing: if false then error + * @author QweR + * @version v0.01 + */ + protected boolean parseSNMPVars(String r) { + char[] c = r.toCharArray(); + int i; + + m_vars.clear(); + for(i=0;i<c.length;i+=4) { + if(c[i+1]==0 && c[i+3]==0 && c[i]<SNMPgroups.size() && c[i+2]<SNMPgroups.get(c[i]).instance.size()) { + m_vars.add(SNMPgroups.get(c[i])+"."+SNMPgroups.get(c[i]).instance.get(c[i+2])); + } + else { + m_errorstatus=SNMP_ERROR_DPI_notFound; + m_errorindex=m_vars.size(); + return false; + } + } + return true; + } + + /** + * This method parse SNMP body to array of group+instance+value. + * @param in packet body + * @param v (output data) vector of values conform returned variables + * @return result of parsing: if false then error + * @author QweR + * @version v0.01 + */ + protected boolean parseSNMPVarsValues(String in) { + char[] c = in.toCharArray(); + int i,len; + + m_vars.clear(); + m_values.clear(); + for(i=0;i<c.length;i+=7) { + if(c[i+1]==0 && c[i+3]==0 && c[i]<SNMPgroups.size() && c[i+2]<SNMPgroups.get(c[i]).instance.size() && c[i+4]==2) { + len = c[i+5]*256+c[i+6]; + m_vars.add(SNMPgroups.get(c[i])+"."+SNMPgroups.get(c[i]).instance.get(c[i+2])); + m_values.add(String.copyValueOf(c, i+7, len)); + } + else { + m_errorstatus=SNMP_ERROR_DPI_notFound; + m_errorindex=m_vars.size(); + return false; + } + } return true; } /** + * This method parse SNMP error body of packet to normal data. + * @param in error header + * @param last last piece of packet + * @return result of parsing: if false then error + * @author QweR + * @version v0.01 + */ + protected boolean parseSNMPError(String in,String last) { + if(in.length()>7) { + m_errorstatus=in.charAt(0); + m_errorindex=((in.charAt(1)*256+in.charAt(2))*256+in.charAt(3))*256+in.charAt(4); + last = in.substring(7); + return true; + } + return false; + } + + /** + * This method parse SNMP trap body of packet to normal data. + * @param in trap header + * @param last last piece of packet + * @return result of parsing: if false then error + * @author QweR + * @version v0.01 + */ + protected boolean parseSNMPTrap(String in,String last) { + if(in.length()>6) { + m_generictrap=((in.charAt(0)*256+in.charAt(1))*256+in.charAt(2))*256+in.charAt(3); + m_specifictrap=in.charAt(4)+in.charAt(5); + last = in.substring(6); + return true; + } + return false; + } + + /** * This method gets next value of SNMPID modulo 2^16. * @author QweR * @version v0.01 */ ! protected int getNextID() { if(SNMPID>=65535) SNMPID=0; else SNMPID++; *************** *** 251,255 **** } ! public static int getGroupID(String n) { int i; --- 716,726 ---- } ! /** ! * This method return index by string name of variable. ! * @param n name of variable ! * @author QweR ! * @version v0.01 ! */ ! public int getGroupID(String n) { int i; *************** *** 261,264 **** --- 732,744 ---- } + protected void printInfo(String s) { + LayerInfo protInfo = new LayerInfo(getClass().getName()); + protInfo.setObjectName(mParentStack.getParentNodeName()); + protInfo.setDataType("SNMP Protocol Data"); + protInfo.setLayer("Application"); + protInfo.setDescription(s); + Simulation.addLayerInfo(protInfo); + } + public class SNMPInstance { public String name; *************** *** 270,273 **** --- 750,759 ---- } + /** + * This method return index by string name of variable. + * @param n name of variable + * @author QweR + * @version v0.01 + */ public int getInstanceID(String n) { int i; *************** *** 280,283 **** --- 766,776 ---- } + /** + * This method add variable and variable value to my MIB. + * @param i instance of variables + * @param v value of varialbes + * @author QweR + * @version v0.01 + */ public void add(String i,String v) { instance.add(i); |
From: gift <gi...@us...> - 2005-12-09 18:48:19
|
Update of /cvsroot/javanetsim/javaNetSim/configs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11226/configs Added Files: Conf_2.jfst Conf_3.jfst Log Message: more --- NEW FILE: Conf_3.jfst --- R1 GuiRouter 462,106 2 eth0|R1-TO-H_OFFICE1|172.198.99.254|255.255.0.0|null|C5:6B:93:6D:17:63|100.0 eth1|H_OFFICE2-TO-R1|121.192.0.1|255.248.0.0|null|78:24:9B:BC:65:60|100.0 0 H_OFFICE2 GuiHub 717,106 5 eth0|OFFICE2 pc1-TO-H_OFFICE2||| eth1|OFFICE2 pc2-TO-H_OFFICE2||| eth2|null||| eth3|null||| eth4|H_OFFICE2-TO-R1||| 0 H_OFFICE1 GuiHub 183,106 5 eth0|OFFICE1 pc1-TO-H_OFFICE1||| eth1|OFFICE1 pc2-TO-H_OFFICE1||| eth2|OFFICE1 pc3-TO-H_OFFICE1||| eth3|OFFICE1 pc4-TO-H_OFFICE1||| eth4|R1-TO-H_OFFICE1||| 0 OFFICE1 pc4 GuiPC 293,41 1 eth0|OFFICE1 pc4-TO-H_OFFICE1|172.198.12.254|255.255.128.0|172.198.99.254|A7:16:5A:81:99:92|100.0 1 default|172.198.99.254|255.255.0.0|0|eth0 OFFICE2 pc2 GuiPC 882,106 1 eth0|OFFICE2 pc2-TO-H_OFFICE2|121.199.253.250|255.248.0.0|121.192.0.1|21:B2:90:82:B0:4B|100.0 1 default|121.192.0.1|255.0.0.0|0|eth0 OFFICE2 pc1 GuiPC 717,7 1 eth0|OFFICE2 pc1-TO-H_OFFICE2|121.199.253.254|255.248.0.0|121.192.0.1|9A:56:A9:98:8D:28|100.0 1 default|121.192.0.1|255.0.0.0|0|eth0 OFFICE1 pc3 GuiPC 69,179 1 eth0|OFFICE1 pc3-TO-H_OFFICE1|172.198.71.254|255.255.128.0|172.198.99.254|8D:36:9F:42:46:9C|100.0 1 default|172.198.99.254|255.255.0.0|0|eth0 OFFICE1 pc2 GuiPC 288,183 1 eth0|OFFICE1 pc2-TO-H_OFFICE1|172.198.127.254|255.255.0.0|172.198.99.254|8F:A9:59:26:70:65|100.0 1 default|172.198.99.254|255.255.0.0|0|eth0 OFFICE1 pc1 GuiPC 89,37 1 eth0|OFFICE1 pc1-TO-H_OFFICE1|172.198.0.1|255.255.128.0|172.198.99.254|6B:49:71:3C:45:1B|100.0 1 default|172.198.99.254|255.255.0.0|0|eth0 --- NEW FILE: Conf_2.jfst --- BIG BOSS GuiPC 463,4 1 eth0|R1-TO-BIG BOSS|204.188.0.1|255.255.255.192|204.188.0.45|A4:7B:C0:A5:9B:30|100.0 1 default|204.188.0.45|255.255.255.0|0|eth0 R1 GuiRouter 462,106 2 eth0|R1-TO-H_OFFICE1|172.198.99.254|255.255.0.0|null|C5:6B:93:6D:17:63|100.0 eth1|R1-TO-BIG BOSS|204.188.0.45|255.255.255.0|null|78:24:9B:BC:65:60|100.0 0 OFFICE1 pc4 GuiPC 293,41 1 eth0|OFFICE1 pc4-TO-H_OFFICE1|172.198.12.254|255.255.128.0|172.198.99.254|A7:16:5A:81:99:92|100.0 1 default|172.198.99.254|255.255.0.0|0|eth0 H_OFFICE1 GuiHub 183,106 5 eth0|OFFICE1 pc1-TO-H_OFFICE1||| eth1|OFFICE1 pc2-TO-H_OFFICE1||| eth2|OFFICE1 pc3-TO-H_OFFICE1||| eth3|OFFICE1 pc4-TO-H_OFFICE1||| eth4|R1-TO-H_OFFICE1||| 0 OFFICE1 pc3 GuiPC 69,179 1 eth0|OFFICE1 pc3-TO-H_OFFICE1|172.198.71.254|255.255.128.0|172.198.99.254|8D:36:9F:42:46:9C|100.0 1 default|172.198.99.254|255.255.0.0|0|eth0 OFFICE1 pc2 GuiPC 288,183 1 eth0|OFFICE1 pc2-TO-H_OFFICE1|172.198.127.254|255.255.0.0|172.198.99.254|8F:A9:59:26:70:65|100.0 1 default|172.198.99.254|255.255.0.0|0|eth0 OFFICE1 pc1 GuiPC 89,37 1 eth0|OFFICE1 pc1-TO-H_OFFICE1|172.198.0.1|255.255.128.0|172.198.99.254|6B:49:71:3C:45:1B|100.0 1 default|172.198.99.254|255.255.0.0|0|eth0 |
From: gift <gi...@us...> - 2005-12-09 18:44:38
|
Update of /cvsroot/javanetsim/javaNetSim/configs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10291/configs Added Files: Conf_1.jfst Log Message: ttt --- NEW FILE: Conf_1.jfst --- R1 GuiRouter 462,106 2 eth0|R1-TO-H_OFFICE1|172.198.99.254|255.255.0.0|null|C5:6B:93:6D:17:63|100.0 eth1|H_OFFICE2-TO-R1|121.192.0.1|255.248.0.0|null|78:24:9B:BC:65:60|100.0 0 H_OFFICE2 GuiHub 717,106 5 eth0|OFFICE2 pc1-TO-H_OFFICE2||| eth1|OFFICE2 pc2-TO-H_OFFICE2||| eth2|null||| eth3|null||| eth4|H_OFFICE2-TO-R1||| 0 OFFICE2 pc2 GuiPC 882,106 1 eth0|OFFICE2 pc2-TO-H_OFFICE2|121.199.253.250|255.248.0.0|121.192.0.1|21:B2:90:82:B0:4B|100.0 1 default|121.192.0.1|255.0.0.0|0|eth0 OFFICE1 pc4 GuiPC 293,41 1 eth0|OFFICE1 pc4-TO-H_OFFICE1|172.198.12.254|255.255.128.0|172.198.99.254|A7:16:5A:81:99:92|100.0 1 default|172.198.99.254|255.255.0.0|0|eth0 H_OFFICE1 GuiHub 183,106 5 eth0|OFFICE1 pc1-TO-H_OFFICE1||| eth1|OFFICE1 pc2-TO-H_OFFICE1||| eth2|OFFICE1 pc3-TO-H_OFFICE1||| eth3|OFFICE1 pc4-TO-H_OFFICE1||| eth4|R1-TO-H_OFFICE1||| 0 OFFICE1 pc3 GuiPC 69,179 1 eth0|OFFICE1 pc3-TO-H_OFFICE1|172.198.71.254|255.255.128.0|172.198.99.254|8D:36:9F:42:46:9C|100.0 1 default|172.198.99.254|255.255.0.0|0|eth0 OFFICE2 pc1 GuiPC 717,7 1 eth0|OFFICE2 pc1-TO-H_OFFICE2|121.199.253.254|255.248.0.0|121.192.0.1|9A:56:A9:98:8D:28|100.0 1 default|121.192.0.1|255.0.0.0|0|eth0 OFFICE1 pc2 GuiPC 288,183 1 eth0|OFFICE1 pc2-TO-H_OFFICE1|172.198.127.254|255.255.0.0|172.198.99.254|8F:A9:59:26:70:65|100.0 1 default|172.198.99.254|255.255.0.0|0|eth0 OFFICE1 pc1 GuiPC 89,37 1 eth0|OFFICE1 pc1-TO-H_OFFICE1|172.198.0.1|255.255.128.0|172.198.99.254|6B:49:71:3C:45:1B|100.0 1 default|172.198.99.254|255.255.0.0|0|eth0 |
From: gift <gi...@us...> - 2005-12-09 17:02:18
|
Update of /cvsroot/javanetsim/javaNetSim/configs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14074/configs Log Message: Directory /cvsroot/javanetsim/javaNetSim/configs added to the repository |
From: gift <gi...@us...> - 2005-12-09 14:50:45
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17527/core/protocolsuite/tcp_ip Modified Files: Tcp.java Log Message: TCP v0.95 Index: Tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** Tcp.java 8 Dec 2005 21:33:26 -0000 1.31 --- Tcp.java 9 Dec 2005 14:50:35 -0000 1.32 *************** *** 970,978 **** Elm.sent_segments++; //UNIQUE ID Elm.seq_number++; //inc for next segment ! if (!(flags[4] && a_num==0)) Elm.sent_ACK++; //inc in case this is an ACK-segment (each segment except for 1-st SYN is ACK-segment) //this.total_sent++; //overall stats ! ! //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 --- 970,979 ---- Elm.sent_segments++; //UNIQUE ID Elm.seq_number++; //inc for next segment ! ! if (!(flags[4] && a_num==0) && flags[1]) Elm.sent_ACK++; //inc in case this is an ACK-segment //this.total_sent++; //overall stats ! ! //IF NOT ACK then pushing a copy into Hashtable ! if (!flags[1] || a_num<=1) 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 |
From: gift <gi...@us...> - 2005-12-08 21:33:39
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1502/core/protocolsuite/tcp_ip Modified Files: Tcp.java Log Message: Counters update Solntce zashlo - vsem spat!!! Index: Tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Tcp.java 8 Dec 2005 20:56:57 -0000 1.30 --- Tcp.java 8 Dec 2005 21:33:26 -0000 1.31 *************** *** 396,400 **** Simulation.addLayerInfo(TCP_Info); ! mParentStack.sendPacket((TCP_packet)Elm.SegmentsToResend.get(curkey)); } catch (Exception e) {} --- 396,400 ---- Simulation.addLayerInfo(TCP_Info); ! Elm.sent_duplicates++; mParentStack.sendPacket((TCP_packet)Elm.SegmentsToResend.get(curkey)); } catch (Exception e) {} *************** *** 1173,1176 **** --- 1173,1178 ---- System.out.println("tttttttt"); Elm.received_duplicates++; + Elm.sent_ACK++; + //Elm.sent_segments++; //Create Layer info LayerInfo TCP_Info = new LayerInfo(getClass().getName()); *************** *** 1285,1289 **** } else { //we have already received this segment ! Elm.received_duplicates++; System.out.println("t+++++++++t"); //Create Layer info --- 1287,1293 ---- } else { //we have already received this segment ! Elm.received_duplicates++; ! Elm.sent_ACK++; ! //Elm.sent_segments++; System.out.println("t+++++++++t"); //Create Layer info *************** *** 1390,1393 **** --- 1394,1399 ---- } else { //we have already received this segment Elm.received_duplicates++; + Elm.sent_ACK++; + //Elm.sent_segments++; System.out.println("t------t"); //Create Layer info |
From: gift <gi...@us...> - 2005-12-08 20:57:10
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26021/core/protocolsuite/tcp_ip Modified Files: Tcp.java Log Message: -- Index: Tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Tcp.java 8 Dec 2005 19:41:51 -0000 1.29 --- Tcp.java 8 Dec 2005 20:56:57 -0000 1.30 *************** *** 878,882 **** --- 878,907 ---- window_size=(int)ACCELER_KOEFF*inSeg/TOTAL_TIME; } + + + /** + * This method returns the ORD ACK number in + * Elm.ReceivedACKs + * @author gift (sourceforge.net user) + * @param inV vector of Integers + * @return int last ordered value + */ + private int GetNumber (Vector inV) + { + int mx=0; + boolean ordered=true; + int previous=(Integer)inV.firstElement(); + Enumeration vEnum = inV.elements(); + + while (vEnum.hasMoreElements() && ordered) + { + mx=(Integer)vEnum.nextElement(); + if (mx>=previous) previous=mx; else ordered=false; + } + + return previous; + } + /** * This method returns the TCP packet to send *************** *** 903,907 **** Integer gg = new Integer(0); ! if (!Elm.ReceivedACKs.isEmpty()) gg = (Integer)Elm.ReceivedACKs.lastElement(); if (Elm.seq_number <= gg+window_size) --- 928,932 ---- Integer gg = new Integer(0); ! if (!Elm.ReceivedACKs.isEmpty()) gg = GetNumber(Elm.ReceivedACKs); if (Elm.seq_number <= gg+window_size) |
From: Alexander B. <da...@us...> - 2005-12-08 20:57:00
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25279/guiUI Modified Files: MainScreen.java Log Message: New TCP counters. Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** MainScreen.java 8 Dec 2005 20:32:53 -0000 1.26 --- MainScreen.java 8 Dec 2005 20:56:48 -0000 1.27 *************** *** 3156,3159 **** --- 3156,3162 ---- "\n Recieved TCP segments: " + Integer.valueOf(PS.getTCPinputCount()).toString() + "\n Sent TCP segments: " + Integer.valueOf(PS.getTCPoutputCount()).toString() + + "\n Sent TCP ACK's: " + Integer.valueOf(PS.getTCPACKCount()).toString() + + "\n Sent TCP Dublicates: " + Integer.valueOf(PS.getTCPSDCount()).toString() + + "\n Recieved TCP Dublicates: " + Integer.valueOf(PS.getTCPRDCount()).toString() + "\n Recieved UDP segments: " + Integer.valueOf(PS.getUDPinputCount()).toString() + "\n Sent UDP segments: " + Integer.valueOf(PS.getUDPoutputCount()).toString(); |
From: Alexander B. <da...@us...> - 2005-12-08 20:56:57
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25279/core/protocolsuite/tcp_ip Modified Files: ProtocolStack.java Log Message: New TCP counters. Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** ProtocolStack.java 8 Dec 2005 19:04:23 -0000 1.34 --- ProtocolStack.java 8 Dec 2005 20:56:48 -0000 1.35 *************** *** 1314,1317 **** --- 1314,1329 ---- return mTCPprotocol.GetSentSegmentsNumber(); } + + public int getTCPRDCount(){ + return mTCPprotocol.GetReceivedDuplicatesNumber(); + } + + public int getTCPSDCount(){ + return mTCPprotocol.GetSentDuplicatesNumber(); + } + + public int getTCPACKCount(){ + return mTCPprotocol.GetSentACKSegmentsNumber(); + } public int getUDPinputCount(){ |
From: Alexander B. <da...@us...> - 2005-12-08 20:33:11
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20936/guiUI Modified Files: MainScreen.java Log Message: timer layerinfo bugfix. happy coding && debugging to Ilgar! Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** MainScreen.java 8 Dec 2005 20:10:58 -0000 1.25 --- MainScreen.java 8 Dec 2005 20:32:53 -0000 1.26 *************** *** 3022,3026 **** String msg = JOptionPane.showInputDialog(this, "Message:", "Message.", JOptionPane.QUESTION_MESSAGE); ! String cnt = JOptionPane.showInputDialog(this, "Number:", "How many times send.", JOptionPane.QUESTION_MESSAGE); if(port!=null && ip!=null && msg!=null && cnt!=null){ --- 3022,3026 ---- String msg = JOptionPane.showInputDialog(this, "Message:", "Message.", JOptionPane.QUESTION_MESSAGE); ! String cnt = JOptionPane.showInputDialog(this, "Quantity:", "How many times send.", JOptionPane.QUESTION_MESSAGE); if(port!=null && ip!=null && msg!=null && cnt!=null){ *************** *** 3051,3057 **** { private MainScreen ms; ! public TTask (MainScreen ms) { this.ms=ms; --- 3051,3059 ---- { private MainScreen ms; + private int counts; ! public TTask (MainScreen ms, int counts) { + this.counts=counts; this.ms=ms; *************** *** 3062,3067 **** { ms.printLayerInfo(false); ! ms.addFooter(); ! this.cancel(); } } --- 3064,3071 ---- { ms.printLayerInfo(false); ! if(counts--<=0){ ! ms.addFooter(); ! this.cancel(); ! } } } *************** *** 3087,3091 **** String msg = JOptionPane.showInputDialog(this, "Message:", "Message.", JOptionPane.QUESTION_MESSAGE); ! String cnt = JOptionPane.showInputDialog(this, "Number:", "How many times send.", JOptionPane.QUESTION_MESSAGE); if(port!=null && ip!=null && msg!=null && cnt!=null){ --- 3091,3095 ---- String msg = JOptionPane.showInputDialog(this, "Message:", "Message.", JOptionPane.QUESTION_MESSAGE); ! String cnt = JOptionPane.showInputDialog(this, "Quantity:", "How many times send.", JOptionPane.QUESTION_MESSAGE); if(port!=null && ip!=null && msg!=null && cnt!=null){ *************** *** 3097,3101 **** Timer timer = null; timer=new Timer(); ! timer.schedule(new TTask(this),4000,4000); ((Echo_tcp)((core.ApplicationLayerDevice)Sim.getNode(inNodeName)).getApp(30017)).SendEcho(msg, ip, Integer.valueOf(port).intValue(), Integer.valueOf(cnt).intValue()); --- 3101,3105 ---- Timer timer = null; timer=new Timer(); ! timer.schedule(new TTask(this, 1),4000,4000); ((Echo_tcp)((core.ApplicationLayerDevice)Sim.getNode(inNodeName)).getApp(30017)).SendEcho(msg, ip, Integer.valueOf(port).intValue(), Integer.valueOf(cnt).intValue()); |
From: Alexander B. <da...@us...> - 2005-12-08 20:33:02
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20936/core/protocolsuite/tcp_ip Modified Files: Echo_tcp.java Log Message: timer layerinfo bugfix. happy coding && debugging to Ilgar! Index: Echo_tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Echo_tcp.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Echo_tcp.java 8 Dec 2005 20:10:56 -0000 1.18 --- Echo_tcp.java 8 Dec 2005 20:32:52 -0000 1.19 *************** *** 208,212 **** try { ! SendData(Data); }catch(Exception e){ ///*TODO*: here to catch --- 208,212 ---- try { ! SendData(Data); }catch(Exception e){ ///*TODO*: here to catch |
From: Alexander B. <da...@us...> - 2005-12-08 20:11:38
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16673/core/protocolsuite/tcp_ip Modified Files: Echo.java Echo_tcp.java Route_entry.java Log Message: New Echo (v2) implementation. Index: Route_entry.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Route_entry.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Route_entry.java 1 Dec 2005 14:54:37 -0000 1.4 --- Route_entry.java 8 Dec 2005 20:10:56 -0000 1.5 *************** *** 2,6 **** * Route_entry.java * ! * Created on 7 Nov 2005 Ç., 17:52 * * To change this template, choose Tools | Options and locate the template under --- 2,6 ---- * Route_entry.java * ! * Created on 7 Nov 2005, 17:52 * * To change this template, choose Tools | Options and locate the template under Index: Echo_tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Echo_tcp.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Echo_tcp.java 8 Dec 2005 19:35:07 -0000 1.17 --- Echo_tcp.java 8 Dec 2005 20:10:56 -0000 1.18 *************** *** 30,39 **** private byte ConnectionAttempts=5; ! private int tryings; /** Creates a new instance of Echo */ public Echo_tcp(ProtocolStack inParentStack, int listenPort, int appType, int UID) { super(inParentStack, listenPort, appType, UID); ! tryings = 0; } --- 30,39 ---- private byte ConnectionAttempts=5; ! private int counts; /** Creates a new instance of Echo */ public Echo_tcp(ProtocolStack inParentStack, int listenPort, int appType, int UID) { super(inParentStack, listenPort, appType, UID); ! counts = 0; } *************** *** 46,50 **** //throw new TransportLayerException("Cannot bind port " + listenPort + "."); try{ ! if(appType == 1) mParentStack.ListenTCP(this, listenPort); } catch (TransportLayerException e) { --- 46,50 ---- //throw new TransportLayerException("Cannot bind port " + listenPort + "."); try{ ! if(appType != 0) mParentStack.ListenTCP(this, listenPort); } catch (TransportLayerException e) { *************** *** 124,128 **** protInfo3.setDataType("Echo Protocol Data"); protInfo3.setLayer("Application "); ! protInfo3.setDescription("Application closing connection. Now listening on " + listenPort + "."); Simulation.addLayerInfo(protInfo3); --- 124,132 ---- protInfo3.setDataType("Echo Protocol Data"); protInfo3.setLayer("Application "); ! if(appType==0){ ! protInfo3.setDescription("Application closing connection."); ! }else{ ! protInfo3.setDescription("Application closing connection. Now listening on " + listenPort + "."); ! } Simulation.addLayerInfo(protInfo3); *************** *** 174,178 **** protInfo.setDescription("Recieving echo message '" + Data + "' from server."); Simulation.addLayerInfo(protInfo);*/ ! Disconnect(); }else{ --- 178,192 ---- protInfo.setDescription("Recieving echo message '" + Data + "' from server."); Simulation.addLayerInfo(protInfo);*/ ! ! if(this.counts==0){ ! Disconnect(); ! }else{ ! this.counts--; ! try { ! SendData(Data); ! }catch(Exception e){ ! ///*TODO*: here to catch ! } ! } }else{ *************** *** 192,204 **** protInfo2.setDescription("Sending echo message '" + Data + "' to client."); Simulation.addLayerInfo(protInfo2); ! try { SendData(Data); }catch(Exception e){ ///*TODO*: here to catch } ! ! // Disconnect(); ! ! // Listen(); } } --- 206,216 ---- protInfo2.setDescription("Sending echo message '" + Data + "' to client."); Simulation.addLayerInfo(protInfo2); ! ! try { SendData(Data); }catch(Exception e){ ///*TODO*: here to catch } ! } } *************** *** 213,220 **** * @version v0.02 */ ! public void SendEcho(String Data, String Host, int port) throws CommunicationException, LowLinkException, InvalidNetworkLayerDeviceException, TransportLayerException{ mParentStack.FreeTCPApplication(this); ! if (ClientConnect(Host, port)) --- 225,232 ---- * @version v0.02 */ ! public void SendEcho(String Data, String Host, int port, int counts) throws CommunicationException, LowLinkException, InvalidNetworkLayerDeviceException, TransportLayerException{ mParentStack.FreeTCPApplication(this); ! this.counts = counts; if (ClientConnect(Host, port)) *************** *** 227,230 **** --- 239,243 ---- Simulation.addLayerInfo(protInfo); + this.counts--; SendData(Data); *************** *** 237,241 **** protInfo.setDescription("Error: can not connect to " + Host + ":" + port + "!"); Simulation.addLayerInfo(protInfo); ! } } --- 250,254 ---- protInfo.setDescription("Error: can not connect to " + Host + ":" + port + "!"); Simulation.addLayerInfo(protInfo); ! this.counts=0; } } Index: Echo.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Echo.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Echo.java 27 Nov 2005 20:14:12 -0000 1.16 --- Echo.java 8 Dec 2005 20:10:56 -0000 1.17 *************** *** 181,187 **** * @version v0.01 */ ! public void SendEcho(String Data, String Host, int port) throws CommunicationException, LowLinkException, InvalidNetworkLayerDeviceException, TransportLayerException{ mParentStack.FreeUDPApplication(this); if (ClientConnect(Host, port)) { --- 181,188 ---- * @version v0.01 */ ! public void SendEcho(String Data, String Host, int port, int counts) throws CommunicationException, LowLinkException, InvalidNetworkLayerDeviceException, TransportLayerException{ mParentStack.FreeUDPApplication(this); + for(int c=0; c<counts; c++){ if (ClientConnect(Host, port)) { *************** *** 202,206 **** --- 203,209 ---- protInfo.setDescription("Error: can not connect to " + Host + ":" + port + "!"); Simulation.addLayerInfo(protInfo); + c=counts; } + } } |
From: Alexander B. <da...@us...> - 2005-12-08 20:11:13
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16673/guiUI Modified Files: MainScreen.java Log Message: New Echo (v2) implementation. Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** MainScreen.java 8 Dec 2005 19:04:24 -0000 1.24 --- MainScreen.java 8 Dec 2005 20:10:58 -0000 1.25 *************** *** 3021,3026 **** String msg = JOptionPane.showInputDialog(this, "Message:", "Message.", JOptionPane.QUESTION_MESSAGE); ! if(port!=null && ip!=null && msg!=null){ try{ --- 3021,3028 ---- String msg = JOptionPane.showInputDialog(this, "Message:", "Message.", JOptionPane.QUESTION_MESSAGE); + + String cnt = JOptionPane.showInputDialog(this, "Number:", "How many times send.", JOptionPane.QUESTION_MESSAGE); ! if(port!=null && ip!=null && msg!=null && cnt!=null){ try{ *************** *** 3028,3032 **** printNetworkStart(); ! ((Echo)((core.ApplicationLayerDevice)Sim.getNode(inNodeName)).getApp(30007)).SendEcho(msg, ip, Integer.valueOf(port).intValue()); this.addToConsole("Trying to send echo message '" + msg + "' from " + inNodeName + " to " + ip + ":" + port + "\n"); --- 3030,3034 ---- printNetworkStart(); ! ((Echo)((core.ApplicationLayerDevice)Sim.getNode(inNodeName)).getApp(30007)).SendEcho(msg, ip, Integer.valueOf(port).intValue(), Integer.valueOf(cnt).intValue()); this.addToConsole("Trying to send echo message '" + msg + "' from " + inNodeName + " to " + ip + ":" + port + "\n"); *************** *** 3085,3089 **** String msg = JOptionPane.showInputDialog(this, "Message:", "Message.", JOptionPane.QUESTION_MESSAGE); ! if(port!=null && ip!=null && msg!=null){ try{ --- 3087,3093 ---- String msg = JOptionPane.showInputDialog(this, "Message:", "Message.", JOptionPane.QUESTION_MESSAGE); ! String cnt = JOptionPane.showInputDialog(this, "Number:", "How many times send.", JOptionPane.QUESTION_MESSAGE); ! ! if(port!=null && ip!=null && msg!=null && cnt!=null){ try{ *************** *** 3095,3099 **** timer.schedule(new TTask(this),4000,4000); ! ((Echo_tcp)((core.ApplicationLayerDevice)Sim.getNode(inNodeName)).getApp(30017)).SendEcho(msg, ip, Integer.valueOf(port).intValue()); this.addToConsole("Trying to send echo message '" + msg + "' from " + inNodeName + " to " + ip + ":" + port + "\n"); --- 3099,3103 ---- timer.schedule(new TTask(this),4000,4000); ! ((Echo_tcp)((core.ApplicationLayerDevice)Sim.getNode(inNodeName)).getApp(30017)).SendEcho(msg, ip, Integer.valueOf(port).intValue(), Integer.valueOf(cnt).intValue()); this.addToConsole("Trying to send echo message '" + msg + "' from " + inNodeName + " to " + ip + ":" + port + "\n"); |
From: gift <gi...@us...> - 2005-12-08 19:42:03
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10312/core/protocolsuite/tcp_ip Modified Files: Tcp.java Log Message: - Index: Tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Tcp.java 8 Dec 2005 19:35:07 -0000 1.28 --- Tcp.java 8 Dec 2005 19:41:51 -0000 1.29 *************** *** 1248,1253 **** } else { ! ClosePort((Application)Elm.application); //FIN sent and confirmed!!! Closing connection in case isPassive==true ! ((Application)Elm.application).Listen(); } // Active application has to disconnect by calling Application.Disconnect(); --- 1248,1255 ---- } else { ! Application serv; ! serv=(Application)Elm.application; ! ClosePort(serv); //FIN sent and confirmed!!! Closing connection in case isPassive==true ! serv.Listen(); } // Active application has to disconnect by calling Application.Disconnect(); |
From: gift <gi...@us...> - 2005-12-08 19:35:18
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9065/core/protocolsuite/tcp_ip Modified Files: Application.java Echo_tcp.java Tcp.java Log Message: no comments Index: Application.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Application.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Application.java 27 Nov 2005 20:14:11 -0000 1.13 --- Application.java 8 Dec 2005 19:35:07 -0000 1.14 *************** *** 73,77 **** */ ! public abstract void Disconnect()throws TransportLayerException; /** --- 73,77 ---- */ ! public abstract void Disconnect()throws TransportLayerException, LowLinkException; /** Index: Tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Tcp.java 7 Dec 2005 13:24:51 -0000 1.27 --- Tcp.java 8 Dec 2005 19:35:07 -0000 1.28 *************** *** 1249,1252 **** --- 1249,1253 ---- { ClosePort((Application)Elm.application); //FIN sent and confirmed!!! Closing connection in case isPassive==true + ((Application)Elm.application).Listen(); } // Active application has to disconnect by calling Application.Disconnect(); Index: Echo_tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Echo_tcp.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Echo_tcp.java 8 Dec 2005 19:04:23 -0000 1.16 --- Echo_tcp.java 8 Dec 2005 19:35:07 -0000 1.17 *************** *** 46,50 **** //throw new TransportLayerException("Cannot bind port " + listenPort + "."); try{ ! mParentStack.ListenTCP(this, listenPort); } catch (TransportLayerException e) { --- 46,50 ---- //throw new TransportLayerException("Cannot bind port " + listenPort + "."); try{ ! if(appType == 1) mParentStack.ListenTCP(this, listenPort); } catch (TransportLayerException e) { *************** *** 113,117 **** */ ! public void Disconnect() throws TransportLayerException { mParentStack.CloseTCP(this); //mParentStack.freeTCPPort(this); --- 113,130 ---- */ ! public void Disconnect() throws TransportLayerException, LowLinkException{ ! try { ! mParentStack.FinalizeTCP(this); //will close client connection ! }catch(Exception e){ ! ///*TODO*: here to catch ! } ! ! LayerInfo protInfo3 = new LayerInfo(getClass().getName()); ! protInfo3.setObjectName(mParentStack.getParentNodeName()); ! protInfo3.setDataType("Echo Protocol Data"); ! protInfo3.setLayer("Application "); ! protInfo3.setDescription("Application closing connection. Now listening on " + listenPort + "."); ! Simulation.addLayerInfo(protInfo3); ! mParentStack.CloseTCP(this); //mParentStack.freeTCPPort(this); *************** *** 161,168 **** protInfo.setDescription("Recieving echo message '" + Data + "' from server."); Simulation.addLayerInfo(protInfo);*/ ! //Disconnect(); }else{ //server processing recieve ! try{ LayerInfo protInfo = new LayerInfo(getClass().getName()); protInfo.setObjectName(mParentStack.getParentNodeName()); --- 174,182 ---- protInfo.setDescription("Recieving echo message '" + Data + "' from server."); Simulation.addLayerInfo(protInfo);*/ ! Disconnect(); ! }else{ //server processing recieve ! LayerInfo protInfo = new LayerInfo(getClass().getName()); protInfo.setObjectName(mParentStack.getParentNodeName()); *************** *** 178,200 **** protInfo2.setDescription("Sending echo message '" + Data + "' to client."); Simulation.addLayerInfo(protInfo2); ! SendData(Data); ! mParentStack.FinalizeTCP(this); //will close client connection ! ! LayerInfo protInfo3 = new LayerInfo(getClass().getName()); ! protInfo3.setObjectName(mParentStack.getParentNodeName()); ! protInfo3.setDataType("Echo Protocol Data"); ! protInfo3.setLayer("Application "); ! protInfo3.setDescription("Server closing connection. Now listening on " + listenPort + "."); ! Simulation.addLayerInfo(protInfo3); ! ! Disconnect(); ! Listen(); ! ! }catch(Exception e){ ! ///*TODO*: here to catch ! } } } --- 192,204 ---- protInfo2.setDescription("Sending echo message '" + Data + "' to client."); Simulation.addLayerInfo(protInfo2); ! try { SendData(Data); + }catch(Exception e){ + ///*TODO*: here to catch + } ! // Disconnect(); ! // Listen(); } } |
From: Alexander B. <da...@us...> - 2005-12-08 19:04:36
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30654/core/protocolsuite/tcp_ip Modified Files: Echo_tcp.java ProtocolStack.java Log Message: Transport counters + minor ARP counters fix. Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** ProtocolStack.java 8 Dec 2005 16:45:10 -0000 1.33 --- ProtocolStack.java 8 Dec 2005 19:04:23 -0000 1.34 *************** *** 1304,1314 **** public int getARPCount(){ ! return packetoutputIPCounter; } public void resetCounters(){ packetinputIPCounter = 0; packetoutputIPCounter = 0; packetARPCounter = 0; } --- 1304,1333 ---- public int getARPCount(){ ! return packetARPCounter; ! } ! ! public int getTCPinputCount(){ ! return mTCPprotocol.GetReceivedSegmentsNumber(); } + public int getTCPoutputCount(){ + return mTCPprotocol.GetSentSegmentsNumber(); + } + + public int getUDPinputCount(){ + return mUDPprotocol.GetReceivedDatagrammsNumber(); + } + + public int getUDPoutputCount(){ + return mUDPprotocol.GetSentDatagrammsNumber(); + } + + public void resetCounters(){ packetinputIPCounter = 0; packetoutputIPCounter = 0; packetARPCounter = 0; + mUDPprotocol.ResetCounters(); + mTCPprotocol.ResetCounters(); } Index: Echo_tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Echo_tcp.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Echo_tcp.java 4 Dec 2005 22:14:21 -0000 1.15 --- Echo_tcp.java 8 Dec 2005 19:04:23 -0000 1.16 *************** *** 30,37 **** --- 30,39 ---- private byte ConnectionAttempts=5; + private int tryings; /** Creates a new instance of Echo */ public Echo_tcp(ProtocolStack inParentStack, int listenPort, int appType, int UID) { super(inParentStack, listenPort, appType, UID); + tryings = 0; } *************** *** 210,213 **** --- 212,217 ---- mParentStack.FreeTCPApplication(this); + + if (ClientConnect(Host, port)) { *************** *** 221,225 **** SendData(Data); - //SendData("CLIENTTTTT-Botva"); } else { --- 225,228 ---- *************** *** 230,233 **** --- 233,237 ---- protInfo.setDescription("Error: can not connect to " + Host + ":" + port + "!"); Simulation.addLayerInfo(protInfo); + } } |