Update of /cvsroot/opennms/opennms/src/services/org/opennms/protocols/icmp
In directory sc8-pr-cvs1:/tmp/cvs-serv31259/protocols/icmp
Modified Files:
AddressMaskReply.java AddressMaskRequest.java
ErrorMessage.java ICMPHeader.java IcmpSocket.java
TimestampReply.java TimestampRequest.java
Log Message:
Cleaning up some ICMP stuff
Index: AddressMaskReply.java
===================================================================
RCS file: /cvsroot/opennms/opennms/src/services/org/opennms/protocols/icmp/AddressMaskReply.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AddressMaskReply.java 14 Nov 2002 22:19:39 -0000 1.2
+++ AddressMaskReply.java 5 Mar 2003 20:22:38 -0000 1.3
@@ -81,7 +81,7 @@
* the ICMP message.
*
*/
- public void computeChecksum( )
+ public final void computeChecksum( )
{
OC16ChecksumProducer summer = new OC16ChecksumProducer();
super.computeChecksum(summer);
@@ -106,7 +106,7 @@
* does not have enough storage space.
*
*/
- public int storeToBuffer(byte[] buf, int offset)
+ public final int storeToBuffer(byte[] buf, int offset)
{
if(buf.length < (offset + 12))
throw new IndexOutOfBoundsException("Array index overflow in buffer build");
@@ -144,7 +144,7 @@
* @exception java.lang.IllegalArgumentException Thrown if the ICMP type
* is not an Address Mask reply.
*/
- public int loadFromBuffer(byte[] buf, int offset)
+ public final int loadFromBuffer(byte[] buf, int offset)
{
if(buf.length < (offset + 12))
throw new IndexOutOfBoundsException("Insufficient data to load ICMP header");
@@ -157,9 +157,9 @@
//
// get the mask
//
- m_mask = byteToInt(buf[offset++]) << 24 |
- byteToInt(buf[offset++]) << 16 |
- byteToInt(buf[offset++]) << 8 |
+ m_mask = (byteToInt(buf[offset++]) << 24) |
+ (byteToInt(buf[offset++]) << 16) |
+ (byteToInt(buf[offset++]) << 8) |
byteToInt(buf[offset++]);
return offset;
@@ -168,7 +168,7 @@
/**
* Used to get the IPv4 32-bit address mask.
*/
- public int getAddressMask( )
+ public final int getAddressMask( )
{
return m_mask;
}
@@ -176,7 +176,7 @@
/**
* Used to set the IPv4 32-bit address mask.
*/
- public void setAddressMask(int mask)
+ public final void setAddressMask(int mask)
{
m_mask = mask;
}
@@ -184,7 +184,7 @@
/**
* Converts the object to a stream of bytes.
*/
- public byte[] toBytes()
+ public final byte[] toBytes()
{
byte[] buf = new byte[12];
storeToBuffer(buf, 0);
Index: AddressMaskRequest.java
===================================================================
RCS file: /cvsroot/opennms/opennms/src/services/org/opennms/protocols/icmp/AddressMaskRequest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AddressMaskRequest.java 14 Nov 2002 22:19:39 -0000 1.2
+++ AddressMaskRequest.java 5 Mar 2003 20:22:38 -0000 1.3
@@ -76,7 +76,7 @@
* the ICMP message.
*
*/
- public void computeChecksum( )
+ public final void computeChecksum( )
{
OC16ChecksumProducer summer = new OC16ChecksumProducer();
super.computeChecksum(summer);
@@ -101,7 +101,7 @@
* does not have enough storage space.
*
*/
- public int storeToBuffer(byte[] buf, int offset)
+ public final int storeToBuffer(byte[] buf, int offset)
{
if(buf.length < (offset + 12))
throw new IndexOutOfBoundsException("Array index overflow in buffer build");
@@ -137,7 +137,7 @@
* @exception java.lang.IllegalArgumentException Thrown if the ICMP type
* is not an Address Mask Request.
*/
- public int loadFromBuffer(byte[] buf, int offset)
+ public final int loadFromBuffer(byte[] buf, int offset)
{
if(buf.length < (offset + 12))
throw new IndexOutOfBoundsException("Insufficient data to load ICMP header");
@@ -155,7 +155,7 @@
* Converts the object to an array of bytes
*
*/
- public byte[] toBytes()
+ public final byte[] toBytes()
{
byte[] b = new byte[12];
storeToBuffer(b,0);
Index: ErrorMessage.java
===================================================================
RCS file: /cvsroot/opennms/opennms/src/services/org/opennms/protocols/icmp/ErrorMessage.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ErrorMessage.java 14 Nov 2002 22:19:39 -0000 1.2
+++ ErrorMessage.java 5 Mar 2003 20:22:39 -0000 1.3
@@ -99,7 +99,7 @@
* @exception java.lang.IndexOutOfBoundsException Thrown if there
* is not sufficent data in the buffer.
*/
- public int loadFromBuffer(byte[] buf, int offset)
+ public final int loadFromBuffer(byte[] buf, int offset)
{
//
// minimum length
@@ -141,7 +141,7 @@
* @return The IP Header in error.
*
*/
- public IPHeader getIPHeader( )
+ public final IPHeader getIPHeader( )
{
return m_iphdr;
}
@@ -163,7 +163,7 @@
* @return The first 8 bytes of the packet in error.
*
*/
- public byte[] getProtocolData()
+ public final byte[] getProtocolData()
{
return m_protoData;
}
Index: ICMPHeader.java
===================================================================
RCS file: /cvsroot/opennms/opennms/src/services/org/opennms/protocols/icmp/ICMPHeader.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ICMPHeader.java 14 Nov 2002 22:19:39 -0000 1.2
+++ ICMPHeader.java 5 Mar 2003 20:22:39 -0000 1.3
@@ -125,7 +125,7 @@
*
* @return The next 16-bit sequence number, may be negative.
*/
- public static synchronized short nextSequenceId()
+ public final static synchronized short nextSequenceId()
{
if(sm_seq == 0)
{
@@ -280,7 +280,7 @@
*
* @return The ICMP type.
*/
- public byte getType( )
+ public final byte getType( )
{
return m_type;
}
@@ -302,7 +302,7 @@
* @return The ICMP code.
*
*/
- public byte getCode( )
+ public final byte getCode( )
{
return m_code;
}
@@ -313,7 +313,7 @@
* @param code The new ICMP code.
*
*/
- public void setCode(byte code)
+ public final void setCode(byte code)
{
m_code = code;
}
@@ -325,7 +325,7 @@
* @return The 16-bit sequence identifier.
*
*/
- public short getSequenceId( )
+ public final short getSequenceId( )
{
return m_sequence;
}
@@ -339,7 +339,7 @@
* @return The new 16-bit sequence identifier.
*
*/
- public short setNextSequenceId( )
+ public final short setNextSequenceId( )
{
m_sequence = nextSequenceId();
return m_sequence;
@@ -351,7 +351,7 @@
* @param id The new 16-bit sequence id.
*
*/
- public void setSequenceId(short id)
+ public final void setSequenceId(short id)
{
m_sequence = id;
}
@@ -362,7 +362,7 @@
* @return The 16-bit identity.
*
*/
- public short getIdentity( )
+ public final short getIdentity( )
{
return m_ident;
}
@@ -374,7 +374,7 @@
* @param identity The header's new identity.
*
*/
- public void setIdentity(short identity)
+ public final void setIdentity(short identity)
{
m_ident = identity;
}
@@ -389,7 +389,7 @@
* @return The 16-bit one's compliment checksum.
*
*/
- public short getChecksum( )
+ public final short getChecksum( )
{
return m_checksum;
}
@@ -527,7 +527,7 @@
* @return True if the header marks an echo reply.
*
*/
- public boolean isEchoReply( )
+ public final boolean isEchoReply( )
{
return (m_type == TYPE_ECHO_REPLY);
}
@@ -540,7 +540,7 @@
* @return True if the header marks an echo request.
*
*/
- public boolean isEchoRequest( )
+ public final boolean isEchoRequest( )
{
return (m_type == TYPE_ECHO_REQUEST);
}
Index: IcmpSocket.java
===================================================================
RCS file: /cvsroot/opennms/opennms/src/services/org/opennms/protocols/icmp/IcmpSocket.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- IcmpSocket.java 14 Nov 2002 22:19:39 -0000 1.2
+++ IcmpSocket.java 5 Mar 2003 20:22:39 -0000 1.3
@@ -39,7 +39,7 @@
* @author <a href="http://www.opennms.org/">OpenNMS</a>
*
*/
-public class IcmpSocket
+public final class IcmpSocket
{
/**
* This instance is used by the native code
@@ -101,7 +101,7 @@
* reading the next ICMP message.
*
*/
- public native DatagramPacket receive()
+ public final native DatagramPacket receive()
throws IOException;
/**
@@ -116,7 +116,7 @@
* @exception java.net.NoRouteToHostException Thrown if the
* destination address is a broadcast address.
*/
- public native void send(DatagramPacket packet)
+ public final native void send(DatagramPacket packet)
throws IOException;
/**
@@ -127,7 +127,7 @@
* this instance should result in exceptions
* being generated.
*/
- public native void close();
+ public final native void close();
}
Index: TimestampReply.java
===================================================================
RCS file: /cvsroot/opennms/opennms/src/services/org/opennms/protocols/icmp/TimestampReply.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TimestampReply.java 14 Nov 2002 22:19:39 -0000 1.2
+++ TimestampReply.java 5 Mar 2003 20:22:39 -0000 1.3
@@ -84,7 +84,7 @@
* the ICMP message.
*
*/
- public void computeChecksum( )
+ public final void computeChecksum( )
{
OC16ChecksumProducer summer = new OC16ChecksumProducer();
super.computeChecksum(summer);
@@ -111,7 +111,7 @@
* does not have enough storage space.
*
*/
- public int storeToBuffer(byte[] buf, int offset)
+ public final int storeToBuffer(byte[] buf, int offset)
{
if(buf.length < (offset + 20))
throw new IndexOutOfBoundsException("Array index overflow in buffer build");
@@ -160,7 +160,7 @@
* @exception java.lang.IllegalArgumentException Thrown if the ICMP type
* is not an Timestamp Reply.
*/
- public int loadFromBuffer(byte[] buf, int offset)
+ public final int loadFromBuffer(byte[] buf, int offset)
{
if(buf.length < (offset + 20))
throw new IndexOutOfBoundsException("Insufficient data to load ICMP header");
@@ -195,7 +195,7 @@
* @see java.util.Date#getTime
*
*/
- public void setOriginateTS( )
+ public final void setOriginateTS( )
{
m_origStamp = (int)((new Date()).getTime() & 0xffffffff);
}
@@ -207,7 +207,7 @@
* @param ts The timestamp in milliseconds
*
*/
- public void setOriginateTS(int ts)
+ public final void setOriginateTS(int ts)
{
m_origStamp = ts;
}
@@ -219,7 +219,7 @@
* @return The 32-bit timestamp in milliseconds.
*
*/
- public int getOriginateTS( )
+ public final int getOriginateTS( )
{
return m_origStamp;
}
@@ -232,7 +232,7 @@
* @see java.util.Date#getTime
*
*/
- public void setReceiveTS( )
+ public final void setReceiveTS( )
{
m_recvStamp = (int)((new Date()).getTime() & 0xffffffff);
}
@@ -244,7 +244,7 @@
* @param ts The timestamp in milliseconds
*
*/
- public void setReceiveTS(int ts)
+ public final void setReceiveTS(int ts)
{
m_recvStamp = ts;
}
@@ -256,7 +256,7 @@
* @return The 32-bit timestamp in milliseconds.
*
*/
- public int getReceiveTS( )
+ public final int getReceiveTS( )
{
return m_recvStamp;
}
@@ -269,7 +269,7 @@
* @see java.util.Date#getTime
*
*/
- public void setTransmitTS( )
+ public final void setTransmitTS( )
{
m_xmitStamp = (int)((new Date()).getTime() & 0xffffffff);
}
@@ -281,7 +281,7 @@
* @param ts The timestamp in milliseconds
*
*/
- public void setTransmitTS(int ts)
+ public final void setTransmitTS(int ts)
{
m_xmitStamp = ts;
}
@@ -293,7 +293,7 @@
* @return The 32-bit timestamp in milliseconds.
*
*/
- public int getTransmitTS( )
+ public final int getTransmitTS( )
{
return m_xmitStamp;
}
@@ -302,7 +302,7 @@
* Converts the object to an array of bytes.
*
*/
- public byte[] toBytes()
+ public final byte[] toBytes()
{
byte[] b = new byte[20];
storeToBuffer(b, 0);
Index: TimestampRequest.java
===================================================================
RCS file: /cvsroot/opennms/opennms/src/services/org/opennms/protocols/icmp/TimestampRequest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TimestampRequest.java 14 Nov 2002 22:19:39 -0000 1.2
+++ TimestampRequest.java 5 Mar 2003 20:22:40 -0000 1.3
@@ -80,7 +80,7 @@
* the ICMP message.
*
*/
- public void computeChecksum( )
+ public final void computeChecksum( )
{
OC16ChecksumProducer summer = new OC16ChecksumProducer();
super.computeChecksum(summer);
@@ -107,7 +107,7 @@
* does not have enough storage space.
*
*/
- public int storeToBuffer(byte[] buf, int offset)
+ public final int storeToBuffer(byte[] buf, int offset)
{
if(buf.length < (offset + 20))
throw new IndexOutOfBoundsException("Array index overflow in buffer build");
@@ -151,7 +151,7 @@
* @exception java.lang.IllegalArgumentException Thrown if the ICMP type
* is not an Timestamp Request.
*/
- public int loadFromBuffer(byte[] buf, int offset)
+ public final int loadFromBuffer(byte[] buf, int offset)
{
if(buf.length < (offset + 20))
throw new IndexOutOfBoundsException("Insufficient data to load ICMP header");
@@ -178,7 +178,7 @@
* @see java.util.Date#getTime
*
*/
- public void setOriginateTS( )
+ public final void setOriginateTS( )
{
m_origStamp = (int)((new Date()).getTime() & 0xffffffff);
}
@@ -190,7 +190,7 @@
* @param ts The timestamp in milliseconds
*
*/
- public void setOriginateTS(int ts)
+ public final void setOriginateTS(int ts)
{
m_origStamp = ts;
}
@@ -202,7 +202,7 @@
* @return The 32-bit timestamp in milliseconds.
*
*/
- public int getOriginateTS( )
+ public final int getOriginateTS( )
{
return m_origStamp;
}
@@ -211,7 +211,7 @@
* Converts the object to an array of bytes.
*
*/
- public byte[] toBytes()
+ public final byte[] toBytes()
{
byte[] b = new byte[20];
storeToBuffer(b, 0);
|