コード例 #1
0
 /// <summary>
 /// Call registerPrefix on the Face given to the constructor so that this
 /// MemoryContentCache will answer interests whose name has the prefix.
 /// Alternatively, if the Face's registerPrefix has already been called, then
 /// you can call this object's setInterestFilter.
 /// This uses the default WireFormat.getDefaultWireFormat().
 /// </summary>
 ///
 /// <param name="prefix">The Name for the prefix to register. This copies the Name.</param>
 /// <param name="onRegisterFailed">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>
 /// <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).  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.</param>
 /// <param name="flags">See Face.registerPrefix.</param>
 /// <exception cref="IOException">For I/O error in sending the registration request.</exception>
 /// <exception cref="System.Security.SecurityException">If signing a command interest for NFD and cannotfind the private key for the certificateName.</exception>
 public void registerPrefix(Name prefix,
                            OnRegisterFailed onRegisterFailed,
                            OnInterestCallback onDataNotFound, ForwardingFlags flags)
 {
     registerPrefix(prefix, onRegisterFailed, onDataNotFound, flags,
                    net.named_data.jndn.encoding.WireFormat.getDefaultWireFormat());
 }
コード例 #2
0
        /// <summary>
        /// Submit a task to the thread pool to register prefix with the connected
        /// forwarder and call onInterest when a matching interest is received. To
        /// register a prefix with NFD, you must first call setCommandSigningInfo.
        /// </summary>
        ///
        /// <param name="prefix_0">A Name for the prefix to register. This copies the Name.</param>
        /// <param name="onInterest">onInterest.onInterest(prefix, interest, face, interestFilterId, filter). The onInterest callback should supply the Data with face.putData(). NOTE: You must not change the prefix or filter objects - if you need to change them then make a copy. If onInterest is null, it is ignored and you must call setInterestFilter. 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>
        /// <param name="onRegisterFailed">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>
        /// <param name="onRegisterSuccess">receives a success message from the forwarder. If onRegisterSuccess is null, this does not use it. (The onRegisterSuccess parameter comes after onRegisterFailed because it can be null or omitted, unlike onRegisterFailed.) 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>
        /// <param name="flags_1"></param>
        /// <param name="wireFormat_2">A WireFormat object used to encode the message.</param>
        /// <returns>The registered prefix ID which can be used with
        /// removeRegisteredPrefix.</returns>
        public override long registerPrefix(Name prefix_0,
                                            OnInterestCallback onInterest, OnRegisterFailed onRegisterFailed,
                                            OnRegisterSuccess onRegisterSuccess, ForwardingFlags flags_1,
                                            WireFormat wireFormat_2)
        {
            long registeredPrefixId_3 = node_.getNextEntryId();

            // Wrap callbacks to submit to the thread pool.
            OnInterestCallback finalOnInterest_4  = onInterest;
            OnInterestCallback onInterestSubmit_5 = (onInterest == null) ? null
                                        : new ThreadPoolFace.Anonymous_C6(this, finalOnInterest_4);

            OnRegisterFailed finalOnRegisterFailed_6  = onRegisterFailed;
            OnRegisterFailed onRegisterFailedSubmit_7 = new ThreadPoolFace.Anonymous_C5(this, finalOnRegisterFailed_6);

            // Wrap callbacks to submit to the thread pool.
            OnRegisterSuccess finalOnRegisterSuccess_8  = onRegisterSuccess;
            OnRegisterSuccess onRegisterSuccessSubmit_9 = (onRegisterSuccess == null) ? null
                                        : new ThreadPoolFace.Anonymous_C4(this, finalOnRegisterSuccess_8);

            threadPool_.submit(new ThreadPoolFace.Anonymous_C3(this, wireFormat_2, onRegisterSuccessSubmit_9, prefix_0,
                                                               flags_1, onInterestSubmit_5, onRegisterFailedSubmit_7,
                                                               registeredPrefixId_3));

            return(registeredPrefixId_3);
        }
コード例 #3
0
 /// <summary>
 /// Call registerPrefix on the Face given to the constructor so that this
 /// MemoryContentCache will answer interests whose name has the prefix.
 /// Alternatively, if the Face's registerPrefix has already been called, then
 /// you can call this object's setInterestFilter.
 /// </summary>
 ///
 /// <param name="prefix">The Name for the prefix to register. This copies the Name.</param>
 /// <param name="onRegisterFailed">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>
 /// <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).  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>
 /// <param name="flags">See Face.registerPrefix.</param>
 /// <param name="wireFormat">See Face.registerPrefix.</param>
 /// <exception cref="IOException">For I/O error in sending the registration request.</exception>
 /// <exception cref="System.Security.SecurityException">If signing a command interest for NFD and cannotfind the private key for the certificateName.</exception>
 public void registerPrefix(Name prefix,
                            OnRegisterFailed onRegisterFailed,
                            OnInterestCallback onDataNotFound, ForwardingFlags flags,
                            WireFormat wireFormat)
 {
     registerPrefix(prefix, onRegisterFailed, null, onDataNotFound, flags,
                    wireFormat);
 }
