当前位置: 首页>>代码示例>>C#>>正文


C# Interest.getName方法代码示例

本文整理汇总了C#中net.named_data.jndn.Interest.getName方法的典型用法代码示例。如果您正苦于以下问题:C# Interest.getName方法的具体用法?C# Interest.getName怎么用?C# Interest.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.named_data.jndn.Interest的用法示例。


在下文中一共展示了Interest.getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: generate

        /// <summary>
        /// Append a timestamp component and a random value component to interest's
        /// name. This ensures that the timestamp is greater than the timestamp used in
        /// the previous call. Then use keyChain to sign the interest which appends a
        /// SignatureInfo component and a component with the signature bits. If the
        /// interest lifetime is not set, this sets it.
        /// </summary>
        ///
        /// <param name="interest">The interest whose name is append with components.</param>
        /// <param name="keyChain">The KeyChain for calling sign.</param>
        /// <param name="certificateName">The certificate name of the key to use for signing.</param>
        /// <param name="wireFormat"></param>
        public void generate(Interest interest, KeyChain keyChain,
				Name certificateName, WireFormat wireFormat)
        {
            double timestamp;
             lock (lastTimestampLock_) {
                        timestamp = Math.Round(net.named_data.jndn.util.Common.getNowMilliseconds(),MidpointRounding.AwayFromZero);
                        while (timestamp <= lastTimestamp_)
                            timestamp += 1.0d;
                        // Update the timestamp now while it is locked. In the small chance that
                        //   signing fails, it just means that we have bumped the timestamp.
                        lastTimestamp_ = timestamp;
                    }

            // The timestamp is encoded as a TLV nonNegativeInteger.
            TlvEncoder encoder = new TlvEncoder(8);
            encoder.writeNonNegativeInteger((long) timestamp);
            interest.getName().append(new Blob(encoder.getOutput(), false));

            // The random value is a TLV nonNegativeInteger too, but we know it is 8 bytes,
            //   so we don't need to call the nonNegativeInteger encoder.
            ByteBuffer randomBuffer = ILOG.J2CsMapping.NIO.ByteBuffer.allocate(8);
            // Note: SecureRandom is thread safe.
            net.named_data.jndn.util.Common.getRandom().nextBytes(randomBuffer.array());
            interest.getName().append(new Blob(randomBuffer, false));

            keyChain.sign(interest, certificateName, wireFormat);

            if (interest.getInterestLifetimeMilliseconds() < 0)
                // The caller has not set the interest lifetime, so set it here.
                interest.setInterestLifetimeMilliseconds(1000.0d);
        }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:43,代码来源:CommandInterestGenerator.cs

示例2: testMaxNdnPacketSize

        public void testMaxNdnPacketSize()
        {
            // Construct an interest whose encoding is one byte larger than getMaxNdnPacketSize.
            int targetSize = net.named_data.jndn.Face.getMaxNdnPacketSize() + 1;
            // Start with an interest which is almost the right size.
            Interest interest = new Interest();
            interest.getName().append(new byte[targetSize]);
            int initialSize = interest.wireEncode().size();
            // Now replace the component with the desired size which trims off the extra encoding.
            interest.setName(new Name().append(new byte[targetSize
                    - (initialSize - targetSize)]));
            int interestSize = interest.wireEncode().size();
            AssertEquals("Wrong interest size for MaxNdnPacketSize", targetSize,
                    interestSize);

            CallbackCounter counter = new CallbackCounter();
            bool gotError = true;
            try {
                face.expressInterest(interest, counter, counter);
                gotError = false;
            } catch (Exception ex) {
            }
            if (!gotError)
                Fail("expressInterest didn't throw an exception when the interest size exceeds getMaxNdnPacketSize()");
        }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:25,代码来源:TestFaceInterestMethods.cs

