Beispiel #1
0
 public void onInterest(Name localPrefix_0,
                        Interest interest_1, Face face_2,
                        long interestFilterId_3,
                        InterestFilter filter_4)
 {
     outer_ThreadPoolFace.threadPool_.submit(new net.named_data.jndn.ThreadPoolFace.Anonymous_C6.Anonymous_C18(this, localPrefix_0, interestFilterId_3, face_2,
                                                                                                               interest_1, filter_4));
 }
Beispiel #2
0
 public Anonymous_C1(ThreadPoolFace paramouter_ThreadPoolFace,
                     InterestFilter filter_0, OnInterestCallback onInterestSubmit_1,
                     long interestFilterId_2)
 {
     this.filter               = filter_0;
     this.onInterestSubmit     = onInterestSubmit_1;
     this.interestFilterId     = interestFilterId_2;
     this.outer_ThreadPoolFace = paramouter_ThreadPoolFace;
 }
Beispiel #3
0
 public Anonymous_C18(ThreadPoolFace.Anonymous_C6 paramouter_Anonymous_C6,
                      Name localPrefix_0, long interestFilterId_1, Face face_2,
                      Interest interest_3, InterestFilter filter_4)
 {
     this.localPrefix        = localPrefix_0;
     this.interestFilterId   = interestFilterId_1;
     this.face               = face_2;
     this.interest           = interest_3;
     this.filter             = filter_4;
     this.outer_Anonymous_C6 = paramouter_Anonymous_C6;
 }
Beispiel #4
0
 public Anonymous_C15(ThreadPoolFace.Anonymous_C2 paramouter_Anonymous_C2,
                      long interestFilterId_0, Interest interest_1, Face face_2,
                      InterestFilter filter_3, Name prefix_4)
 {
     this.interestFilterId   = interestFilterId_0;
     this.interest           = interest_1;
     this.face               = face_2;
     this.filter             = filter_3;
     this.prefix             = prefix_4;
     this.outer_Anonymous_C2 = paramouter_Anonymous_C2;
 }