コード例 #4
0
 /// <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;
 }
コード例 #5
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;
 }
コード例 #6
0
ファイル: Node.cs プロジェクト: vcgato29/ndn-dot-net
 /// <summary>
 /// Register prefix with the connected NDN hub and call onInterest when a
 /// matching interest is received. To register a prefix with NFD, you must
 /// first call setCommandSigningInfo.
 /// </summary>
 ///
 /// <param name="registeredPrefixId"></param>
 /// <param name="prefix">A Name for the prefix to register. This copies the Name.</param>
 /// <param name="onInterest">onInterest.onInterest(prefix, interest, face, interestFilterId, filter). If onInterest is null, it is ignored and you must call setInterestFilter.</param>
 /// <param name="onRegisterFailed">prefix.</param>
 /// <param name="onRegisterSuccess">receives a success message from the forwarder. If onRegisterSuccess is null, this does not use it.</param>
 /// <param name="flags"></param>
 /// <param name="wireFormat">A WireFormat object used to encode the message.</param>
 /// <param name="commandKeyChain">The KeyChain object for signing interests.</param>
 /// <param name="commandCertificateName">The certificate name for signing interests.</param>
 /// <param name="face"></param>
 /// <exception cref="IOException">For I/O error in sending the registration request.</exception>
 /// <exception cref="System.Security.SecurityException">If signing a command interest for NFD and cannotfind the private key for the certificateName.</exception>
 public void registerPrefix(long registeredPrefixId, Name prefix,
                            OnInterestCallback onInterest, OnRegisterFailed onRegisterFailed,
                            OnRegisterSuccess onRegisterSuccess, ForwardingFlags flags,
                            WireFormat wireFormat, KeyChain commandKeyChain,
                            Name commandCertificateName, Face face)
 {
     nfdRegisterPrefix(registeredPrefixId, new Name(prefix), onInterest,
                       onRegisterFailed, onRegisterSuccess, flags, commandKeyChain,
                       commandCertificateName, wireFormat, face);
 }
コード例 #7
0
        /// <summary>
        /// Call setInterestFilter on the Face given to the constructor so that this
        /// MemoryContentCache will answer interests whose name has the prefix.
        /// </summary>
        ///
        /// <param name="prefix"></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(Name prefix,
                                      OnInterestCallback onDataNotFound)
        {
            if (onDataNotFound != null)
            {
                ILOG.J2CsMapping.Collections.Collections.Put(onDataNotFoundForPrefix_, prefix.toUri(), onDataNotFound);
            }
            long interestFilterId = face_.setInterestFilter(prefix, this);

            ILOG.J2CsMapping.Collections.Collections.Add(interestFilterIdList_, interestFilterId);
        }
コード例 #8
0
ファイル: Node.cs プロジェクト: vcgato29/ndn-dot-net
 /// <param name="prefix"></param>
 /// <param name="onRegisterFailed"></param>
 /// <param name="onRegisterSuccess"></param>
 /// <param name="registeredPrefixId"></param>
 /// <param name="onInterest">The callback to add if register succeeds.</param>
 /// <param name="face_0"></param>
 public Info(Name prefix, OnRegisterFailed onRegisterFailed,
             OnRegisterSuccess onRegisterSuccess,
             long registeredPrefixId, OnInterestCallback onInterest,
             Face face_0)
 {
     prefix_             = prefix;
     onRegisterFailed_   = onRegisterFailed;
     onRegisterSuccess_  = onRegisterSuccess;
     registeredPrefixId_ = registeredPrefixId;
     onInterest_         = onInterest;
     face_ = face_0;
 }
コード例 #9
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);
        }
コード例 #10
0
        public override long registerPrefix(Name prefix, OnInterestCallback onInterest,
                                            OnRegisterFailed onRegisterFailed,
                                            OnRegisterSuccess onRegisterSuccess, ForwardingFlags flags,
                                            WireFormat wireFormat)
        {
            interestFilterTable_.setInterestFilter(0, new InterestFilter(prefix),
                                                   onInterest, this);

            if (onRegisterSuccess != null)
            {
                onRegisterSuccess.onRegisterSuccess(prefix, 0);
            }
            return(0);
        }
コード例 #11
0
 public Anonymous_C3(ThreadPoolFace paramouter_ThreadPoolFace,
                     WireFormat wireFormat_0,
                     OnRegisterSuccess onRegisterSuccessSubmit_1, Name prefix_2,
                     ForwardingFlags flags_3, OnInterestCallback onInterestSubmit_4,
                     OnRegisterFailed onRegisterFailedSubmit_5, long registeredPrefixId_6)
 {
     this.wireFormat = wireFormat_0;
     this.onRegisterSuccessSubmit = onRegisterSuccessSubmit_1;
     this.prefix                 = prefix_2;
     this.flags                  = flags_3;
     this.onInterestSubmit       = onInterestSubmit_4;
     this.onRegisterFailedSubmit = onRegisterFailedSubmit_5;
     this.registeredPrefixId     = registeredPrefixId_6;
     this.outer_ThreadPoolFace   = paramouter_ThreadPoolFace;
 }
