コード例 #1
0
ファイル: KeyChain.cs プロジェクト: redfood/ndn-dot-net
 public void onTimeout(Interest interest)
 {
     if (retry_ > 0)
     {
         // Issue the same expressInterest as in verifyData except decrement
         //   retry.
         KeyChain.VerifyCallbacksForVerifyInterest callbacks = new KeyChain.VerifyCallbacksForVerifyInterest(
             outer_KeyChain, nextStep_, retry_ - 1, onVerifyFailed_,
             originalInterest_);
         try {
             outer_KeyChain.face_.expressInterest(interest, callbacks, callbacks);
         } catch (IOException ex) {
             try {
                 onVerifyFailed_
                 .onVerifyInterestFailed(originalInterest_);
             } catch (Exception exception) {
                 net.named_data.jndn.security.KeyChain.logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE,
                                                                   "Error in onVerifyInterestFailed", exception);
             }
         }
     }
     else
     {
         try {
             onVerifyFailed_.onVerifyInterestFailed(originalInterest_);
         } catch (Exception ex_0) {
             net.named_data.jndn.security.KeyChain.logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE,
                                                               "Error in onVerifyInterestFailed", ex_0);
         }
     }
 }
コード例 #2
0
ファイル: KeyChain.cs プロジェクト: redfood/ndn-dot-net
        public void verifyInterest(Interest interest,
                                   OnVerifiedInterest onVerified,
                                   OnVerifyInterestFailed onVerifyFailed, int stepCount)
        {
            ILOG.J2CsMapping.Util.Logging.Logger.getLogger(this.GetType().FullName).log(ILOG.J2CsMapping.Util.Logging.Level.INFO,
                                                                                        "Enter Verify");

            if (policyManager_.requireVerify(interest))
            {
                ValidationRequest nextStep = policyManager_
                                             .checkVerificationPolicy(interest, stepCount, onVerified,
                                                                      onVerifyFailed);
                if (nextStep != null)
                {
                    KeyChain.VerifyCallbacksForVerifyInterest callbacks = new KeyChain.VerifyCallbacksForVerifyInterest(
                        this, nextStep, nextStep.retry_, onVerifyFailed, interest);
                    try {
                        face_.expressInterest(nextStep.interest_, callbacks,
                                              callbacks);
                    } catch (IOException ex) {
                        try {
                            onVerifyFailed.onVerifyInterestFailed(interest);
                        } catch (Exception exception) {
                            logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE,
                                        "Error in onVerifyInterestFailed", exception);
                        }
                    }
                }
            }
            else if (policyManager_.skipVerifyAndTrust(interest))
            {
                try {
                    onVerified.onVerifiedInterest(interest);
                } catch (Exception ex_0) {
                    logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onVerifiedInterest", ex_0);
                }
            }
            else
            {
                try {
                    onVerifyFailed.onVerifyInterestFailed(interest);
                } catch (Exception ex_1) {
                    logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onVerifyInterestFailed", ex_1);
                }
            }
        }
コード例 #3
0
ファイル: KeyChain.cs プロジェクト: named-data/ndn-dot-net
        public void verifyInterest(Interest interest,
				OnVerifiedInterest onVerified,
				OnInterestValidationFailed onValidationFailed, int stepCount)
        {
            ILOG.J2CsMapping.Util.Logging.Logger.getLogger(this.GetType().FullName).log(ILOG.J2CsMapping.Util.Logging.Level.INFO,
                    "Enter Verify");

            if (policyManager_.requireVerify(interest)) {
                ValidationRequest nextStep = policyManager_
                        .checkVerificationPolicy(interest, stepCount, onVerified,
                                onValidationFailed);
                if (nextStep != null) {
                    KeyChain.VerifyCallbacksForVerifyInterest  callbacks = new KeyChain.VerifyCallbacksForVerifyInterest (
                            this, nextStep, nextStep.retry_, onValidationFailed, interest);
                    try {
                        face_.expressInterest(nextStep.interest_, callbacks,
                                callbacks);
                    } catch (IOException ex) {
                        try {
                            onValidationFailed.onInterestValidationFailed(interest,
                                    "Error calling expressInterest " + ex);
                        } catch (Exception exception) {
                            logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE,
                                    "Error in onInterestValidationFailed",
                                    exception);
                        }
                    }
                }
            } else if (policyManager_.skipVerifyAndTrust(interest)) {
                try {
                    onVerified.onVerifiedInterest(interest);
                } catch (Exception ex_0) {
                    logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onVerifiedInterest", ex_0);
                }
            } else {
                try {
                    onValidationFailed
                            .onInterestValidationFailed(interest,
                                    "The packet has no verify rule but skipVerifyAndTrust is false");
                } catch (Exception ex_1) {
                    logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE,
                            "Error in onInterestValidationFailed", ex_1);
                }
            }
        }
コード例 #4
0
ファイル: KeyChain.cs プロジェクト: named-data/ndn-dot-net
 public void onTimeout(Interest interest)
 {
     if (retry_ > 0) {
             // Issue the same expressInterest as in verifyData except decrement
             //   retry.
             KeyChain.VerifyCallbacksForVerifyInterest  callbacks = new KeyChain.VerifyCallbacksForVerifyInterest (
                     outer_KeyChain, nextStep_, retry_ - 1, onValidationFailed_,
                     originalInterest_);
             try {
                 outer_KeyChain.face_.expressInterest(interest, callbacks, callbacks);
             } catch (IOException ex) {
                 try {
                     onValidationFailed_.onInterestValidationFailed(
                             originalInterest_,
                             "Error in expressInterest to retry after timeout for fetching "
                                     + interest.getName().toUri() + ": "
                                     + ex);
                 } catch (Exception exception) {
                     net.named_data.jndn.security.KeyChain.logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE,
                             "Error in onInterestValidationFailed",
                             exception);
                 }
             }
         } else {
             try {
                 onValidationFailed_.onInterestValidationFailed(
                         originalInterest_,
                         "The retry count is zero after timeout for fetching "
                                 + interest.getName().toUri());
             } catch (Exception ex_0) {
                 net.named_data.jndn.security.KeyChain.logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE,
                         "Error in onInterestValidationFailed", ex_0);
             }
         }
 }