public class NrpePacket extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PADDING
Constant
DEFAULT_PADDING=2 |
static String |
HELLO_COMMAND
Constant
HELLO_COMMAND="_NRPE_CHECK" |
static int |
MAX_PACKETBUFFER_LENGTH
Constant
MAX_PACKETBUFFER_LENGTH=1024 |
static int |
PACKET_SIZE
Constant
PACKET_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
Constant
PACKET_VERSION_2=2 |
static short |
QUERY_PACKET
Constant
QUERY_PACKET=1 |
static short |
RESPONSE_PACKET
Constant
RESPONSE_PACKET=2 |
Constructor and Description |
---|
NrpePacket()
Constructor for NrpePacket.
|
NrpePacket(short type,
short resultCode,
String buffer)
Constructor for NrpePacket.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
buildPacket(int padding)
buildPacket
|
byte[] |
buildPacket(int padding,
SecureRandom random)
buildPacket
|
String |
getBuffer()
getBuffer
|
short |
getResultCode()
getResultCode
|
short |
getType()
getType
|
short |
getVersion()
getVersion
|
static int |
positive(byte b)
positive
|
static NrpePacket |
receivePacket(InputStream i,
int padding)
receivePacket
|
void |
setBuffer(String buffer)
setBuffer
|
void |
setResultCode(short resultCode)
setResultCode
|
void |
setType(short type)
setType
|
void |
setVersion(short version)
setVersion
|
String |
toString()
toString
|
public static final short QUERY_PACKET
QUERY_PACKET=1
public static final short RESPONSE_PACKET
RESPONSE_PACKET=2
public static final String HELLO_COMMAND
HELLO_COMMAND="_NRPE_CHECK"
public static final short PACKET_VERSION_2
PACKET_VERSION_2=2
public static final int MAX_PACKETBUFFER_LENGTH
MAX_PACKETBUFFER_LENGTH=1024
public static final int PACKET_SIZE
PACKET_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
public static final int DEFAULT_PADDING
DEFAULT_PADDING=2
public short getVersion()
getVersion
public void setVersion(short version)
setVersion
version
- a short.public short getType()
getType
public void setType(short type)
setType
type
- a short.public short getResultCode()
getResultCode
public void setResultCode(short resultCode)
setResultCode
resultCode
- a short.public static NrpePacket receivePacket(InputStream i, int padding) throws NrpeException, IOException
receivePacket
i
- a InputStream
object.padding
- a int.NrpePacket
object.NrpeException
- if any.IOException
- if any.public static int positive(byte b)
positive
b
- a byte.public String toString()
toString
public byte[] buildPacket(int padding)
buildPacket
padding
- a int.public byte[] buildPacket(int padding, SecureRandom random)
buildPacket
padding
- a int.random
- a SecureRandom
object.Copyright © 2021. All rights reserved.