コード例 #12
0
        /// <summary>
        /// Call registerPrefix on the Face given to the constructor so that this
        /// MemoryContentCache will answer interests whose name has the prefix.
        /// Alternatively, if the Face's registerPrefix has already been called, then
        /// you can call this object's setInterestFilter.
        /// </summary>
        ///
        /// <param name="prefix">The Name for the prefix to register. This copies the Name.</param>
        /// <param name="onRegisterFailed">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>
        /// <param name="onRegisterSuccess">receives a success message from the forwarder. If onRegisterSuccess 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>
        /// <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).  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>
        /// <param name="flags">See Face.registerPrefix.</param>
        /// <param name="wireFormat">See Face.registerPrefix.</param>
        /// <exception cref="IOException">For I/O error in sending the registration request.</exception>
        /// <exception cref="System.Security.SecurityException">If signing a command interest for NFD and cannotfind the private key for the certificateName.</exception>
        public void registerPrefix(Name prefix,
                                   OnRegisterFailed onRegisterFailed,
                                   OnRegisterSuccess onRegisterSuccess,
                                   OnInterestCallback onDataNotFound, ForwardingFlags flags,
                                   WireFormat wireFormat)
        {
            if (onDataNotFound != null)
            {
                ILOG.J2CsMapping.Collections.Collections.Put(onDataNotFoundForPrefix_, prefix.toUri(), onDataNotFound);
            }
            long registeredPrefixId = face_.registerPrefix(prefix, this,
                                                           onRegisterFailed, onRegisterSuccess, flags, wireFormat);

            ILOG.J2CsMapping.Collections.Collections.Add(registeredPrefixIdList_, registeredPrefixId);
        }
コード例 #13
0
ファイル: Face.cs プロジェクト: named-data/ndn-dot-net
        /// <summary>
        /// Register prefix with the connected NDN hub and call onInterest when a
        /// matching interest is received. To register a prefix with NFD, you must
        /// first call setCommandSigningInfo.
        /// Use default ForwardingFlags.
        /// </summary>
        ///
        /// <param name="prefix">A Name for the prefix to register. This copies the Name.</param>
        /// <param name="onInterest">onInterest.onInterest(prefix, interest, face, interestFilterId, filter). The onInterest callback should supply the Data with face.putData(). NOTE: You must not change the prefix or filter objects - if you need to change them then make a copy. If onInterest is null, it is ignored and you must call setInterestFilter. 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>
        /// <param name="onRegisterFailed">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>
        /// <param name="wireFormat">A WireFormat object used to encode the message.</param>
        /// <returns>The registered prefix ID which can be used with
        /// removeRegisteredPrefix.</returns>
        /// <exception cref="IOException">For I/O error in sending the registration request.</exception>
        /// <exception cref="System.Security.SecurityException">If signing a command interest for NFD and cannotfind the private key for the certificateName.</exception>
        public long registerPrefix(Name prefix, OnInterestCallback onInterest,
				OnRegisterFailed onRegisterFailed, WireFormat wireFormat)
        {
            return registerPrefix(prefix, onInterest, onRegisterFailed, null,
                    new ForwardingFlags(), wireFormat);
        }
コード例 #14
0
ファイル: Face.cs プロジェクト: named-data/ndn-dot-net
        public long registerPrefix(Name prefix, OnInterestCallback onInterest,
				OnRegisterSuccess onRegisterSuccess,
				OnRegisterFailed onRegisterFailed, ForwardingFlags flags)
        {
            return registerPrefix(prefix, onInterest, onRegisterFailed,
                    onRegisterSuccess, flags, net.named_data.jndn.encoding.WireFormat.getDefaultWireFormat());
        }
コード例 #15
0
ファイル: Node.cs プロジェクト: named-data/ndn-dot-net
                /// <param name="prefix"></param>
                /// <param name="onRegisterFailed"></param>
                /// <param name="onRegisterSuccess"></param>
                /// <param name="registeredPrefixId"></param>
                /// <param name="onInterest">The callback to add if register succeeds.</param>
                /// <param name="face_0"></param>
                public Info(Name prefix, OnRegisterFailed onRegisterFailed,
						OnRegisterSuccess onRegisterSuccess,
						long registeredPrefixId, OnInterestCallback onInterest,
						Face face_0)
                {
                    prefix_ = prefix;
                    onRegisterFailed_ = onRegisterFailed;
                    onRegisterSuccess_ = onRegisterSuccess;
                    registeredPrefixId_ = registeredPrefixId;
                    onInterest_ = onInterest;
                    face_ = face_0;
                }
