def interpret_association_accept(message)
      info = Hash.new
      msg = Stream.new(message, @net_endian)
      # Protocol version (2 bytes)
      info[:protocol_version] = msg.decode(2, "HEX")
      # Reserved (2 bytes)
      msg.skip(2)
      # Called AE (shall be identical to the one sent in the request, but not tested against) (16 bytes)
      info[:called_ae] = msg.decode(16, "STR")
      # Calling AE (shall be identical to the one sent in the request, but not tested against) (16 bytes)
      info[:calling_ae] = msg.decode(16, "STR")
      # Reserved (32 bytes)
      msg.skip(32)
      # APPLICATION CONTEXT:
      # Item type (1 byte)
      info[:application_item_type] = msg.decode(1, "HEX")
      # Reserved (1 byte)
      msg.skip(1)
      # Application item length (2 bytes)
      info[:application_item_length] = msg.decode(2, "US")
      # Application context (variable length)
      info[:application_context] = msg.decode(info[:application_item_length], "STR")
      # PRESENTATION CONTEXT:
      # As multiple presentation contexts may occur, we need a loop to catch them all:
      # Each presentation context hash will be put in an array, which will be put in the info hash.
      presentation_contexts = Array.new
      pc_loop = true
      while pc_loop do
        # Item type (1 byte)
        item_type = msg.decode(1, "HEX")
        if item_type == ITEM_PRESENTATION_CONTEXT_RESPONSE
          pc = Hash.new
          pc[:presentation_item_type] = item_type
          # Reserved (1 byte)
          msg.skip(1)
          # Presentation item length (2 bytes)
          pc[:presentation_item_length] = msg.decode(2, "US")
          # Presentation context ID (1 byte)
          pc[:presentation_context_id] = msg.decode(1, "BY")
          # Reserved (1 byte)
          msg.skip(1)
          # Result (& Reason) (1 byte)
          pc[:result] = msg.decode(1, "BY")
          process_result(pc[:result])
          # Reserved (1 byte)
          msg.skip(1)
          # Transfer syntax sub-item:
          # Item type (1 byte)
          pc[:transfer_syntax_item_type] = msg.decode(1, "HEX")
          # Reserved (1 byte)
          msg.skip(1)
          # Transfer syntax item length (2 bytes)
          pc[:transfer_syntax_item_length] = msg.decode(2, "US")
          # Transfer syntax name (variable length)
          pc[:transfer_syntax] = msg.decode(pc[:transfer_syntax_item_length], "STR")
          presentation_contexts << pc
        else
          # Break the presentation context loop, as we have probably reached the next stage, which is user info. Rewind:
          msg.skip(-1)
          pc_loop = false
        end
      end
      info[:pc] = presentation_contexts
      # USER INFORMATION:
      # Item type (1 byte)
      info[:user_info_item_type] = msg.decode(1, "HEX")
      # Reserved (1 byte)
      msg.skip(1)
      # User information item length (2 bytes)
      info[:user_info_item_length] = msg.decode(2, "US")
      while msg.index < msg.length do
        # Item type (1 byte)
        item_type = msg.decode(1, "HEX")
        # Reserved (1 byte)
        msg.skip(1)
        # Item length (2 bytes)
        item_length = msg.decode(2, "US")
        case item_type
          when ITEM_MAX_LENGTH
            info[:max_pdu_length] = msg.decode(item_length, "UL")
            @max_receive_size = info[:max_pdu_length]
          when ITEM_IMPLEMENTATION_UID
            info[:implementation_class_uid] = msg.decode(item_length, "STR")
          when ITEM_MAX_OPERATIONS_INVOKED
            # Asynchronous operations window negotiation (PS 3.7: D.3.3.3) (2*2 bytes)
            info[:maxnum_operations_invoked] = msg.decode(2, "US")
            info[:maxnum_operations_performed] = msg.decode(2, "US")
          when ITEM_ROLE_NEGOTIATION
            # SCP/SCU Role Selection Negotiation (PS 3.7 D.3.3.4)
            # Note: An association response may contain several instances of this item type (each with a different abstract syntax).
            uid_length = msg.decode(2, "US")
            role = Hash.new
            # SOP Class UID (Abstract syntax):
            role[:sop_uid] = msg.decode(uid_length, "STR")
            # SCU Role (1 byte):
            role[:scu] = msg.decode(1, "BY")
            # SCP Role (1 byte):
            role[:scp] = msg.decode(1, "BY")
            if info[:role_negotiation]
              info[:role_negotiation] << role
            else
              info[:role_negotiation] = [role]
            end
          when ITEM_IMPLEMENTATION_VERSION
            info[:implementation_version] = msg.decode(item_length, "STR")
          else
            # Value (variable length)
            value = msg.decode(item_length, "STR")
            logger.warn("Unknown user info item type received. Please update source code or contact author. (item type: #{item_type})")
        end
      end
      stop_receiving
      info[:valid] = true
      return info
    end