Beispiel #5
0
        /// <summary>
        /// Submit a task to the thread pool to add an entry to the local interest
        /// filter table to call the onInterest callback for a matching incoming
        /// Interest. This method only modifies the library's local callback table and
        /// does not register the prefix with the forwarder. It will always succeed.
        /// To register a prefix with the forwarder, use registerPrefix.
        /// </summary>
        ///
        /// <param name="filter_0"></param>
        /// <param name="onInterest">onInterest.onInterest(prefix, interest, face, interestFilterId, filter). NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <returns>The interest filter ID which can be used with unsetInterestFilter.</returns>
        public override long setInterestFilter(InterestFilter filter_0,
                                               OnInterestCallback onInterest)
        {
            long interestFilterId_1 = node_.getNextEntryId();

            // Wrap callbacks to submit to the thread pool.
            OnInterestCallback finalOnInterest_2  = onInterest;
            OnInterestCallback onInterestSubmit_3 = new ThreadPoolFace.Anonymous_C2(this, finalOnInterest_2);

            threadPool_.submit(new ThreadPoolFace.Anonymous_C1(this, filter_0, onInterestSubmit_3, interestFilterId_1));

            return(interestFilterId_1);
        }
                public Anonymous_C15(ThreadPoolFace.Anonymous_C2  paramouter_Anonymous_C2,
										Name prefix_0, Face face_1, InterestFilter filter_2,
										Interest interest_3, long interestFilterId_4)
                {
                    this.prefix = prefix_0;
                                    this.face = face_1;
                                    this.filter = filter_2;
                                    this.interest = interest_3;
                                    this.interestFilterId = interestFilterId_4;
                                    this.outer_Anonymous_C2 = paramouter_Anonymous_C2;
                }
        public void onInterest(Name prefix, Interest interest, Face face,
				long interestFilterId, InterestFilter filter)
        {
            doCleanup();

            Name.Component selectedComponent = null;
            Blob selectedEncoding = null;
            // We need to iterate over both arrays.
            int totalSize = staleTimeCache_.Count + noStaleTimeCache_.Count;
            for (int i = 0; i < totalSize; ++i) {
                MemoryContentCache.Content  content;
                if (i < staleTimeCache_.Count)
                    content = staleTimeCache_[i];
                else
                    // We have iterated over the first array. Get from the second.
                    content = noStaleTimeCache_[i - staleTimeCache_.Count];

                if (interest.matchesName(content.getName())) {
                    if (interest.getChildSelector() < 0) {
                        // No child selector, so send the first match that we have found.
                        try {
                            face.send(content.getDataEncoding());
                        } catch (IOException ex) {
                            ILOG.J2CsMapping.Util.Logging.Logger.getLogger(typeof(MemoryContentCache).FullName)
                                    .log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, null, ex);
                        }
                        return;
                    } else {
                        // Update selectedEncoding based on the child selector.
                        Name.Component component;
                        if (content.getName().size() > interest.getName().size())
                            component = content.getName().get(
                                    interest.getName().size());
                        else
                            component = emptyComponent_;

                        bool gotBetterMatch = false;
                        if (selectedEncoding == null)
                            // Save the first match.
                            gotBetterMatch = true;
                        else {
                            if (interest.getChildSelector() == 0) {
                                // Leftmost child.
                                if (component.compare(selectedComponent) < 0)
                                    gotBetterMatch = true;
                            } else {
                                // Rightmost child.
                                if (component.compare(selectedComponent) > 0)
                                    gotBetterMatch = true;
                            }
                        }

                        if (gotBetterMatch) {
                            selectedComponent = component;
                            selectedEncoding = content.getDataEncoding();
                        }
                    }
                }
            }

            if (selectedEncoding != null) {
                // We found the leftmost or rightmost child.
                try {
                    face.send(selectedEncoding);
                } catch (IOException ex_0) {
                    ILOG.J2CsMapping.Util.Logging.Logger.getLogger(typeof(MemoryContentCache).FullName).log(
                            ILOG.J2CsMapping.Util.Logging.Level.SEVERE, null, ex_0);
                }
            } else {
                // Call the onDataNotFound callback (if defined).
                Object onDataNotFound = ILOG.J2CsMapping.Collections.Collections.Get(onDataNotFoundForPrefix_,prefix.toUri());
                if (onDataNotFound != null) {
                    try {
                        ((OnInterestCallback) onDataNotFound).onInterest(prefix,
                                interest, face, interestFilterId, filter);
                    } catch (Exception ex_1) {
                        logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onDataNotFound", ex_1);
                    }
                }
            }
        }
 /// <summary>
 /// Create an InterestFilter which is a copy of the given interestFilter.
 /// </summary>
 ///
 /// <param name="interestFilter">The InterestFilter with values to copy from.</param>
 public InterestFilter(InterestFilter interestFilter)
 {
     // Make a deep copy of the Name.
     prefix_ = new Name(interestFilter.prefix_);
     regexFilter_ = interestFilter.regexFilter_;
     regexFilterPattern_ = interestFilter.regexFilterPattern_;
 }
            public void onInterest(Name localPrefix_0,
						Interest interest_1, Face face_2,
						long interestFilterId_3,
						InterestFilter filter_4)
            {
                outer_ThreadPoolFace.threadPool_.submit(new net.named_data.jndn.ThreadPoolFace.Anonymous_C6.Anonymous_C18 (this, interest_1, interestFilterId_3, localPrefix_0,
                            filter_4, face_2));
            }
Beispiel #10
0
 /// <summary>
 /// Add an entry to the local interest filter table to call the onInterest
 /// callback for a matching incoming Interest. This method only modifies the
 /// library's local callback table and does not register the prefix with the
 /// forwarder. It will always succeed. To register a prefix with the forwarder,
 /// use registerPrefix.
 /// </summary>
 ///
 /// <param name="interestFilterId"></param>
 /// <param name="filter"></param>
 /// <param name="onInterest">onInterest.onInterest(prefix, interest, face, interestFilterId, filter).</param>
 /// <param name="face">The face which is passed to the onInterest callback.</param>
 public void setInterestFilter(long interestFilterId,
                               InterestFilter filter, OnInterestCallback onInterest, Face face)
 {
     interestFilterTable_.setInterestFilter(interestFilterId,
                                            new InterestFilter(filter), onInterest, face);
 }
