コード例 #1
0
    public void expressHintInterest(Name.Component excludeComp = null)
    {
        Name hintName = new Name(prefix);

        hintName.append(this.getStartTimeComponent()).append(producerNameComponents.trackHint);
        Interest hintInterest = new Interest(hintName);



        if (excludeComp != null)
        {
            Exclude exclude = new Exclude();
            exclude.appendAny();
            //		Debug.Log ("   excluding hint num " + excludeComp.toNumber ());
            exclude.appendComponent(excludeComp);
            hintInterest.setExclude(exclude);
        }

        hintInterest.setMustBeFresh(true);
        hintInterest.setInterestLifetimeMilliseconds(config.defaultHintLifetime);
        hintInterest.setChildSelector(1);
        HintHandler handler = new HintHandler(this);

        FaceSingleton.getFace().expressInterest(hintInterest, handler, handler);
    }
コード例 #2
0
        public void testExcludeMatches()
        {
            Exclude exclude = new Exclude();

            exclude.appendComponent(new Name("%00%02").get(0));
            exclude.appendAny();
            exclude.appendComponent(new Name("%00%20").get(0));

            Name.Component component;
            component = new Name("%00%01").get(0);
            Assert.AssertFalse(component.toEscapedString() + " should not match "
                               + exclude.toUri(), exclude.matches(component));
            component = new Name("%00%0F").get(0);
            Assert.AssertTrue(
                component.toEscapedString() + " should match "
                + exclude.toUri(), exclude.matches(component));
            component = new Name("%00%21").get(0);
            Assert.AssertFalse(component.toEscapedString() + " should not match "
                               + exclude.toUri(), exclude.matches(component));
        }
コード例 #3
0
    public void expressHintInterest(Name.Component excludeComp = null)
    {
        Name hintName = new Name(prefix);

        hintName.append(this.getStartTimeComponent()).append(producerNameComponents.trackHint);
        Interest hintInterest = new Interest(hintName);

        if (excludeComp != null)
        {
            Exclude exclude = new Exclude();
            exclude.appendAny();
            exclude.appendComponent(excludeComp);
        }

        hintInterest.setMustBeFresh(true);
        hintInterest.setInterestLifetimeMilliseconds(config.defaultHintLifetime);
        HintHandler handler = new HintHandler(this);

        face.expressInterest(hintInterest, handler, handler);
    }
コード例 #4
0
    //fetchTrack
    public void expressInterestForTrack(string trackID, Name.Component excludeComp = null)
    {
        Name trackName = new Name(prefix);

        trackName.append(startTimeComponent).append(producerNameComponents.tracks).append(trackID);           //.append ("0");
        Interest trackInterest = new Interest(trackName);

        if (excludeComp != null)
        {
            Exclude exclude = new Exclude();
            exclude.appendAny();
            exclude.appendComponent(excludeComp);
            trackInterest.setExclude(exclude);
        }


        trackInterest.setMustBeFresh(true);
        trackInterest.setChildSelector(1);
        TrackHandler handler = new TrackHandler(this);

        FaceSingleton.getFace().expressInterest(trackInterest, handler, handler);
    }
コード例 #5
0
ファイル: Producer.cs プロジェクト: redfood/ndn-dot-net
        /// <summary>
        /// Set the Exclude object from the list of ExcludeEntry.
        /// </summary>
        ///
        /// <param name="exclude">The Exclude object to update.</param>
        /// <param name="entries">The list of ExcludeEntry.</param>
        private static void setExcludeEntries(Exclude exclude, ArrayList entries)
        {
            exclude.clear();

            for (int i = 0; i < entries.Count; ++i)
            {
                Producer.ExcludeEntry entry = (Producer.ExcludeEntry)entries[i];

                if (i == 0 && entry.component_.getValue().size() == 0 &&
                    entry.anyFollowsComponent_)
                {
                    // This is a "beginning ANY".
                    exclude.appendAny();
                }
                else
                {
                    exclude.appendComponent(entry.component_);
                    if (entry.anyFollowsComponent_)
                    {
                        exclude.appendAny();
                    }
                }
            }
        }