示例3: getMatchedFilters

        public void getMatchedFilters(Interest interest,
				ArrayList matchedFilters)
        {
            for (int i = 0; i < table_.Count; ++i) {
                InterestFilterTable.Entry  entry = table_[i];
                if (entry.getFilter().doesMatch(interest.getName()))
                    ILOG.J2CsMapping.Collections.Collections.Add(matchedFilters,entry);
            }
        }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:9,代码来源:InterestFilterTable.cs

示例4: Interest

        /// <summary>
        /// Create a new interest as a deep copy of the given interest.
        /// </summary>
        ///
        /// <param name="interest">The interest to copy.</param>
        public Interest(Interest interest)
        {
            this.name_ = new ChangeCounter(new Name());
            this.minSuffixComponents_ = -1;
            this.maxSuffixComponents_ = -1;
            this.keyLocator_ = new ChangeCounter(
                    new KeyLocator());
            this.exclude_ = new ChangeCounter(new Exclude());
            this.childSelector_ = -1;
            this.mustBeFresh_ = true;
            this.interestLifetimeMilliseconds_ = -1;
            this.nonce_ = new Blob();
            this.getNonceChangeCount_ = 0;
            this.lpPacket_ = null;
            this.linkWireEncoding_ = new Blob();
            this.linkWireEncodingFormat_ = null;
            this.link_ = new ChangeCounter(null);
            this.selectedDelegationIndex_ = -1;
            this.defaultWireEncoding_ = new SignedBlob();
            this.getDefaultWireEncodingChangeCount_ = 0;
            this.changeCount_ = 0;
            name_.set(new Name(interest.getName()));
            minSuffixComponents_ = interest.minSuffixComponents_;
            maxSuffixComponents_ = interest.maxSuffixComponents_;
            keyLocator_.set(new KeyLocator(interest.getKeyLocator()));
            exclude_.set(new Exclude(interest.getExclude()));
            childSelector_ = interest.childSelector_;
            mustBeFresh_ = interest.mustBeFresh_;

            interestLifetimeMilliseconds_ = interest.interestLifetimeMilliseconds_;
            nonce_ = interest.getNonce();

            linkWireEncoding_ = interest.linkWireEncoding_;
            linkWireEncodingFormat_ = interest.linkWireEncodingFormat_;
            if (interest.link_.get() != null)
                link_.set(new Link((Link) interest.link_.get()));
            selectedDelegationIndex_ = interest.selectedDelegationIndex_;

            setDefaultWireEncoding(interest.getDefaultWireEncoding(),
                    interest.defaultWireEncodingFormat_);
        }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:46,代码来源:Interest.cs

示例5: onInterest

            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);
                    }
            }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:18,代码来源:TestFaceCallRegisterMethods.cs

示例6: signInterestByCertificate

        /// <summary>
        /// Append a SignatureInfo to the Interest name, sign the name components and
        /// append a final name component with the signature bits.
        /// </summary>
        ///
        /// <param name="interest"></param>
        /// <param name="certificateName">The certificate name of the key to use for signing.</param>
        /// <param name="wireFormat">A WireFormat object used to encode the input.</param>
        public void signInterestByCertificate(Interest interest,
				Name certificateName, WireFormat wireFormat)
        {
            DigestAlgorithm[] digestAlgorithm = new DigestAlgorithm[1];
            Signature signature = makeSignatureByCertificate(certificateName,
                    digestAlgorithm);

            // Append the encoded SignatureInfo.
            interest.getName().append(wireFormat.encodeSignatureInfo(signature));

            // Append an empty signature so that the "signedPortion" is correct.
            interest.getName().append(new Name.Component());
            // Encode once to get the signed portion, and sign.
            SignedBlob encoding = interest.wireEncode(wireFormat);
            signature.setSignature(privateKeyStorage_.sign(encoding.signedBuf(),
                    net.named_data.jndn.security.certificate.IdentityCertificate
                            .certificateNameToPublicKeyName(certificateName),
                    digestAlgorithm[0]));

            // Remove the empty signature and append the real one.
            interest.setName(interest.getName().getPrefix(-1)
                    .append(wireFormat.encodeSignatureValue(signature)));
        }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:31,代码来源:IdentityManager.cs

