public virtual void onData(Interest originalInterest_0, Data data) { if (validatorKeyChain_ != null) { try { SegmentFetcher thisSegmentFetcher_1 = this; validatorKeyChain_.verifyData(data, new SegmentFetcher.Anonymous_C0(originalInterest_0, thisSegmentFetcher_1), this); } catch (Exception ex) { try { onError_.onError(net.named_data.jndn.util.SegmentFetcher.ErrorCode.SEGMENT_VERIFICATION_FAILED, "Error in KeyChain.verifyData " + ex.Message); } catch (Exception ex2) { logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onError", ex2); } } } else { bool verified = false; try { verified = verifySegment_.verifySegment(data); } catch (Exception ex_2) { logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in verifySegment", ex_2); } if (!verified) { try { onError_.onError(net.named_data.jndn.util.SegmentFetcher.ErrorCode.SEGMENT_VERIFICATION_FAILED, "Segment verification failed"); } catch (Exception ex_3) { logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onError", ex_3); } return; } onVerified(data, originalInterest_0); } }
public Anonymous_C0(Interest originalInterest_0, SegmentFetcher thisSegmentFetcher_1) { this.originalInterest = originalInterest_0; this.thisSegmentFetcher = thisSegmentFetcher_1; }
public Anonymous_C0(SegmentFetcher thisSegmentFetcher_0, Interest originalInterest_1) { this.thisSegmentFetcher = thisSegmentFetcher_0; this.originalInterest = originalInterest_1; }
/// <summary> /// Initiate segment fetching. For more details, see the documentation for /// the class. /// </summary> /// /// <param name="face">This calls face.expressInterest to fetch more segments.</param> /// <param name="baseInterest">This interest may include a custom InterestLifetime and selectors that will propagate to all subsequent Interests. The only exception is that the initial Interest will be forced to include selectors "ChildSelector=1" and "MustBeFresh=true" which will be turned off in subsequent Interests.</param> /// <param name="validatorKeyChain">fetching and call onError with SEGMENT_VERIFICATION_FAILED. This does not make a copy of the KeyChain; the object must remain valid while fetching. If validatorKeyChain is null, this does not validate the data packet.</param> /// <param name="onComplete">content of all the segments. 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="onError">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 static void fetch(Face face, Interest baseInterest, KeyChain validatorKeyChain, SegmentFetcher.OnComplete onComplete, SegmentFetcher.OnError onError) { new SegmentFetcher(face, validatorKeyChain, DontVerifySegment, onComplete, onError).fetchFirstSegment(baseInterest); }
/// <summary> /// Initiate segment fetching. For more details, see the documentation for /// the class. /// </summary> /// /// <param name="face">This calls face.expressInterest to fetch more segments.</param> /// <param name="baseInterest">This interest may include a custom InterestLifetime and selectors that will propagate to all subsequent Interests. The only exception is that the initial Interest will be forced to include selectors "ChildSelector=1" and "MustBeFresh=true" which will be turned off in subsequent Interests.</param> /// <param name="verifySegment">and call onError.onError with ErrorCode.SEGMENT_VERIFICATION_FAILED. If data validation is not required, use DontVerifySegment. 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="onComplete">content of all the segments. 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="onError">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 static void fetch(Face face, Interest baseInterest, SegmentFetcher.VerifySegment verifySegment, SegmentFetcher.OnComplete onComplete, SegmentFetcher.OnError onError) { new SegmentFetcher(face, null, verifySegment, onComplete, onError) .fetchFirstSegment(baseInterest); }
/// <summary> /// Create a new SegmentFetcher to use the Face. See the static fetch method /// for details. If validatorKeyChain is not null, use it and ignore /// verifySegment. After creating the SegmentFetcher, call fetchFirstSegment. /// </summary> /// /// <param name="face">This calls face.expressInterest to fetch more segments.</param> /// <param name="validatorKeyChain"></param> /// <param name="verifySegment">and call onError.onError with ErrorCode.SEGMENT_VERIFICATION_FAILED.</param> /// <param name="onComplete">content of all the segments.</param> /// <param name="onError"></param> private SegmentFetcher(Face face, KeyChain validatorKeyChain, SegmentFetcher.VerifySegment verifySegment, SegmentFetcher.OnComplete onComplete, SegmentFetcher.OnError onError) { this.contentParts_ = new ArrayList(); face_ = face; validatorKeyChain_ = validatorKeyChain; verifySegment_ = verifySegment; onComplete_ = onComplete; onError_ = onError; }