Class NrpePacket
- java.lang.Object
-
- org.opennms.netmgt.poller.monitors.nrpe.NrpePacket
-
public class NrpePacket extends Object
NrpePacket class.
- Version:
- $Id: $
- Author:
- ranger
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_PADDING
ConstantDEFAULT_PADDING=2
static String
HELLO_COMMAND
ConstantHELLO_COMMAND="_NRPE_CHECK"
static int
MAX_PACKETBUFFER_LENGTH
ConstantMAX_PACKETBUFFER_LENGTH=1024
static int
PACKET_SIZE
ConstantPACKET_SIZE=2 + // packet version, 16 bit integer 2 + // packet type, 16 bit integer 4 + // crc32, 32 bit unsigned integer 2 + // result code MAX_PACKETBUFFER_LENGTH
static short
PACKET_VERSION_2
ConstantPACKET_VERSION_2=2
static short
QUERY_PACKET
ConstantQUERY_PACKET=1
static short
RESPONSE_PACKET
ConstantRESPONSE_PACKET=2
-
Constructor Summary
Constructors Constructor Description NrpePacket()
Constructor for NrpePacket.NrpePacket(short type, short resultCode, String buffer)
Constructor for NrpePacket.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
buildPacket(int padding)
buildPacketbyte[]
buildPacket(int padding, SecureRandom random)
buildPacketString
getBuffer()
getBuffershort
getResultCode()
getResultCodeshort
getType()
getTypeshort
getVersion()
getVersionstatic int
positive(byte b)
positivestatic NrpePacket
receivePacket(InputStream i, int padding)
receivePacketvoid
setBuffer(String buffer)
setBuffervoid
setResultCode(short resultCode)
setResultCodevoid
setType(short type)
setTypevoid
setVersion(short version)
setVersionString
toString()
toString
-
-
-
Field Detail
-
QUERY_PACKET
public static final short QUERY_PACKET
ConstantQUERY_PACKET=1
- See Also:
- Constant Field Values
-
RESPONSE_PACKET
public static final short RESPONSE_PACKET
ConstantRESPONSE_PACKET=2
- See Also:
- Constant Field Values
-
HELLO_COMMAND
public static final String HELLO_COMMAND
ConstantHELLO_COMMAND="_NRPE_CHECK"
- See Also:
- Constant Field Values
-
PACKET_VERSION_2
public static final short PACKET_VERSION_2
ConstantPACKET_VERSION_2=2
- See Also:
- Constant Field Values
-
MAX_PACKETBUFFER_LENGTH
public static final int MAX_PACKETBUFFER_LENGTH
ConstantMAX_PACKETBUFFER_LENGTH=1024
- See Also:
- Constant Field Values
-
PACKET_SIZE
public static final int PACKET_SIZE
ConstantPACKET_SIZE=2 + // packet version, 16 bit integer 2 + // packet type, 16 bit integer 4 + // crc32, 32 bit unsigned integer 2 + // result code MAX_PACKETBUFFER_LENGTH
- See Also:
- Constant Field Values
-
DEFAULT_PADDING
public static final int DEFAULT_PADDING
ConstantDEFAULT_PADDING=2
- See Also:
- Constant Field Values
-
-
Method Detail
-
getVersion
public short getVersion()
getVersion
- Returns:
- a short.
-
setVersion
public void setVersion(short version)
setVersion
- Parameters:
version
- a short.
-
getType
public short getType()
getType
- Returns:
- a short.
-
setType
public void setType(short type)
setType
- Parameters:
type
- a short.
-
getResultCode
public short getResultCode()
getResultCode
- Returns:
- a short.
-
setResultCode
public void setResultCode(short resultCode)
setResultCode
- Parameters:
resultCode
- a short.
-
receivePacket
public static NrpePacket receivePacket(InputStream i, int padding) throws NrpeException, IOException
receivePacket
- Parameters:
i
- aInputStream
object.padding
- a int.- Returns:
- a
org.opennms.netmgt.poller.nrpe.NrpePacket
object. - Throws:
org.opennms.netmgt.poller.nrpe.NrpeException
- if any.IOException
- if any.NrpeException
-
positive
public static int positive(byte b)
positive
- Parameters:
b
- a byte.- Returns:
- a int.
-
toString
public String toString()
toString
-
buildPacket
public byte[] buildPacket(int padding)
buildPacket
- Parameters:
padding
- a int.- Returns:
- an array of byte.
-
buildPacket
public byte[] buildPacket(int padding, SecureRandom random)
buildPacket
- Parameters:
padding
- a int.random
- aSecureRandom
object.- Returns:
- an array of byte.
-
-