[Javanetsim-cvs] javaNetSim/core/protocolsuite/tcp_ip ARP_packet.java,1.1,1.2 Route_entry.java,1.2,1
Status: Beta
Brought to you by:
darkkey
From: gift <gi...@us...> - 2005-11-16 20:26:17
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17792/core/protocolsuite/tcp_ip Modified Files: ARP_packet.java Route_entry.java UDP_packet.java Log Message: well this is first thing I've done on CVS ;) Index: Route_entry.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Route_entry.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Route_entry.java 8 Nov 2005 20:58:14 -0000 1.2 --- Route_entry.java 16 Nov 2005 20:25:40 -0000 1.3 *************** *** 2,6 **** * Route_entry.java * ! * Created on 7 îÏÑÂÒØ 2005 Ç., 17:52 * * To change this template, choose Tools | Options and locate the template under --- 2,6 ---- * Route_entry.java * ! * Created on 7 Nov 2005 Ç., 17:52 * * To change this template, choose Tools | Options and locate the template under Index: ARP_packet.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ARP_packet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ARP_packet.java 8 Nov 2005 16:10:47 -0000 1.1 --- ARP_packet.java 16 Nov 2005 20:25:40 -0000 1.2 *************** *** 1,131 **** ! /* ! 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 is a representation of the Internets ARP packet. ! * ARP packets are userd for IP address resolution. Echo resquests and echo reply ! * are currently the only ones implemented. Packets type will need to be ! * implemented if you wish to futher this class. ! * @author bevan_calliess ! * @author robert_hulford ! * @since Sep 17, 2004 ! * @version v0.20 ! */ ! ! public class ARP_packet extends IP_packet{ ! public static final int ARP_REQUEST = 1; ! public static final int ARP_REPLY = 2; ! public static final int RARP_REQUEST = 3; ! public static final int RARP_REPLY = 4; ! private String ARP_message; ! private String sourceMac; ! private int mMessageCode; ! ! /** ! * This method passes the destination address into the super class ! * (IP_packet) ! * @author bevan_calliess ! * @author robert_hulford ! * @param inDestIPAddress ! * @version v0.20 ! */ ! public ARP_packet(String inDestIPAddress){ ! super (inDestIPAddress); ! } ! ! /** ! * This method passes sets the ARP_message ! * @author bevan_calliess ! * @author robert_hulford ! * @param inARP_message ! * @version v0.20 ! */ ! public void setARP_message(String inARP_message) ! { ! ARP_message = inARP_message; ! } ! /** ! * This method gets the ARP_message ! * @author bevan_calliess ! * @author robert_hulford ! * @version v0.20 ! */ ! public String getARP_message() ! { ! return ARP_message; ! } ! /** ! * This method sets the SourceMAC address ! * @author bevan_calliess ! * @author robert_hulford ! * @param inMac ! * @version v0.20 ! */ ! public void setSourceMAC(String inMac){ ! sourceMac = inMac; ! } ! /** ! * This method gets the SourceMAC address ! * @author bevan_calliess ! * @author robert_hulford ! * @param inDestIPAddress ! * @version v0.20 ! */ ! public String getSourceMAC(){ ! return sourceMac; ! } ! /** ! * This method will take an integer value representing the ARP Packet ! * code that identifies the type of Packet. EG an ARP request packet is ! * type 1, ARP reply is 2 see page 57 ! * TCP/IP illustrated Vol1 the protocols ! * and see the constants setup in this class ! * NOTE no validation of Codes is currently implemented ! * @author bevan_calliess ! * @author robert_hulford ! * @param InCode - The code of the message ! * @version v0.20 ! */ ! public void setMessageCode(int inCode){ ! mMessageCode = inCode; ! } ! /** ! * returns the message code for this packet ! * @author bevan_calliess ! * @author robert_hulford ! * @return integer representing the message code ! * @version v0.20 ! */ ! public int getMessageCode(){ ! return mMessageCode; ! } ! ! }//EOF --- 1,262 ---- ! /* ! ! 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 is a representation of the Internets ARP packet. ! ! * ARP packets are userd for IP address resolution. Echo resquests and echo reply ! ! * are currently the only ones implemented. Packets type will need to be ! ! * implemented if you wish to futher this class. ! ! * @author bevan_calliess ! ! * @author robert_hulford ! ! * @since Sep 17, 2004 ! ! * @version v0.20 ! ! */ ! ! ! ! public class ARP_packet extends IP_packet{ ! ! public static final int ARP_REQUEST = 1; ! ! public static final int ARP_REPLY = 2; ! ! public static final int RARP_REQUEST = 3; ! ! public static final int RARP_REPLY = 4; ! ! private String ARP_message; ! ! private String sourceMac; ! ! private int mMessageCode; ! ! ! ! /** ! ! * This method passes the destination address into the super class ! ! * (IP_packet) ! ! * @author bevan_calliess ! ! * @author robert_hulford ! ! * @param inDestIPAddress ! ! * @version v0.20 ! ! */ ! ! public ARP_packet(String inDestIPAddress){ ! ! super (inDestIPAddress); ! ! } ! ! ! ! /** ! ! * This method passes sets the ARP_message ! ! * @author bevan_calliess ! ! * @author robert_hulford ! ! * @param inARP_message ! ! * @version v0.20 ! ! */ ! ! public void setARP_message(String inARP_message) ! ! { ! ! ARP_message = inARP_message; ! ! } ! ! /** ! ! * This method gets the ARP_message ! ! * @author bevan_calliess ! ! * @author robert_hulford ! ! * @version v0.20 ! ! */ ! ! public String getARP_message() ! ! { ! ! return ARP_message; ! ! } ! ! /** ! ! * This method sets the SourceMAC address ! ! * @author bevan_calliess ! ! * @author robert_hulford ! ! * @param inMac ! ! * @version v0.20 ! ! */ ! ! public void setSourceMAC(String inMac){ ! ! sourceMac = inMac; ! ! } ! ! /** ! ! * This method gets the SourceMAC address ! ! * @author bevan_calliess ! ! * @author robert_hulford ! ! * @param inDestIPAddress ! ! * @version v0.20 ! ! */ ! ! public String getSourceMAC(){ ! ! return sourceMac; ! ! } ! ! /** ! ! * This method will take an integer value representing the ARP Packet ! ! * code that identifies the type of Packet. EG an ARP request packet is ! ! * type 1, ARP reply is 2 see page 57 ! ! * TCP/IP illustrated Vol1 the protocols ! ! * and see the constants setup in this class ! ! * NOTE no validation of Codes is currently implemented ! ! * @author bevan_calliess ! ! * @author robert_hulford ! ! * @param InCode - The code of the message ! ! * @version v0.20 ! ! */ ! ! public void setMessageCode(int inCode){ ! ! mMessageCode = inCode; ! ! } ! ! /** ! ! * returns the message code for this packet ! ! * @author bevan_calliess ! ! * @author robert_hulford ! ! * @return integer representing the message code ! ! * @version v0.20 ! ! */ ! ! public int getMessageCode(){ ! ! return mMessageCode; ! ! } ! ! ! ! }//EOF ! Index: UDP_packet.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/UDP_packet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UDP_packet.java 8 Nov 2005 16:10:47 -0000 1.1 --- UDP_packet.java 16 Nov 2005 20:25:40 -0000 1.2 *************** *** 1,45 **** ! /* ! 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 if for design and future implementation of UDP_packet ! * @author luke_hamilton ! * @since Sep 17, 2004 ! * @version v0.20 ! */ ! ! ! ! public class UDP_packet extends Packet{ ! } --- 1,186 ---- ! /* ! ! 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 if for design and future implementation of UDP_packet ! ! * @author luke_hamilton ! ! * @since Sep 17, 2004 ! ! * Design and implementation of UDP_packet ! * @author gift ! * @since Nov 16, 2005 ! * @version v0.20 ! */ ! ! public class UDP_packet extends IP_packet ! { ! ! private int UDP_MessageLength; ! ! private int mMessageCode; ! ! private String UDP_message; ! ! private static final int CHECK_SUM = 1; //for future developing :) ! ! private static final int HEAD_LENGTH = 8; //UDP header is 8 bytes ! ! private static final int MAX_LENGTH = 65535; //bytes is UDP datagramm maximum length ! ! ! ! /** ! * This method passes the destination address into the super class ! * @author gift ! * @param destination IP address ! * @return Nothing. ! * @version v0.20 ! */ ! ! public UDP_packet(String inDestIPAddress) ! { ! super (inDestIPAddress); ! UDP_MessageLength = HEAD_LENGTH; ! UDP_message = ""; ! } ! ! /** ! * This method sets the UDP_message and calculates UDP_message length ! * @author gift ! * @param a string to be set as a UDP message ! * @return Nothing. ! * @exception TransportLayerException If UDP message exceeds maximum size of UDP message. ! * @version v0.20 ! * @see TransportLayerException ! */ ! ! public void setUDP_message(String inUDP_message) throws TransportLayerException ! { ! int length; ! ! length = HEAD_LENGTH + UDP_message.length(); ! ! if (length <= MAX_LENGTH) ! { ! UDP_message = inUDP_message; ! UDP_MessageLength = length; ! ! }else ! { ! throw new TransportLayerException("UDP Error: UDP message exceeds maximum size of " + MAX_LENGTH + " bytes."); ! } ! } ! ! /** ! * This method returns the string describing UDP message ! * @author gift ! * @param Unused. ! * @return the UDP message ! * @version v0.20 ! */ ! ! public String getUDP_message() ! { ! return UDP_message; ! } ! ! /** ! * This method returns integer describing UDP message length ! * @author gift ! * @param Unused. ! * @return the length of UDP message. ! * @version v0.20 ! */ ! ! public int getUDP_MessageLength() ! { ! return UDP_MessageLength; ! } ! ! /** ! * This method sets mMessageCode ! * @author gift ! * @param the value to be set as mMessageCode ! * @return Nothing. ! * @version v0.20 ! */ ! public void setMessageCode(int inCode) ! { ! mMessageCode = inCode; ! } ! ! /** ! * This method gets mMessageCode ! * @author gift ! * @param Unused. ! * @return message code. ! * @version v0.20 ! */ ! public int getMessageCode() ! { ! return mMessageCode; ! } ! ! ! }//EOF ! |