javanetsim-cvs Mailing List for javaNetSim (Page 33)
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: gift <gi...@us...> - 2005-11-25 22:54:10
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32476/core/protocolsuite/tcp_ip Modified Files: Tcp.java Udp.java Log Message: A little more on the dance floor Index: Tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Tcp.java 25 Nov 2005 21:21:53 -0000 1.4 --- Tcp.java 25 Nov 2005 22:54:02 -0000 1.5 *************** *** 159,166 **** private Hashtable PortTable = new Hashtable(); ! private ProtocolStack mParentStack; private static final int PORT_QUANT=100; private static final int PORT_START_NUMBER=3000; private static final int PORT_INIT = -1; //used in ListenPort && AlreadyListens /** --- 159,169 ---- private Hashtable PortTable = new Hashtable(); ! private ProtocolStack mParentStack; ! private int window_size=10; private static final int PORT_QUANT=100; private static final int PORT_START_NUMBER=3000; private static final int PORT_INIT = -1; //used in ListenPort && AlreadyListens + private static final int TOTAL_TIME = 10; //seconds to send all data + private static final int AXELER_KOEFF=2; //coeff depends on line quality, in practise >=2 /** *************** *** 525,528 **** } ! } --- 528,556 ---- } ! ! /** ! * This method gets current window size. ! * @author gift (sourceforge.net user) ! * @param Unused. ! * @return int current TCP window size. ! * @version v0.10 ! */ ! public int getWindowSize() ! { ! return window_size; ! } ! ! /** ! * This method sets new window size. ! * @author gift (sourceforge.net user) ! * @param inSeg number of segments to send. ! * @return Nothing. ! * @version v0.10 ! */ ! public void setWindowSize(int inSeg) ! { ! window_size=(int)AXELER_KOEFF*inSeg/TOTAL_TIME; ! } ! ! } //EOF Index: Udp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Udp.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Udp.java 25 Nov 2005 21:21:53 -0000 1.26 --- Udp.java 25 Nov 2005 22:54:02 -0000 1.27 *************** *** 220,224 **** UDP_Info.setObjectName(mParentStack.getParentNodeName()); ! UDP_Info.setDataType("UDP Packet"); UDP_Info.setLayer("Transport"); --- 220,224 ---- UDP_Info.setObjectName(mParentStack.getParentNodeName()); ! UDP_Info.setDataType("UDP Protocol"); UDP_Info.setLayer("Transport"); *************** *** 252,256 **** UDP_Info.setObjectName(mParentStack.getParentNodeName()); ! UDP_Info.setDataType("UDP Packet"); UDP_Info.setLayer("Transport"); --- 252,256 ---- UDP_Info.setObjectName(mParentStack.getParentNodeName()); ! UDP_Info.setDataType("UDP Protocol"); UDP_Info.setLayer("Transport"); *************** *** 308,312 **** LayerInfo UDP_Info = new LayerInfo(getClass().getName()); UDP_Info.setObjectName(mParentStack.getParentNodeName()); ! UDP_Info.setDataType("UDP Packet"); UDP_Info.setLayer("Transport"); UDP_Info.setDescription("Created UDP packet for " + inDestIPAddress + ":" + insrcPort +"."); --- 308,312 ---- LayerInfo UDP_Info = new LayerInfo(getClass().getName()); UDP_Info.setObjectName(mParentStack.getParentNodeName()); ! UDP_Info.setDataType("UDP Protocol"); UDP_Info.setLayer("Transport"); UDP_Info.setDescription("Created UDP packet for " + inDestIPAddress + ":" + insrcPort +"."); |
From: gift <gi...@us...> - 2005-11-25 21:22:02
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14517/core/protocolsuite/tcp_ip Modified Files: Echo.java ProtocolStack.java Tcp.java Udp.java Log Message: TCP v0.0000000000001 Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ProtocolStack.java 25 Nov 2005 16:57:35 -0000 1.15 --- ProtocolStack.java 25 Nov 2005 21:21:53 -0000 1.16 *************** *** 1293,1297 **** LayerInfo UDP_Info = new LayerInfo(getClass().getName()); UDP_Info.setObjectName(getParentNodeName()); ! UDP_Info.setDataType("UDP Packet"); UDP_Info.setLayer("Transport"); UDP_Info.setDescription("UDP port closing: \""+ te.toString() + "\"."); --- 1293,1297 ---- LayerInfo UDP_Info = new LayerInfo(getClass().getName()); UDP_Info.setObjectName(getParentNodeName()); ! UDP_Info.setDataType("UDP Protocol"); UDP_Info.setLayer("Transport"); UDP_Info.setDescription("UDP port closing: \""+ te.toString() + "\"."); *************** *** 1318,1322 **** LayerInfo UDP_Info = new LayerInfo(getClass().getName()); UDP_Info.setObjectName(getParentNodeName()); ! UDP_Info.setDataType("UDP Packet"); UDP_Info.setLayer("Transport"); UDP_Info.setDescription("UDP port freeing: \""+ te.toString() + "\"."); --- 1318,1322 ---- LayerInfo UDP_Info = new LayerInfo(getClass().getName()); UDP_Info.setObjectName(getParentNodeName()); ! UDP_Info.setDataType("UDP Protocol"); UDP_Info.setLayer("Transport"); UDP_Info.setDescription("UDP port freeing: \""+ te.toString() + "\"."); *************** *** 1442,1445 **** --- 1442,1582 ---- } } + + + + /** + * This method reserves the TCP port + * @author gift (sourceforge.net user) + * @param application application that uses port + * @param inDestIPAddress destination IP address + * @param indestPort destination port number + * @return int port number that has been reserved for application + * @exception InvalidNetworkLayerDeviceException + * @exception TransportLayerException + * @exception CommunicationException + * @version v0.30 + * @see InvalidNetworkLayerDeviceException + * @see TransportLayerException + * @see CommunicationException + */ + + public int reserveTCPPort(Object application, String inDestIPAddress, int indestPort) throws InvalidNetworkLayerDeviceException, TransportLayerException, CommunicationException + { + + if(IPV4Address.validateDecIP(inDestIPAddress)) + { + + //lets get first network interface name + String FirstInterfaceName; + Node temp = (Node)mParentNode; + FirstInterfaceName = temp.getFirstInterfaceName(); + + if (FirstInterfaceName!=null) + { + return mTCPprotocol.ReservePort(application,inDestIPAddress,indestPort); + } else + throw new InvalidNetworkLayerDeviceException("Network interface unavailable on host \"" + temp.getName() +"\"."); + }else + throw new CommunicationException("Packet dropped host unreachable: " + inDestIPAddress); + } + + + + /** + * This method closes the TCP port for an application + * @author gift (sourceforge.net user) + * @param application application that uses port + * @return Nothing + * @exception TransportLayerException + * @version v0.10 + * @see TransportLayerException + */ + + public void CloseTCP(Object application) throws TransportLayerException + { + try { + mTCPprotocol.ClosePort(application); + } catch (TransportLayerException te) + { + LayerInfo TCP_Info = new LayerInfo(getClass().getName()); + TCP_Info.setObjectName(getParentNodeName()); + TCP_Info.setDataType("TCP Protocol"); + TCP_Info.setLayer("Transport"); + TCP_Info.setDescription("TCP port closing: \""+ te.toString() + "\"."); + Simulation.addLayerInfo(TCP_Info); + } + } + + + /** + * This method sets the TCP port free + * @author gift (sourceforge.net user) + * @param application application that uses port + * @return Nothing + * @exception TransportLayerException + * @version v0.10 + * @see TransportLayerException + */ + public void freeTCPPort(Object application) throws TransportLayerException + { + try { + mTCPprotocol.FreePort(application); + } catch (TransportLayerException te) + { + LayerInfo TCP_Info = new LayerInfo(getClass().getName()); + TCP_Info.setObjectName(getParentNodeName()); + TCP_Info.setDataType("TCP Protocol"); + TCP_Info.setLayer("Transport"); + TCP_Info.setDescription("TCP port freeing: \""+ te.toString() + "\"."); + Simulation.addLayerInfo(TCP_Info); + } + } + + /** + * This method sets the TCP port totally free + * @author gift (sourceforge.net user) + * @param application application that uses port + * @return Nothing + * @exception TransportLayerException + * @version v0.10 + * @see TransportLayerException + */ + public void FreeTCPApplication(Object application) throws TransportLayerException + { + mTCPprotocol.FreeApplication(application); + } + + /** + * This method sets the TCP port status to 1 (is being listened to) + * @author gift (sourceforge.net user) + * @param application application that uses port + * @param inPort port that the application want to listen to + * @return Nothing + * @exception TransportLayerException + * @version v0.10 + * @see TransportLayerException + */ + public void ListenTCP(Object application, int inPort) throws TransportLayerException + { + try{ + mTCPprotocol.ListenPort(application,inPort); + + LayerInfo TCP_Info = new LayerInfo(getClass().getName()); + TCP_Info.setObjectName(getParentNodeName()); + TCP_Info.setDataType("TCP Application"); + TCP_Info.setLayer("Transport"); + TCP_Info.setDescription("Application is now listening on port " + inPort + "."); + Simulation.addLayerInfo(TCP_Info); + + } catch (TransportLayerException te) + { + LayerInfo TCP_Info = new LayerInfo(getClass().getName()); + TCP_Info.setObjectName(getParentNodeName()); + TCP_Info.setDataType("TCP Application"); + TCP_Info.setLayer("Transport"); + TCP_Info.setDescription("Error: TCP port listening: \""+ te.toString() + "\"."); + Simulation.addLayerInfo(TCP_Info); + } + } }//EOF Index: Tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Tcp.java 25 Nov 2005 16:57:35 -0000 1.3 --- Tcp.java 25 Nov 2005 21:21:53 -0000 1.4 *************** *** 118,124 **** public String connectedtoIP; //contains IP of the other connected computer | provided PortStatus==2 public int connectedtoPort; //contains port number of the other connected computer | provided PortStatus==2 ! public Vector ReceivedSegments; //contains received segments ONLY sequence_number for each segment is stored ! public Vector ReceivedACKs; //contains received acknowledgments from destination computer ONLY sequence_number for each ACK segment is stored ! public Hashtable SegmentsToResend; //contains segments that will be resend in case no ACK for them will be received } --- 118,159 ---- public String connectedtoIP; //contains IP of the other connected computer | provided PortStatus==2 public int connectedtoPort; //contains port number of the other connected computer | provided PortStatus==2 ! /*statistic block*/ ! public int received_segments; //counter inc when a segment is received ! public int sent_segments; //counter inc when a segment is sent ! public int sent_ACK; //counter inc when an ACK is sent ! public int received_duplicates;//counter inc when a duplicate of a received segment is received again ! public int sent_duplicates; //counter inc when a duplicate of a segment is resent ! /*end of statistic block*/ ! /*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*/ ! ! public void reset() ! { ! this.PortStatus=0; ! this.application=null; ! this.connectedtoIP=""; ! this.connectedtoPort=0; ! this.received_segments=0; ! this.sent_segments=0; ! this.sent_ACK=0; ! this.received_duplicates=0; ! this.sent_duplicates=0; ! if (!this.ReceivedSegments.isEmpty()) this.ReceivedSegments.removeAllElements(); ! if (!this.ReceivedACKs.isEmpty()) this.ReceivedACKs.removeAllElements(); ! if (!this.SegmentsToResend.isEmpty()) ! { ! Set set = this.SegmentsToResend.keySet(); ! Iterator itr = set.iterator(); ! while (itr.hasNext()) ! { ! this.SegmentsToResend.remove(itr.next()); ! } ! } ! } } *************** *** 137,156 **** public Tcp(ProtocolStack inParentStack) { ! int i; for(i=0;i<PORT_QUANT;i++) { TCP_HashTableElement Elm = new TCP_HashTableElement(); ! Elm.PortStatus=0; ! Elm.application=null; ! Elm.connectedtoIP=""; ! Elm.connectedtoPort=0; ! mParentStack = inParentStack; ! ! PortTable.put(new Integer((PORT_START_NUMBER+i)),Elm); // DANGEROUS PLACE! Check before change. } ! } } --- 172,528 ---- public Tcp(ProtocolStack inParentStack) { ! int i; ! mParentStack = inParentStack; for(i=0;i<PORT_QUANT;i++) { + TCP_HashTableElement Elm = new TCP_HashTableElement(); + 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] + * if not found then we reserve a new number + * @author gift (sourceforge.net user) + * @param application that will: take free port or take already occupied port (only by itself) or tell that all ports are busy :( + * @param inDestIPAddress destination IP address + * @param indestPort destination port number + * @return int port number that has been reserved for application + * @exception TransportLayerException in several cases + * @version v0.10 + * @see TransportLayerException + */ + public int ReservePort(Object application,String inDestIPAddress, int indestPort) throws TransportLayerException + { + Integer number = new Integer(0); + boolean Found=false; + boolean Reserved=false; + Enumeration LocalPorts = PortTable.keys(); + + TCP_HashTableElement Elm = new TCP_HashTableElement(); ! while ( (LocalPorts.hasMoreElements()) && !(Found) ) ! { ! number = (Integer) LocalPorts.nextElement(); ! ! ! Elm = (TCP_HashTableElement) PortTable.get(number); ! ! int UID1 = -2; ! int UID2 = -1; ! ! if(Elm.application!=null && application!=null){ ! UID1 = ((Application)Elm.application).getUID(); ! UID2 = ((Application)application).getUID(); ! } ! ! if ( UID1 == UID2) ! { ! Found=true; ! //we have found our application; let's check whom we are connected to ! if (Elm.connectedtoIP.equals(inDestIPAddress)) ! { ! //now goes port number ! if (Elm.connectedtoPort==indestPort) ! { ! //everything is OK, need to return "number" ! ! } else { ! throw new TransportLayerException("TCP Error: application is already connected to another port number! Connected to host: " + Elm.connectedtoIP + ":" + Elm.connectedtoPort + "."); ! } ! } else { ! throw new TransportLayerException("TCP Error: application is already connected to another IP! Connected to host: " + Elm.connectedtoIP + "."); ! } ! ! } ! } ! //in case we have not found our application in hash table..... ! if (!Found) ! { ! //lets try to reserve any free port ! number=PORT_START_NUMBER; ! while ( (number<PORT_START_NUMBER+PORT_QUANT) && !(Reserved) ) ! { ! Elm = (TCP_HashTableElement) PortTable.get((Integer)number); ! ! if (Elm.PortStatus == 0) //free port ! { ! Reserved=true; ! Elm.PortStatus=2; //port will be busy from now ! Elm.connectedtoIP=inDestIPAddress; ! Elm.connectedtoPort=indestPort; ! Elm.application = application; ! } ! if (!Reserved) number++; ! } ! ! if (!Reserved) //all ports are busy :( ! { ! throw new TransportLayerException("TCP Error: all ports are busy! Can not send TCP segments to host " + inDestIPAddress + ":" + indestPort +"."); ! } ! ! } ! ! //For debugging ! // UDP_HashTableElement Elm2 = new UDP_HashTableElement();//For debugging ! // Elm2 = (UDP_HashTableElement) PortTable.get((Integer)number+1);//For debugging ! ! return (number); //do not change here! if you want to change here scan again the code ! ! ! } ! ! ! /** ! * This method finds port number for an application. Port number range: [PORT_START_NUMBER; PORT_START_NUMBER+PORT_QUANT] ! * @author gift (sourceforge.net user) ! * @param inSrcPort port number that has been reserved for the applicaion ! * @return int port number of the other host (that the application is connected to) ! * @exception TransportLayerException ! * @version v0.20 ! * @see TransportLayerException ! */ ! public int getApplicationDestPortNumber(int inSrcPort) throws TransportLayerException ! { ! int number=0; ! TCP_HashTableElement Elm = null; ! ! Elm=(TCP_HashTableElement)PortTable.get((Integer)inSrcPort); ! number=Elm.connectedtoPort; ! return number; ! } ! ! /** ! * This method closes the TCP port for an application ! * @author gift (sourceforge.net user) ! * @param application application that uses port ! * @return Nothing ! * @exception TransportLayerException ! * @version v0.10 ! * @see TransportLayerException ! */ ! public void ClosePort(Object application) throws TransportLayerException //changes port status from 1 (listen) or (see proc ;) to 0 (free) ! { ! TCP_HashTableElement Elm=null; ! Integer PortToClose=getApplicationLocalPortNumber(application); ! ! 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() + "\"."); ! } ! ! /** ! * This method sets the TCP port free ! * @author gift (sourceforge.net user) ! * @param application application that uses port ! * @return Nothing ! * @exception TransportLayerException ! * @version v0.10 ! * @see TransportLayerException ! */ ! public void FreePort(Object application) throws TransportLayerException //changes port status from 2 (busy) to 0 (free) ! { ! TCP_HashTableElement Elm=null; ! Integer PortToFree=getApplicationLocalPortNumber(application); ! ! Elm=(TCP_HashTableElement) PortTable.get((Integer)PortToFree); ! ! if (Elm.PortStatus==2) ! { ! Elm.reset(); ! } else throw new TransportLayerException("TCP Error: port "+ PortToFree +" is not BUSY by the application: \"" + application.toString() + "\"."); ! } ! ! /** ! * This method sets the TCP port totally free ! * @author gift (sourceforge.net user) ! * @param application application that uses port ! * @return Nothing ! * @exception TransportLayerException ! * @version v0.10 ! * @see TransportLayerException ! */ ! public void FreeApplication(Object application) throws TransportLayerException //changes any port status to 0 (free) ! { ! TCP_HashTableElement Elm=null; ! ! try{ ! Integer PortToFree=getApplicationLocalPortNumber(application); ! Elm=(TCP_HashTableElement) PortTable.get((Integer)PortToFree); ! Elm.reset(); ! }catch(Exception e){} ! } ! ! /** ! * This method checks whether server is already listening to port ! * @author gift (sourceforge.net user) ! * @param application application that uses port ! * @return int - port number if listens or PORT_INIT if not listens ! * @version v0.10 ! */ ! public int AlreadyListens(Object application) ! { ! boolean bo=false; ! int listensto=PORT_INIT; ! int localPort; ! ! try { ! localPort=getApplicationLocalPortNumber(application); ! listensto=localPort; ! } catch (TransportLayerException e) ! {} ! ! return listensto; ! } ! ! ! /** ! * This method sets the TCP port status to 1 (is being listened to) ! * NOTE: server must listen to TCP port numbers from 0 to 10000 ! * @author gift (sourceforge.net user) ! * @param application application that uses port ! * @param in_Port port that the application want to listen to ! * @return Nothing ! * @exception TransportLayerException ! * @version v0.10 ! * @see TransportLayerException ! */ ! public void ListenPort(Object application, int in_Port) throws TransportLayerException ! { ! int lsPort=PORT_INIT; ! Integer inPort = new Integer(in_Port); ! ! if ( (lsPort=AlreadyListens(application)) == PORT_INIT ) ! { ! if (inPort>=0 && inPort<=10000) ! { ! TCP_HashTableElement Elm = null; ! ! if ( (Elm =(TCP_HashTableElement)PortTable.get(inPort)) !=null ) ! { ! switch(Elm.PortStatus) ! { ! case 0: //port is free => update such a record in hashtable ! Elm.PortStatus=1; ! Elm.application=application; ! Elm.connectedtoIP=""; ! Elm.connectedtoPort=0; ! break; ! case 1: // port is being listened to by whom? ! int UID1=-2; ! int UID2=-1; ! UID1=((Application)Elm.application).getUID(); ! UID2=((Application)application).getUID(); ! ! if (UID1==UID2) ! { ! throw new TransportLayerException("error: already listening to port "+ inPort +"!"); ! } else throw new TransportLayerException("error: port "+ inPort +" is being listened to by another application! Can listen only to free ports." ); ! case 2: //port is busy => error ! throw new TransportLayerException("error: port "+ inPort +" is busy! Can listen only to free ports." ); ! // no "break" needed ;) ! default: //unknown port status ! throw new TransportLayerException("error: unknown port status! Port "+ inPort +" on host \""+ mParentStack.getParentNodeName()+"\"."); ! } ! ! } else ! { ! //create such a record in hashtable ! TCP_HashTableElement newElm = new TCP_HashTableElement(); ! newElm.PortStatus=1; ! newElm.application=application; ! newElm.connectedtoIP=""; ! newElm.connectedtoPort=0; ! ! PortTable.put(inPort,newElm); //hash table update ! } ! } else // ! { ! throw new TransportLayerException("error: can not listen to port "+ inPort +"! Use port range from 0 to 10000 to listen to."); ! } ! } else // ! { ! if (lsPort==inPort) throw new TransportLayerException("error: can not double listen to port "+ inPort +"! Server is already listening to this port"); ! throw new TransportLayerException("error: can not listen to port "+ inPort +"! Already listening to port " + lsPort); ! } ! } ! ! ! /** ! * This method finds destination IP (host) for an application. ! * @author gift (sourceforge.net user) ! * @param inSrcPort port number that has been reserved for the applicaion ! * @return String destination IP (other host IP that the application is connected to) ! * @exception TransportLayerException ! * @version v0.20 ! * @see TransportLayerException ! */ ! public String getApplicationDestIP(int inSrcPort) throws TransportLayerException ! { ! String dIP=null; ! TCP_HashTableElement Elm = null; ! ! Elm=(TCP_HashTableElement)PortTable.get((Integer)inSrcPort); ! dIP=Elm.connectedtoIP; ! ! return dIP; ! } ! ! ! /** ! * This method finds LOCAL port number for an application. Port number range: [PORT_START_NUMBER; PORT_START_NUMBER+PORT_QUANT] ! * @author gift (sourceforge.net user) ! * @param application which local port will be returned ! * @return int port number that has been reserved for application ! * @exception TransportLayerException in several cases ! * @version v0.10 ! * @see TransportLayerException ! */ ! public int getApplicationLocalPortNumber(Object application) throws TransportLayerException ! { ! Integer number= new Integer(0); ! boolean Found=false; ! boolean Reserved=false; ! Enumeration LocalPorts = PortTable.keys(); ! TCP_HashTableElement Elm = null; ! ! while ( (LocalPorts.hasMoreElements()) && !(Found) ) ! { ! number = (Integer)LocalPorts.nextElement(); ! Elm = (TCP_HashTableElement) PortTable.get(number); ! ! int UID1 = -2; ! int UID2 = -1; ! ! if(Elm.application!=null && application!=null){ ! UID1 = ((Application)Elm.application).getUID(); ! UID2 = ((Application)application).getUID(); ! } ! ! if ( UID1 == UID2 ) ! { ! Found=true; ! //we have found our application ! //everything is OK, need to return "number" ! } } ! ! //in case we have not found our application in hash table..... ! if (!Found) ! { ! throw new TransportLayerException("TCP Error: no local port reserved for the application: \"" + application.toString() + "\"! Can not get local reserved port number."); ! } ! ! return (number); //do not change here! if you want to change here scan again the code ! } ! } Index: Udp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Udp.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Udp.java 25 Nov 2005 16:57:35 -0000 1.25 --- Udp.java 25 Nov 2005 21:21:53 -0000 1.26 *************** *** 148,163 **** { int i; ! for(i=0;i<PORT_QUANT;i++) { ! UDP_HashTableElement Elm = new UDP_HashTableElement(); ! ! Elm.PortStatus=0; ! Elm.application=null; ! Elm.connectedtoIP=""; ! Elm.connectedtoPort=0; ! mParentStack = inParentStack; ! ! PortTable.put(new Integer((PORT_START_NUMBER+i)),Elm); // DANGEROUS PLACE! Check before change. } --- 148,160 ---- { int i; ! mParentStack = inParentStack; for(i=0;i<PORT_QUANT;i++) { ! UDP_HashTableElement Elm = new UDP_HashTableElement(); ! ! Elm.PortStatus=0; ! Elm.application=null; ! Elm.connectedtoIP=""; ! Elm.connectedtoPort=0; PortTable.put(new Integer((PORT_START_NUMBER+i)),Elm); // DANGEROUS PLACE! Check before change. } *************** *** 321,325 **** ! /** * This method reserves LOCAL port number for an application in case reserved. Port number range: [PORT_START_NUMBER; PORT_START_NUMBER+PORT_QUANT] * if not found then we reserve a new number --- 318,322 ---- ! /** * This method reserves LOCAL port number for an application in case reserved. Port number range: [PORT_START_NUMBER; PORT_START_NUMBER+PORT_QUANT] * if not found then we reserve a new number *************** *** 407,412 **** //For debugging ! UDP_HashTableElement Elm2 = new UDP_HashTableElement();//For debugging ! Elm2 = (UDP_HashTableElement) PortTable.get((Integer)number+1);//For debugging return (number); //do not change here! if you want to change here scan again the code --- 404,409 ---- //For debugging ! // UDP_HashTableElement Elm2 = new UDP_HashTableElement();//For debugging ! // Elm2 = (UDP_HashTableElement) PortTable.get((Integer)number+1);//For debugging return (number); //do not change here! if you want to change here scan again the code *************** *** 444,448 **** * @see TransportLayerException */ ! public void ClosePort(Object application) throws TransportLayerException //changes port status from 1 (listen) to 0 (free) { UDP_HashTableElement Elm=null; --- 441,445 ---- * @see TransportLayerException */ ! public void ClosePort(Object application) throws TransportLayerException //changes port status from 1 (listen) or (see proc ;) to 0 (free) { UDP_HashTableElement Elm=null; *************** *** 452,464 **** if (Elm.PortStatus==1 || (Elm.PortStatus==2 && PortToClose<PORT_START_NUMBER)) ! { ! //UDP_HashTableElement Elm = new UDP_HashTableElement(); Elm.PortStatus=0; Elm.application=null; Elm.connectedtoIP=""; ! Elm.connectedtoPort=0; ! ! //PortTable.remove(PortToClose); //delete old element ! //PortTable.put(PortToClose,Elm); //hash table update } else throw new TransportLayerException("UDP Error: port "+ PortToClose +" is not being LISTENED to by the application: \"" + application.toString() + "\"."); } --- 449,457 ---- if (Elm.PortStatus==1 || (Elm.PortStatus==2 && PortToClose<PORT_START_NUMBER)) ! { Elm.PortStatus=0; Elm.application=null; Elm.connectedtoIP=""; ! Elm.connectedtoPort=0; } else throw new TransportLayerException("UDP Error: port "+ PortToClose +" is not being LISTENED to by the application: \"" + application.toString() + "\"."); } *************** *** 473,477 **** * @see TransportLayerException */ ! public void FreePort(Object application) throws TransportLayerException //changes port status from 3 (listen) to 0 (free) { UDP_HashTableElement Elm=null; --- 466,470 ---- * @see TransportLayerException */ ! public void FreePort(Object application) throws TransportLayerException //changes port status from 2 (busy) to 0 (free) { UDP_HashTableElement Elm=null; *************** *** 482,493 **** if (Elm.PortStatus==2) { - //UDP_HashTableElement Elm = new UDP_HashTableElement(); Elm.PortStatus=0; Elm.application=null; Elm.connectedtoIP=""; Elm.connectedtoPort=0; - - //PortTable.remove(PortToFree); //delete old element - //PortTable.put(PortToFree,Elm); //hash table update } else throw new TransportLayerException("UDP Error: port "+ PortToFree +" is not BUSY by the application: \"" + application.toString() + "\"."); } --- 475,482 ---- *************** *** 551,558 **** * @version v0.10 * @see TransportLayerException ! */ ! ! // else throw new TransportLayerException("UDP Error: port "+ PortToFree +" is not BUSY by the application: \"" + application.toString() + "\"."); ! public void ListenPort(Object application, int in_Port) throws TransportLayerException { --- 540,544 ---- * @version v0.10 * @see TransportLayerException ! */ public void ListenPort(Object application, int in_Port) throws TransportLayerException { *************** *** 563,568 **** { if (inPort>=0 && inPort<=10000) ! { ! //UDP_HashTableElement oldElm = null; UDP_HashTableElement Elm = null; --- 549,553 ---- { if (inPort>=0 && inPort<=10000) ! { UDP_HashTableElement Elm = null; *************** *** 572,584 **** { case 0: //port is free => update such a record in hashtable - - //UDP_HashTableElement Elm = new UDP_HashTableElement(); Elm.PortStatus=1; Elm.application=application; Elm.connectedtoIP=""; Elm.connectedtoPort=0; - - //PortTable.remove(inPort); //delete old element - //PortTable.put(inPort,Elm); //hash table update break; case 1: // port is being listened to by whom? --- 557,564 ---- Index: Echo.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Echo.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Echo.java 21 Nov 2005 14:56:01 -0000 1.13 --- Echo.java 25 Nov 2005 21:21:53 -0000 1.14 *************** *** 41,45 **** //throw new TransportLayerException("Cannot bind port " + listenPort + "."); try{ ! mParentStack.ListenUDP(this, listenPort); } catch (TransportLayerException e) { --- 41,45 ---- //throw new TransportLayerException("Cannot bind port " + listenPort + "."); try{ ! mParentStack.ListenUDP(this, listenPort); } catch (TransportLayerException e) { |
From: gift <gi...@us...> - 2005-11-25 16:57:43
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20758/core/protocolsuite/tcp_ip Modified Files: ProtocolStack.java Tcp.java Tcp_packet.java Udp.java Log Message: TCP structure && new revision of UDP Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ProtocolStack.java 21 Nov 2005 15:27:53 -0000 1.14 --- ProtocolStack.java 25 Nov 2005 16:57:35 -0000 1.15 *************** *** 155,159 **** mICMPprotocol = new ICMP(this); ! mTCPprotocol = new Tcp(); mUDPprotocol = new Udp(this); //gift (sourceforge.net user) 17 Nov 2005 --- 155,159 ---- mICMPprotocol = new ICMP(this); ! mTCPprotocol = new Tcp(this); //gift (sourceforge.net user) 25 Nov 2005 mUDPprotocol = new Udp(this); //gift (sourceforge.net user) 17 Nov 2005 Index: Tcp_packet.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp_packet.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Tcp_packet.java 25 Nov 2005 14:20:55 -0000 1.3 --- Tcp_packet.java 25 Nov 2005 16:57:35 -0000 1.4 *************** *** 94,100 **** private static final int RESERVED = 0; //not used ! private int sequence_number; ! private int acknowledgment_number; boolean flags[] = {false,false,false,false,false,false}; /* URG, ACK, PSH, RST, SYN, FIN */ --- 94,100 ---- private static final int RESERVED = 0; //not used ! private int sequence_number; //very very important field. It's value is used as an unique ID of each TCP_packet ! private int acknowledgment_number; //important field as well ;) boolean flags[] = {false,false,false,false,false,false}; /* URG, ACK, PSH, RST, SYN, FIN */ Index: Udp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Udp.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Udp.java 21 Nov 2005 15:27:53 -0000 1.24 --- Udp.java 25 Nov 2005 16:57:35 -0000 1.25 *************** *** 77,82 **** import core.protocolsuite.tcp_ip.ProtocolStack; - ///import core.protocolsuite.tcp_ip.UDP_HashTableElement; - /** --- 77,80 ---- *************** *** 108,116 **** * @author gift (sourceforge.net user) - * @since 17 Nov 2005 ! ! * @version v0.10 ! */ --- 106,111 ---- * @author gift (sourceforge.net user) * @since 17 Nov 2005 ! * @version v0.11 */ *************** *** 134,144 **** public byte PortStatus; // 0 - free port; 1 - port is being listened to; 2 - busy. public Object application; //points to application that listens to this port | provided PortStatus==1 ! public String connectedtoIP; //contains IP of the other connected computer | provided PortStatus==3 ! public int connectedtoPort; //contains port number of the other connected computer | provided PortStatus==3 } private Hashtable PortTable = new Hashtable(); private ProtocolStack mParentStack; ! private static final int PORT_QUANT=100; //should be 100, only for dbg purposes private static final int PORT_START_NUMBER=3000; private static final int PORT_INIT = -1; //used in ListenPort && AlreadyListens --- 129,139 ---- public byte PortStatus; // 0 - free port; 1 - port is being listened to; 2 - busy. public Object application; //points to application that listens to this port | provided PortStatus==1 ! public String connectedtoIP; //contains IP of the other connected computer | provided PortStatus==2 ! public int connectedtoPort; //contains port number of the other connected computer | provided PortStatus==2 } private Hashtable PortTable = new Hashtable(); private ProtocolStack mParentStack; ! private static final int PORT_QUANT=100; private static final int PORT_START_NUMBER=3000; private static final int PORT_INIT = -1; //used in ListenPort && AlreadyListens *************** *** 152,157 **** public Udp(ProtocolStack inParentStack) { - //String i; //String is port number :( such a pity but we use hash tables - //int j; //port number int i; --- 147,150 ---- *************** *** 167,171 **** ! PortTable.put(new Integer((PORT_START_NUMBER+i)),Elm); // CHECK HERE } } --- 160,164 ---- ! PortTable.put(new Integer((PORT_START_NUMBER+i)),Elm); // DANGEROUS PLACE! Check before change. } } Index: Tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Tcp.java 20 Nov 2005 20:30:53 -0000 1.2 --- Tcp.java 25 Nov 2005 16:57:35 -0000 1.3 *************** *** 1,43 **** /* 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 core.protocolsuite.tcp_ip; import java.io.Serializable; /** * This is for design and future implementation of TCP * @author luke_hamilton * @since Sep 17, 2004 * @version v0.20 */ ! public class Tcp implements Serializable{ } --- 1,156 ---- /* + 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 core.protocolsuite.tcp_ip; import java.io.Serializable; + import java.util.*; + + import core.CommunicationException; + + import core.LowLinkException; + + import core.LayerInfo; + + import core.Simulation; + + import core.TransportLayerException; + + import core.TransportLayerPortException; + + import core.InvalidNetworkLayerDeviceException; + + import core.protocolsuite.tcp_ip.ProtocolStack; + + + /** + * This is for design and future implementation of TCP + * @author luke_hamilton + * @since Sep 17, 2004 + * @version v0.20 + * + * @author gift (sourceforge.net user) + * @since 25 Nov 2005 + * @version v0.10 + */ ! ! ! ! public class Tcp implements Serializable ! { ! /* ! * TCP_HashTableElement.java ! * ! * Created on 25 November 2005, 17:33 ! */ ! ! /** ! * @author gift (sourceforge.net user) ! * @version v0.10, 25 Nov 2005 ! */ ! public class TCP_HashTableElement ! { ! public byte PortStatus; // 0 - free port; 1 - port is being listened to; 2 - busy. ! public Object application; //points to application that listens to this port | provided PortStatus==1 ! public String connectedtoIP; //contains IP of the other connected computer | provided PortStatus==2 ! public int connectedtoPort; //contains port number of the other connected computer | provided PortStatus==2 ! public Vector ReceivedSegments; //contains received segments ONLY sequence_number for each segment is stored ! public Vector ReceivedACKs; //contains received acknowledgments from destination computer ONLY sequence_number for each ACK segment is stored ! public Hashtable SegmentsToResend; //contains segments that will be resend in case no ACK for them will be received ! } ! ! private Hashtable PortTable = new Hashtable(); ! private ProtocolStack mParentStack; ! private static final int PORT_QUANT=100; ! private static final int PORT_START_NUMBER=3000; ! private static final int PORT_INIT = -1; //used in ListenPort && AlreadyListens ! ! /** ! * This method assigns the ParentStack ! * @author gift (sourceforge.net user) ! * @param inParentStack protocol stack ! * @version v0.20 ! */ ! public Tcp(ProtocolStack inParentStack) ! { ! int i; ! ! for(i=0;i<PORT_QUANT;i++) ! { ! TCP_HashTableElement Elm = new TCP_HashTableElement(); ! ! Elm.PortStatus=0; ! Elm.application=null; ! Elm.connectedtoIP=""; ! Elm.connectedtoPort=0; ! mParentStack = inParentStack; ! ! ! PortTable.put(new Integer((PORT_START_NUMBER+i)),Elm); // DANGEROUS PLACE! Check before change. ! } ! } } + |
From: gift <gi...@us...> - 2005-11-25 14:24:04
|
Update of /cvsroot/javanetsim/javaNetSim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21921 Modified Files: TODO.txt Log Message: just forgot to commit Index: TODO.txt =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/TODO.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TODO.txt 21 Nov 2005 16:37:22 -0000 1.8 --- TODO.txt 25 Nov 2005 14:23:56 -0000 1.9 *************** *** 39,43 **** 15. UDP (Gift) pretty done ! 16. TCP(Gift && Key). 17. 2Fedor: RIP (over IP) --- 39,44 ---- 15. UDP (Gift) pretty done ! 16. TCP(Gift && Key) ! Starting..... You, Bobr, high time you've started to do something!!!! 17. 2Fedor: RIP (over IP) |
From: gift <gi...@us...> - 2005-11-25 14:21:03
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21359/core/protocolsuite/tcp_ip Modified Files: Tcp_packet.java Log Message: TCP packet implementation v0.1 Index: Tcp_packet.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp_packet.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Tcp_packet.java 20 Nov 2005 20:30:53 -0000 1.2 --- Tcp_packet.java 25 Nov 2005 14:20:55 -0000 1.3 *************** *** 1,42 **** /* 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 core.protocolsuite.tcp_ip; import core.Packet; /** * This is for design and future implementation of TCP_PACKET * @author luke_hamilton * @since Sep 17, 2004 * @version v0.20 */ ! public class Tcp_packet extends Packet{ } --- 1,449 ---- /* + 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 core.protocolsuite.tcp_ip; + import core.Packet; + import core.TransportLayerException; + + /** + * This is for design and future implementation of TCP_PACKET + * @author luke_hamilton + * @since Sep 17, 2004 + + * Design and implementation of TCP_packet + * @author gift (sourceforge.net user) + * @since Nov 25, 2005 * @version v0.20 */ + public class TCP_packet extends IP_packet + { + /* DO NOT forget about pseudo UDP header fields + * - mSourceIPAddress (implemented) + * - mDestIPAddress (implemented) + * - PTCL (protocol type code) (implemented) + * - TCP length - not needed (not implemented) + * that's why TCP_packet as well as UDP_packet extends IP_packet */ + + private int TCP_srcPort; + + private int TCP_destPort; + + private int TCP_MessageLength; + + private static final int RESERVED = 0; //not used + + private int sequence_number; + + private int acknowledgment_number; + + boolean flags[] = {false,false,false,false,false,false}; /* URG, ACK, PSH, RST, SYN, FIN */ + + private int TCP_window; //for future developing :) + + private Object URG_pointer; //for future developing :) + + private String TCP_message; + + private static final int PTCL = 6; //see RFC :) + + private static final int CHECK_SUM = 1; //for future developing :) + + private static final int HEAD_LENGTH = 22; //TCP header is 22 bytes + + private static final int MAX_LENGTH = 65535; //bytes is UDP datagramm maximum length ! /** ! * This method passes the destination and source addresses into the super class ! * @author gift (sourceforge.net user) ! * @param inDestIPAddress destination IP address ! * @param inSourceIPAddress source IP address ! * @param indestPort destination port number ! * @param insrcPort sorce port number ! * @return Nothing. ! * @version v0.20 ! */ ! ! public TCP_packet(String inDestIPAddress, String inSourceIPAddress, int indestPort, int insrcPort) ! { ! super (inDestIPAddress); ! this.setSourceIPAddress(inSourceIPAddress); ! TCP_destPort = indestPort; ! TCP_srcPort = insrcPort; ! TCP_MessageLength = HEAD_LENGTH; ! TCP_message = ""; } + + /** + * This method sets the TCP_message and calculates TCP_message length + * @author gift (sourceforge.net user) + * @param inTCP_message a string to be set as a TCP message + * @return Nothing. + * @exception TransportLayerException If TCP message exceeds maximum size of TCP message. + * @version v0.20 + * @see TransportLayerException + */ + + public void setTCP_message(String inTCP_message) throws TransportLayerException + { + int length; + + length = HEAD_LENGTH + TCP_message.length(); + + if (length <= MAX_LENGTH) + { + TCP_message = inTCP_message; + TCP_MessageLength = length; + + }else + { + throw new TransportLayerException("TCP Error: TCP message exceeds maximum size of " + MAX_LENGTH + " bytes."); + } + } + + /** + * This method returns the string describing TCP message + * @author gift (sourceforge.net user) + * @param Unused. + * @return the TCP message + * @version v0.20 + */ + + public String getTCP_message() + { + return TCP_message; + } + + /** + * This method returns integer describing TCP message length + * @author gift (sourceforge.net user) + * @param Unused. + * @return the length of TCP message. + * @version v0.20 + */ + + public int getTCP_MessageLength() + { + return TCP_MessageLength; + } + + + /** + * This if for design and future implementation of TCP_packet + * @author gift (sourceforge.net user) + * @param Unused. + * @return Nothing. + * @version v0.20 + */ + public void calculate_Check_Sum() + { + + } + + /** + * This method gets Check_Sum + * can be used for design and future implementation of TCP_packet + * @author gift (sourceforge.net user) + * @param Unused. + * @return CHECK_SUM. + * @version v0.20 + */ + public int getCheck_Sum() + { + return CHECK_SUM; + } + + /** + * This method gets protocol code (6 for TCP) + * @author gift (sourceforge.net user) + * @param Unused. + * @return protocol code PTCL. + * @version v0.20 + */ + public int getProtocolCode() + { + return PTCL; + } + + /** + * This method gets source port + * @author gift (sourceforge.net user) + * @param Unused. + * @return source TCP port number. + * @version v0.20 + */ + public int get_srcPort() + { + return TCP_srcPort; + } + + /** + * This method gets destination port + * @author gift (sourceforge.net user) + * @param Unused. + * @return destination TCP port number. + * @version v0.20 + */ + public int get_destPort() + { + return TCP_destPort; + } + + /** + * This method sets the sequence number + * @author gift (sourceforge.net user) + * @param inSNumb integer to be set as the sequence number + * @return Nothing. + * @version v0.20 + */ + + public void set_sequence_number(int inSNumb) + { + sequence_number=inSNumb; + } + + /** + * This method sets the acknowledgment number + * @author gift (sourceforge.net user) + * @param inACK integer to be set as the acknowledgment number + * @return Nothing. + * @version v0.20 + */ + + public void set_acknowledgment_number(int inACK) + { + acknowledgment_number=inACK; + } + + /** + * This method gets sequence number + * @author gift (sourceforge.net user) + * @param Unused. + * @return TCP sequence number. + * @version v0.20 + */ + public int get_sequence_number() + { + return sequence_number; + } + + /** + * This method gets acknowledgment number + * @author gift (sourceforge.net user) + * @param Unused. + * @return TCP acknowledgment number. + * @version v0.20 + */ + public int get_acknowledgment_number() + { + return acknowledgment_number; + } + + /** + * This method gets URG flag + * @author gift (sourceforge.net user) + * @param Unused. + * @return URG boolean flag value. + * @version v0.20 + */ + public boolean get_URG_flag() + { + return flags[0]; + } + + /** + * This method gets ACK flag + * @author gift (sourceforge.net user) + * @param Unused. + * @return ACK boolean flag value. + * @version v0.20 + */ + public boolean get_ACK_flag() + { + return flags[1]; + } + + /** + * This method gets PSH flag + * @author gift (sourceforge.net user) + * @param Unused. + * @return PSH boolean flag value. + * @version v0.20 + */ + public boolean get_PSH_flag() + { + return flags[2]; + } + + /** + * This method gets RST flag + * @author gift (sourceforge.net user) + * @param Unused. + * @return RST boolean flag value. + * @version v0.20 + */ + public boolean get_RST_flag() + { + return flags[3]; + } + + /** + * This method gets SYN flag + * @author gift (sourceforge.net user) + * @param Unused. + * @return SYN boolean flag value. + * @version v0.20 + */ + public boolean get_SYN_flag() + { + return flags[4]; + } + + /** + * This method gets FIN flag + * @author gift (sourceforge.net user) + * @param Unused. + * @return FIN boolean flag value. + * @version v0.20 + */ + public boolean get_FIN_flag() + { + return flags[5]; + } + + /** + * This method sets URG flag + * @author gift (sourceforge.net user) + * @param inflg_val boolean the value to be set for URG flag. + * @return Nothing. + * @version v0.20 + */ + public void set_URG_flag(boolean inflg_val) + { + flags[0]=inflg_val; + } + + /** + * This method sets ACK flag + * @author gift (sourceforge.net user) + * @param inflg_val boolean the value to be set for ACK flag. + * @return Nothing. + * @version v0.20 + */ + public void set_ACK_flag(boolean inflg_val) + { + flags[1]=inflg_val; + } + + /** + * This method sets PSH flag + * @author gift (sourceforge.net user) + * @param inflg_val boolean the value to be set for PSH flag. + * @return Nothing. + * @version v0.20 + */ + public void set_PSH_flag(boolean inflg_val) + { + flags[2]=inflg_val; + } + + /** + * This method sets RST flag + * @author gift (sourceforge.net user) + * @param inflg_val boolean the value to be set for RST flag. + * @return Nothing. + * @version v0.20 + */ + public void set_RST_flag(boolean inflg_val) + { + flags[3]=inflg_val; + } + + /** + * This method sets SYN flag + * @author gift (sourceforge.net user) + * @param inflg_val boolean the value to be set for SYN flag. + * @return Nothing. + * @version v0.20 + */ + public void set_SYN_flag(boolean inflg_val) + { + flags[4]=inflg_val; + } + + /** + * This method sets FIN flag + * @author gift (sourceforge.net user) + * @param inflg_val boolean the value to be set for FIN flag. + * @return Nothing. + * @version v0.20 + */ + public void set_FIN_flag(boolean inflg_val) + { + flags[5]=inflg_val; + } + + + }//EOF + |
From: gift <gi...@us...> - 2005-11-21 16:37:30
|
Update of /cvsroot/javanetsim/javaNetSim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv471 Modified Files: TODO.txt Log Message: test from gift Index: TODO.txt =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/TODO.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TODO.txt 21 Nov 2005 14:56:01 -0000 1.7 --- TODO.txt 21 Nov 2005 16:37:22 -0000 1.8 *************** *** 38,41 **** --- 38,42 ---- 14. Switches (?) 15. UDP (Gift) + pretty done 16. TCP(Gift && Key). 17. 2Fedor: RIP (over IP) |
From: Alexander B. <da...@us...> - 2005-11-21 15:58:28
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23282/guiUI Modified Files: MainScreen.java Log Message: Fixing ICMP no LayerInfo bug Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** MainScreen.java 21 Nov 2005 15:27:54 -0000 1.11 --- MainScreen.java 21 Nov 2005 15:58:20 -0000 1.12 *************** *** 950,953 **** --- 950,955 ---- { + + printNetworkStart(); try{ *************** *** 993,997 **** } ! // Ok button was pressed. --- 995,999 ---- } ! printLayerInfo(); // Ok button was pressed. *************** *** 3094,3096 **** } - --- 3096,3097 ---- |
From: gift <gi...@us...> - 2005-11-21 15:28:07
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16852/guiUI Modified Files: MainScreen.java Log Message: Can test now. Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** MainScreen.java 21 Nov 2005 14:56:01 -0000 1.10 --- MainScreen.java 21 Nov 2005 15:27:54 -0000 1.11 *************** *** 2859,2863 **** echo1.setPort(Integer.valueOf(port).intValue()); ! echo1.Listen(); }catch(Exception e){ --- 2859,2865 ---- echo1.setPort(Integer.valueOf(port).intValue()); ! echo1.Listen(); ! ! printLayerInfo(); }catch(Exception e){ |
From: gift <gi...@us...> - 2005-11-21 15:28:07
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16852/core/protocolsuite/tcp_ip Modified Files: ProtocolStack.java Udp.java Log Message: Can test now. Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ProtocolStack.java 20 Nov 2005 20:30:53 -0000 1.13 --- ProtocolStack.java 21 Nov 2005 15:27:53 -0000 1.14 *************** *** 1352,1356 **** { try{ ! mUDPprotocol.ListenPort(application,inPort); } catch (TransportLayerException te) --- 1352,1363 ---- { try{ ! mUDPprotocol.ListenPort(application,inPort); ! ! LayerInfo UDP_Info = new LayerInfo(getClass().getName()); ! UDP_Info.setObjectName(getParentNodeName()); ! UDP_Info.setDataType("UDP Application"); ! UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("Application is now listening on port " + inPort + "."); ! Simulation.addLayerInfo(UDP_Info); } catch (TransportLayerException te) *************** *** 1358,1364 **** LayerInfo UDP_Info = new LayerInfo(getClass().getName()); UDP_Info.setObjectName(getParentNodeName()); ! UDP_Info.setDataType("UDP Packet"); UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("UDP port listening: \""+ te.toString() + "\"."); Simulation.addLayerInfo(UDP_Info); } --- 1365,1371 ---- LayerInfo UDP_Info = new LayerInfo(getClass().getName()); UDP_Info.setObjectName(getParentNodeName()); ! UDP_Info.setDataType("UDP Application"); UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("Error: UDP port listening: \""+ te.toString() + "\"."); Simulation.addLayerInfo(UDP_Info); } Index: Udp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Udp.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Udp.java 21 Nov 2005 14:56:01 -0000 1.23 --- Udp.java 21 Nov 2005 15:27:53 -0000 1.24 *************** *** 568,573 **** if ( (lsPort=AlreadyListens(application)) == PORT_INIT ) ! { ! if (inPort>=0 && inPort<=10000) { --- 568,572 ---- if ( (lsPort=AlreadyListens(application)) == PORT_INIT ) ! { if (inPort>=0 && inPort<=10000) { *************** *** 598,608 **** if (UID1==UID2) { ! throw new TransportLayerException("UDP Error: already listening to port "+ inPort +"!"); ! } else throw new TransportLayerException("UDP Error: port "+ inPort +" is being listened to by another application! Can listen only to free ports." ); case 2: //port is busy => error ! throw new TransportLayerException("UDP Error: port "+ inPort +" is busy! Can listen only to free ports." ); // no "break" needed ;) default: //unknown port status ! throw new TransportLayerException("UDP Error: unknown port status! Port "+ inPort +" on host \""+ mParentStack.getParentNodeName()+"\"."); } --- 597,607 ---- if (UID1==UID2) { ! throw new TransportLayerException("error: already listening to port "+ inPort +"!"); ! } else throw new TransportLayerException("error: port "+ inPort +" is being listened to by another application! Can listen only to free ports." ); case 2: //port is busy => error ! throw new TransportLayerException("error: port "+ inPort +" is busy! Can listen only to free ports." ); // no "break" needed ;) default: //unknown port status ! throw new TransportLayerException("error: unknown port status! Port "+ inPort +" on host \""+ mParentStack.getParentNodeName()+"\"."); } *************** *** 618,638 **** PortTable.put(inPort,newElm); //hash table update } ! } else throw new TransportLayerException("UDP Error: can not listen to port "+ inPort +"! Use port range from 0 to 10000 to listen to."); ! } else throw new TransportLayerException("UDP Error: can not listen to port "+ inPort +"! Already listening to port " + lsPort + "."); ! /* { ! LayerInfo UDP_Info = new LayerInfo(getClass().getName()); ! UDP_Info.setObjectName(mParentStack.getParentNodeName()); ! UDP_Info.setDataType("UDP Packet"); ! UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("UDP port listening: \"UDP Error: can not listen to port "+ inPort +"! Already listening to port " + lsPort + ".\"."); ! Simulation.addLayerInfo(UDP_Info); ! } */ ! LayerInfo UDP_Info = new LayerInfo(getClass().getName()); ! UDP_Info.setObjectName(mParentStack.getParentNodeName()); ! UDP_Info.setDataType("UDP Applicaion"); ! UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("UDP application is now listening on UDP port "+ inPort +"."); ! Simulation.addLayerInfo(UDP_Info); } --- 617,648 ---- PortTable.put(inPort,newElm); //hash table update } ! } else // ! { ! /* LayerInfo UDP_Info = new LayerInfo(getClass().getName()); ! UDP_Info.setObjectName(mParentStack.getParentNodeName()); ! UDP_Info.setDataType("UDP Applicaion"); ! UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("UDP port listening: \"UDP Error: can not listen to port "+ inPort +"! Use port range from 0 to 10000 to listen to."); ! Simulation.addLayerInfo(UDP_Info); */ ! throw new TransportLayerException("error: can not listen to port "+ inPort +"! Use port range from 0 to 10000 to listen to."); ! } ! } else // ! { ! /* LayerInfo UDP_Info = new LayerInfo(getClass().getName()); ! UDP_Info.setObjectName(mParentStack.getParentNodeName()); ! UDP_Info.setDataType("UDP Applicaion"); ! UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("UDP port listening: \"UDP Error: can not listen to port "+ inPort +"! Already listening to port " + lsPort + ".\"."); ! Simulation.addLayerInfo(UDP_Info); */ ! if (lsPort==inPort) throw new TransportLayerException("error: can not double listen to port "+ inPort +"! Server is already listening to this port"); ! throw new TransportLayerException("error: can not listen to port "+ inPort +"! Already listening to port " + lsPort); ! } ! /* LayerInfo UDP_Info = new LayerInfo(getClass().getName()); ! UDP_Info.setObjectName(mParentStack.getParentNodeName()); ! UDP_Info.setDataType("UDP Applicaion"); ! UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("UDP application is now listening on UDP port "+ inPort +"."); ! Simulation.addLayerInfo(UDP_Info); */ } |
From: gift <gi...@us...> - 2005-11-21 14:56:13
|
Update of /cvsroot/javanetsim/javaNetSim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9298 Modified Files: TODO.txt Log Message: Check LayerInfo - BUGS Index: TODO.txt =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/TODO.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TODO.txt 20 Nov 2005 22:03:59 -0000 1.6 --- TODO.txt 21 Nov 2005 14:56:01 -0000 1.7 *************** *** 38,44 **** 14. Switches (?) 15. UDP (Gift) - - server listens to port - new listen port => exception!!! 16. TCP(Gift && Key). 17. 2Fedor: RIP (over IP) --- 38,41 ---- |
From: gift <gi...@us...> - 2005-11-21 14:56:13
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9298/core/protocolsuite/tcp_ip Modified Files: Echo.java Udp.java Log Message: Check LayerInfo - BUGS Index: Udp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Udp.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Udp.java 20 Nov 2005 22:03:59 -0000 1.22 --- Udp.java 21 Nov 2005 14:56:01 -0000 1.23 *************** *** 141,145 **** private ProtocolStack mParentStack; private static final int PORT_QUANT=100; //should be 100, only for dbg purposes ! private static final int PORT_START_NUMBER=3000; /** --- 141,146 ---- private ProtocolStack mParentStack; private static final int PORT_QUANT=100; //should be 100, only for dbg purposes ! private static final int PORT_START_NUMBER=3000; ! private static final int PORT_INIT = -1; //used in ListenPort && AlreadyListens /** *************** *** 523,527 **** --- 524,551 ---- }catch(Exception e){} } + + /** + * This method checks whether server is already listening to port + * @author gift (sourceforge.net user) + * @param application application that uses port + * @return int - port number if listens or PORT_INIT if not listens + * @version v0.10 + */ + public int AlreadyListens(Object application) + { + boolean bo=false; + int listensto=PORT_INIT; + int localPort; + + try { + localPort=getApplicationLocalPortNumber(application); + listensto=localPort; + } catch (TransportLayerException e) + {} + return listensto; + } + + /** * This method sets the UDP port status to 1 (is being listened to) *************** *** 539,593 **** public void ListenPort(Object application, int in_Port) throws TransportLayerException ! { ! Integer inPort = new Integer(in_Port); ! if (inPort>=0 && inPort<=10000) ! { ! //UDP_HashTableElement oldElm = null; ! UDP_HashTableElement Elm = null; ! ! if ( (Elm =(UDP_HashTableElement)PortTable.get(inPort)) !=null ) ! { ! switch(Elm.PortStatus) ! { ! case 0: //port is free => update such a record in hashtable ! ! //UDP_HashTableElement Elm = new UDP_HashTableElement(); ! Elm.PortStatus=1; ! Elm.application=application; ! Elm.connectedtoIP=""; ! Elm.connectedtoPort=0; ! ! //PortTable.remove(inPort); //delete old element ! //PortTable.put(inPort,Elm); //hash table update ! break; ! case 1: // port is being listened to by whom? ! int UID1=-2; ! int UID2=-1; ! UID1=((Application)Elm.application).getUID(); ! UID2=((Application)application).getUID(); ! ! if (UID1==UID2) ! { ! throw new TransportLayerException("UDP Error: already listening to port "+ inPort +"!"); ! } else throw new TransportLayerException("UDP Error: port "+ inPort +" is being listened to by another application! Can listen only to free ports." ); ! case 2: //port is busy => error ! throw new TransportLayerException("UDP Error: port "+ inPort +" is busy! Can listen only to free ports." ); ! // no "break" needed ;) ! default: //unknown port status ! throw new TransportLayerException("UDP Error: unknown port status! Port "+ inPort +" on host \""+ mParentStack.getParentNodeName()+"\"."); ! } ! } else ! { ! //create such a record in hashtable ! UDP_HashTableElement newElm = new UDP_HashTableElement(); ! newElm.PortStatus=1; ! newElm.application=application; ! newElm.connectedtoIP=""; ! newElm.connectedtoPort=0; ! ! PortTable.put(inPort,newElm); //hash table update ! } ! } else throw new TransportLayerException("UDP Error: can not listen to port "+ inPort +"! Use port range from 0 to 10000 to listen to."); } --- 563,638 ---- public void ListenPort(Object application, int in_Port) throws TransportLayerException ! { ! int lsPort=PORT_INIT; ! Integer inPort = new Integer(in_Port); ! ! if ( (lsPort=AlreadyListens(application)) == PORT_INIT ) ! { ! ! if (inPort>=0 && inPort<=10000) ! { ! //UDP_HashTableElement oldElm = null; ! UDP_HashTableElement Elm = null; ! if ( (Elm =(UDP_HashTableElement)PortTable.get(inPort)) !=null ) ! { ! switch(Elm.PortStatus) ! { ! case 0: //port is free => update such a record in hashtable ! ! //UDP_HashTableElement Elm = new UDP_HashTableElement(); ! Elm.PortStatus=1; ! Elm.application=application; ! Elm.connectedtoIP=""; ! Elm.connectedtoPort=0; ! ! //PortTable.remove(inPort); //delete old element ! //PortTable.put(inPort,Elm); //hash table update ! break; ! case 1: // port is being listened to by whom? ! int UID1=-2; ! int UID2=-1; ! UID1=((Application)Elm.application).getUID(); ! UID2=((Application)application).getUID(); ! ! if (UID1==UID2) ! { ! throw new TransportLayerException("UDP Error: already listening to port "+ inPort +"!"); ! } else throw new TransportLayerException("UDP Error: port "+ inPort +" is being listened to by another application! Can listen only to free ports." ); ! case 2: //port is busy => error ! throw new TransportLayerException("UDP Error: port "+ inPort +" is busy! Can listen only to free ports." ); ! // no "break" needed ;) ! default: //unknown port status ! throw new TransportLayerException("UDP Error: unknown port status! Port "+ inPort +" on host \""+ mParentStack.getParentNodeName()+"\"."); ! } ! ! } else ! { ! //create such a record in hashtable ! UDP_HashTableElement newElm = new UDP_HashTableElement(); ! newElm.PortStatus=1; ! newElm.application=application; ! newElm.connectedtoIP=""; ! newElm.connectedtoPort=0; ! ! PortTable.put(inPort,newElm); //hash table update ! } ! } else throw new TransportLayerException("UDP Error: can not listen to port "+ inPort +"! Use port range from 0 to 10000 to listen to."); ! } else throw new TransportLayerException("UDP Error: can not listen to port "+ inPort +"! Already listening to port " + lsPort + "."); ! /* { ! LayerInfo UDP_Info = new LayerInfo(getClass().getName()); ! UDP_Info.setObjectName(mParentStack.getParentNodeName()); ! UDP_Info.setDataType("UDP Packet"); ! UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("UDP port listening: \"UDP Error: can not listen to port "+ inPort +"! Already listening to port " + lsPort + ".\"."); ! Simulation.addLayerInfo(UDP_Info); ! } */ ! ! LayerInfo UDP_Info = new LayerInfo(getClass().getName()); ! UDP_Info.setObjectName(mParentStack.getParentNodeName()); ! UDP_Info.setDataType("UDP Applicaion"); ! UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("UDP application is now listening on UDP port "+ inPort +"."); ! Simulation.addLayerInfo(UDP_Info); } *************** *** 617,621 **** * This method finds LOCAL port number for an application. Port number range: [PORT_START_NUMBER; PORT_START_NUMBER+PORT_QUANT] * @author gift (sourceforge.net user) ! * @param application that will: take free port or take already occupied port (only by itself) or tell that all ports are busy :( * @return int port number that has been reserved for application * @exception TransportLayerException in several cases --- 662,666 ---- * This method finds LOCAL port number for an application. Port number range: [PORT_START_NUMBER; PORT_START_NUMBER+PORT_QUANT] * @author gift (sourceforge.net user) ! * @param application which local port will be returned * @return int port number that has been reserved for application * @exception TransportLayerException in several cases Index: Echo.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Echo.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Echo.java 20 Nov 2005 21:06:50 -0000 1.12 --- Echo.java 21 Nov 2005 14:56:01 -0000 1.13 *************** *** 40,44 **** public void Listen() throws TransportLayerException{ //throw new TransportLayerException("Cannot bind port " + listenPort + "."); ! mParentStack.ListenUDP(this, listenPort); } --- 40,49 ---- public void Listen() throws TransportLayerException{ //throw new TransportLayerException("Cannot bind port " + listenPort + "."); ! try{ ! mParentStack.ListenUDP(this, listenPort); ! } catch (TransportLayerException e) ! { ! ! } } |
From: gift <gi...@us...> - 2005-11-21 14:56:13
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9298/guiUI Modified Files: MainScreen.java Log Message: Check LayerInfo - BUGS Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** MainScreen.java 20 Nov 2005 15:17:35 -0000 1.9 --- MainScreen.java 21 Nov 2005 14:56:01 -0000 1.10 *************** *** 1,1548 **** ! /* ! 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. [...4613 lines suppressed...] ! /** ! ! * Returns the current cursor on the Sandbox ! ! * @return Cursor SandboxCursor The current cursor on the Sandbox ! ! */ ! ! ! ! public Cursor getCurrentSandboxCursor() ! ! { ! ! return Sandbox.getCursor(); ! ! } ! ! } ! |
From: gift <gi...@us...> - 2005-11-20 22:04:17
|
Update of /cvsroot/javanetsim/javaNetSim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22416 Modified Files: TODO.txt Log Message: task for tommorow (today) Index: TODO.txt =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/TODO.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TODO.txt 19 Nov 2005 21:53:50 -0000 1.5 --- TODO.txt 20 Nov 2005 22:03:59 -0000 1.6 *************** *** 38,41 **** --- 38,44 ---- 14. Switches (?) 15. UDP (Gift) + + server listens to port + new listen port => exception!!! 16. TCP(Gift && Key). 17. 2Fedor: RIP (over IP) |
From: gift <gi...@us...> - 2005-11-20 22:04:17
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22416/core/protocolsuite/tcp_ip Modified Files: Udp.java Log Message: task for tommorow (today) Index: Udp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Udp.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Udp.java 20 Nov 2005 21:06:50 -0000 1.21 --- Udp.java 20 Nov 2005 22:03:59 -0000 1.22 *************** *** 194,198 **** // test if this packet is for a local Address. - if(mParentStack.isInternalIP(inPacket.getDestIPAddress())){ --- 194,197 ---- *************** *** 512,518 **** { UDP_HashTableElement Elm=null; - try{ - Integer PortToFree=getApplicationLocalPortNumber(application); Elm=(UDP_HashTableElement) PortTable.get((Integer)PortToFree); --- 511,517 ---- { UDP_HashTableElement Elm=null; + try{ + Integer PortToFree=getApplicationLocalPortNumber(application); Elm=(UDP_HashTableElement) PortTable.get((Integer)PortToFree); *************** *** 521,525 **** Elm.connectedtoIP=""; Elm.connectedtoPort=0; ! }catch(Exception e){} } --- 520,525 ---- Elm.connectedtoIP=""; Elm.connectedtoPort=0; ! ! }catch(Exception e){} } |
From: Alexander B. <da...@us...> - 2005-11-20 21:06:58
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7498/core/protocolsuite/tcp_ip Modified Files: Application.java Echo.java Udp.java Log Message: Fixed UDP Error in Exceptions Index: Application.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Application.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Application.java 20 Nov 2005 20:30:53 -0000 1.10 --- Application.java 20 Nov 2005 21:06:50 -0000 1.11 *************** *** 105,114 **** } - /** - * This method totally disconnects from server. - * @author gift (sourceforge user) - * @version v0.01 - */ - - public abstract void TotalDisconnect()throws TransportLayerException; } --- 105,107 ---- Index: Udp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Udp.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Udp.java 20 Nov 2005 20:30:53 -0000 1.20 --- Udp.java 20 Nov 2005 21:06:50 -0000 1.21 *************** *** 458,462 **** Elm=(UDP_HashTableElement) PortTable.get((Integer)PortToClose); ! if (Elm.PortStatus==1) { //UDP_HashTableElement Elm = new UDP_HashTableElement(); --- 458,462 ---- Elm=(UDP_HashTableElement) PortTable.get((Integer)PortToClose); ! if (Elm.PortStatus==1 || (Elm.PortStatus==2 && PortToClose<PORT_START_NUMBER)) { //UDP_HashTableElement Elm = new UDP_HashTableElement(); *************** *** 512,515 **** --- 512,516 ---- { UDP_HashTableElement Elm=null; + try{ Integer PortToFree=getApplicationLocalPortNumber(application); *************** *** 520,524 **** Elm.connectedtoIP=""; Elm.connectedtoPort=0; ! } --- 521,525 ---- Elm.connectedtoIP=""; Elm.connectedtoPort=0; ! }catch(Exception e){} } Index: Echo.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Echo.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Echo.java 20 Nov 2005 20:30:53 -0000 1.11 --- Echo.java 20 Nov 2005 21:06:50 -0000 1.12 *************** *** 90,103 **** } ! /** ! * This method disconnects from server. ! * @author key ! * @version v0.01 ! */ ! ! public void TotalDisconnect() throws TransportLayerException { ! mParentStack.FreeUDPApplication(this); ! } ! /** * This method sends data to the other side. --- 90,94 ---- } ! /** * This method sends data to the other side. *************** *** 185,189 **** */ public void SendEcho(String Data, String Host, int port) throws CommunicationException, LowLinkException, InvalidNetworkLayerDeviceException, TransportLayerException{ ! TotalDisconnect(); ClientConnect(Host, port); --- 176,181 ---- */ public void SendEcho(String Data, String Host, int port) throws CommunicationException, LowLinkException, InvalidNetworkLayerDeviceException, TransportLayerException{ ! mParentStack.FreeUDPApplication(this); ! ClientConnect(Host, port); |
From: gift <gi...@us...> - 2005-11-20 20:33:03
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31566/core Added Files: TransportLayerPortException.java Log Message: --- NEW FILE: TransportLayerPortException.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. */ /* * TransportLayerPortException.java * * Created on 20 November 2005, 22:27 * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */ package core; /** * @author gift (sourceforge.net user) * @param inExceptionMsg the Exception Message * @version v0.10 */ public class TransportLayerPortException extends SimulationException { /** Creates a new instance of TransportLayerException */ public TransportLayerPortException(String inExceptionMsg) { super(inExceptionMsg); } /** * @author gift (sourceforge.net user) * @return exceptionMsg * @version v0.10 */ public String toString() { return exceptionMsg; } } |
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30938/core/protocolsuite/tcp_ip Modified Files: ARPTableEntry.java Application.java Echo.java ICMP_packet.java IGMP.java IPAddress.java IPV4Address.java IPV6Address.java InvalidIPAddressException.java InvalidSubnetMaskException.java Ip.java IpV6.java ProtocolStack.java ProtocolStackException.java RARP.java SNMP.java Tcp.java Tcp_packet.java Udp.java ipconfig.java ipconfigTableEntry.java Log Message: Index: ipconfig.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ipconfig.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ipconfig.java 8 Nov 2005 16:10:47 -0000 1.1 --- ipconfig.java 20 Nov 2005 20:30:53 -0000 1.2 *************** *** 1,67 **** ! /* ! 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 core.protocolsuite.tcp_ip; ! ! import java.util.Vector; ! ! ! ! public class ipconfig { ! private Vector ipconfigTable; ! ! /** ! * Assigns a new IP config vector ! * @author luke_hamilton ! * @author bevan_calliess ! * @version v0.20 ! */ ! public ipconfig(){ ! ipconfigTable = new Vector(); ! } ! ! /** ! * Add a new entry to the IPconfigTable ! * @author luke_hamilton ! * @author bevan_calliess ! * @param inEntry - IPconfigTableEntry ! * @version v0.20 ! */ ! public void addTableEntry(ipconfigTableEntry inEntry){ ! ipconfigTable.add(inEntry); ! } ! ! /** ! * Returns the size of the ipconfigTable ! * @author luke_hamilton ! * @author bevan_calliess ! * @return size - The size of the ipconfigtable ! */ ! public int size(){ ! return ipconfigTable.size(); ! } ! }//EOF --- 1,67 ---- ! /* ! 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 core.protocolsuite.tcp_ip; ! ! import java.util.Vector; ! ! ! ! public class ipconfig { ! private Vector ipconfigTable; ! ! /** ! * Assigns a new IP config vector ! * @author luke_hamilton ! * @author bevan_calliess ! * @version v0.20 ! */ ! public ipconfig(){ ! ipconfigTable = new Vector(); ! } ! ! /** ! * Add a new entry to the IPconfigTable ! * @author luke_hamilton ! * @author bevan_calliess ! * @param inEntry - IPconfigTableEntry ! * @version v0.20 ! */ ! public void addTableEntry(ipconfigTableEntry inEntry){ ! ipconfigTable.add(inEntry); ! } ! ! /** ! * Returns the size of the ipconfigTable ! * @author luke_hamilton ! * @author bevan_calliess ! * @return size - The size of the ipconfigtable ! */ ! public int size(){ ! return ipconfigTable.size(); ! } ! }//EOF Index: Tcp_packet.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp_packet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Tcp_packet.java 8 Nov 2005 16:10:47 -0000 1.1 --- Tcp_packet.java 20 Nov 2005 20:30:53 -0000 1.2 *************** *** 1,42 **** ! /* ! 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 core.protocolsuite.tcp_ip; ! import core.Packet; ! ! /** ! * This is for design and future implementation of TCP_PACKET ! * @author luke_hamilton ! * @since Sep 17, 2004 ! * @version v0.20 ! */ ! ! ! public class Tcp_packet extends Packet{ ! } --- 1,42 ---- ! /* ! 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 core.protocolsuite.tcp_ip; ! import core.Packet; ! ! /** ! * This is for design and future implementation of TCP_PACKET ! * @author luke_hamilton ! * @since Sep 17, 2004 ! * @version v0.20 ! */ ! ! ! public class Tcp_packet extends Packet{ ! } Index: InvalidIPAddressException.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/InvalidIPAddressException.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** InvalidIPAddressException.java 8 Nov 2005 16:10:47 -0000 1.1 --- InvalidIPAddressException.java 20 Nov 2005 20:30:53 -0000 1.2 *************** *** 1,46 **** ! /* ! 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 core.protocolsuite.tcp_ip; ! /** ! * Exception that is thrown when there is an invalid IP address ! * @author luke_hamilton ! * @since Sep 27, 2004 ! * @version v0.20 ! */ ! public class InvalidIPAddressException extends ProtocolStackException { ! ! /** ! * Call the super class and passes the message up ! * @author luke_hamilton ! * @param inExceptionMsg - Message ! * @version v0.20 ! */ ! public InvalidIPAddressException(String inExceptionMsg){ ! super(inExceptionMsg); ! } ! } --- 1,46 ---- ! /* ! 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 core.protocolsuite.tcp_ip; ! /** ! * Exception that is thrown when there is an invalid IP address ! * @author luke_hamilton ! * @since Sep 27, 2004 ! * @version v0.20 ! */ ! public class InvalidIPAddressException extends ProtocolStackException { ! ! /** ! * Call the super class and passes the message up ! * @author luke_hamilton ! * @param inExceptionMsg - Message ! * @version v0.20 ! */ ! public InvalidIPAddressException(String inExceptionMsg){ ! super(inExceptionMsg); ! } ! } Index: Udp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Udp.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Udp.java 20 Nov 2005 19:13:04 -0000 1.19 --- Udp.java 20 Nov 2005 20:30:53 -0000 1.20 *************** *** 71,74 **** --- 71,76 ---- import core.TransportLayerException; + import core.TransportLayerPortException; + import core.InvalidNetworkLayerDeviceException; *************** *** 179,182 **** --- 181,185 ---- * @exception LowLinkException * @exception InvalidNetworkLayerDeviceException + * @exception TransportLayerPortException * @version v0.20 * @see TransportLayerException *************** *** 184,190 **** * @see LowLinkException * @see InvalidNetworkLayerDeviceException */ ! public void receiveUDPPacket(UDP_packet inPacket) throws TransportLayerException, LowLinkException { --- 187,194 ---- * @see LowLinkException * @see InvalidNetworkLayerDeviceException + * @see TransportLayerPortException */ ! public void receiveUDPPacket(UDP_packet inPacket) throws TransportLayerPortException, TransportLayerException, LowLinkException { *************** *** 204,212 **** { case 0: //port is free => Error: no application to receive UDP ! //have to disconnect listener from port ! Application listener; ! listener = (Application)Elm.application; ! listener.Disconnect(); ! throw new TransportLayerException("UDP Error: no server application listening to port "+inPacket.get_destPort() +" on host \""+ mParentStack.getParentNodeName()+"\"!"); //no break needed ;) case 1: // port is being listened to by a new application. Have to "establish" (in UDP no connections are being established) a new connection by replacing hashtable element --- 208,213 ---- { case 0: //port is free => Error: no application to receive UDP ! //have to disconnect listener from port ! throw new TransportLayerPortException("UDP Error: no server application listening to port "+inPacket.get_destPort() +" on host \""+ mParentStack.getParentNodeName()+"\"!"); //no break needed ;) case 1: // port is being listened to by a new application. Have to "establish" (in UDP no connections are being established) a new connection by replacing hashtable element *************** *** 237,241 **** Simulation.addLayerInfo(UDP_Info); ! listener = (Application)Elm.application; listener.RecvData(inPacket.getUDP_message()); --- 238,242 ---- Simulation.addLayerInfo(UDP_Info); ! Application listener; listener = (Application)Elm.application; listener.RecvData(inPacket.getUDP_message()); *************** *** 269,273 **** Simulation.addLayerInfo(UDP_Info); ! listener = (Application)Elm.application; listener.RecvData(inPacket.getUDP_message()); --- 270,274 ---- Simulation.addLayerInfo(UDP_Info); ! Application listener; listener = (Application)Elm.application; listener.RecvData(inPacket.getUDP_message()); *************** *** 278,304 **** } else { //have to disconnect listener from port ! ! listener = (Application)Elm.application; ! listener.Disconnect(); ! throw new TransportLayerException("UDP Error: port is busy! Port is connected to another host or/and port and is busy by another application." + "Port "+inPacket.get_destPort() +" on host \""+ mParentStack.getParentNodeName()+"\"."); ! } break; default: //UDP Error: unknown port status :( ! //have to disconnect listener from port ! ! listener = (Application)Elm.application; ! listener.Disconnect(); ! throw new TransportLayerException("UDP Error: unknown port status! Port "+inPacket.get_destPort() +" on host \""+ mParentStack.getParentNodeName()+"\"."); } ! } else { ! //have to disconnect listener from port ! UDP_HashTableElement Elm = null; ! Elm=(UDP_HashTableElement)PortTable.get(inPacket.get_destPort()); ! Application listener; ! listener = (Application)Elm.application; ! listener.Disconnect(); /* ! throw new TransportLayerException("UDP Error: port " + inPacket.get_destPort() + " does not exist. Host \"" + mParentStack.getParentNodeName()+"\"."); } } --- 279,292 ---- } else { //have to disconnect listener from port ! throw new TransportLayerPortException("UDP Error: port is busy! Port is connected to another host or/and port and is busy by another application." + "Port "+inPacket.get_destPort() +" on host \""+ mParentStack.getParentNodeName()+"\"."); } break; default: //UDP Error: unknown port status :( ! //have to disconnect listener from port ! throw new TransportLayerPortException("UDP Error: unknown port status! Port "+inPacket.get_destPort() +" on host \""+ mParentStack.getParentNodeName()+"\"."); } ! } else { ! throw new TransportLayerPortException("UDP Error: port " + inPacket.get_destPort() + " does not exist. Host \"" + mParentStack.getParentNodeName()+"\"."); } } *************** *** 512,515 **** --- 500,525 ---- } + /** + * This method sets the UDP port totally free + * @author gift (sourceforge.net user) + * @param application application that uses port + * @return Nothing + * @exception TransportLayerException + * @version v0.10 + * @see TransportLayerException + */ + public void FreeApplication(Object application) throws TransportLayerException //changes any port status to 0 (free) + { + UDP_HashTableElement Elm=null; + Integer PortToFree=getApplicationLocalPortNumber(application); + + Elm=(UDP_HashTableElement) PortTable.get((Integer)PortToFree); + + Elm.PortStatus=0; + Elm.application=null; + Elm.connectedtoIP=""; + Elm.connectedtoPort=0; + + } /** Index: IGMP.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/IGMP.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IGMP.java 8 Nov 2005 16:10:47 -0000 1.1 --- IGMP.java 20 Nov 2005 20:30:53 -0000 1.2 *************** *** 1,43 **** ! /* ! 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 core.protocolsuite.tcp_ip; ! ! import java.io.Serializable; ! ! /** ! * @author luke_hamilton ! * @since Sep 17, 2004 ! * @version v0.00 ! * ! */ ! ! ! public class IGMP implements Serializable{ ! } --- 1,43 ---- ! /* ! 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 core.protocolsuite.tcp_ip; ! ! import java.io.Serializable; ! ! /** ! * @author luke_hamilton ! * @since Sep 17, 2004 ! * @version v0.00 ! * ! */ ! ! ! public class IGMP implements Serializable{ ! } Index: IPV6Address.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/IPV6Address.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IPV6Address.java 8 Nov 2005 16:10:47 -0000 1.1 --- IPV6Address.java 20 Nov 2005 20:30:53 -0000 1.2 *************** *** 1,41 **** ! /* ! 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 core.protocolsuite.tcp_ip; ! ! /** ! * This class will one day contain all the method related to IPv6's ip addressing. ! * As i currently know nothining about IPv6, i am unable to determine if there are ! * any method that are both common to IPv4 and IPv6, and that is why the superclass ! * is a very bare class. ! * @author luke_hamilton ! * @since Sep 19, 2004 ! * @version v0.20 ! **/ ! public class IPV6Address extends IPAddress { ! ! } --- 1,41 ---- ! /* ! 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 core.protocolsuite.tcp_ip; ! ! /** ! * This class will one day contain all the method related to IPv6's ip addressing. ! * As i currently know nothining about IPv6, i am unable to determine if there are ! * any method that are both common to IPv4 and IPv6, and that is why the superclass ! * is a very bare class. ! * @author luke_hamilton ! * @since Sep 19, 2004 ! * @version v0.20 ! **/ ! public class IPV6Address extends IPAddress { ! ! } Index: ProtocolStackException.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStackException.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ProtocolStackException.java 8 Nov 2005 16:10:47 -0000 1.1 --- ProtocolStackException.java 20 Nov 2005 20:30:53 -0000 1.2 *************** *** 1,49 **** ! /* ! 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 core.protocolsuite.tcp_ip; ! ! import core.SimulationException; ! ! /** ! * This class extends the SimulationException class. ! * @author luke_hamilton ! * @since Sep 27, 2004 ! * @version v0.20 ! */ ! public class ProtocolStackException extends SimulationException{ ! /** ! * This method is called when there is an error within the ! * ProtocolStack. The idea is that this error should never occur. ! * @author luke_hamilton ! * @param inExceptionMsg ! * @version v0.20 ! */ ! public ProtocolStackException(String inExceptionMsg){ ! super(inExceptionMsg); ! } ! } --- 1,49 ---- ! /* ! 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 core.protocolsuite.tcp_ip; ! ! import core.SimulationException; ! ! /** ! * This class extends the SimulationException class. ! * @author luke_hamilton ! * @since Sep 27, 2004 ! * @version v0.20 ! */ ! public class ProtocolStackException extends SimulationException{ ! /** ! * This method is called when there is an error within the ! * ProtocolStack. The idea is that this error should never occur. ! * @author luke_hamilton ! * @param inExceptionMsg ! * @version v0.20 ! */ ! public ProtocolStackException(String inExceptionMsg){ ! super(inExceptionMsg); ! } ! } Index: Tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Tcp.java 8 Nov 2005 16:10:47 -0000 1.1 --- Tcp.java 20 Nov 2005 20:30:53 -0000 1.2 *************** *** 1,43 **** ! /* ! 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 core.protocolsuite.tcp_ip; ! ! import java.io.Serializable; ! ! /** ! * This is for design and future implementation of TCP ! * @author luke_hamilton ! * @since Sep 17, 2004 ! * @version v0.20 ! */ ! ! ! public class Tcp implements Serializable{ ! } --- 1,43 ---- ! /* ! 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 core.protocolsuite.tcp_ip; ! ! import java.io.Serializable; ! ! /** ! * This is for design and future implementation of TCP ! * @author luke_hamilton ! * @since Sep 17, 2004 ! * @version v0.20 ! */ ! ! ! public class Tcp implements Serializable{ ! } Index: IPV4Address.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/IPV4Address.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IPV4Address.java 8 Nov 2005 16:10:47 -0000 1.1 --- IPV4Address.java 20 Nov 2005 20:30:53 -0000 1.2 *************** *** 1,587 **** ! /* ! 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. [...1145 lines suppressed...] ! if(subIP.equals(subInIP)){ //Compare the two substrings ! return true; ! } ! return false; ! } catch (Exception e) {} ! return false; ! } ! ! /* ! * int i = getNetworkIDBits(); ! ! subIP = binaryIpAddress.substring(0,i); //Create substring containing only the network bits of the binary address ! subInIP = IPV4Address.toBinaryString(inIPAddress).substring(0,getNetworkIDBits()); ! ! if(subIP.equals(subInIP)){ //Compare the two substrings ! return true; ! } ! */ ! ! }//EOF Index: RARP.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/RARP.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RARP.java 8 Nov 2005 16:10:47 -0000 1.1 --- RARP.java 20 Nov 2005 20:30:53 -0000 1.2 *************** *** 1,43 **** ! /* ! 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 core.protocolsuite.tcp_ip; ! ! import java.io.Serializable; ! ! /** ! * This is for design and future implementation of RARP ! * @author luke_hamilton ! * @since Sep 17, 2004 ! * @version v0.20 ! */ ! ! ! public class RARP implements Serializable{ ! } --- 1,43 ---- ! /* ! 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 core.protocolsuite.tcp_ip; ! ! import java.io.Serializable; ! ! /** ! * This is for design and future implementation of RARP ! * @author luke_hamilton ! * @since Sep 17, 2004 ! * @version v0.20 ! */ ! ! ! public class RARP implements Serializable{ ! } Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ProtocolStack.java 20 Nov 2005 19:13:04 -0000 1.12 --- ProtocolStack.java 20 Nov 2005 20:30:53 -0000 1.13 *************** *** 767,771 **** try{ mUDPprotocol.receiveUDPPacket(temp); ! }catch(TransportLayerException te){ //here *TODO*: disconnect sender from port!!! --- 767,772 ---- try{ mUDPprotocol.receiveUDPPacket(temp); ! }catch(TransportLayerException te){} ! catch(TransportLayerPortException tpe){ //here *TODO*: disconnect sender from port!!! *************** *** 774,779 **** UDP_Info.setDataType("UDP Packet"); UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("UDP port packet receiving: \""+ te.toString() + "\"."); Simulation.addLayerInfo(UDP_Info); } --- 775,781 ---- UDP_Info.setDataType("UDP Packet"); UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("UDP port packet receiving: \""+ tpe.toString() + "\"."); Simulation.addLayerInfo(UDP_Info); + // throw tpe; } *************** *** 1323,1326 **** --- 1325,1342 ---- } + /** + * This method sets the UDP port totally free + * @author gift (sourceforge.net user) + * @param application application that uses port + * @return Nothing + * @exception TransportLayerException + * @version v0.10 + * @see TransportLayerException + */ + public void FreeUDPApplication(Object application) throws TransportLayerException + { + mUDPprotocol.FreeApplication(application); + } + /** * This method sets the UDP port status to 1 (is being listened to) Index: InvalidSubnetMaskException.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/InvalidSubnetMaskException.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** InvalidSubnetMaskException.java 8 Nov 2005 16:10:47 -0000 1.1 --- InvalidSubnetMaskException.java 20 Nov 2005 20:30:53 -0000 1.2 *************** *** 1,50 **** ! /* ! 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 core.protocolsuite.tcp_ip; ! ! /** ! * Exception that is called when an Invalid SubnetMask is set ! * @author robert_hulford ! * @author Bevan_Calliess ! * @version v0.20 ! */ ! public class InvalidSubnetMaskException extends ProtocolStackException { ! ! ! /** ! * call the super class and passes the message to it ! * @author bevan_calliess ! * @author luke_hamilton ! * @param inMessage ! * @version v0.20 ! */ ! public InvalidSubnetMaskException (String inMessage){ ! super(inMessage); ! } ! ! } --- 1,50 ---- ! /* ! 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 core.protocolsuite.tcp_ip; ! ! /** ! * Exception that is called when an Invalid SubnetMask is set ! * @author robert_hulford ! * @author Bevan_Calliess ! * @version v0.20 ! */ ! public class InvalidSubnetMaskException extends ProtocolStackException { ! ! ! /** ! * call the super class and passes the message to it ! * @author bevan_calliess ! * @author luke_hamilton ! * @param inMessage ! * @version v0.20 ! */ ! public InvalidSubnetMaskException (String inMessage){ ! super(inMessage); ! } ! ! } Index: ICMP_packet.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ICMP_packet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ICMP_packet.java 8 Nov 2005 16:10:47 -0000 1.1 --- ICMP_packet.java 20 Nov 2005 20:30:53 -0000 1.2 *************** *** 1,118 **** ! /* ! 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 core.protocolsuite.tcp_ip; ! ! ! /** ! * Currently the only packets being used are echo_requests and echo_reply. ! * The others are in their for future development. ! * @author luke_hamilton ! * @author angela_brown ! * @author robert_hulford ! * @author bevan_calliess ! * @version v0.20 ! */ ! public class ICMP_packet extends IP_packet{ ! private int mMessageCode; ! private String ICMP_message; ! public static final int ECHO_REPLY = 0; ! public static final int DESTINATION_UNREACHABLE = 3; ! public static final int SOURCE_QUENCH = 4; ! public static final int REDIRECT = 5; ! public static final int ECHO_REQUEST = 8; ! public static final int ROUTER_ADVERTISEMENT = 9; ! public static final int ROUTER_SOLICITATION = 10; ! public static final int TIME_EXCEEDED = 11; ! public static final int PARAMETER_PROBLEM = 12; ! public static final int TIMESTAMP_REQUEST = 13; ! public static final int TIMESTAMP_REPLY = 14; ! public static final int INFORMATION_REQUEST = 15; ! public static final int INFORMATION_REPLY= 16; ! public static final int ADDRESSMASK_REQUEST = 17; ! public static final int ADDRESSMASK_REPLY = 18; ! ! /** ! * Assigns the Destination IPAddress ! * @author bevan_calliess ! * @author luke_hamilton ! * @param inDestIPAddress ! * @version v0.20 ! **/ ! ! public ICMP_packet(String inDestIPAddress) ! { ! super (inDestIPAddress); ! } ! /** ! * sets the ICMP_message ! * @author bevan_calliess ! * @param inICMP_message ! * @version v0.20 ! */ ! public void setICMP_message(String inICMP_message) ! { ! ICMP_message = inICMP_message; ! } ! /** ! * Return the ICMP_message ! * @author bevan_calliess ! * @return ICMP_message ! * @version v0.20 ! */ ! ! public String getICMP_message() ! { ! return ICMP_message; ! } ! /** ! * This method will take an integer value representing the ICMP Packet ! * code that identifies the type of Packet. EG an echo request packet is ! * type 8, Destination unreachable is 3. You can refer to Page 133 of ! * TCP/IP Principles, protocols & architectures VOl 1 ! * and see the constants setup in this class ! * NOTE no validation of Codes is currently implemented ! * @author bevan_calliess ! * @author angela_brown ! * @param InCode - The code of the message eg: 8 ! * @version v0.20 ! */ ! public void setMessageCode(int inCode){ ! mMessageCode = inCode; ! } ! /** ! * returns the message code for this packet ! * @author angela_brown ! * @author bevan_calliess ! * @return integer representing the message code ! * @version v0.20 ! **/ ! public int getMessageCode(){ ! return mMessageCode; ! } ! }//EOF \ No newline at end of file --- 1,118 ---- ! /* ! 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 O... [truncated message content] |
Update of /cvsroot/javanetsim/javaNetSim/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30938/core Modified Files: DataLinkLayerDevice.java EthernetLink.java EthernetNetworkInterface.java Ethernet_packet.java FiberLink.java Hub.java InvalidDataLinkLayerDeviceException.java InvalidDefaultGatewayException.java InvalidLinkConnectionException.java InvalidLinkNameException.java InvalidNetworkInterfaceNameException.java InvalidNetworkLayerDeviceException.java InvalidNodeNameException.java InvalidProtocolStackException.java LayerInfo.java LayerInfoHandler.java LowLinkException.java NetworkLayerDevice.java Packet.java ProtocolStack.java README.txt Router.java SendThread.java Simulation.java SimulationException.java Switch.java Version.java Log Message: Index: EthernetLink.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/EthernetLink.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EthernetLink.java 19 Nov 2005 17:54:33 -0000 1.2 --- EthernetLink.java 20 Nov 2005 20:30:53 -0000 1.3 *************** *** 1,86 **** ! /* ! 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 core; ! import java.util.*; ! /** ! * EthernetLink extends Link. It sets two Interface links to a pc. ! * @author luke_hamilton ! * @author bevan_calliess ! * @since Sep 17, 2004 ! * @version v0.20 ! */ ! ! ! public class EthernetLink extends Link { ! ! /** ! * Constructor to be used by the Simulation when connecting 2 PC's ! * We have made a design decision to restrict a Ethernet link to only has 2 ends. ! * @author bevan_calliess ! * @author luke_hamilton ! * @param String Name - Node name eg: PC1 ! * @param inInterface1 The first Interface to connect this link to eg: eth0 ! * @param inInterface2 The Seceond Interface to connect this link to eg: eth1 ! * @throws InvalidLinkConnectionException ! */ ! ! public EthernetLink(String inName, NetworkInterface inFirstNodeInterface, NetworkInterface inSecondNodeInterface)throws InvalidLinkConnectionException { ! super(inName); ! NetworkInterfaces.add(inFirstNodeInterface); ! NetworkInterfaces.add(inSecondNodeInterface); ! inFirstNodeInterface.setConnectedLink(this); ! inSecondNodeInterface.setConnectedLink(this); ! } ! ! /** ! * This method checks to see if the sourceName is within the hashtable ! * that is stored within the NetworkInterface Layer. If it is send inPacket ! * off to NetworkInterface. ! * @author bevan_calliess ! * @author luke_hamilton ! * @param inPacket - Ethernet Packet ! * @param inSourceName - Source name of node ! * @version v0.20 ! */ ! public void transportPacket(Ethernet_packet inPacket,String inSourceName) throws LowLinkException ! { ! Iterator it = NetworkInterfaces.iterator(); ! while (it.hasNext()) ! { ! NetworkInterface temp = (NetworkInterface) it.next(); ! if (!temp.getSourceName().equals(inSourceName)) ! { ! if( (sievingCoefficient/100)>Math.random()) ! temp.receivePacket(inPacket); ! else throw new LowLinkException("Packet lost due to physical link problems!"); ! } ! } ! } ! } --- 1,86 ---- ! /* ! 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 core; ! import java.util.*; ! /** ! * EthernetLink extends Link. It sets two Interface links to a pc. ! * @author luke_hamilton ! * @author bevan_calliess ! * @since Sep 17, 2004 ! * @version v0.20 ! */ ! ! ! public class EthernetLink extends Link { ! ! /** ! * Constructor to be used by the Simulation when connecting 2 PC's ! * We have made a design decision to restrict a Ethernet link to only has 2 ends. ! * @author bevan_calliess ! * @author luke_hamilton ! * @param String Name - Node name eg: PC1 ! * @param inInterface1 The first Interface to connect this link to eg: eth0 ! * @param inInterface2 The Seceond Interface to connect this link to eg: eth1 ! * @throws InvalidLinkConnectionException ! */ ! ! public EthernetLink(String inName, NetworkInterface inFirstNodeInterface, NetworkInterface inSecondNodeInterface)throws InvalidLinkConnectionException { ! super(inName); ! NetworkInterfaces.add(inFirstNodeInterface); ! NetworkInterfaces.add(inSecondNodeInterface); ! inFirstNodeInterface.setConnectedLink(this); ! inSecondNodeInterface.setConnectedLink(this); ! } ! ! /** ! * This method checks to see if the sourceName is within the hashtable ! * that is stored within the NetworkInterface Layer. If it is send inPacket ! * off to NetworkInterface. ! * @author bevan_calliess ! * @author luke_hamilton ! * @param inPacket - Ethernet Packet ! * @param inSourceName - Source name of node ! * @version v0.20 ! */ ! public void transportPacket(Ethernet_packet inPacket,String inSourceName) throws LowLinkException ! { ! Iterator it = NetworkInterfaces.iterator(); ! while (it.hasNext()) ! { ! NetworkInterface temp = (NetworkInterface) it.next(); ! if (!temp.getSourceName().equals(inSourceName)) ! { ! if( (sievingCoefficient/100)>Math.random()) ! temp.receivePacket(inPacket); ! else throw new LowLinkException("Packet lost due to physical link problems!"); ! } ! } ! } ! } Index: Hub.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Hub.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Hub.java 8 Nov 2005 15:35:29 -0000 1.1 --- Hub.java 20 Nov 2005 20:30:53 -0000 1.2 *************** *** 1,109 **** ! /* ! Java Network Simulator (jNetSim) ! ! Copyright (c) 2005, Ice Team; All rights reserved. ! 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 Ice Team 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 core; ! import java.util.*; ! ! /** ! * This class extends of the DataLinkLayerDevice and allows the ! * creation of hubs ! * @author bevan_calliess ! * @author luke_hamilton ! * @author Key ! * @since Nov 8, 2005 ! * @version v0.22 ! **/ ! ! public class Hub extends DataLinkLayerDevice { ! ! /** ! * This creates a layer 1 hub with a default of 4 interface (ports) ! * @author luke_hamilton ! * @param inName The name of the Hub ! * @param inProtocolStackLayers ! * @version v0.20 ! */ ! ! int sz = 0; ! ! public Hub(String inName) { ! super(inName, 1); //pass name and protocolstack layer ! addNetworkInterface("eth0"); ! addNetworkInterface("eth1"); ! addNetworkInterface("eth2"); ! addNetworkInterface("eth3"); ! addNetworkInterface("eth4"); ! } ! ! ! public void Reset(){ ! sz = 0; ! } ! ! public int getState(){ ! return sz; ! } ! ! /** ! * This method will recieve a packet from any of the connected links and the copy ! * the Packet and distribute a copy to each of the other connected links. ! * @author bevan_calliess ! * @param inPacket - The packet to be transported ! * @param inLinkName - The name of the link that sent the packet eg: eth0 ! */ ! ! protected void receivePacket(Packet inPacket,String inInterfaceName) throws LowLinkException{ ! if(sz!=1){ ! Ethernet_packet tempPacket = (Ethernet_packet)inPacket; ! Enumeration it; ! ! ! try{ ! it = NetworkInterfacetable.elements(); ! ! ! while(it.hasMoreElements()){ ! //Create a copy of the packet ! Ethernet_packet copyPacket = new Ethernet_packet(tempPacket.getData(), tempPacket.getDestinationMACAddress(),tempPacket.getSourceMACAddress()); ! ! //Test to see if the current Interface is the Interface that sent in the packet ! // if it is skip that interface ! NetworkInterface tempInterface = (NetworkInterface)it.nextElement(); ! if(!tempInterface.getName().equals(inInterfaceName)){ ! tempInterface.sendPacket(copyPacket); ! } ! ! } ! }catch(Throwable th) ! { ! sz=1; ! throw new LowLinkException("Hub buffer overflow (packet loop flood?)."); ! } ! } ! } ! } --- 1,109 ---- ! /* ! Java Network Simulator (jNetSim) ! ! Copyright (c) 2005, Ice Team; All rights reserved. ! 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 Ice Team 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 core; ! import java.util.*; ! ! /** ! * This class extends of the DataLinkLayerDevice and allows the ! * creation of hubs ! * @author bevan_calliess ! * @author luke_hamilton ! * @author Key ! * @since Nov 8, 2005 ! * @version v0.22 ! **/ ! ! public class Hub extends DataLinkLayerDevice { ! ! /** ! * This creates a layer 1 hub with a default of 4 interface (ports) ! * @author luke_hamilton ! * @param inName The name of the Hub ! * @param inProtocolStackLayers ! * @version v0.20 ! */ ! ! int sz = 0; ! ! public Hub(String inName) { ! super(inName, 1); //pass name and protocolstack layer ! addNetworkInterface("eth0"); ! addNetworkInterface("eth1"); ! addNetworkInterface("eth2"); ! addNetworkInterface("eth3"); ! addNetworkInterface("eth4"); ! } ! ! ! public void Reset(){ ! sz = 0; ! } ! ! public int getState(){ ! return sz; ! } ! ! /** ! * This method will recieve a packet from any of the connected links and the copy ! * the Packet and distribute a copy to each of the other connected links. ! * @author bevan_calliess ! * @param inPacket - The packet to be transported ! * @param inLinkName - The name of the link that sent the packet eg: eth0 ! */ ! ! protected void receivePacket(Packet inPacket,String inInterfaceName) throws LowLinkException{ ! if(sz!=1){ ! Ethernet_packet tempPacket = (Ethernet_packet)inPacket; ! Enumeration it; ! ! ! try{ ! it = NetworkInterfacetable.elements(); ! ! ! while(it.hasMoreElements()){ ! //Create a copy of the packet ! Ethernet_packet copyPacket = new Ethernet_packet(tempPacket.getData(), tempPacket.getDestinationMACAddress(),tempPacket.getSourceMACAddress()); ! ! //Test to see if the current Interface is the Interface that sent in the packet ! // if it is skip that interface ! NetworkInterface tempInterface = (NetworkInterface)it.nextElement(); ! if(!tempInterface.getName().equals(inInterfaceName)){ ! tempInterface.sendPacket(copyPacket); ! } ! ! } ! }catch(Throwable th) ! { ! sz=1; ! throw new LowLinkException("Hub buffer overflow (packet loop flood?)."); ! } ! } ! } ! } Index: Version.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Version.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Version.java 8 Nov 2005 15:35:29 -0000 1.1 --- Version.java 20 Nov 2005 20:30:53 -0000 1.2 *************** *** 1,56 **** ! /* ! 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 core; ! ! /** ! * This Class hold a array of Strings listing the stakeholders of the ! * project, their role and semester they worked on the project ! * @author luke_hamilton ! * @author Key ! * @since Sep 23, 2004 ! * @version v0.22 ! */ ! public class Version { ! public final static String CORE_VERSION = "v0.22"; //version of the simulation core ! ! public static final String TEAM_MEMBERS[] = { ! "from 03 November 2005","", ! "Alexander Bolshev [Key]", "Project Manager / Documentation Manager / Developer / Maintainer", "", "", ! "Semester 2, 2004", "", ! "Angela Brown " , "Project Manager / Documentation Manager / Developer ", ! "Bevan Calliess " , "Disaster Recovery Manager / Assistant Project Manager / Developer ", ! "Luke Hamilton " , "Documentation Manager / Project Manager / Developer ", ! "Michael Reith " , "Testing Manager / Assistant Release Manager / Developer ", ! "Rob Hulford " , "Release Manager / Assistant Disaster Recovery Manager / Developer \n", ! "Semester 1, 2004", "", ! "Tristan Veness " , "Project Manager / Developer ", ! "James Nikolaidis" , "Developer ", ! }; ! }//EOF --- 1,56 ---- ! /* ! 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 core; ! ! /** ! * This Class hold a array of Strings listing the stakeholders of the ! * project, their role and semester they worked on the project ! * @author luke_hamilton ! * @author Key ! * @since Sep 23, 2004 ! * @version v0.22 ! */ ! public class Version { ! public final static String CORE_VERSION = "v0.22"; //version of the simulation core ! ! public static final String TEAM_MEMBERS[] = { ! "from 03 November 2005","", ! "Alexander Bolshev [Key]", "Project Manager / Documentation Manager / Developer / Maintainer", "", "", ! "Semester 2, 2004", "", ! "Angela Brown " , "Project Manager / Documentation Manager / Developer ", ! "Bevan Calliess " , "Disaster Recovery Manager / Assistant Project Manager / Developer ", ! "Luke Hamilton " , "Documentation Manager / Project Manager / Developer ", ! "Michael Reith " , "Testing Manager / Assistant Release Manager / Developer ", ! "Rob Hulford " , "Release Manager / Assistant Disaster Recovery Manager / Developer \n", ! "Semester 1, 2004", "", ! "Tristan Veness " , "Project Manager / Developer ", ! "James Nikolaidis" , "Developer ", ! }; ! }//EOF Index: SimulationException.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/SimulationException.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SimulationException.java 8 Nov 2005 15:35:29 -0000 1.1 --- SimulationException.java 20 Nov 2005 20:30:53 -0000 1.2 *************** *** 1,60 **** ! /* ! 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 core; ! /** ! * This class hold a SimulationException Method that will be ! * thrown from within the core if an error is found relating to ! * SimulationException. ! * @author luke_hamilton ! * @since Sep 27, 2004 ! * @version v0.20 ! */ ! public class SimulationException extends Exception{ ! protected String exceptionMsg; ! /** ! * This method assigns the exception message that is thrown ! * by the child classes ! * @author luke_hamilton ! * @param inExceptionMsg - The Exception Message ! * @version v0.20 ! **/ ! public SimulationException(String inExceptionMsg){ ! exceptionMsg = inExceptionMsg; ! } ! /** ! * This method returns the exception method to the file that ! * calls it ! * @author luke_hamilton ! * @return String The Exception message ! * @version v0.20 ! */ ! public String toString(){ ! return "Exception Details: "+exceptionMsg; ! } ! }//EOF --- 1,60 ---- ! /* ! 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 core; ! /** ! * This class hold a SimulationException Method that will be ! * thrown from within the core if an error is found relating to ! * SimulationException. ! * @author luke_hamilton ! * @since Sep 27, 2004 ! * @version v0.20 ! */ ! public class SimulationException extends Exception{ ! protected String exceptionMsg; ! /** ! * This method assigns the exception message that is thrown ! * by the child classes ! * @author luke_hamilton ! * @param inExceptionMsg - The Exception Message ! * @version v0.20 ! **/ ! public SimulationException(String inExceptionMsg){ ! exceptionMsg = inExceptionMsg; ! } ! /** ! * This method returns the exception method to the file that ! * calls it ! * @author luke_hamilton ! * @return String The Exception message ! * @version v0.20 ! */ ! public String toString(){ ! return "Exception Details: "+exceptionMsg; ! } ! }//EOF Index: InvalidProtocolStackException.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/InvalidProtocolStackException.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** InvalidProtocolStackException.java 8 Nov 2005 15:35:29 -0000 1.1 --- InvalidProtocolStackException.java 20 Nov 2005 20:30:53 -0000 1.2 *************** *** 1,50 **** ! /* ! 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 core; ! ! /** ! * InvalidProtoclStackException Class that extends from the Simulation Exception ! * class ! * @author luke_hamilton ! * @version v0.20 ! **/ ! ! public class InvalidProtocolStackException extends SimulationException { ! /** ! * This method throw inExceptionMsg up to the super class Simulation ! * Excpetion ! * @author luke_hamilton ! * @param inExceptionMsg - The Exception Message ! * @version v0.20 ! **/ ! public InvalidProtocolStackException(String inExceptionMsg) { ! super(inExceptionMsg); ! } ! ! } --- 1,50 ---- ! /* ! 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 core; ! ! /** ! * InvalidProtoclStackException Class that extends from the Simulation Exception ! * class ! * @author luke_hamilton ! * @version v0.20 ! **/ ! ! public class InvalidProtocolStackException extends SimulationException { ! /** ! * This method throw inExceptionMsg up to the super class Simulation ! * Excpetion ! * @author luke_hamilton ! * @param inExceptionMsg - The Exception Message ! * @version v0.20 ! **/ ! public InvalidProtocolStackException(String inExceptionMsg) { ! super(inExceptionMsg); ! } ! ! } Index: LayerInfoHandler.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/LayerInfoHandler.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LayerInfoHandler.java 8 Nov 2005 15:35:29 -0000 1.1 --- LayerInfoHandler.java 20 Nov 2005 20:30:53 -0000 1.2 *************** *** 1,131 **** ! 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 java.util.*; ! ! /** ! * The LayerInfoHandler's job is to receive and store LayerInfo objects and pass them ! * up to the Simulation (which then passes them to the GUI or CLI) when required. These LayerInfo objects ! * are passed to the LayerInfoHandler when an object in the Simulation (such as a Protocol or NetworkInterface) ! * has received, processed or is sending a Packet or some other data object. Any kind of ! * information that the user might want to see during a 'send' process should be passed to the LayerInfoHandler ! * encapsulated in a LayerInfo object. ! * ! * @author tristan_veness ! * @version 13 June 2004 ! * @version v0.10 ! */ ! ! class LayerInfoHandler { ! /** Queue to hold incoming info from an Object */ ! private Vector infoQueue; ! /** Indicates when there is no more info to receive */ ! private boolean ended; ! ! /** Constructs a new LayerInfoHandler */ ! protected LayerInfoHandler() { ! infoQueue = new Vector(); ! ended = false; ! } ! ! /** ! * Receives info and places it into the LayerInfoHandler's info queue. ! * @param info - The LayerInfo object to receive. ! * @author tristan_veness ! * @version v0.10 ! */ ! public void receiveInfo(LayerInfo info) { ! if (!ended) { ! infoQueue.add(info); ! } ! } ! ! /** ! * Gets the next LayerInfo object from the infoQueue and removes it from the queue. ! * @author tristan_veness ! * @return null when there are no more items in the queue. ! * @version v0.10 ! **/ ! public LayerInfo getNext() { ! if (infoQueue.size() == 0) { ! return null; ! } ! LayerInfo info = (LayerInfo)infoQueue.elementAt(0); ! infoQueue.remove(0); ! return info; ! } ! ! /** ! * Sets the state of the LayerInfoHandler to indicate it can receive no more info ! * @author tristan_veness ! * @version v0.10 ! **/ ! public void end() { ! ended = true; ! } ! ! /** ! * Returns the state of the LayerInfoHandler ! * @author tristan_veness ! * @return true if the LayerInfoHandler can not receive any more info. ! * False if it is still open to incoming info. ! * @version v0.10 ! **/ ! public boolean hasEnded() { ! return ended; ! } ! ! /** ! * This method clears the vector of all ! * Layer info objects ready for a new recording. * ! * @author tristan_veness ! * @version v0.10 ! **/ ! public void clear(){ ! infoQueue = new Vector(); ! } ! ! /** ! * This method returns a vector containing String arrays that ! * represent each object recorded by the LayerInfoHandler. * ! * @author tristan_veness ! * @return Vector containg string arrays for each line recorded ! * @version v0.10 ! **/ ! public Vector getRecordedInfo(){ ! Vector output = new Vector(); ! Iterator it = infoQueue.iterator(); ! while(it.hasNext()){ ! LayerInfo tempInfo = (LayerInfo)it.next(); ! output.addElement(tempInfo.getRecordedInfo()); ! } ! return output; ! } ! }//EOF --- 1,131 ---- ! 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 java.util.*; ! ! /** ! * The LayerInfoHandler's job is to receive and store LayerInfo objects and pass them ! * up to the Simulation (which then passes them to the GUI or CLI) when required. These LayerInfo objects ! * are passed to the LayerInfoHandler when an object in the Simulation (such as a Protocol or NetworkInterface) ! * has received, processed or is sending a Packet or some other data object. Any kind of ! * information that the user might want to see during a 'send' process should be passed to the LayerInfoHandler ! * encapsulated in a LayerInfo object. ! * ! * @author tristan_veness ! * @version 13 June 2004 ! * @version v0.10 ! */ ! ! class LayerInfoHandler { ! /** Queue to hold incoming info from an Object */ ! private Vector infoQueue; ! /** Indicates when there is no more info to receive */ ! private boolean ended; ! ! /** Constructs a new LayerInfoHandler */ ! protected LayerInfoHandler() { ! infoQueue = new Vector(); ! ended = false; ! } ! ! /** ! * Receives info and places it into the LayerInfoHandler's info queue. ! * @param info - The LayerInfo object to receive. ! * @author tristan_veness ! * @version v0.10 ! */ ! public void receiveInfo(LayerInfo info) { ! if (!ended) { ! infoQueue.add(info); ! } ! } ! ! /** ! * Gets the next LayerInfo object from the infoQueue and removes it from the queue. ! * @author tristan_veness ! * @return null when there are no more items in the queue. ! * @version v0.10 ! **/ ! public LayerInfo getNext() { ! if (infoQueue.size() == 0) { ! return null; ! } ! LayerInfo info = (LayerInfo)infoQueue.elementAt(0); ! infoQueue.remove(0); ! return info; ! } ! ! /** ! * Sets the state of the LayerInfoHandler to indicate it can receive no more info ! * @author tristan_veness ! * @version v0.10 ! **/ ! public void end() { ! ended = true; ! } ! ! /** ! * Returns the state of the LayerInfoHandler ! * @author tristan_veness ! * @return true if the LayerInfoHandler can not receive any more info. ! * False if it is still open to incoming info. ! * @version v0.10 ! **/ ! public boolean hasEnded() { ! return ended; ! } ! ! /** ! * This method clears the vector of all ! * Layer info objects ready for a new recording. * ! * @author tristan_veness ! * @version v0.10 ! **/ ! public void clear(){ ! infoQueue = new Vector(); ! } ! ! /** ! * This method returns a vector containing String arrays that ! * represent each object recorded by the LayerInfoHandler. * ! * @author tristan_veness ! * @return Vector containg string arrays for each line recorded ! * @version v0.10 ! **/ ! public Vector getRecordedInfo(){ ! Vector output = new Vector(); ! Iterator it = infoQueue.iterator(); ! while(it.hasNext()){ ! LayerInfo tempInfo = (LayerInfo)it.next(); ! output.addElement(tempInfo.getRecordedInfo()); ! } ! return output; ! } ! }//EOF Index: InvalidNetworkLayerDeviceException.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/InvalidNetworkLayerDeviceException.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** InvalidNetworkLayerDeviceException.java 8 Nov 2005 15:35:29 -0000 1.1 --- InvalidNetworkLayerDeviceException.java 20 Nov 2005 20:30:53 -0000 1.2 *************** *** 1,47 **** ! /* ! 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 core; ! /** ! * InvalidNetworkLayerDeviceException Class that extends from the Simulation Exception ! * class ! * @author luke_hamilton ! * @version v0.20 ! **/ ! public class InvalidNetworkLayerDeviceException extends SimulationException { ! /** ! * This method throw inExceptionMsg up to the super class Simulation ! * Excpetion ! * @author luke_hamilton ! * @param inExceptionMsg - The Exception Message ! * @version v0.20 ! */ ! public InvalidNetworkLayerDeviceException(String inExceptionMsg) { ! super(inExceptionMsg); ! } ! ! } --- 1,47 ---- ! /* ! 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 core; ! /** ! * InvalidNetworkLayerDeviceException Class that extends from the Simulation Exception ! * class ! * @author luke_hamilton ! * @version v0.20 ! **/ ! public class InvalidNetworkLayerDeviceException extends SimulationException { ! /** ! * This method throw inExceptionMsg up to the super class Simulation ! * Excpetion ! * @author luke_hamilton ! * @param inExceptionMsg - The Exception Message ! * @version v0.20 ! */ ! public InvalidNetworkLayerDeviceException(String inExceptionMsg) { ! super(inExceptionMsg); ! } ! ! } Index: InvalidNetworkInterfaceNameException.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/InvalidNetworkInterfaceNameException.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** InvalidNetworkInterfaceNameException.java 8 Nov 2005 15:35:29 -0000 1.1 --- InvalidNetworkInterfaceNameException.java 20 Nov 2005 20:30:53 -0000 1.2 *************** *** 1,49 **** ! /* ! 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 core; ! ! /** ! * This InvalidNetworkInterfaceName Exception Class that extends from the ! * Simulation Exception class ! * @author luke_hamilton ! * @since Sep 27, 2004 ! * @version v0.20 ! **/ ! public class InvalidNetworkInterfaceNameException extends SimulationException{ ! ! /** ! * This method throw inExceptionMsg up to the super class Simulation ! * Excpetion ! * @author luke_hamilton ! * @param inExceptionMsg - The Excpetion Message ! * @version v0.20 ! */ ! public InvalidNetworkInterfaceNameException(String inExceptionMsg) { ! super(inExceptionMsg); ! } ! } --- 1,49 ---- ! /* ! 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 core; ! ! /** ! * This InvalidNetworkInterfaceName Exception Class that extends from the ! * Simulation Exception class ! * @author luke_hamilton ! * @since Sep 27, 2004 ! * @version v0.20 ! **/ ! public class InvalidNetworkInterfaceNameException extends SimulationException{ ! ! /** ! * This method throw inExceptionMsg up to the super class Simulation ! * Excpetion ! * @author luke_hamilton ! * @param inExceptionMsg - The Excpetion Message ! * @version v0.20 ! */ ! public InvalidNetworkInterfaceNameException(String inExceptionMsg) { ! super(inExceptionMsg); ! } ! } Index: Simulation.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Simulation.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Simulation.java 19 Nov 2005 16:55:37 -0000 1.4 --- Simulation.java 20 Nov 2005 20:30:53 -0000 1.5 *************** *** 1,1101 **** ! /* ! 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. [...2173 lines suppressed...] ! vecInterfaceInfo.add((String)tempNetworkCard.getConnectLinkName()); ! } ! ! catch(InvalidNetworkInterfaceNameException e) ! { ! //This should never happen ! } ! vecNodeInfo.add(vecInterfaceInfo); ! } ! ! } ! ! } ! else{ ! throw new InvalidNodeNameException("Node does not exist."); ! } ! return vecNodeInfo; ! } ! ! }//EOF Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/ProtocolStack.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ProtocolStack.java 19 Nov 2005 21:53:51 -0000 1.4 --- ProtocolStack.java 20 Nov 2005 20:30:53 -0000 1.5 *************** *** 1,77 **** ! /* ! 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. ! /* ! 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 core; ! ! /** ! * @author luke_hamilton ! * @since Sep 17, 2004 ! * @version v0.20 ! */ ! ! public abstract class ProtocolStack { ! public static final int TCP_IP = 0; ! public static final int IPX_SPX = 1; ! public static final int IBM_SNA = 2; ! public static final int APPLETALK = 3; ! ! public static int UIDGen; ! /** ! * Future use. All protocol stacks regardless of type must implement ! * recievepacket! ! * @author bevan_calliess ! * @param inPacket ! */ ! public abstract void receivePacket(Packet inPacket) throws LowLinkException; ! ! }//EOF --- 1,154 ---- ! /* ! ! 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... [truncated message content] |
From: gift <gi...@us...> - 2005-11-20 20:31:02
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/ipx_spx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30938/core/protocolsuite/ipx_spx Modified Files: ProtocolStack.java Log Message: Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/ipx_spx/ProtocolStack.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ProtocolStack.java 8 Nov 2005 16:11:41 -0000 1.1 --- ProtocolStack.java 20 Nov 2005 20:30:53 -0000 1.2 *************** *** 1,49 **** ! /* ! 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 core.protocolsuite.ipx_spx; ! ! import core.Packet; ! ! ! /** ! * @author luke_hamilton ! * @since Sep 17, 2004 ! * @version v0.00 ! * ! */ ! ! ! public class ProtocolStack extends core.ProtocolStack { ! public void sendPacket(String inDestIPAddress, String inPacketType, String inPacketData){ ! } ! public void receivePacket(Packet inPacket){ ! } ! ! }//EOF --- 1,49 ---- ! /* ! 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 core.protocolsuite.ipx_spx; ! ! import core.Packet; ! ! ! /** ! * @author luke_hamilton ! * @since Sep 17, 2004 ! * @version v0.00 ! * ! */ ! ! ! public class ProtocolStack extends core.ProtocolStack { ! public void sendPacket(String inDestIPAddress, String inPacketType, String inPacketData){ ! } ! public void receivePacket(Packet inPacket){ ! } ! ! }//EOF |
From: gift <gi...@us...> - 2005-11-20 19:13:13
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13819/core/protocolsuite/tcp_ip Modified Files: Application.java Echo.java ProtocolStack.java Udp.java Log Message: Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ProtocolStack.java 20 Nov 2005 16:20:56 -0000 1.11 --- ProtocolStack.java 20 Nov 2005 19:13:04 -0000 1.12 *************** *** 764,773 **** }else if(ipPacket instanceof UDP_packet){ ! UDP_packet temp = (UDP_packet)inPacket; ! System.out.println("UDP packet here Receiving!!!! Message from ProtocolStack."); try{ mUDPprotocol.receiveUDPPacket(temp); ! }catch(TransportLayerException e){ ! //here *TODO*: insert catcher here } --- 764,779 ---- }else if(ipPacket instanceof UDP_packet){ ! UDP_packet temp = (UDP_packet)inPacket; try{ mUDPprotocol.receiveUDPPacket(temp); ! }catch(TransportLayerException te){ ! //here *TODO*: disconnect sender from port!!! ! ! LayerInfo UDP_Info = new LayerInfo(getClass().getName()); ! UDP_Info.setObjectName(getParentNodeName()); ! UDP_Info.setDataType("UDP Packet"); ! UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("UDP port packet receiving: \""+ te.toString() + "\"."); ! Simulation.addLayerInfo(UDP_Info); } *************** *** 1238,1261 **** * @exception InvalidNetworkLayerDeviceException * @exception TransportLayerException * @version v0.30 * @see InvalidNetworkLayerDeviceException * @see TransportLayerException */ ! public int reserveUDPPort(Object application, String inDestIPAddress, int indestPort) throws InvalidNetworkLayerDeviceException, TransportLayerException { ! //lets get first network interface name ! //will be used when resolving source IP of UDP sender ! String FirstInterfaceName; ! Node temp = (Node)mParentNode; ! FirstInterfaceName = temp.getFirstInterfaceName(); ! if (FirstInterfaceName!=null) ! { return mUDPprotocol.ReservePort(application,inDestIPAddress,indestPort); ! } else ! throw new InvalidNetworkLayerDeviceException("Network interface unavailable on host \"" + temp.getName() +"\"."); ! } --- 1244,1272 ---- * @exception InvalidNetworkLayerDeviceException * @exception TransportLayerException + * @exception CommunicationException * @version v0.30 * @see InvalidNetworkLayerDeviceException * @see TransportLayerException + * @see CommunicationException */ ! public int reserveUDPPort(Object application, String inDestIPAddress, int indestPort) throws InvalidNetworkLayerDeviceException, TransportLayerException, CommunicationException { ! if(IPV4Address.validateDecIP(inDestIPAddress)) ! { ! ! //lets get first network interface name ! String FirstInterfaceName; ! Node temp = (Node)mParentNode; ! FirstInterfaceName = temp.getFirstInterfaceName(); ! if (FirstInterfaceName!=null) ! { return mUDPprotocol.ReservePort(application,inDestIPAddress,indestPort); ! } else ! throw new InvalidNetworkLayerDeviceException("Network interface unavailable on host \"" + temp.getName() +"\"."); ! }else ! throw new CommunicationException("Packet dropped host unreachable: " + inDestIPAddress); } *************** *** 1273,1278 **** public void CloseUDP(Object application) throws TransportLayerException ! { mUDPprotocol.ClosePort(application); } --- 1284,1299 ---- public void CloseUDP(Object application) throws TransportLayerException ! { ! try { mUDPprotocol.ClosePort(application); + } catch (TransportLayerException te) + { + LayerInfo UDP_Info = new LayerInfo(getClass().getName()); + UDP_Info.setObjectName(getParentNodeName()); + UDP_Info.setDataType("UDP Packet"); + UDP_Info.setLayer("Transport"); + UDP_Info.setDescription("UDP port closing: \""+ te.toString() + "\"."); + Simulation.addLayerInfo(UDP_Info); + } } *************** *** 1288,1293 **** */ public void freeUDPPort(Object application) throws TransportLayerException ! { mUDPprotocol.FreePort(application); } --- 1309,1324 ---- */ public void freeUDPPort(Object application) throws TransportLayerException ! { ! try { mUDPprotocol.FreePort(application); + } catch (TransportLayerException te) + { + LayerInfo UDP_Info = new LayerInfo(getClass().getName()); + UDP_Info.setObjectName(getParentNodeName()); + UDP_Info.setDataType("UDP Packet"); + UDP_Info.setLayer("Transport"); + UDP_Info.setDescription("UDP port freeing: \""+ te.toString() + "\"."); + Simulation.addLayerInfo(UDP_Info); + } } *************** *** 1304,1308 **** --- 1335,1350 ---- public void ListenUDP(Object application, int inPort) throws TransportLayerException { + try{ mUDPprotocol.ListenPort(application,inPort); + + } catch (TransportLayerException te) + { + LayerInfo UDP_Info = new LayerInfo(getClass().getName()); + UDP_Info.setObjectName(getParentNodeName()); + UDP_Info.setDataType("UDP Packet"); + UDP_Info.setLayer("Transport"); + UDP_Info.setDescription("UDP port listening: \""+ te.toString() + "\"."); + Simulation.addLayerInfo(UDP_Info); + } } *************** *** 1354,1358 **** --- 1396,1420 ---- //throw new InvalidNetworkLayerDeviceException("Network interface unavailable on host \"" + temp.getName() +"\"."); }catch(Exception e){ + + try { + mUDPprotocol.FreePort(application); + + LayerInfo UDP_Info = new LayerInfo(getClass().getName()); + UDP_Info.setObjectName(getParentNodeName()); + UDP_Info.setDataType("UDP Packet"); + UDP_Info.setLayer("Transport"); + UDP_Info.setDescription("UDP sending error: \""+ e.toString() + "\"."); + Simulation.addLayerInfo(UDP_Info); //*TODO*: here we shall put some layerinfo for TransportException + } catch (TransportLayerException te) + { + LayerInfo UDP_Info = new LayerInfo(getClass().getName()); + UDP_Info.setObjectName(getParentNodeName()); + UDP_Info.setDataType("UDP Packet"); + UDP_Info.setLayer("Transport"); + UDP_Info.setDescription("UDP port freeing: \""+ te.toString() + "\"."); + Simulation.addLayerInfo(UDP_Info); + } + } } Index: Application.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Application.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Application.java 19 Nov 2005 21:53:51 -0000 1.8 --- Application.java 20 Nov 2005 19:13:04 -0000 1.9 *************** *** 65,69 **** */ ! public abstract void ClientConnect(String Host, int port) throws TransportLayerException, InvalidNetworkLayerDeviceException; /** --- 65,69 ---- */ ! public abstract void ClientConnect(String Host, int port) throws TransportLayerException, InvalidNetworkLayerDeviceException, CommunicationException; /** Index: Udp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Udp.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Udp.java 20 Nov 2005 16:05:19 -0000 1.18 --- Udp.java 20 Nov 2005 19:13:04 -0000 1.19 *************** *** 203,209 **** switch(Elm.PortStatus) { ! case 0: //port is free => Error: no application to receive UDP ! throw new TransportLayerException("UDP Error: no application listening to port "+inPacket.get_destPort() +" on host \""+ mParentStack.getParentNodeName()+"\"!" ); ! // no "break" needed ;) case 1: // port is being listened to by a new application. Have to "establish" (in UDP no connections are being established) a new connection by replacing hashtable element Elm.PortStatus=2; //port will be busy from now --- 203,213 ---- switch(Elm.PortStatus) { ! case 0: //port is free => Error: no application to receive UDP ! //have to disconnect listener from port ! Application listener; ! listener = (Application)Elm.application; ! listener.Disconnect(); ! throw new TransportLayerException("UDP Error: no server application listening to port "+inPacket.get_destPort() +" on host \""+ mParentStack.getParentNodeName()+"\"!"); ! //no break needed ;) case 1: // port is being listened to by a new application. Have to "establish" (in UDP no connections are being established) a new connection by replacing hashtable element Elm.PortStatus=2; //port will be busy from now *************** *** 233,237 **** Simulation.addLayerInfo(UDP_Info); ! Application listener; listener = (Application)Elm.application; listener.RecvData(inPacket.getUDP_message()); --- 237,241 ---- Simulation.addLayerInfo(UDP_Info); ! listener = (Application)Elm.application; listener.RecvData(inPacket.getUDP_message()); *************** *** 265,269 **** Simulation.addLayerInfo(UDP_Info); ! Application listener; listener = (Application)Elm.application; listener.RecvData(inPacket.getUDP_message()); --- 269,273 ---- Simulation.addLayerInfo(UDP_Info); ! listener = (Application)Elm.application; listener.RecvData(inPacket.getUDP_message()); *************** *** 272,284 **** throw new TransportLayerException("UDP Error: incorrect checksum on receiving!"); } ! } else { throw new TransportLayerException("UDP Error: port is busy! Port is connected to another host or/and port and is busy by another application." + "Port "+inPacket.get_destPort() +" on host \""+ mParentStack.getParentNodeName()+"\"."); } break; default: //UDP Error: unknown port status :( throw new TransportLayerException("UDP Error: unknown port status! Port "+inPacket.get_destPort() +" on host \""+ mParentStack.getParentNodeName()+"\"."); } } else { throw new TransportLayerException("UDP Error: port " + inPacket.get_destPort() + " does not exist. Host \"" + mParentStack.getParentNodeName()+"\"."); } --- 276,303 ---- throw new TransportLayerException("UDP Error: incorrect checksum on receiving!"); } ! } else { ! //have to disconnect listener from port ! ! listener = (Application)Elm.application; ! listener.Disconnect(); throw new TransportLayerException("UDP Error: port is busy! Port is connected to another host or/and port and is busy by another application." + "Port "+inPacket.get_destPort() +" on host \""+ mParentStack.getParentNodeName()+"\"."); + } break; default: //UDP Error: unknown port status :( + //have to disconnect listener from port + + listener = (Application)Elm.application; + listener.Disconnect(); throw new TransportLayerException("UDP Error: unknown port status! Port "+inPacket.get_destPort() +" on host \""+ mParentStack.getParentNodeName()+"\"."); } } else { + //have to disconnect listener from port + UDP_HashTableElement Elm = null; + Elm=(UDP_HashTableElement)PortTable.get(inPacket.get_destPort()); + Application listener; + listener = (Application)Elm.application; + listener.Disconnect(); /* throw new TransportLayerException("UDP Error: port " + inPacket.get_destPort() + " does not exist. Host \"" + mParentStack.getParentNodeName()+"\"."); } Index: Echo.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Echo.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Echo.java 20 Nov 2005 16:36:59 -0000 1.9 --- Echo.java 20 Nov 2005 19:13:04 -0000 1.10 *************** *** 63,67 **** */ ! public void ClientConnect(String Host, int port) throws TransportLayerException, InvalidNetworkLayerDeviceException { sdHost = Host; sdPort = port; --- 63,67 ---- */ ! public void ClientConnect(String Host, int port) throws TransportLayerException, InvalidNetworkLayerDeviceException, CommunicationException { sdHost = Host; sdPort = port; |
From: Alexander B. <da...@us...> - 2005-11-20 16:37:07
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2162/core/protocolsuite/tcp_ip Modified Files: Echo.java Log Message: Corrected LayerInfo for Echo Index: Echo.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Echo.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Echo.java 20 Nov 2005 14:21:58 -0000 1.8 --- Echo.java 20 Nov 2005 16:36:59 -0000 1.9 *************** *** 16,19 **** --- 16,24 ---- import core.LowLinkException; + import core.LayerInfo; + + import core.Packet; + + import core.Simulation; /** *************** *** 113,123 **** //client processing recieve // printing some ... ! System.out.println(Data); Disconnect(); }else{ //server processing recieve try{ ! System.out.println(Data); SendData(Data); Close(); Listen(); --- 118,161 ---- //client processing recieve // printing some ... ! LayerInfo protInfo = new LayerInfo(getClass().getName()); ! protInfo.setObjectName(mParentStack.getParentNodeName()); ! protInfo.setDataType("Echo Protocol Data"); ! protInfo.setLayer("Application "); ! protInfo.setDescription("Recieving echo message '" + Data + "' from server."); ! Simulation.addLayerInfo(protInfo); ! /* ! LayerInfo protInfo = new LayerInfo(getClass().getName()); ! protInfo.setObjectName(mParentStack.getParentNodeName()); ! protInfo.setDataType("Echo Protocol Data"); ! protInfo.setLayer("Application "); ! 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()); ! protInfo.setDataType("Echo Protocol Data"); ! protInfo.setLayer("Application "); ! protInfo.setDescription("Recieving echo message '" + Data + "' from client."); ! Simulation.addLayerInfo(protInfo); ! ! LayerInfo protInfo2 = new LayerInfo(getClass().getName()); ! protInfo2.setObjectName(mParentStack.getParentNodeName()); ! protInfo2.setDataType("Echo Protocol Data"); ! protInfo2.setLayer("Application "); ! protInfo2.setDescription("Sending echo message '" + Data + "' to client."); ! Simulation.addLayerInfo(protInfo2); ! SendData(Data); + + 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); + Close(); Listen(); *************** *** 139,142 **** --- 177,187 ---- ClientConnect(Host, port); + LayerInfo protInfo = new LayerInfo(getClass().getName()); + protInfo.setObjectName(mParentStack.getParentNodeName()); + protInfo.setDataType("Echo Protocol Data"); + protInfo.setLayer("Application "); + protInfo.setDescription("Start sending echo message '" + Data + "' to " + Host + ":" + port); + Simulation.addLayerInfo(protInfo); + SendData(Data); } |
From: Alexander B. <da...@us...> - 2005-11-20 16:21:04
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31831/core/protocolsuite/tcp_ip Modified Files: ProtocolStack.java Log Message: Corrected LayerInfo for IP Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ProtocolStack.java 20 Nov 2005 13:43:57 -0000 1.10 --- ProtocolStack.java 20 Nov 2005 16:20:56 -0000 1.11 *************** *** 211,215 **** protocolInfo.setObjectName(getParentNodeName()); ! protocolInfo.setDataType(trimClassName(inPacket.getClass().getName())); protocolInfo.setLayer("Network"); --- 211,218 ---- protocolInfo.setObjectName(getParentNodeName()); ! if(!(inPacket instanceof ARP_packet) && !(inPacket instanceof ICMP_packet)) ! protocolInfo.setDataType("IP_Packet"); ! else ! protocolInfo.setDataType(trimClassName(inPacket.getClass().getName())); protocolInfo.setLayer("Network"); *************** *** 258,264 **** protocolInfo.setObjectName(getParentNodeName()); ! ! protocolInfo.setDataType(trimClassName(inPacket.getClass().getName())); ! protocolInfo.setLayer("Network"); --- 261,269 ---- protocolInfo.setObjectName(getParentNodeName()); ! ! if(!(inPacket instanceof ARP_packet) && !(inPacket instanceof ICMP_packet)) ! protocolInfo.setDataType("IP_Packet"); ! else ! protocolInfo.setDataType(trimClassName(inPacket.getClass().getName())); protocolInfo.setLayer("Network"); *************** *** 361,365 **** protocolInfo.setObjectName(getParentNodeName()); ! protocolInfo.setDataType(trimClassName(inPacket.getClass().getName())); protocolInfo.setLayer("Network"); --- 366,373 ---- protocolInfo.setObjectName(getParentNodeName()); ! if(!(inPacket instanceof ARP_packet) && !(inPacket instanceof ICMP_packet)) ! protocolInfo.setDataType("IP_Packet"); ! else ! protocolInfo.setDataType(trimClassName(inPacket.getClass().getName())); protocolInfo.setLayer("Network"); *************** *** 429,433 **** protocolInfo.setObjectName(getParentNodeName()); ! protocolInfo.setDataType(trimClassName(inPacket.getClass().getName())); protocolInfo.setLayer("Network"); --- 437,444 ---- protocolInfo.setObjectName(getParentNodeName()); ! if(!(inPacket instanceof ARP_packet) && !(inPacket instanceof ICMP_packet)) ! protocolInfo.setDataType("IP_Packet"); ! else ! protocolInfo.setDataType(trimClassName(inPacket.getClass().getName())); protocolInfo.setLayer("Network"); *************** *** 699,703 **** protocolInfo.setObjectName(getParentNodeName()); ! protocolInfo.setDataType(trimClassName(inPacket.getClass().getName())); protocolInfo.setLayer("Network"); --- 710,717 ---- protocolInfo.setObjectName(getParentNodeName()); ! if(!(inPacket instanceof ARP_packet) && !(inPacket instanceof ICMP_packet)) ! protocolInfo.setDataType("IP_Packet"); ! else ! protocolInfo.setDataType(trimClassName(inPacket.getClass().getName())); protocolInfo.setLayer("Network"); *************** *** 723,727 **** protInfo.setObjectName(getParentNodeName()); ! protInfo.setDataType(trimClassName(inPacket.getClass().getName())); protInfo.setLayer("Network"); --- 737,744 ---- protInfo.setObjectName(getParentNodeName()); ! if(!(inPacket instanceof ARP_packet) && !(inPacket instanceof ICMP_packet)) ! protInfo.setDataType("IP_Packet"); ! else ! protInfo.setDataType(trimClassName(inPacket.getClass().getName())); protInfo.setLayer("Network"); |
From: gift <gi...@us...> - 2005-11-20 16:05:31
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28515/core/protocolsuite/tcp_ip Modified Files: Udp.java Log Message: Index: Udp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Udp.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Udp.java 20 Nov 2005 15:31:37 -0000 1.17 --- Udp.java 20 Nov 2005 16:05:19 -0000 1.18 *************** *** 138,142 **** private Hashtable PortTable = new Hashtable(); private ProtocolStack mParentStack; ! private static final int PORT_QUANT=2; //should be 100, only for dbg purposes private static final int PORT_START_NUMBER=3000; --- 138,142 ---- private Hashtable PortTable = new Hashtable(); private ProtocolStack mParentStack; ! private static final int PORT_QUANT=100; //should be 100, only for dbg purposes private static final int PORT_START_NUMBER=3000; |
From: gift <gi...@us...> - 2005-11-20 15:31:46
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21248/core/protocolsuite/tcp_ip Modified Files: Udp.java Log Message: Working v 0.1 !!!! Congratulations! Index: Udp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Udp.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Udp.java 20 Nov 2005 15:17:35 -0000 1.16 --- Udp.java 20 Nov 2005 15:31:37 -0000 1.17 *************** *** 229,233 **** UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("UDP packet received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + " message: \"" +inPacket.getUDP_message() + "\". \r\n" + "UDP Port " + inPacket.get_destPort() + " has status \"busy\" from now. Host \"" + mParentStack.getParentNodeName()+"\"."); Simulation.addLayerInfo(UDP_Info); --- 229,233 ---- UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("UDP packet received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + " message: \"" +inPacket.getUDP_message() + "\"." + " UDP Port " + inPacket.get_destPort() + " has status \"busy\" from now."); Simulation.addLayerInfo(UDP_Info); *************** *** 261,265 **** UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("UDP packet received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + " message: \"" +inPacket.getUDP_message() + "\". \r\n" + "Host \"" + mParentStack.getParentNodeName()+"\"."); Simulation.addLayerInfo(UDP_Info); --- 261,265 ---- UDP_Info.setLayer("Transport"); ! UDP_Info.setDescription("UDP packet received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + " message: \"" +inPacket.getUDP_message() + "\"."); Simulation.addLayerInfo(UDP_Info); *************** *** 273,277 **** } } else { ! throw new TransportLayerException("UDP Error: port is busy! Port is connected to another host or/and port and is busy by another application. \r\n" + "Port "+inPacket.get_destPort() +" on host \""+ mParentStack.getParentNodeName()+"\"."); } break; --- 273,277 ---- } } else { ! throw new TransportLayerException("UDP Error: port is busy! Port is connected to another host or/and port and is busy by another application." + "Port "+inPacket.get_destPort() +" on host \""+ mParentStack.getParentNodeName()+"\"."); } break; |
From: Alexander B. <da...@us...> - 2005-11-20 15:17:49
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17983/guiUI Modified Files: MainScreen.java Log Message: Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MainScreen.java 20 Nov 2005 14:21:58 -0000 1.8 --- MainScreen.java 20 Nov 2005 15:17:35 -0000 1.9 *************** *** 1450,1454 **** try{ printNetworkStart(); ! ((Echo)((core.ApplicationLayerDevice)Sim.getNode(inNodeName)).getApp(0)).SendEcho(msg, ip, Integer.valueOf(port).intValue()); this.addToConsole("Trying to send echo message '" + msg + "' from " + inNodeName + " to " + ip + ":" + port + "\n"); }catch(Exception e){ --- 1450,1454 ---- try{ 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"); }catch(Exception e){ |