Example #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());
 }
Example #2
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);
 }
        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);
        }
Example #4
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);
        }