コード例 #16
0
            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;
            }
コード例 #17
0
 public Anonymous_C2(ThreadPoolFace paramouter_ThreadPoolFace,
                     OnInterestCallback finalOnInterest_0)
 {
     this.finalOnInterest      = finalOnInterest_0;
     this.outer_ThreadPoolFace = paramouter_ThreadPoolFace;
 }
コード例 #18
0
            /// <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;
            }
コード例 #19
0
ファイル: Face.cs プロジェクト: named-data/ndn-dot-net
        /// <summary>
        /// Register prefix with the connected NDN hub and call onInterest when a
        /// matching interest is received. To register a prefix with NFD, you must
        /// first call setCommandSigningInfo.
        /// This uses the default WireFormat.getDefaultWireFormat().
        /// Use default ForwardingFlags.
        /// </summary>
        ///
        /// <param name="prefix">A Name for the prefix to register. This copies the Name.</param>
        /// <param name="onInterest">onInterest.onInterest(prefix, interest, face, interestFilterId, filter). The onInterest callback should supply the Data with face.putData(). NOTE: You must not change the prefix or filter objects - if you need to change them then make a copy. If onInterest is null, it is ignored and you must call setInterestFilter. 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>
        /// <param name="onRegisterFailed">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 registered prefix ID which can be used with
        /// removeRegisteredPrefix.</returns>
        /// <exception cref="IOException">For I/O error in sending the registration request.</exception>
        /// <exception cref="System.Security.SecurityException">If signing a command interest for NFD and cannotfind the private key for the certificateName.</exception>
        public long registerPrefix(Name prefix, OnInterestCallback onInterest,
				OnRegisterFailed onRegisterFailed)
        {
            return registerPrefix(prefix, onInterest, onRegisterFailed, null,
                    new ForwardingFlags(), net.named_data.jndn.encoding.WireFormat.getDefaultWireFormat());
        }
コード例 #20
0
ファイル: Face.cs プロジェクト: named-data/ndn-dot-net
 /// <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="prefix"></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 long setInterestFilter(Name prefix, OnInterestCallback onInterest)
 {
     return setInterestFilter(new InterestFilter(prefix), onInterest);
 }
コード例 #21
0
        /// <summary>
        /// Call setInterestFilter on the Face given to the constructor so that this
        /// MemoryContentCache will answer interests whose name has the prefix.
        /// </summary>
        ///
        /// <param name="prefix"></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(Name prefix,
				OnInterestCallback onDataNotFound)
        {
            if (onDataNotFound != null)
                ILOG.J2CsMapping.Collections.Collections.Put(onDataNotFoundForPrefix_,prefix.toUri(),onDataNotFound);
            long interestFilterId = face_.setInterestFilter(prefix, this);
            ILOG.J2CsMapping.Collections.Collections.Add(interestFilterIdList_,interestFilterId);
        }
コード例 #22
0
        private void construct()
        {
            nextCleanupTime_ = net.named_data.jndn.util.Common.getNowMilliseconds()
                    + cleanupIntervalMilliseconds_;

            storePendingInterestCallback_ = new MemoryContentCache.Anonymous_C0 (this);
        }
コード例 #23
0
        /// <summary>
        /// Call registerPrefix on the Face given to the constructor so that this
        /// MemoryContentCache will answer interests whose name has the prefix.
        /// Alternatively, if the Face's registerPrefix has already been called, then
        /// you can call this object's setInterestFilter.
        /// This uses the default WireFormat.getDefaultWireFormat().
        /// Use default ForwardingFlags.
        /// </summary>
        ///
        /// <param name="prefix">The Name for the prefix to register. This copies the Name.</param>
        /// <param name="onRegisterFailed">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>
        /// <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).  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>
        /// <exception cref="IOException">For I/O error in sending the registration request.</exception>
        /// <exception cref="System.Security.SecurityException">If signing a command interest for NFD and cannotfind the private key for the certificateName.</exception>
        public void registerPrefix(Name prefix,
				OnRegisterFailed onRegisterFailed, OnInterestCallback onDataNotFound)
        {
            registerPrefix(prefix, onRegisterFailed, onDataNotFound,
                    new ForwardingFlags(), net.named_data.jndn.encoding.WireFormat.getDefaultWireFormat());
        }
