Package com.hierynomus.mssmb2
Class SMB2Packet
- java.lang.Object
-
- com.hierynomus.smb.SMBPacket<SMB2PacketData,SMB2PacketHeader>
-
- com.hierynomus.mssmb2.SMB2Packet
-
- Direct Known Subclasses:
PacketEncryptor.EncryptedPacketWrapper
,PacketSignatory.SignedPacketWrapper
,SMB2Cancel
,SMB2ChangeNotifyResponse
,SMB2Close
,SMB2CreateRequest
,SMB2CreateResponse
,SMB2Echo
,SMB2Flush
,SMB2IoctlResponse
,SMB2LockRequest
,SMB2LockResponse
,SMB2Logoff
,SMB2MultiCreditPacket
,SMB2NegotiateRequest
,SMB2NegotiateResponse
,SMB2QueryDirectoryResponse
,SMB2QueryInfoRequest
,SMB2QueryInfoResponse
,SMB2ReadResponse
,SMB2SessionSetup
,SMB2SetInfoRequest
,SMB2SetInfoResponse
,SMB2TreeConnectRequest
,SMB2TreeConnectResponse
,SMB2TreeDisconnect
,SMB2WriteResponse
public class SMB2Packet extends SMBPacket<SMB2PacketData,SMB2PacketHeader>
-
-
Field Summary
Fields Modifier and Type Field Description static int
SINGLE_CREDIT_PAYLOAD_SIZE
protected int
structureSize
-
Constructor Summary
Constructors Modifier Constructor Description protected
SMB2Packet()
protected
SMB2Packet(int structureSize, SMB2Dialect dialect, SMB2MessageCommandCode messageType)
protected
SMB2Packet(int structureSize, SMB2Dialect dialect, SMB2MessageCommandCode messageType, long sessionId)
protected
SMB2Packet(int structureSize, SMB2Dialect dialect, SMB2MessageCommandCode messageType, long sessionId, long treeId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SMBBuffer
getBuffer()
The buffer from which this packet is read if it was a received packetint
getCreditsAssigned()
SMB2Error
getError()
int
getMaxPayloadSize()
Returns the maximum payload size of this packet.SMB2Packet
getPacket()
Method that can be overridden by Packet Wrappers to ensure that the original (typed) packet is obtainable.long
getSequenceNumber()
int
getStructureSize()
boolean
isIntermediateAsyncResponse()
Check whether this packet is an intermediate ASYNC responseboolean
isSuccess()
Whether this packet contains a success response or an error responseprotected void
read(SMB2PacketData packetData)
protected void
readMessage(SMBBuffer buffer)
Read the packet body, this should be implemented by the various packet types.void
setCreditsAssigned(int creditsAssigned)
java.lang.String
toString()
void
write(SMBBuffer buffer)
protected void
writeTo(SMBBuffer buffer)
Write the message fields into the buffer, as specified in the [MS-SMB2] specification.
-
-
-
Field Detail
-
SINGLE_CREDIT_PAYLOAD_SIZE
public static final int SINGLE_CREDIT_PAYLOAD_SIZE
- See Also:
- Constant Field Values
-
structureSize
protected int structureSize
-
-
Constructor Detail
-
SMB2Packet
protected SMB2Packet()
-
SMB2Packet
protected SMB2Packet(int structureSize, SMB2Dialect dialect, SMB2MessageCommandCode messageType)
-
SMB2Packet
protected SMB2Packet(int structureSize, SMB2Dialect dialect, SMB2MessageCommandCode messageType, long sessionId)
-
SMB2Packet
protected SMB2Packet(int structureSize, SMB2Dialect dialect, SMB2MessageCommandCode messageType, long sessionId, long treeId)
-
-
Method Detail
-
getSequenceNumber
public long getSequenceNumber()
-
getStructureSize
public int getStructureSize()
-
getBuffer
public SMBBuffer getBuffer()
The buffer from which this packet is read if it was a received packet- Overrides:
getBuffer
in classSMBPacket<SMB2PacketData,SMB2PacketHeader>
- Returns:
- The buffer
-
write
public void write(SMBBuffer buffer)
-
writeTo
protected void writeTo(SMBBuffer buffer)
Write the message fields into the buffer, as specified in the [MS-SMB2] specification.- Parameters:
buffer
-
-
read
protected final void read(SMB2PacketData packetData) throws Buffer.BufferException
- Specified by:
read
in classSMBPacket<SMB2PacketData,SMB2PacketHeader>
- Throws:
Buffer.BufferException
-
readMessage
protected void readMessage(SMBBuffer buffer) throws Buffer.BufferException
Read the packet body, this should be implemented by the various packet types.- Parameters:
buffer
-- Throws:
Buffer.BufferException
-
isSuccess
public final boolean isSuccess()
Whether this packet contains a success response or an error response- Returns:
true
if the packet does not containerror
data
-
isIntermediateAsyncResponse
public boolean isIntermediateAsyncResponse()
Check whether this packet is an intermediate ASYNC response
-
getMaxPayloadSize
public int getMaxPayloadSize()
Returns the maximum payload size of this packet. Normally this is theSINGLE_CREDIT_PAYLOAD_SIZE
. Can be overridden in subclasses to support multi-credit messages.- Returns:
-
getCreditsAssigned
public int getCreditsAssigned()
-
setCreditsAssigned
public void setCreditsAssigned(int creditsAssigned)
-
getError
public SMB2Error getError()
-
getPacket
public SMB2Packet getPacket()
Method that can be overridden by Packet Wrappers to ensure that the original (typed) packet is obtainable.- Returns:
- this
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-