com.ibm.net.rdma.jverbs.cm

Class ConnectionId

  • java.lang.Object
    • com.ibm.net.rdma.jverbs.cm.ConnectionId


  • public class ConnectionId
    extends java.lang.Object
    The RDMA unique identifier used to identify one end of the connection. Connection id can be created using ConnectionId.createConnectionId() or retrieved from RDMA_CM_EVENT_CONNECT_REQUEST event.

    Connection id can operate only within device context associated with id. Context can be accessed through ConnectionId.getVerbsContext(). Device specific operations like allocating ProtectionDomain, creating CompletionChannel and creating CompletionQueue can be done using the context.

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void accept(ConnectionParameter connParam)
      Accept a connection request on connect request event (RDMA_CM_EVENT_CONNECT_REQUEST).
      void bindAddress(java.net.SocketAddress address)
      Associates a source address with an ConnectionId.
      void connect(ConnectionParameter connParam)
      Initiates connection request.
      static ConnectionId create(EventChannel channel, PortSpace rdmaPortSpace)
      Create new ConnectionId which is associated with the channel.
      QueuePair createQueuePair(ProtectionDomain pd, QueuePairInitAttribute attribute)
      Allocates QueuePair and associates with this ConnectionId.
      void destroy()
      Destroys the specified ConnectionId and cancels any outstanding asynchronous operation.
      void destroyQueuePair()
      Destroy the QueuePair associated with this ConnectionId.
      void disconnect()
      Disconnects a connection and transitions any associated QueuePair to the error state.
      java.net.SocketAddress getDestinationAddress()
      Returns the remote IP address associated with ConnectionId.
      int getDestinationPort()
      Return remote process port number associated with ConnectionId.
      EventChannel getEventChannel()
      Gets the communication channel associated with this ConnectionId.
      PortSpace getPortSpace()
      Gets the port space used to create this ConnectionId
      QueuePair getQueuePair()
      Gets the Queue Pair (QP) associated with this id.
      java.net.SocketAddress getSourceAddress()
      Returns the local IP address for ConnectionId that has been bound to a local device.
      int getSourcePort()
      Return host process port number associated with ConnectionId.
      VerbsContext getVerbsContext()
      Gets the device context associated with this id.
      void listen(int backlog)
      Initiates a listen for incoming connection requests.
      void resolveAddress(java.net.SocketAddress src, java.net.SocketAddress dst, int timeout)
      Resolve destination and optional source addresses from IP addresses to an RDMA address.
      void resolveRoute(int timeout)
      Resolves an RDMA route to the destination address in order to establish a connection.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • accept

        public void accept(ConnectionParameter connParam)
                    throws java.lang.IllegalArgumentException,
                           java.io.IOException
        Accept a connection request on connect request event (RDMA_CM_EVENT_CONNECT_REQUEST). On successful completion of accept(), RDMA_CM_EVENT_ESTABLISHED event will be sent to other side.
        Parameters:
        connParam - connection parameters.
        Throws:
        java.lang.IllegalArgumentException - If the value of any of the parameter is invalid
        java.io.IOException - If an I/O error occurs
      • bindAddress

        public void bindAddress(java.net.SocketAddress address)
                         throws java.lang.IllegalArgumentException,
                                java.io.IOException
        Associates a source address with an ConnectionId. The address may be wildcarded. If binding to a specific local address, the ConnectionId will also be bound to a local RDMA device.
        Parameters:
        address - local address information.
        Throws:
        java.lang.IllegalArgumentException - If the value of any of the parameter is invalid
        java.io.IOException - If an I/O error occurs
      • connect

        public void connect(ConnectionParameter connParam)
                     throws java.lang.IllegalArgumentException,
                            java.io.IOException
        Initiates connection request. Route to the destination address must have been resolved before initiating connect request.
        Parameters:
        connParam - connection parameters.
        Throws:
        java.lang.IllegalArgumentException - If the value of any of the parameter is invalid
        java.io.IOException - If an I/O error occurs
      • create

        public static ConnectionId create(EventChannel channel,
                                          PortSpace rdmaPortSpace)
                                   throws java.lang.IllegalArgumentException,
                                          java.io.IOException
        Create new ConnectionId which is associated with the channel. Users must release the id by calling destroy().
        Parameters:
        channel - EventChannel to which ConnectionId to be associated.
        rdmaPortSpace - the RDMA port space. Only RDMA_PS_TCP supported.
        Returns:
        the newly created Id
        Throws:
        java.io.IOException - If an I/O error occurs
        java.lang.IllegalArgumentException - If the value of any of the parameter is invalid
      • createQueuePair

        public QueuePair createQueuePair(ProtectionDomain pd,
                                         QueuePairInitAttribute attribute)
                                  throws java.lang.IllegalArgumentException,
                                         java.io.IOException
        Allocates QueuePair and associates with this ConnectionId. A ConnectionId can be associated with one QueuePair only. Any attempt to associate more than one QueuePair will result in IOException. ConnectionId must have been associated with a QueuePair for sending and receiving data. This fails with IOException if the specified values are more than device limit.
        Parameters:
        pd - the protection domain.
        attribute - the queue pair size attributes.
        Returns:
        the created QueuePair.
        Throws:
        java.lang.IllegalArgumentException - If the value of any of the parameter is invalid
        java.io.IOException - If an I/O error occurs
      • destroy

        public void destroy()
                     throws java.io.IOException
        Destroys the specified ConnectionId and cancels any outstanding asynchronous operation.
        Throws:
        java.io.IOException - If an I/O error occurs ConnectionId's associated QueuePair needs to be destroyed and it needs to be disconnected prior to this call.
      • destroyQueuePair

        public void destroyQueuePair()
                              throws java.io.IOException
        Destroy the QueuePair associated with this ConnectionId. ConnectionId cannot be used further.
        Throws:
        java.io.IOException - If an I/O error occurs
      • disconnect

        public void disconnect()
                        throws java.io.IOException
        Disconnects a connection and transitions any associated QueuePair to the error state. Flushes any posted work requests to the completion queue. This routine may be called by both the client and server side of a connection. After successfully disconnecting, an RDMA_CM_EVENT_DISCONNECTED event will be generated on both sides of the connection.
        Throws:
        java.io.IOException - If an I/O error occurs
      • getDestinationAddress

        public java.net.SocketAddress getDestinationAddress()
                                                     throws java.io.IOException
        Returns the remote IP address associated with ConnectionId.
        Returns:
        the SocketAddress address of the connected peer. If the ConnectionId is not connected the call returns NULL.
        Throws:
        java.io.IOException - If an I/O error occurs
      • getDestinationPort

        public int getDestinationPort()
                               throws java.io.IOException
        Return remote process port number associated with ConnectionId.
        Returns:
        port number, 0 if id is not connected
        Throws:
        java.io.IOException - If an I/O error occurs
      • getEventChannel

        public EventChannel getEventChannel()
        Gets the communication channel associated with this ConnectionId.
        Returns:
        the communication channel.
      • getPortSpace

        public PortSpace getPortSpace()
        Gets the port space used to create this ConnectionId
        Returns:
        the port space.
      • getQueuePair

        public QueuePair getQueuePair()
        Gets the Queue Pair (QP) associated with this id. QueuePair is associated with an id only after CreateQueuePair
        Returns:
        the Queue Pair (QP).
      • getSourceAddress

        public java.net.SocketAddress getSourceAddress()
                                                throws java.io.IOException
        Returns the local IP address for ConnectionId that has been bound to a local device.
        Returns:
        the local IP address for an ConnectionId that has been bound to a local device.
        Throws:
        java.io.IOException - If an I/O error occurs
      • getSourcePort

        public int getSourcePort()
                          throws java.io.IOException
        Return host process port number associated with ConnectionId.
        Returns:
        local port number
        Throws:
        java.io.IOException - If an I/O error occurs
      • getVerbsContext

        public VerbsContext getVerbsContext()
                                     throws java.io.IOException
        Gets the device context associated with this id.
        Returns:
        the context. null if ConnectionId is not bound to device
        Throws:
        java.io.IOException - If an I/O error occurs
      • listen

        public void listen(int backlog)
                    throws java.io.IOException
        Initiates a listen for incoming connection requests. The listen will be restricted to the locally bound source address.
        Parameters:
        backlog - the backlog of listen call. Assumed 50 if less than or equal to 0 is passed
        Throws:
        java.io.IOException - If an I/O error occurs
      • resolveAddress

        public void resolveAddress(java.net.SocketAddress src,
                                   java.net.SocketAddress dst,
                                   int timeout)
                            throws java.lang.IllegalArgumentException,
                                   java.io.IOException
        Resolve destination and optional source addresses from IP addresses to an RDMA address. If successful, the specified ConnectionId will be bound to a local device.
        Parameters:
        src - source address information. Not Used. Assumed null
        dst - destination address information
        timeout - time to wait for resolution to complete.
        Throws:
        java.lang.IllegalArgumentException - If the value of any of the parameter is invalid
        java.io.IOException - If an I/O error occurs
      • resolveRoute

        public void resolveRoute(int timeout)
                          throws java.lang.IllegalArgumentException,
                                 java.io.IOException
        Resolves an RDMA route to the destination address in order to establish a connection. The destination address must have already been resolved by calling resolveAddr.
        Parameters:
        timeout - time to wait for resolution to complete.
        Throws:
        java.lang.IllegalArgumentException - If the value of any of the parameter is invalid
        java.io.IOException - If an I/O error occurs