Module jcifs

Class SmbTransportPoolImpl

java.lang.Object
org.codelibs.jcifs.smb.impl.SmbTransportPoolImpl
All Implemented Interfaces:
SmbTransportPool

public class SmbTransportPoolImpl extends Object implements SmbTransportPool
Implementation of the SMB transport pool for managing SMB connections. Provides connection pooling and reuse for improved performance.
Author:
mbechler

This class is intended for internal use.

  • Constructor Details

    • SmbTransportPoolImpl

      public SmbTransportPoolImpl()
      Constructs a new SmbTransportPoolImpl instance. This transport pool manages SMB connections for the client.
  • Method Details

    • getSmbTransport

      public org.codelibs.jcifs.smb.impl.SmbTransportImpl getSmbTransport(CIFSContext tc, Address address, int port, boolean nonPooled)
      Description copied from interface: SmbTransportPool
      Get transport connection
      Specified by:
      getSmbTransport in interface SmbTransportPool
      Parameters:
      tc - context to use
      address - the server address
      port - the port number
      nonPooled - whether to acquire an unshared connection
      Returns:
      a transport connection to the target
    • getSmbTransport

      public org.codelibs.jcifs.smb.impl.SmbTransportImpl getSmbTransport(CIFSContext tc, Address address, int port, boolean nonPooled, boolean forceSigning)
      Description copied from interface: SmbTransportPool
      Get transport connection
      Specified by:
      getSmbTransport in interface SmbTransportPool
      Parameters:
      tc - context to use
      address - the server address
      port - the port number
      nonPooled - whether to acquire an unshared connection
      forceSigning - whether to enforce SMB signing on this connection
      Returns:
      a transport connection to the target
    • getSmbTransport

      public org.codelibs.jcifs.smb.impl.SmbTransportImpl getSmbTransport(CIFSContext tc, Address address, int port, InetAddress localAddr, int localPort, String hostName, boolean nonPooled)
      Description copied from interface: SmbTransportPool
      Get transport connection, with local binding
      Specified by:
      getSmbTransport in interface SmbTransportPool
      Parameters:
      tc - context to use
      address - the server address
      port - the port number
      localAddr - the local address to bind to
      localPort - the local port to bind to
      hostName - the server host name
      nonPooled - whether to acquire an unshared connection
      Returns:
      a transport connection to the target
    • getSmbTransport

      public org.codelibs.jcifs.smb.impl.SmbTransportImpl getSmbTransport(CIFSContext tc, Address address, int port, InetAddress localAddr, int localPort, String hostName, boolean nonPooled, boolean forceSigning)
      Description copied from interface: SmbTransportPool
      Gets or creates an SMB transport for the given context.
      Specified by:
      getSmbTransport in interface SmbTransportPool
      Parameters:
      tc - context to use
      address - the server address
      port - the port number
      localAddr - the local address to bind to
      localPort - the local port to bind to
      hostName - the server host name
      nonPooled - whether to acquire an unshared connection
      forceSigning - whether to enforce SMB signing on this connection
      Returns:
      a transport connection to the target
    • getSmbTransport

      public org.codelibs.jcifs.smb.impl.SmbTransportImpl getSmbTransport(CIFSContext tf, String name, int port, boolean exclusive, boolean forceSigning) throws IOException
      Description copied from interface: SmbTransportPool
      Gets an SMB transport connection to the specified server.
      Specified by:
      getSmbTransport in interface SmbTransportPool
      Parameters:
      tf - the CIFS context to use
      name - the server name or address
      port - the port number
      exclusive - whether to acquire an unshared connection
      forceSigning - whether to enforce SMB signing
      Returns:
      a connected transport
      Throws:
      UnknownHostException - if the host cannot be resolved
      IOException - if an I/O error occurs
    • contains

      public boolean contains(SmbTransport trans)
      Checks if the specified transport is contained in the connection pool
      Parameters:
      trans - the transport to check for
      Returns:
      whether (non-exclusive) connection is in the pool
    • removeTransport

      public void removeTransport(SmbTransport trans)
      Description copied from interface: SmbTransportPool
      Removes a transport from the pool.
      Specified by:
      removeTransport in interface SmbTransportPool
      Parameters:
      trans - the transport to remove
    • close

      public boolean close() throws CIFSException
      Closes the pool and all connections in it
      Specified by:
      close in interface SmbTransportPool
      Returns:
      whether any transport was still in use
      Throws:
      CIFSException - if an error occurs during authentication
      See Also:
    • getChallenge

      public byte[] getChallenge(CIFSContext tf, Address dc) throws SmbException
      Description copied from interface: SmbTransportPool
      Get NTLM challenge from a server
      Specified by:
      getChallenge in interface SmbTransportPool
      Parameters:
      tf - the CIFS context containing credentials
      dc - the domain controller address
      Returns:
      NTLM challenge
      Throws:
      SmbException
    • getChallenge

      public byte[] getChallenge(CIFSContext tf, Address dc, int port) throws SmbException
      Description copied from interface: SmbTransportPool
      Get NTLM challenge from a server
      Specified by:
      getChallenge in interface SmbTransportPool
      Parameters:
      tf - the CIFS context containing credentials
      dc - the domain controller address
      port - the port number
      Returns:
      NTLM challenge
      Throws:
      SmbException
    • logon

      public void logon(CIFSContext tf, Address dc) throws SmbException
      Description copied from interface: SmbTransportPool
      Authenticate arbitrary credentials represented by the NtlmPasswordAuthentication object against the domain controller specified by the UniAddress parameter. If the credentials are not accepted, an SmbAuthException will be thrown. If an error occurs an SmbException will be thrown. If the credentials are valid, the method will return without throwing an exception. See the last FAQ question.

      See also the org.codelibs.jcifs.smb.impl.client.logonShare property.

      Specified by:
      logon in interface SmbTransportPool
      Parameters:
      tf - the CIFS context containing credentials
      dc - the domain controller address
      Throws:
      SmbException
    • logon

      @Deprecated public void logon(CIFSContext tf, Address dc, int port) throws SmbException
      Deprecated.
      Description copied from interface: SmbTransportPool
      Authenticate arbitrary credentials represented by the NtlmPasswordAuthentication object against the domain controller specified by the UniAddress parameter. If the credentials are not accepted, an SmbAuthException will be thrown. If an error occurs an SmbException will be thrown. If the credentials are valid, the method will return without throwing an exception. See the last FAQ question.

      See also the org.codelibs.jcifs.smb.impl.client.logonShare property.

      Specified by:
      logon in interface SmbTransportPool
      Parameters:
      tf - the CIFS context containing credentials
      dc - the domain controller address
      port - the port number
      Throws:
      SmbException