示例7: signInterestWithSha256

        /// <summary>
        /// Append a SignatureInfo for DigestSha256 to the Interest name, digest the
        /// name components and append a final name component with the signature bits
        /// (which is the digest).
        /// </summary>
        ///
        /// <param name="interest"></param>
        /// <param name="wireFormat">A WireFormat object used to encode the input.</param>
        public void signInterestWithSha256(Interest interest,
				WireFormat wireFormat)
        {
            DigestSha256Signature signature = new DigestSha256Signature();
            // Append the encoded SignatureInfo.
            interest.getName().append(wireFormat.encodeSignatureInfo(signature));

            // Append an empty signature so that the "signedPortion" is correct.
            interest.getName().append(new Name.Component());
            // Encode once to get the signed portion.
            SignedBlob encoding = interest.wireEncode(wireFormat);

            // Digest and set the signature.
            byte[] signedPortionDigest = net.named_data.jndn.util.Common.digestSha256(encoding.signedBuf());
            signature.setSignature(new Blob(signedPortionDigest, false));

            // Remove the empty signature and append the real one.
            interest.setName(interest.getName().getPrefix(-1)
                    .append(wireFormat.encodeSignatureValue(signature)));
        }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:28,代码来源:IdentityManager.cs

示例8: dumpInterest

 private static ArrayList dumpInterest(Interest interest)
 {
     ArrayList result = new ArrayList();
     ILOG.J2CsMapping.Collections.Collections.Add(result,dump("name:", interest.getName().toUri()));
     ILOG.J2CsMapping.Collections.Collections.Add(result,dump(
                     "minSuffixComponents:",
                     (interest.getMinSuffixComponents() >= 0) ? (Object) (interest.getMinSuffixComponents()) : (Object) ("<none>")));
     ILOG.J2CsMapping.Collections.Collections.Add(result,dump(
                     "maxSuffixComponents:",
                     (interest.getMaxSuffixComponents() >= 0) ? (Object) (interest.getMaxSuffixComponents()) : (Object) ("<none>")));
     if (interest.getKeyLocator().getType() != net.named_data.jndn.KeyLocatorType.NONE) {
         if (interest.getKeyLocator().getType() == net.named_data.jndn.KeyLocatorType.KEY_LOCATOR_DIGEST)
             ILOG.J2CsMapping.Collections.Collections.Add(result,dump("keyLocator: KeyLocatorDigest:", interest
                                     .getKeyLocator().getKeyData().toHex()));
         else if (interest.getKeyLocator().getType() == net.named_data.jndn.KeyLocatorType.KEYNAME)
             ILOG.J2CsMapping.Collections.Collections.Add(result,dump("keyLocator: KeyName:", interest
                                     .getKeyLocator().getKeyName().toUri()));
         else
             ILOG.J2CsMapping.Collections.Collections.Add(result,dump("keyLocator: <unrecognized KeyLocatorType"));
     } else
         ILOG.J2CsMapping.Collections.Collections.Add(result,dump("keyLocator: <none>"));
     ILOG.J2CsMapping.Collections.Collections.Add(result,dump("exclude:", (interest.getExclude().size() > 0) ? interest
                     .getExclude().toUri() : "<none>"));
     ILOG.J2CsMapping.Collections.Collections.Add(result,dump("childSelector:",
                     (interest.getChildSelector() >= 0) ? (Object) (interest.getChildSelector())
                             : (Object) ("<none>")));
     ILOG.J2CsMapping.Collections.Collections.Add(result,dump("mustBeFresh:", (interest.getMustBeFresh()) ? "true"
                     : "false"));
     ILOG.J2CsMapping.Collections.Collections.Add(result,dump("nonce:", (interest.getNonce().size() == 0) ? "<none>"
                     : interest.getNonce().toHex()));
     ILOG.J2CsMapping.Collections.Collections.Add(result,dump("lifetimeMilliseconds:",
                     (interest.getInterestLifetimeMilliseconds() < 0) ? "<none>" : ""
                             + (long) interest.getInterestLifetimeMilliseconds()));
     return result;
 }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:35,代码来源:TestInterestMethods.cs