コード例 #24
0
        /// <summary>
        /// Call registerPrefix on the Face given to the constructor so that this
        /// MemoryContentCache will answer interests whose name has the prefix.
        /// Alternatively, if the Face's registerPrefix has already been called, then
        /// you can call this object's setInterestFilter.
        /// </summary>
        ///
        /// <param name="prefix">The Name for the prefix to register. This copies the Name.</param>
        /// <param name="onRegisterFailed">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>
        /// <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).  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>
        /// <param name="flags">See Face.registerPrefix.</param>
        /// <param name="wireFormat">See Face.registerPrefix.</param>
        /// <exception cref="IOException">For I/O error in sending the registration request.</exception>
        /// <exception cref="System.Security.SecurityException">If signing a command interest for NFD and cannotfind the private key for the certificateName.</exception>
        public void registerPrefix(Name prefix,
				OnRegisterFailed onRegisterFailed,
				OnInterestCallback onDataNotFound, ForwardingFlags flags,
				WireFormat wireFormat)
        {
            registerPrefix(prefix, onRegisterFailed, null, onDataNotFound, flags,
                    wireFormat);
        }
コード例 #25
0
        /// <summary>
        /// Call registerPrefix on the Face given to the constructor so that this
        /// MemoryContentCache will answer interests whose name has the prefix.
        /// Alternatively, if the Face's registerPrefix has already been called, then
        /// you can call this object's setInterestFilter.
        /// </summary>
        ///
        /// <param name="prefix">The Name for the prefix to register. This copies the Name.</param>
        /// <param name="onRegisterFailed">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>
        /// <param name="onRegisterSuccess">receives a success message from the forwarder. If onRegisterSuccess 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>
        /// <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).  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>
        /// <param name="flags">See Face.registerPrefix.</param>
        /// <param name="wireFormat">See Face.registerPrefix.</param>
        /// <exception cref="IOException">For I/O error in sending the registration request.</exception>
        /// <exception cref="System.Security.SecurityException">If signing a command interest for NFD and cannotfind the private key for the certificateName.</exception>
        public void registerPrefix(Name prefix,
				OnRegisterFailed onRegisterFailed,
				OnRegisterSuccess onRegisterSuccess,
				OnInterestCallback onDataNotFound, ForwardingFlags flags,
				WireFormat wireFormat)
        {
            if (onDataNotFound != null)
                ILOG.J2CsMapping.Collections.Collections.Put(onDataNotFoundForPrefix_,prefix.toUri(),onDataNotFound);
            long registeredPrefixId = face_.registerPrefix(prefix, this,
                    onRegisterFailed, onRegisterSuccess, flags, wireFormat);
            ILOG.J2CsMapping.Collections.Collections.Add(registeredPrefixIdList_,registeredPrefixId);
        }
コード例 #26
0
ファイル: Node.cs プロジェクト: named-data/ndn-dot-net
        /// <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);
        }
コード例 #27
0
 public void setInterestFilter(long interestFilterId,
                               InterestFilter filter, OnInterestCallback onInterest, Face face)
 {
     ILOG.J2CsMapping.Collections.Collections.Add(table_, new InterestFilterTable.Entry(interestFilterId, filter, onInterest, face));
 }
コード例 #28
0
ファイル: Face.cs プロジェクト: named-data/ndn-dot-net
        /// <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;
        }
コード例 #29
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, onInterestSubmit_3, filter_0, interestFilterId_1));

            return interestFilterId_1;
        }
コード例 #30
0
        public void setInterestFilter(long interestFilterId,
				InterestFilter filter, OnInterestCallback onInterest, Face face)
        {
            ILOG.J2CsMapping.Collections.Collections.Add(table_,new InterestFilterTable.Entry (interestFilterId, filter, onInterest, face));
        }
コード例 #31
0
ファイル: Node.cs プロジェクト: vcgato29/ndn-dot-net
 /// <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);
 }
コード例 #32
0
            public Anonymous_C6(ThreadPoolFace paramouter_ThreadPoolFace,
						OnInterestCallback finalOnInterest_0)
            {
                this.finalOnInterest = finalOnInterest_0;
                    this.outer_ThreadPoolFace = paramouter_ThreadPoolFace;
            }
コード例 #33
0
ファイル: Node.cs プロジェクト: named-data/ndn-dot-net
        /// <summary>
        /// Register prefix with the connected NDN hub and call onInterest when a
        /// matching interest is received. To register a prefix with NFD, you must
        /// first call setCommandSigningInfo.
        /// </summary>
        ///
        /// <param name="registeredPrefixId"></param>
        /// <param name="prefix">A Name for the prefix to register. This copies the Name.</param>
        /// <param name="onInterest">onInterest.onInterest(prefix, interest, face, interestFilterId, filter). If onInterest is null, it is ignored and you must call setInterestFilter.</param>
        /// <param name="onRegisterFailed">prefix.</param>
        /// <param name="onRegisterSuccess">receives a success message from the forwarder. If onRegisterSuccess is null, this does not use it.</param>
        /// <param name="flags"></param>
        /// <param name="wireFormat">A WireFormat object used to encode the message.</param>
        /// <param name="commandKeyChain">The KeyChain object for signing interests.</param>
        /// <param name="commandCertificateName">The certificate name for signing interests.</param>
        /// <param name="face"></param>
        /// <exception cref="IOException">For I/O error in sending the registration request.</exception>
        /// <exception cref="System.Security.SecurityException">If signing a command interest for NFD and cannotfind the private key for the certificateName.</exception>
        public void registerPrefix(long registeredPrefixId, Name prefix,
				OnInterestCallback onInterest, OnRegisterFailed onRegisterFailed,
				OnRegisterSuccess onRegisterSuccess, ForwardingFlags flags,
				WireFormat wireFormat, KeyChain commandKeyChain,
				Name commandCertificateName, Face face)
        {
            nfdRegisterPrefix(registeredPrefixId, new Name(prefix), onInterest,
                    onRegisterFailed, onRegisterSuccess, flags, commandKeyChain,
                    commandCertificateName, wireFormat, face);
        }
