Exemple #1
0
        public void extractEntriesForNackInterest(
            Interest interest, ArrayList <Entry> entries)
        {
            SignedBlob encoding = interest.wireEncode();

            // Go backwards through the list so we can remove entries.
            for (int i = table_.Count - 1; i >= 0; --i)
            {
                PendingInterestTable.Entry pendingInterest = table_[i];
                if (pendingInterest.getOnNetworkNack() == null)
                {
                    continue;
                }

                // wireEncode returns the encoding cached when the interest was sent (if
                // it was the default wire encoding).
                if (pendingInterest.getInterest().wireEncode().equals(encoding))
                {
                    ILOG.J2CsMapping.Collections.Collections.Add(entries, table_[i]);
                    // We let the callback from callLater call _processInterestTimeout, but
                    // for efficiency, mark this as removed so that it returns right away.
                    ILOG.J2CsMapping.Collections.Collections.RemoveAt(table_, i);
                    pendingInterest.setIsRemoved();
                }
            }
        }
        public PendingInterestTable.Entry add(long pendingInterestId,
				Interest interestCopy, OnData onData, OnTimeout onTimeout,
				OnNetworkNack onNetworkNack)
        {
            int removeRequestIndex = removeRequests_.indexOf(pendingInterestId);
            if (removeRequestIndex >= 0) {
                // removePendingInterest was called with the pendingInterestId returned by
                //   expressInterest before we got here, so don't add a PIT entry.
                ILOG.J2CsMapping.Collections.Collections.RemoveAt(removeRequests_,removeRequestIndex);
                return null;
            }

            PendingInterestTable.Entry  entry = new PendingInterestTable.Entry (pendingInterestId, interestCopy, onData,
                    onTimeout, onNetworkNack);
            ILOG.J2CsMapping.Collections.Collections.Add(table_,entry);
            return entry;
        }
Exemple #3
0
        public void extractEntriesForExpressedInterest(
            Data data, ArrayList <Entry> entries)
        {
            // Go backwards through the list so we can remove entries.
            for (int i = table_.Count - 1; i >= 0; --i)
            {
                PendingInterestTable.Entry pendingInterest = table_[i];

                if (pendingInterest.getInterest().matchesData(data))
                {
                    ILOG.J2CsMapping.Collections.Collections.Add(entries, table_[i]);
                    // We let the callback from callLater call _processInterestTimeout, but
                    // for efficiency, mark this as removed so that it returns right away.
                    ILOG.J2CsMapping.Collections.Collections.RemoveAt(table_, i);
                    pendingInterest.setIsRemoved();
                }
            }
        }
Exemple #4
0
        public PendingInterestTable.Entry  add(long pendingInterestId,
                                               Interest interestCopy, OnData onData, OnTimeout onTimeout,
                                               OnNetworkNack onNetworkNack)
        {
            int removeRequestIndex = removeRequests_.indexOf(pendingInterestId);

            if (removeRequestIndex >= 0)
            {
                // removePendingInterest was called with the pendingInterestId returned by
                //   expressInterest before we got here, so don't add a PIT entry.
                ILOG.J2CsMapping.Collections.Collections.RemoveAt(removeRequests_, removeRequestIndex);
                return(null);
            }

            PendingInterestTable.Entry entry = new PendingInterestTable.Entry(pendingInterestId, interestCopy, onData,
                                                                              onTimeout, onNetworkNack);
            ILOG.J2CsMapping.Collections.Collections.Add(table_, entry);
            return(entry);
        }
Exemple #5
0
        public bool removeEntry(PendingInterestTable.Entry pendingInterest)
        {
            if (pendingInterest.getIsRemoved())
            {
                // extractEntriesForExpressedInterest or removePendingInterest has
                // removed pendingInterest from the table, so we don't need to look for it.
                // Do nothing.
                return(false);
            }

            if (ILOG.J2CsMapping.Collections.Collections.Remove(table_, pendingInterest))
            {
                pendingInterest.setIsRemoved();
                return(true);
            }
            else
            {
                return(false);
            }
        }