示例9: handleCoveringKey

        /// <summary>
        /// This is called from an expressInterest OnData to check that the encryption
        /// key contained in data fits the timeSlot. This sends a refined interest if
        /// required.
        /// </summary>
        ///
        /// <param name="interest">The interest given to expressInterest.</param>
        /// <param name="data">The fetched Data packet.</param>
        /// <param name="timeSlot_0">The time slot as milliseconds since Jan 1, 1970 UTC.</param>
        /// <param name="onEncryptedKeys_1">encrypted content key Data packets. If onEncryptedKeys is null, this does not use it.</param>
        internal void handleCoveringKey(Interest interest, Data data,
				double timeSlot_0, Producer.OnEncryptedKeys  onEncryptedKeys_1, net.named_data.jndn.encrypt.EncryptError.OnError  onError_2)
        {
            double timeCount = Math.Round(timeSlot_0,MidpointRounding.AwayFromZero);
            Producer.KeyRequest  keyRequest = (Producer.KeyRequest ) ILOG.J2CsMapping.Collections.Collections.Get(keyRequests_,timeCount);

            Name interestName = interest.getName();
            Name keyName = data.getName();

            double begin = net.named_data.jndn.encrypt.Schedule.fromIsoString(keyName
                    .get(START_TIME_STAMP_INDEX).getValue().toString());
            double end = net.named_data.jndn.encrypt.Schedule.fromIsoString(keyName.get(END_TIME_STAMP_INDEX)
                    .getValue().toString());

            if (timeSlot_0 >= end) {
                // If the received E-KEY covers some earlier period, try to retrieve an
                // E-KEY covering a later one.
                Exclude timeRange = new Exclude(interest.getExclude());
                excludeBefore(timeRange, keyName.get(START_TIME_STAMP_INDEX));
                ILOG.J2CsMapping.Collections.Collections.Put(keyRequest.repeatAttempts,interestName,0);

                sendKeyInterest(new Interest(interestName).setExclude(timeRange)
                        .setChildSelector(1), timeSlot_0, onEncryptedKeys_1, onError_2);
            } else {
                // If the received E-KEY covers the content key, encrypt the content.
                Blob encryptionKey = data.getContent();
                // If everything is correct, save the E-KEY as the current key.
                if (encryptContentKey(encryptionKey, keyName, timeSlot_0,
                        onEncryptedKeys_1, onError_2)) {
                    Producer.KeyInfo  keyInfo = (Producer.KeyInfo ) ILOG.J2CsMapping.Collections.Collections.Get(eKeyInfo_,interestName);
                    keyInfo.beginTimeSlot = begin;
                    keyInfo.endTimeSlot = end;
                    keyInfo.keyBits = encryptionKey;
                }
            }
        }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:46,代码来源:Producer.cs

示例10: onInterest

        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);
                    }
                }
            }
        }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:81,代码来源:MemoryContentCache.cs