コード例 #34
0
ファイル: Node.cs プロジェクト: vcgato29/ndn-dot-net
        /// <summary>
        /// Do the work of registerPrefix to register with NFD.
        /// </summary>
        ///
        /// <param name="registeredPrefixId">registeredPrefixTable_ (assuming it has already been done).</param>
        /// <param name="prefix"></param>
        /// <param name="onInterest"></param>
        /// <param name="onRegisterFailed"></param>
        /// <param name="onRegisterSuccess"></param>
        /// <param name="flags"></param>
        /// <param name="commandKeyChain"></param>
        /// <param name="commandCertificateName"></param>
        /// <param name="wireFormat_0"></param>
        /// <param name="face_1"></param>
        /// <exception cref="System.Security.SecurityException">If cannot find the private key for thecertificateName.</exception>
        private void nfdRegisterPrefix(long registeredPrefixId, Name prefix,
                                       OnInterestCallback onInterest, OnRegisterFailed onRegisterFailed,
                                       OnRegisterSuccess onRegisterSuccess, ForwardingFlags flags,
                                       KeyChain commandKeyChain, Name commandCertificateName,
                                       WireFormat wireFormat_0, Face face_1)
        {
            if (commandKeyChain == null)
            {
                throw new Exception(
                          "registerPrefix: The command KeyChain has not been set. You must call setCommandSigningInfo.");
            }
            if (commandCertificateName.size() == 0)
            {
                throw new Exception(
                          "registerPrefix: The command certificate name has not been set. You must call setCommandSigningInfo.");
            }

            ControlParameters controlParameters = new ControlParameters();

            controlParameters.setName(prefix);
            controlParameters.setForwardingFlags(flags);

            Interest commandInterest = new Interest();

            // Determine whether to use remote prefix registration.
            bool faceIsLocal;

            try {
                faceIsLocal = isLocal();
            } catch (IOException ex) {
                logger_.log(
                    ILOG.J2CsMapping.Util.Logging.Level.INFO,
                    "Register prefix failed: Error attempting to determine if the face is local: {0}",
                    ex);
                try {
                    onRegisterFailed.onRegisterFailed(prefix);
                } catch (Exception exception) {
                    logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onRegisterFailed",
                                exception);
                }
                return;
            }

            if (faceIsLocal)
            {
                commandInterest.setName(new Name("/localhost/nfd/rib/register"));
                // The interest is answered by the local host, so set a short timeout.
                commandInterest.setInterestLifetimeMilliseconds(2000.0d);
            }
            else
            {
                commandInterest.setName(new Name("/localhop/nfd/rib/register"));
                // The host is remote, so set a longer timeout.
                commandInterest.setInterestLifetimeMilliseconds(4000.0d);
            }

            // NFD only accepts TlvWireFormat packets.
            commandInterest.getName().append(
                controlParameters.wireEncode(net.named_data.jndn.encoding.TlvWireFormat.get()));
            makeCommandInterest(commandInterest, commandKeyChain,
                                commandCertificateName, net.named_data.jndn.encoding.TlvWireFormat.get());

            // Send the registration interest.
            Node.RegisterResponse response = new Node.RegisterResponse(
                new RegisterResponse.Info(prefix, onRegisterFailed,
                                          onRegisterSuccess, registeredPrefixId, onInterest, face_1),
                this);
            try {
                expressInterest(getNextEntryId(), commandInterest, response,
                                response, null, wireFormat_0, face_1);
            } catch (IOException ex_2) {
                // Can't send the interest. Call onRegisterFailed.
                logger_.log(
                    ILOG.J2CsMapping.Util.Logging.Level.INFO,
                    "Register prefix failed: Error sending the register prefix interest to the forwarder: {0}",
                    ex_2);
                try {
                    onRegisterFailed.onRegisterFailed(prefix);
                } catch (Exception exception_3) {
                    logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onRegisterFailed",
                                exception_3);
                }
            }
        }