def interpret_association_accept(message)
      info = Hash.new
      msg = Stream.new(message, @net_endian)
      # Protocol version (2 bytes)
      info[:protocol_version] = msg.decode(2, "HEX")
      # Reserved (2 bytes)
      msg.skip(2)
      # Called AE (shall be identical to the one sent in the request, but not tested against) (16 bytes)
      info[:called_ae] = msg.decode(16, "STR")
      # Calling AE (shall be identical to the one sent in the request, but not tested against) (16 bytes)
      info[:calling_ae] = msg.decode(16, "STR")
      # Reserved (32 bytes)
      msg.skip(32)
      # APPLICATION CONTEXT:
      # Item type (1 byte)
      info[:application_item_type] = msg.decode(1, "HEX")
      # Reserved (1 byte)
      msg.skip(1)
      # Application item length (2 bytes)
      info[:application_item_length] = msg.decode(2, "US")
      # Application context (variable length)
      info[:application_context] = msg.decode(info[:application_item_length], "STR")
      # PRESENTATION CONTEXT:
      # As multiple presentation contexts may occur, we need a loop to catch them all:
      # Each presentation context hash will be put in an array, which will be put in the info hash.
      presentation_contexts = Array.new
      pc_loop = true
      while pc_loop do
        # Item type (1 byte)
        item_type = msg.decode(1, "HEX")
        if item_type == ITEM_PRESENTATION_CONTEXT_RESPONSE
          pc = Hash.new
          pc[:presentation_item_type] = item_type
          # Reserved (1 byte)
          msg.skip(1)
          # Presentation item length (2 bytes)
          pc[:presentation_item_length] = msg.decode(2, "US")
          # Presentation context ID (1 byte)
          pc[:presentation_context_id] = msg.decode(1, "BY")
          # Reserved (1 byte)
          msg.skip(1)
          # Result (& Reason) (1 byte)
          pc[:result] = msg.decode(1, "BY")
          process_result(pc[:result])
          # Reserved (1 byte)
          msg.skip(1)
          # Transfer syntax sub-item:
          # Item type (1 byte)
          pc[:transfer_syntax_item_type] = msg.decode(1, "HEX")
          # Reserved (1 byte)
          msg.skip(1)
          # Transfer syntax item length (2 bytes)
          pc[:transfer_syntax_item_length] = msg.decode(2, "US")
          # Transfer syntax name (variable length)
          pc[:transfer_syntax] = msg.decode(pc[:transfer_syntax_item_length], "STR")
          presentation_contexts << pc
        else
          # Break the presentation context loop, as we have probably reached the next stage, which is user info. Rewind:
          msg.skip(-1)
          pc_loop = false
        end
      end
      info[:pc] = presentation_contexts
      # USER INFORMATION:
      # Item type (1 byte)
      info[:user_info_item_type] = msg.decode(1, "HEX")
      # Reserved (1 byte)
      msg.skip(1)
      # User information item length (2 bytes)
      info[:user_info_item_length] = msg.decode(2, "US")
      while msg.index < msg.length do
        # Item type (1 byte)
        item_type = msg.decode(1, "HEX")
        # Reserved (1 byte)
        msg.skip(1)
        # Item length (2 bytes)
        item_length = msg.decode(2, "US")
        case item_type
          when ITEM_MAX_LENGTH
            info[:max_pdu_length] = msg.decode(item_length, "UL")
            @max_receive_size = info[:max_pdu_length]
          when ITEM_IMPLEMENTATION_UID
            info[:implementation_class_uid] = msg.decode(item_length, "STR")
          when ITEM_MAX_OPERATIONS_INVOKED
            # Asynchronous operations window negotiation (PS 3.7: D.3.3.3) (2*2 bytes)
            info[:maxnum_operations_invoked] = msg.decode(2, "US")
            info[:maxnum_operations_performed] = msg.decode(2, "US")
          when ITEM_ROLE_NEGOTIATION
            # SCP/SCU Role Selection Negotiation (PS 3.7 D.3.3.4)
            # Note: An association response may contain several instances of this item type (each with a different abstract syntax).
            uid_length = msg.decode(2, "US")
            role = Hash.new
            # SOP Class UID (Abstract syntax):
            role[:sop_uid] = msg.decode(uid_length, "STR")
            # SCU Role (1 byte):
            role[:scu] = msg.decode(1, "BY")
            # SCP Role (1 byte):
            role[:scp] = msg.decode(1, "BY")
            if info[:role_negotiation]
              info[:role_negotiation] << role
            else
              info[:role_negotiation] = [role]
            end
          when ITEM_IMPLEMENTATION_VERSION
            info[:implementation_version] = msg.decode(item_length, "STR")
          else
            # Value (variable length)
            value = msg.decode(item_length, "STR")
            logger.warn("Unknown user info item type received. Please update source code or contact author. (item type: #{item_type})")
        end
      end
      stop_receiving
      info[:valid] = true
      return info
    end
Decodes the message received in the association response, and interprets its content.
 Returns the processed information hash.

 === Parameters

 * <tt>message</tt> -- The binary message string.