@ApiStatus.Internal public final class SourceRcon extends Object
Modifier and Type | Field and Description |
---|---|
static ThreadGroup |
DEFAULT_THREAD_GROUP
Constant
DEFAULT_THREAD_GROUP |
static io.netty.util.AttributeKey<Boolean> |
INVALIDATED
Flag indicating that the channel has been invalidated and needs to be re-authenticated
|
static int |
RCON_TERMINATOR_RID
A reserved request id representing a special rcon terminator packet
|
static int |
RCON_TYPE_REQUEST_AUTH
RCON Auth Request Header
|
static int |
RCON_TYPE_REQUEST_COMMAND
RCON Command Request Header
|
static int |
RCON_TYPE_RESPONSE_AUTH
RCON Auth Response Header
|
static int |
RCON_TYPE_RESPONSE_VALUE
RCON Response Value Header
|
static int |
RCON_TYPE_RESPONSE_VALUE_RUST
RCON Response Value Header (Rust)
|
Constructor and Description |
---|
SourceRcon() |
Modifier and Type | Method and Description |
---|---|
static SourceRconAuthRequest |
createAuthRequest(byte[] password)
createAuthRequest.
|
static SourceRconAuthRequest |
createAuthRequest(Credentials credentials)
createAuthRequest.
|
static int |
createRequestId()
A utility method to generate random request ids
|
static String |
getPacketTypeName(int type)
getPacketTypeName.
|
static String |
getPacketTypeName(SourceRconPacket packet)
Get the name of the provided
SourceRconPacket |
static boolean |
isAuthRequestPacket(SourceRconPacket packet)
Check if packet is an RCON Auth request packet
|
static boolean |
isAuthResponsePacket(SourceRconPacket packet)
Check if packet is an RCON auth response packet
|
static boolean |
isCommandResponsePacket(SourceRconPacket packet)
Check if packet is a Command Response Packet
|
static boolean |
isInitialTerminatorPacket(SourceRconPacket packet)
Check if the packet is the primary terminator packet (The first terminator packet sent after a request)
|
static boolean |
isResponseValuePacket(SourceRconPacket packet)
Check if packet is an RCON response value packet
|
static boolean |
isSecondaryTerminatorPacket(SourceRconPacket packet)
Check if the packet is the secondary terminator packet (The secondary terminator packet sent after a request)
|
static boolean |
isTerminatorId(int requestId)
Checks if the rcon request id represents a terminator packet
|
static boolean |
isTerminatorPacket(SourceRconPacket packet)
Check if packet is a valid terminator packet
|
static boolean |
isValidRequestId(int requestId)
Checks if the request id is within the valid range
|
static boolean |
isValidTerminator(int terminator)
Check if value is valid RCON terminator
|
static boolean |
terminatorPacketEnabled(io.netty.channel.ChannelHandlerContext ctx)
Convenience method to determine if terminator packets are enabled for the provided channel
|
public static final ThreadGroup DEFAULT_THREAD_GROUP
DEFAULT_THREAD_GROUP
public static final int RCON_TYPE_REQUEST_AUTH
public static final int RCON_TYPE_REQUEST_COMMAND
public static final int RCON_TYPE_RESPONSE_AUTH
public static final int RCON_TYPE_RESPONSE_VALUE
public static final int RCON_TYPE_RESPONSE_VALUE_RUST
public static final int RCON_TERMINATOR_RID
public static final io.netty.util.AttributeKey<Boolean> INVALIDATED
public static boolean isInitialTerminatorPacket(SourceRconPacket packet)
packet
- SourceRconPacket
to checktrue
if the rcon packet is the initial terminator packet (byte terminator value of 0x0)public static boolean isTerminatorPacket(SourceRconPacket packet)
packet
- The SourceRconPacket
to checktrue
if the packet is a terminator packetpublic static boolean isTerminatorId(int requestId)
Checks if the rcon request id represents a terminator packet
requestId
- An integer representing an Rcon Request Idtrue
if the given id represents a terminatorpublic static boolean isResponseValuePacket(SourceRconPacket packet)
packet
- The SourceRconPacket
to checktrue
if the packet is a valid response value packetpublic static boolean isSecondaryTerminatorPacket(SourceRconPacket packet)
packet
- SourceRconPacket
to checktrue
if the rcon packet is the initial terminator packet (byte terminator value of 0x01)public static boolean isValidRequestId(int requestId)
Checks if the request id is within the valid range
requestId
- An integer representing a request idtrue
if the given request id is within the valid rangepublic static boolean isValidTerminator(int terminator)
terminator
- The terminator valuetrue
if the value is a valid rcon terminatorspublic static boolean terminatorPacketEnabled(io.netty.channel.ChannelHandlerContext ctx)
ctx
- The ChannelHandlerContext
true
if terminator packets are enabledpublic static String getPacketTypeName(SourceRconPacket packet)
SourceRconPacket
packet
- The SourceRconPacket
to checkSourceRconPacket
public static boolean isAuthRequestPacket(SourceRconPacket packet)
packet
- The SourceRconPacket
to checktrue
if packet is a valid AUTH packetpublic static boolean isAuthResponsePacket(SourceRconPacket packet)
packet
- The SourceRconPacket
to checktrue
if the packet is a valid auth response packetpublic static boolean isCommandResponsePacket(SourceRconPacket packet)
packet
- The SourceRconPacket
to checktrue
if the packet is a valid command response packetpublic static String getPacketTypeName(int type)
getPacketTypeName.
type
- a intString
objectpublic static SourceRconAuthRequest createAuthRequest(Credentials credentials)
createAuthRequest.
credentials
- a Credentials
objectSourceRconAuthRequest
objectpublic static SourceRconAuthRequest createAuthRequest(byte[] password)
createAuthRequest.
password
- an array of byte
objectsSourceRconAuthRequest
objectpublic static int createRequestId()
Copyright © 2016–2024. All rights reserved.