コード例 #35
0
ファイル: Face.cs プロジェクト: named-data/ndn-dot-net
        /// <summary>
        /// Register prefix with the connected NDN hub and call onInterest when a
        /// matching interest is received. To register a prefix with NFD, you must
        /// first call setCommandSigningInfo.
        /// </summary>
        ///
        /// <param name="prefix">A Name for the prefix to register. This copies the Name.</param>
        /// <param name="onInterest">onInterest.onInterest(prefix, interest, face, interestFilterId, filter). The onInterest callback should supply the Data with face.putData(). NOTE: You must not change the prefix or filter objects - if you need to change them then make a copy. If onInterest is null, it is ignored and you must call setInterestFilter. 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>
        /// <param name="onRegisterFailed">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>
        /// <param name="onRegisterSuccess">receives a success message from the forwarder. If onRegisterSuccess is null, this does not use it. (The onRegisterSuccess parameter comes after onRegisterFailed because it can be null or omitted, unlike onRegisterFailed.) 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>
        /// <param name="flags"></param>
        /// <param name="wireFormat">A WireFormat object used to encode the message.</param>
        /// <returns>The registered prefix ID which can be used with
        /// removeRegisteredPrefix.</returns>
        /// <exception cref="IOException">For I/O error in sending the registration request.</exception>
        /// <exception cref="System.Security.SecurityException">If signing a command interest for NFD and cannotfind the private key for the certificateName.</exception>
        public virtual long registerPrefix(Name prefix, OnInterestCallback onInterest,
				OnRegisterFailed onRegisterFailed,
				OnRegisterSuccess onRegisterSuccess, ForwardingFlags flags,
				WireFormat wireFormat)
        {
            // Get the registeredPrefixId now so we can return it to the caller.
            long registeredPrefixId = node_.getNextEntryId();

            node_.registerPrefix(registeredPrefixId, prefix, onInterest,
                    onRegisterFailed, onRegisterSuccess, flags, wireFormat,
                    commandKeyChain_, commandCertificateName_, this);

            return registeredPrefixId;
        }
コード例 #36
0
            public Anonymous_C3(ThreadPoolFace paramouter_ThreadPoolFace,
						OnRegisterSuccess onRegisterSuccessSubmit_0,
						OnRegisterFailed onRegisterFailedSubmit_1, Name prefix_2,
						OnInterestCallback onInterestSubmit_3, ForwardingFlags flags_4,
						WireFormat wireFormat_5, long registeredPrefixId_6)
            {
                this.onRegisterSuccessSubmit = onRegisterSuccessSubmit_0;
                    this.onRegisterFailedSubmit = onRegisterFailedSubmit_1;
                    this.prefix = prefix_2;
                    this.onInterestSubmit = onInterestSubmit_3;
                    this.flags = flags_4;
                    this.wireFormat = wireFormat_5;
                    this.registeredPrefixId = registeredPrefixId_6;
                    this.outer_ThreadPoolFace = paramouter_ThreadPoolFace;
            }
コード例 #37
0
ファイル: Face.cs プロジェクト: named-data/ndn-dot-net
        public long registerPrefix(Name prefix, OnInterestCallback onInterest,
				OnRegisterSuccess onRegisterSuccess,
				OnRegisterFailed onRegisterFailed, ForwardingFlags flags,
				WireFormat wireFormat)
        {
            return registerPrefix(prefix, onInterest, onRegisterFailed,
                    onRegisterSuccess, flags, wireFormat);
        }
コード例 #38
0
        /// <summary>
        /// Submit a task to the thread pool to register prefix with the connected
        /// forwarder and call onInterest when a matching interest is received. To
        /// register a prefix with NFD, you must first call setCommandSigningInfo.
        /// </summary>
        ///
        /// <param name="prefix_0">A Name for the prefix to register. This copies the Name.</param>
        /// <param name="onInterest">onInterest.onInterest(prefix, interest, face, interestFilterId, filter). The onInterest callback should supply the Data with face.putData(). NOTE: You must not change the prefix or filter objects - if you need to change them then make a copy. If onInterest is null, it is ignored and you must call setInterestFilter. 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>
        /// <param name="onRegisterFailed">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>
        /// <param name="onRegisterSuccess">receives a success message from the forwarder. If onRegisterSuccess is null, this does not use it. (The onRegisterSuccess parameter comes after onRegisterFailed because it can be null or omitted, unlike onRegisterFailed.) 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>
        /// <param name="flags_1"></param>
        /// <param name="wireFormat_2">A WireFormat object used to encode the message.</param>
        /// <returns>The registered prefix ID which can be used with
        /// removeRegisteredPrefix.</returns>
        public override long registerPrefix(Name prefix_0,
				OnInterestCallback onInterest, OnRegisterFailed onRegisterFailed,
				OnRegisterSuccess onRegisterSuccess, ForwardingFlags flags_1,
				WireFormat wireFormat_2)
        {
            long registeredPrefixId_3 = node_.getNextEntryId();

            // Wrap callbacks to submit to the thread pool.
            OnInterestCallback finalOnInterest_4 = onInterest;
            OnInterestCallback onInterestSubmit_5 = (onInterest == null) ? null
                    : new ThreadPoolFace.Anonymous_C6 (this, finalOnInterest_4);

            OnRegisterFailed finalOnRegisterFailed_6 = onRegisterFailed;
            OnRegisterFailed onRegisterFailedSubmit_7 = new ThreadPoolFace.Anonymous_C5 (this, finalOnRegisterFailed_6);

            // Wrap callbacks to submit to the thread pool.
            OnRegisterSuccess finalOnRegisterSuccess_8 = onRegisterSuccess;
            OnRegisterSuccess onRegisterSuccessSubmit_9 = (onRegisterSuccess == null) ? null
                    : new ThreadPoolFace.Anonymous_C4 (this, finalOnRegisterSuccess_8);

            threadPool_.submit(new ThreadPoolFace.Anonymous_C3 (this, onRegisterSuccessSubmit_9, onRegisterFailedSubmit_7,
                    prefix_0, onInterestSubmit_5, flags_1, wireFormat_2, registeredPrefixId_3));

            return registeredPrefixId_3;
        }