Beispiel #11
0
        /// <summary>
        /// Add an entry to the local interest filter table to call the onInterest
        /// callback for a matching incoming Interest. This method only modifies the
        /// library's local callback table and does not register the prefix with the
        /// forwarder. It will always succeed. To register a prefix with the forwarder,
        /// use registerPrefix.
        /// </summary>
        ///
        /// <param name="filter"></param>
        /// <param name="onInterest">onInterest.onInterest(prefix, interest, face, interestFilterId, filter). NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <returns>The interest filter ID which can be used with unsetInterestFilter.</returns>
        public virtual long setInterestFilter(InterestFilter filter,
				OnInterestCallback onInterest)
        {
            long interestFilterId = node_.getNextEntryId();

            node_.setInterestFilter(interestFilterId, filter, onInterest, this);

            return interestFilterId;
        }
 /// <summary>
 /// Call setInterestFilter on the Face given to the constructor so that this
 /// MemoryContentCache will answer interests whose name has the prefix.
 /// Do not call a callback if a data packet is not found in the cache.
 /// </summary>
 ///
 /// <param name="filter"></param>
 public void setInterestFilter(InterestFilter filter)
 {
     setInterestFilter(filter, null);
 }
            public void onInterest(Name localPrefix, Interest localInterest,
						Face localFace, long localInterestFilterId,
						InterestFilter localFilter)
            {
                outer_MemoryContentCache.storePendingInterest(localInterest, localFace);
            }
                public Anonymous_C18(ThreadPoolFace.Anonymous_C6  paramouter_Anonymous_C6,
										Interest interest_0, long interestFilterId_1, Name localPrefix_2,
										InterestFilter filter_3, Face face_4)
                {
                    this.interest = interest_0;
                                    this.interestFilterId = interestFilterId_1;
                                    this.localPrefix = localPrefix_2;
                                    this.filter = filter_3;
                                    this.face = face_4;
                                    this.outer_Anonymous_C6 = paramouter_Anonymous_C6;
                }
            public Anonymous_C1(ThreadPoolFace paramouter_ThreadPoolFace,
						OnInterestCallback onInterestSubmit_0, InterestFilter filter_1,
						long interestFilterId_2)
            {
                this.onInterestSubmit = onInterestSubmit_0;
                    this.filter = filter_1;
                    this.interestFilterId = interestFilterId_2;
                    this.outer_ThreadPoolFace = paramouter_ThreadPoolFace;
            }
            public void onInterest(Name prefix, Interest interest, Face face,
						long interestFilterId, InterestFilter filter)
            {
                ++interestCallbackCount[0];
                    Data data = new Data(interest.getName());
                    data.setContent(new Blob("SUCCESS"));

                    try {
                        outer_TestFaceCallRegisterMethods.keyChain.sign(data, outer_TestFaceCallRegisterMethods.certificateName);
                    } catch (SecurityException ex) {
                        net.named_data.jndn.tests.integration_tests.TestFaceCallRegisterMethods.logger.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, null, ex);
                    }
                    try {
                        face.putData(data);
                    } catch (IOException ex_0) {
                        net.named_data.jndn.tests.integration_tests.TestFaceCallRegisterMethods.logger.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, null, ex_0);
                    }
            }