示例11: expressInterestHelper

        /// <summary>
        /// Do the work of expressInterest once we know we are connected. Add the entry
        /// to the PIT, encode and send the interest.
        /// </summary>
        ///
        /// <param name="pendingInterestId"></param>
        /// <param name="interestCopy"></param>
        /// <param name="onData"></param>
        /// <param name="onTimeout"></param>
        /// <param name="onNetworkNack"></param>
        /// <param name="wireFormat">A WireFormat object used to encode the message.</param>
        /// <param name="face"></param>
        /// <exception cref="IOException">For I/O error in sending the interest.</exception>
        /// <exception cref="System.Exception">If the encoded interest size exceeds getMaxNdnPacketSize().</exception>
        internal void expressInterestHelper(long pendingInterestId,
				Interest interestCopy, OnData onData, OnTimeout onTimeout,
				OnNetworkNack onNetworkNack, WireFormat wireFormat, Face face)
        {
            PendingInterestTable.Entry pendingInterest = pendingInterestTable_
                    .add(pendingInterestId, interestCopy, onData, onTimeout,
                            onNetworkNack);
            if (pendingInterest == null)
                // removePendingInterest was already called with the pendingInterestId.
                return;

            if (onTimeout != null
                    || interestCopy.getInterestLifetimeMilliseconds() >= 0.0d) {
                // Set up the timeout.
                double delayMilliseconds = interestCopy
                        .getInterestLifetimeMilliseconds();
                if (delayMilliseconds < 0.0d)
                    // Use a default timeout delay.
                    delayMilliseconds = 4000.0d;

                face.callLater(delayMilliseconds, new Node.Anonymous_C0 (this, pendingInterest));
            }

            // Special case: For timeoutPrefix_ we don't actually send the interest.
            if (!timeoutPrefix_.match(interestCopy.getName())) {
                Blob encoding = interestCopy.wireEncode(wireFormat);
                if (encoding.size() > getMaxNdnPacketSize())
                    throw new Exception(
                            "The encoded interest size exceeds the maximum limit getMaxNdnPacketSize()");
                transport_.send(encoding.buf());
            }
        }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:46,代码来源:Node.cs

示例12: extractSignature

        /// <summary>
        /// Extract the signature information from the interest name.
        /// </summary>
        ///
        /// <param name="interest">The interest whose signature is needed.</param>
        /// <param name="wireFormat"></param>
        /// <param name="failureReason"></param>
        /// <returns>A shared_ptr for the Signature object. This is null if can't decode.</returns>
        private static Signature extractSignature(Interest interest,
				WireFormat wireFormat, String[] failureReason)
        {
            if (interest.getName().size() < 2) {
                failureReason[0] = "The signed interest has less than 2 components: "
                        + interest.getName().toUri();
                return null;
            }

            try {
                return wireFormat.decodeSignatureInfoAndValue(interest.getName()
                        .get(-2).getValue().buf(), interest.getName().get(-1)
                        .getValue().buf(), false);
            } catch (EncodingException ex) {
                failureReason[0] = "Error decoding the signed interest signature: "
                        + ex;
                return null;
            }
        }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:27,代码来源:ConfigPolicyManager.cs

示例13: checkVerificationPolicy

        /// <summary>
        /// Check whether the received signed interest complies with the verification
        /// policy, and get the indication of the next verification step.
        /// </summary>
        ///
        /// <param name="interest">The interest with the signature to check.</param>
        /// <param name="stepCount"></param>
        /// <param name="onVerified">better error handling the callback should catch and properly handle any exceptions.</param>
        /// <param name="onValidationFailed">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 indication of next verification step, null if there is no
        /// further step.</returns>
        public override sealed ValidationRequest checkVerificationPolicy(Interest interest,
				int stepCount, OnVerifiedInterest onVerified,
				OnInterestValidationFailed onValidationFailed, WireFormat wireFormat)
        {
            String[] failureReason = new String[] { "unknown" };
            Signature signature = extractSignature(interest, wireFormat,
                    failureReason);
            if (signature == null) {
                // Can't get the signature from the interest name.
                try {
                    onValidationFailed.onInterestValidationFailed(interest,
                            failureReason[0]);
                } catch (Exception ex) {
                    logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE,
                            "Error in onInterestValidationFailed", ex);
                }
                return null;
            }

            // For command interests, we need to ignore the last 4 components when
            //   matching the name.
            Interest certificateInterest = getCertificateInterest(stepCount,
                    "interest", interest.getName().getPrefix(-4), signature,
                    failureReason);
            if (certificateInterest == null) {
                try {
                    onValidationFailed.onInterestValidationFailed(interest,
                            failureReason[0]);
                } catch (Exception ex_0) {
                    logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE,
                            "Error in onInterestValidationFailed", ex_0);
                }
                return null;
            }

            if (certificateInterest.getName().size() > 0)
                return new ValidationRequest(certificateInterest,
                        new ConfigPolicyManager.OnCertificateDownloadCompleteForInterest (this, interest,
                                stepCount, onVerified, onValidationFailed,
                                wireFormat), new ConfigPolicyManager.OnVerifyInterestFailedWrapper (
                                onValidationFailed, interest), 2, stepCount + 1);
            else {
                // For interests, we must check that the timestamp is fresh enough.
                // This is done after (possibly) downloading the certificate to avoid filling
                // the cache with bad keys.
                Name signatureName = net.named_data.jndn.KeyLocator.getFromSignature(signature)
                        .getKeyName();
                Name keyName = net.named_data.jndn.security.certificate.IdentityCertificate
                        .certificateNameToPublicKeyName(signatureName);
                double timestamp = interest.getName().get(-4).toNumber();

                if (!interestTimestampIsFresh(keyName, timestamp, failureReason)) {
                    try {
                        onValidationFailed.onInterestValidationFailed(interest,
                                failureReason[0]);
                    } catch (Exception ex_1) {
                        logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE,
                                "Error in onInterestValidationFailed", ex_1);
                    }
                    return null;
                }

                // Certificate is known. Verify the signature.
                // wireEncode returns the cached encoding if available.
                if (verify(signature, interest.wireEncode(), failureReason)) {
                    try {
                        onVerified.onVerifiedInterest(interest);
                    } catch (Exception ex_2) {
                        logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onVerifiedInterest", ex_2);
                    }
                    updateTimestampForKey(keyName, timestamp);
                } else {
                    try {
                        onValidationFailed.onInterestValidationFailed(interest,
                                failureReason[0]);
                    } catch (Exception ex_3) {
                        logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE,
                                "Error in onInterestValidationFailed", ex_3);
                    }
                }

                return null;
            }
        }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:95,代码来源:ConfigPolicyManager.cs