コード例 #39
0
ファイル: Node.cs プロジェクト: named-data/ndn-dot-net
        /// <summary>
        /// Do the work of registerPrefix to register with NFD.
        /// </summary>
        ///
        /// <param name="registeredPrefixId">registeredPrefixTable_ (assuming it has already been done).</param>
        /// <param name="prefix"></param>
        /// <param name="onInterest"></param>
        /// <param name="onRegisterFailed"></param>
        /// <param name="onRegisterSuccess"></param>
        /// <param name="flags"></param>
        /// <param name="commandKeyChain"></param>
        /// <param name="commandCertificateName"></param>
        /// <param name="wireFormat_0"></param>
        /// <param name="face_1"></param>
        /// <exception cref="System.Security.SecurityException">If cannot find the private key for thecertificateName.</exception>
        private void nfdRegisterPrefix(long registeredPrefixId, Name prefix,
				OnInterestCallback onInterest, OnRegisterFailed onRegisterFailed,
				OnRegisterSuccess onRegisterSuccess, ForwardingFlags flags,
				KeyChain commandKeyChain, Name commandCertificateName,
				WireFormat wireFormat_0, Face face_1)
        {
            if (commandKeyChain == null)
                throw new Exception(
                        "registerPrefix: The command KeyChain has not been set. You must call setCommandSigningInfo.");
            if (commandCertificateName.size() == 0)
                throw new Exception(
                        "registerPrefix: The command certificate name has not been set. You must call setCommandSigningInfo.");

            ControlParameters controlParameters = new ControlParameters();
            controlParameters.setName(prefix);
            controlParameters.setForwardingFlags(flags);

            Interest commandInterest = new Interest();

            // Determine whether to use remote prefix registration.
            bool faceIsLocal;
            try {
                faceIsLocal = isLocal();
            } catch (IOException ex) {
                logger_.log(
                        ILOG.J2CsMapping.Util.Logging.Level.INFO,
                        "Register prefix failed: Error attempting to determine if the face is local: {0}",
                        ex);
                try {
                    onRegisterFailed.onRegisterFailed(prefix);
                } catch (Exception exception) {
                    logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onRegisterFailed",
                            exception);
                }
                return;
            }

            if (faceIsLocal) {
                commandInterest.setName(new Name("/localhost/nfd/rib/register"));
                // The interest is answered by the local host, so set a short timeout.
                commandInterest.setInterestLifetimeMilliseconds(2000.0d);
            } else {
                commandInterest.setName(new Name("/localhop/nfd/rib/register"));
                // The host is remote, so set a longer timeout.
                commandInterest.setInterestLifetimeMilliseconds(4000.0d);
            }

            // NFD only accepts TlvWireFormat packets.
            commandInterest.getName().append(
                    controlParameters.wireEncode(net.named_data.jndn.encoding.TlvWireFormat.get()));
            makeCommandInterest(commandInterest, commandKeyChain,
                    commandCertificateName, net.named_data.jndn.encoding.TlvWireFormat.get());

            // Send the registration interest.
            Node.RegisterResponse  response = new Node.RegisterResponse (
                    new RegisterResponse.Info(prefix, onRegisterFailed,
                            onRegisterSuccess, registeredPrefixId, onInterest, face_1),
                    this);
            try {
                expressInterest(getNextEntryId(), commandInterest, response,
                        response, null, wireFormat_0, face_1);
            } catch (IOException ex_2) {
                // Can't send the interest. Call onRegisterFailed.
                logger_.log(
                        ILOG.J2CsMapping.Util.Logging.Level.INFO,
                        "Register prefix failed: Error sending the register prefix interest to the forwarder: {0}",
                        ex_2);
                try {
                    onRegisterFailed.onRegisterFailed(prefix);
                } catch (Exception exception_3) {
                    logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onRegisterFailed",
                            exception_3);
                }
            }
        }