org.opennms.protocols.snmp
Class SnmpUtil
java.lang.Object
|
+--org.opennms.protocols.snmp.SnmpUtil
- class SnmpUtil
- extends Object
This class provides a set of utilities that may be used
by other package members. This class is not accessable
to non-package classes.
The util class maintains a dynamically created list of
SnmpSyntax object that is uses to lookup received
messages. The typeId() method of each SnmpSyntax object
provides the comparision data for the received ASN.1 type.
- Version:
- $Revision: 1.10 $
- Author:
SnmpInt32
,
SnmpCounter32
,
SnmpGauge32
,
SnmpTimeTicks
,
SnmpOctetString
,
SnmpIPAddress
,
SnmpObjectId
Field Summary |
(package private) static ArrayList |
m_syntaxArray
The array of dynamically registred SnmpSyntax objects |
Constructor Summary |
(package private) |
SnmpUtil()
|
Method Summary |
(package private) static void |
()
|
(package private) static void |
copy(byte[] src,
int srcOffset,
byte[] dest,
int destOffset,
int count)
Used to copy data from one buffer to another. |
(package private) static void |
copy(int[] src,
int srcOffset,
int[] dest,
int destOffset,
int count)
Used to copy data from one buffer to another. |
(package private) static void |
dumpHex(PrintStream out,
byte[] data,
int offset,
int length)
Dumps an array of byte to the output string
as a sequence of hexadecimal digits. |
(package private) static SnmpSyntax |
getSyntaxObject(byte asnType)
Used to dynamically lookup registered SnmpSyntax objects |
(package private) static boolean |
registerSyntax(SnmpSyntax obj)
Used to register a SnmpSyntax object with the
SnmpUtil class. |
(package private) static void |
rotate(byte[] buf,
int begin,
int pivot,
int end)
Rotates a give buffer area marked by begin, pivot, and end. |
(package private) static void |
rotate(int[] buf,
int begin,
int pivot,
int end)
Rotates a give buffer area marked by begin, pivot, and end. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
m_syntaxArray
static ArrayList m_syntaxArray
- The array of dynamically registred SnmpSyntax objects
SnmpUtil
SnmpUtil()
static void ()
registerSyntax
static boolean registerSyntax(SnmpSyntax obj)
- Used to register a SnmpSyntax object with the
SnmpUtil class. Once registered it can be dynamically
found based on it's typeId().
- Parameters:
obj
- The SnmpSyntax object to add- Returns:
- True if the object is successfully added
getSyntaxObject
static SnmpSyntax getSyntaxObject(byte asnType)
- Used to dynamically lookup registered SnmpSyntax objects
- Parameters:
asnType
- The ASN.1 type to search for- Returns:
- A new SnmpSyntax object of the appropiate type
copy
static void copy(byte[] src,
int srcOffset,
byte[] dest,
int destOffset,
int count)
- Used to copy data from one buffer to another. The method has the
flexability to allow the caller to specify an offset in each buffer
and the total number of bytes to copy
- Parameters:
src
- The source buffersrcOffset
- The offset of the first byte in the source bufferdest
- The destination bufferdestOffset
- The offset of the first byte in the destination buffercount
- The number of elements to copy
copy
static void copy(int[] src,
int srcOffset,
int[] dest,
int destOffset,
int count)
- Used to copy data from one buffer to another. The method has the
flexability to allow the caller to specify an offset in each buffer
and the total number of bytes to copy
- Parameters:
src
- The source buffersrcOffset
- The offset of the first byte in the source bufferdest
- The destination bufferdestOffset
- The offset of the first byte in the destination buffercount
- The number of elements to copy
rotate
static void rotate(byte[] buf,
int begin,
int pivot,
int end)
- Rotates a give buffer area marked by begin, pivot, and end.
The pivot marks the point where the bytes between [pivot..end)
are moved to the position marked by begin. The bytes between
[begin..pivot) are shifted such that begin is at [begin+(end-pivot)].
- Parameters:
buf
- The buffer containing the data to rotatebegin
- The start of the rotationpivot
- The pivot point for the rotationend
- The end of the rotational buffer
rotate
static void rotate(int[] buf,
int begin,
int pivot,
int end)
- Rotates a give buffer area marked by begin, pivot, and end.
The pivot marks the point where the bytes between [pivot..end)
are moved to the position marked by begin. The bytes between
[begin..pivot) are shifted such that begin is at [begin+(end-pivot)].
- Parameters:
buf
- The buffer containing the data to rotatebegin
- The start of the rotationpivot
- The pivot point for the rotationend
- The end of the rotational buffer
dumpHex
static void dumpHex(PrintStream out,
byte[] data,
int offset,
int length)
- Dumps an array of byte to the output string
as a sequence of hexadecimal digits.
- Parameters:
out
- The output streamdata
- The data to dumpoffset
- The start location within the datalength
- The length of data to dump