示例14: onTimeout

 public virtual void onTimeout(Interest interest)
 {
     try {
         onError_.onError(net.named_data.jndn.util.SegmentFetcher.ErrorCode.INTEREST_TIMEOUT,
                 "Time out for interest " + interest.getName().toUri());
     } catch (Exception ex) {
         logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onError", ex);
     }
 }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:9,代码来源:SegmentFetcher.cs

示例15: handleTimeout

        /// <summary>
        /// This is called from an expressInterest timeout to update the state of
        /// keyRequest. Re-express the interest if the number of retrials is less than
        /// the max limit.
        /// </summary>
        ///
        /// <param name="interest">The timed-out interest.</param>
        /// <param name="timeSlot_0">The time slot as milliseconds since Jan 1, 1970 UTC.</param>
        /// <param name="onEncryptedKeys_1">encrypted content key Data packets. If onEncryptedKeys is null, this does not use it.</param>
        internal void handleTimeout(Interest interest, double timeSlot_0,
				Producer.OnEncryptedKeys  onEncryptedKeys_1, net.named_data.jndn.encrypt.EncryptError.OnError  onError_2)
        {
            double timeCount = Math.Round(timeSlot_0,MidpointRounding.AwayFromZero);
            Producer.KeyRequest  keyRequest = (Producer.KeyRequest ) ILOG.J2CsMapping.Collections.Collections.Get(keyRequests_,timeCount);

            Name interestName = interest.getName();
            if ((int) (Int32) ILOG.J2CsMapping.Collections.Collections.Get(keyRequest.repeatAttempts,interestName) < maxRepeatAttempts_) {
                // Increase the retrial count.
                ILOG.J2CsMapping.Collections.Collections.Put(keyRequest.repeatAttempts,interestName,(int) (Int32) ILOG.J2CsMapping.Collections.Collections.Get(keyRequest.repeatAttempts,interestName) + 1);
                sendKeyInterest(interest, timeSlot_0, onEncryptedKeys_1, onError_2);
            } else
                // No more retrials.
                updateKeyRequest(keyRequest, timeCount, onEncryptedKeys_1);
        }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:24,代码来源:Producer.cs


注:本文中的net.named_data.jndn.Interest.getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。