public class Session extends Object
Base class for sessions connected to remote disk, print, named pipe and administration named pipe shares.
Modifier and Type | Field and Description |
---|---|
protected static int |
Closed |
static int |
DBGDumpPacket |
static int |
DBGHexDump |
static int |
DBGPacketType |
static int |
DBGSigning |
static int |
DEFAULT_BUFSIZE |
protected SMBPacket |
m_pkt |
protected int |
m_treeid |
static int |
NO_TRANSACTION |
static int |
SecurityModeShare |
static int |
SecurityModeUser |
Modifier | Constructor and Description |
---|---|
protected |
Session(PCShare shr,
int dialect,
SMBPacket pkt)
Construct an SMB session
|
Modifier and Type | Method and Description |
---|---|
protected SMBPacket |
allocatePacket(int pref)
Allocate an SMB packet for this session.
|
void |
CloseSession()
Close this connection with the remote server.
|
protected void |
disableSMBSigning()
Disable SMB signing for this session
|
protected void |
enableSMBSigning(byte[] sessKey)
Enable SMB signing for this session
|
int |
getCapabilities()
Return the session capability flags.
|
int |
getDefaultFlags()
Return the default flags settings for this session
|
int |
getDefaultFlags2()
Return the default flags2 settings for this session
|
int |
getDeviceType()
Get the device type that this session is connected to.
|
int |
getDialect()
Get the SMB dialect property
|
String |
getDialectString()
Get the SMB dialect string
|
String |
getDomain()
Get the servers primary domain name
|
byte[] |
getEncryptionKey()
Return the cahllenge encryption key
|
String |
getLANManagerType()
Get the servers LAN manager type
|
int |
getMaximumMultiplexedRequests()
Get the maximum number of multiplxed requests that are allowed
|
int |
getMaximumPacketSize()
Get the maximum packet size allowed for this session
|
int |
getMaximumVirtualCircuits()
Get the maximum virtual circuits allowed on this session
|
int |
getNextMultiplexId()
Get the next multiplex id to uniquely identify a transaction
|
protected int |
getNextSessionId()
Get the next session id
|
String |
getOperatingSystem()
Get the servers operating system type
|
String |
getPassword()
Get the remote share password string
|
PCShare |
getPCShare()
Get the remote share details for this session
|
int |
getProcessId()
Get the process id for this session
|
int |
getSecurityMode()
Return the security mode of the session (user or share)
|
String |
getServer()
Get the remote server name
|
NetworkSession |
getSession()
Access the associated network session
|
int |
getSessionId()
Get the session identifier property
|
String |
getShareName()
Get the remote share name
|
int |
getSMBSequence()
Get the SMB signing sequence number
|
int |
getTreeId()
Get the connected tree identifier.
|
int |
getUserId()
Return the assigned use id for this SMB session
|
String |
getUserName()
Get the remote share user name string
|
boolean |
hasActiveTransaction()
Determine if there is an active transaction
|
boolean |
hasDataAvailable()
Check if there is data available in the network receive buffer
|
static boolean |
hasDebug()
Determine if SMB session debugging is enabled
|
static boolean |
hasDebugOption(int opt)
Determine if the specified debugging option is enabled
|
boolean |
hasEncryptionKey()
Determine if there is a challenge encryption key
|
boolean |
hasSMBSigning()
Check if SMB signing is enabled on this session
|
boolean |
isActive()
Determine if the session is valid, ie.
|
boolean |
isGuest()
Determine if the session has been created as a guest logon
|
boolean |
isUnicode()
Determine if the Unicode flag is enabled
|
void |
pingServer()
Send a single echo request to the server
|
void |
pingServer(int cnt)
Send an echo request to the server
|
protected void |
processAsynchResponse(SMBPacket pkt)
Process an asynchronous packet
|
protected void |
setCapabilities(int caps)
Set the session capability flags
|
static void |
setDebug(int dbg)
Enable/disable SMB session debugging
|
protected void |
setDefaultFlags(int flg)
Set the default SMB packet flags for this session
|
protected void |
setDefaultFlags2(int flg2)
Set the SMB packet default flags2 for this session
|
protected void |
setDeviceType(int dev)
Set the device type for this session.
|
protected void |
setDialect(int dia)
Set the dialect for this session
|
protected void |
setDialectString(String dia)
Set the dialect string for this session
|
protected void |
setDomain(String dom)
Set the remote servers primary domain name
|
void |
setEncryptionKey(byte[] key)
Set the encryption key
|
protected void |
setGuest(boolean sts)
Set the guest status for the session
|
protected void |
setLANManagerType(String lm)
Set the remote servers LAN manager type
|
protected void |
setMaximumMultiplexedRequests(int maxMulti)
Set the maximum number of multiplexed requests allowed
|
protected void |
setMaximumPacketSize(int siz)
Set the maximum packet size allowed on this session
|
protected void |
setMaximumVirtualCircuits(int maxVC)
Set the maximum number of virtual circuits allowed on this session
|
protected void |
setOperatingSystem(String os)
Set the remote servers operating system type
|
protected void |
setPassword(String pwd)
Set the remote share password
|
void |
setProcessId(int id)
Set the process id for this session
|
void |
setSecurityMode(int secMode)
Set the session security mode (user or share)
|
protected void |
setServer(String srv)
Set the remote server name
|
protected void |
setSession(NetworkSession netSess)
Set the network session that this SMB session is associated with
|
protected void |
setShareName(String shr)
Set the remote share name
|
void |
setSMBSequence(int seq)
Set the SMB signing sequence number
|
void |
setTransactionMID(int mid)
Set the multiplex id of an active transaction
|
protected void |
setTreeId(int id)
Set the connected tree identifier for this session.
|
protected void |
setUserId(int uid)
Set the user identifier for this session
|
protected void |
setUserName(String user)
Set the remote share user name
|
protected void |
signTxPacket(SMBPacket pkt)
Add an SMB signature to an outgoing SMB request
|
boolean |
supportsLargeFiles()
Determine if the session supports large files (ie.
|
boolean |
supportsLevel2Oplocks()
Determine if the session supports level 2 oplocks
|
boolean |
supportsLockAndRead()
Determine if the session supports lock and read
|
boolean |
supportsNTFind()
Determine if the session supports NT find
|
boolean |
supportsNTSmbs()
Determine if the session supports NT specific SMBs
|
boolean |
supportsNTStatusCodes()
Determine if the session supports NT status codes
|
boolean |
supportsRawMode()
Determine if the session supports raw mode read/writes
|
boolean |
supportsRPCAPIs()
Determine if the session supports RPC API requests
|
boolean |
supportsUnicode()
Determine if the session supports Unicode
|
String |
toString()
Output the session details as a string
|
protected void |
verifyRxPacket(SMBPacket pkt)
Verify the SMB signature on an incoming SMB response
|
public static final int SecurityModeUser
public static final int SecurityModeShare
protected static final int Closed
public static final int DBGPacketType
public static final int DBGDumpPacket
public static final int DBGHexDump
public static final int DBGSigning
public static final int DEFAULT_BUFSIZE
public static final int NO_TRANSACTION
protected SMBPacket m_pkt
protected int m_treeid
protected final SMBPacket allocatePacket(int pref)
pref
- Preferred SMB packet sizepublic final boolean supportsRawMode()
public final boolean supportsUnicode()
public final boolean supportsLargeFiles()
public final boolean supportsNTSmbs()
public final boolean supportsRPCAPIs()
public final boolean supportsNTStatusCodes()
public final boolean supportsLevel2Oplocks()
public final boolean supportsLockAndRead()
public final boolean supportsNTFind()
public void CloseSession() throws IOException, SMBException
IOException
- If an I/O error occurs.SMBException
- If an SMB level error occurspublic final int getDefaultFlags()
public final int getDefaultFlags2()
public final int getDeviceType()
public final int getDialect()
public final String getDialectString()
public final String getDomain()
public final boolean hasEncryptionKey()
public final byte[] getEncryptionKey()
public final String getLANManagerType()
public final int getMaximumMultiplexedRequests()
public final int getMaximumPacketSize()
public final int getMaximumVirtualCircuits()
public final int getNextMultiplexId()
protected final int getNextSessionId()
public final String getOperatingSystem()
public final String getPassword()
public final PCShare getPCShare()
public final int getSecurityMode()
public final String getServer()
public final NetworkSession getSession()
public final int getCapabilities()
public final int getProcessId()
public final int getSessionId()
public final String getShareName()
public final int getTreeId()
public final int getUserId()
public final String getUserName()
public final boolean hasDataAvailable() throws IOException
IOException
public static boolean hasDebugOption(int opt)
opt
- Debug option bit maskpublic final boolean hasSMBSigning()
public final boolean isActive()
public static boolean hasDebug()
public final boolean isGuest()
public final boolean isUnicode()
public final void pingServer() throws IOException, SMBException
IOException
SMBException
public final void pingServer(int cnt) throws IOException, SMBException
cnt
- Number of packets to echo from the remote serverIOException
- If an I/O error occursSMBException
- SMB error occurredpublic static void setDebug(int dbg)
dbg
- Bit mask of debug options to enable, or zero to disableprotected final void setDefaultFlags(int flg)
flg
- intprotected final void setDefaultFlags2(int flg2)
flg2
- intprotected final void setDeviceType(int dev)
dev
- Device type for this session.protected final void setDialect(int dia)
dia
- SMB dialect that this session is using.protected final void setDialectString(String dia)
dia
- SMB dialect stringprotected final void setDomain(String dom)
dom
- Servers primary domain name.public final void setEncryptionKey(byte[] key)
key
- byte[]protected final void setGuest(boolean sts)
sts
- booleanprotected final void setLANManagerType(String lm)
lm
- Servers LAN manager type string.protected final void setMaximumMultiplexedRequests(int maxMulti)
maxMulti
- intprotected final void setMaximumPacketSize(int siz)
siz
- Maximum allowed packet size.protected final void setMaximumVirtualCircuits(int maxVC)
maxVC
- intprotected final void setOperatingSystem(String os)
os
- Servers operating system type string.protected final void setPassword(String pwd)
pwd
- Remtoe share password string.public final void setSecurityMode(int secMode)
secMode
- intprotected final void setServer(String srv)
srv
- Server name stringprotected final void setSession(NetworkSession netSess)
netSess
- Network session that this SMB session is to be associated with.protected final void setCapabilities(int caps)
caps
- Capability flags.protected final void setShareName(String shr)
shr
- Remote share name stringpublic final void setProcessId(int id)
id
- intprotected final void setTreeId(int id)
id
- Tree identifier for this session.protected final void setUserId(int uid)
uid
- User identifierprotected final void setUserName(String user)
user
- Remote share user name stringprotected void processAsynchResponse(SMBPacket pkt)
pkt
- SMBPacketprotected final void enableSMBSigning(byte[] sessKey) throws NoSuchAlgorithmException
sessKey
- byte[]NoSuchAlgorithmException
- If the MD5 message digest is not availableprotected final void disableSMBSigning()
protected final void signTxPacket(SMBPacket pkt)
pkt
- SMBPacketprotected final void verifyRxPacket(SMBPacket pkt) throws SMBException
pkt
- SMBPacketSMBException
- If the received packet SMB signature is not validpublic final void setTransactionMID(int mid)
mid
- intpublic final boolean hasActiveTransaction()
public final int getSMBSequence()
public final void setSMBSequence(int seq)
seq
- intCopyright © 2005–2018 Alfresco Software. All rights reserved.