[Javanetsim-cvs] javaNetSim/core/protocolsuite/tcp_ip IpV4.java,1.5,1.6 ProtocolStack.java,1.28,1.29
Status: Beta
Brought to you by:
darkkey
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 |