Class Connection

    • Method Detail

      • init

        private void init()
      • connect

        public void connect​(java.lang.String hostname,
                            int port)
                     throws java.io.IOException
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • close

        public void close​(boolean force)
                   throws java.io.IOException
        Close the Connection. If force is set to true, it forgoes the Session.close() operation on the open sessions, and it just calls the TransportLayer.disconnect().

        If force is set to false, the usage counter of the connection reduces with one. If the usage count drops to zero the connection will be closed.

        Parameters:
        force - if set, does not nicely terminate the open sessions.
        Throws:
        java.io.IOException - If any error occurred during close-ing.
      • authenticate

        public Session authenticate​(AuthenticationContext authContext)
        Authenticate the user on this connection in order to start a (new) session.
        Returns:
        a (new) Session that is authenticated for the user.
      • send

        public <T extends SMB2Packet> java.util.concurrent.Future<T> send​(SMB2Packet packet)
                                                                   throws TransportException
        send a packet.
        Parameters:
        packet - SMBPacket to send
        Returns:
        a Future to be used to retrieve the response packet
        Throws:
        TransportException - When a transport level error occurred
      • calculateGrantedCredits

        private int calculateGrantedCredits​(SMB2Packet packet,
                                            int availableCredits)
      • creditsNeeded

        private int creditsNeeded​(int payloadSize)
        [MS-SMB2] 3.1.5.2 Calculating the CreditCharge
      • getNegotiatedProtocol

        public NegotiatedProtocol getNegotiatedProtocol()
        Returns the negotiated protocol details for this connection.
        Returns:
        The negotiated protocol details
      • getRemoteHostname

        public java.lang.String getRemoteHostname()
      • isConnected

        public boolean isConnected()
      • getPreauthSessionTable

        SessionTable getPreauthSessionTable()