Beispiel #17
0
        /// <summary>
        /// Add an entry to the local interest filter table to call the onInterest
        /// callback for a matching incoming Interest. This method only modifies the
        /// library's local callback table and does not register the prefix with the
        /// forwarder. It will always succeed. To register a prefix with the forwarder,
        /// use registerPrefix.
        /// </summary>
        ///
        /// <param name="interestFilterId"></param>
        /// <param name="filter"></param>
        /// <param name="onInterest">onInterest.onInterest(prefix, interest, face, interestFilterId, filter).</param>
        /// <param name="face">The face which is passed to the onInterest callback.</param>
        public void setInterestFilter(long interestFilterId,
				InterestFilter filter, OnInterestCallback onInterest, Face face)
        {
            interestFilterTable_.setInterestFilter(interestFilterId,
                    new InterestFilter(filter), onInterest, face);
        }
        public void setInterestFilter(long interestFilterId,
				InterestFilter filter, OnInterestCallback onInterest, Face face)
        {
            ILOG.J2CsMapping.Collections.Collections.Add(table_,new InterestFilterTable.Entry (interestFilterId, filter, onInterest, face));
        }
            /// <summary>
            /// Create a new Entry with the given values.
            /// </summary>
            ///
            /// <param name="interestFilterId">The ID from Node.getNextEntryId().</param>
            /// <param name="filter">The InterestFilter for this entry.</param>
            /// <param name="onInterest">The callback to call.</param>
            /// <param name="face"></param>
            public Entry(long interestFilterId, InterestFilter filter,
					OnInterestCallback onInterest, Face face)
            {
                interestFilterId_ = interestFilterId;
                filter_ = filter;
                onInterest_ = onInterest;
                face_ = face;
            }
            public void onInterest(Name prefix, Interest interest, Face face, long interestFilterId,
        InterestFilter filter)
            {
                ++responseCount_;

                // Make and sign a Data packet.
                var data = new Data(interest.getName());
                var content = "Echo " + interest.getName().toUri();
                data.setContent(new Blob(content));

                try {
                  keyChain_.sign(data, certificateName_);      }
                catch (SecurityException exception) {
                  // Don't expect this to happen.
                  throw new SecurityException
                  ("SecurityException in sign: " + exception);
                }

                Console.Out.WriteLine("Sent content " + content);
                try {
                  face.putData(data);
                } catch (Exception ex) {
                  Console.Out.WriteLine("Echo: Exception in sending data " + ex);
                }
            }
        /// <summary>
        /// Call setInterestFilter on the Face given to the constructor so that this
        /// MemoryContentCache will answer interests whose name matches the filter.
        /// </summary>
        ///
        /// <param name="filter"></param>
        /// <param name="onDataNotFound">onDataNotFound.onInterest(prefix, interest, face, interestFilterId, filter). Your callback can find the Data packet for the interest and call face.putData(data).  Note: If you call setInterestFilter multiple times where filter.getPrefix() is the same, it is undetermined which onDataNotFound will be called. If your callback cannot find the Data packet, it can optionally call storePendingInterest(interest, face) to store the pending interest in this object to be satisfied by a later call to add(data). If you want to automatically store all pending interests, you can simply use getStorePendingInterest() for onDataNotFound. If onDataNotFound is null, this does not use it. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        public void setInterestFilter(InterestFilter filter,
				OnInterestCallback onDataNotFound)
        {
            if (onDataNotFound != null)
                ILOG.J2CsMapping.Collections.Collections.Put(onDataNotFoundForPrefix_,filter.getPrefix().toUri(),onDataNotFound);
            long interestFilterId = face_.setInterestFilter(filter, this);
            ILOG.J2CsMapping.Collections.Collections.Add(interestFilterIdList_,interestFilterId);
        }
        /// <summary>
        /// Submit a task to the thread pool to add an entry to the local interest
        /// filter table to call the onInterest callback for a matching incoming
        /// Interest. This method only modifies the library's local callback table and
        /// does not register the prefix with the forwarder. It will always succeed.
        /// To register a prefix with the forwarder, use registerPrefix.
        /// </summary>
        ///
        /// <param name="filter_0"></param>
        /// <param name="onInterest">onInterest.onInterest(prefix, interest, face, interestFilterId, filter). NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <returns>The interest filter ID which can be used with unsetInterestFilter.</returns>
        public override long setInterestFilter(InterestFilter filter_0,
				OnInterestCallback onInterest)
        {
            long interestFilterId_1 = node_.getNextEntryId();

            // Wrap callbacks to submit to the thread pool.
            OnInterestCallback finalOnInterest_2 = onInterest;
            OnInterestCallback onInterestSubmit_3 = new ThreadPoolFace.Anonymous_C2 (this, finalOnInterest_2);

            threadPool_.submit(new ThreadPoolFace.Anonymous_C1 (this, onInterestSubmit_3, filter_0, interestFilterId_1));

            return interestFilterId_1;
        }