/// <summary> /// Create a new Interest with the given name and interest lifetime and "none" /// for other values. /// </summary> /// /// <param name="name">The name for the interest.</param> /// <param name="interestLifetimeMilliseconds"></param> public Interest(Name name, double interestLifetimeMilliseconds) { 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; if (name != null) name_.set(new Name(name)); interestLifetimeMilliseconds_ = interestLifetimeMilliseconds; }
/// <summary> /// Create a new HmacWithSha256Signature with default values. /// </summary> /// public HmacWithSha256Signature() { this.signature_ = new Blob(); this.keyLocator_ = new ChangeCounter( new KeyLocator()); this.changeCount_ = 0; }
/// <summary> /// Create a new KeyLocator with default values. /// </summary> /// public KeyLocator() { this.type_ = net.named_data.jndn.KeyLocatorType.NONE; this.keyData_ = new Blob(); this.keyName_ = new ChangeCounter(new Name()); this.changeCount_ = 0; }
/// <summary> /// Create a new HmacWithSha256Signature with a copy of the fields in the given /// signature object. /// </summary> /// /// <param name="signature">The signature object to copy.</param> public HmacWithSha256Signature(HmacWithSha256Signature signature) { this.signature_ = new Blob(); this.keyLocator_ = new ChangeCounter( new KeyLocator()); this.changeCount_ = 0; signature_ = signature.signature_; keyLocator_.set(new KeyLocator(signature.getKeyLocator())); }
/// <summary> /// Create a new Sha256WithEcdsaSignature with default values. /// </summary> /// public Sha256WithEcdsaSignature() { this.signature_ = new Blob(); this.keyLocator_ = new ChangeCounter( new KeyLocator()); this.validityPeriod_ = new ChangeCounter( new ValidityPeriod()); this.changeCount_ = 0; }
/// <summary> /// Create a new KeyLocator with a copy of the fields in keyLocator. /// </summary> /// /// <param name="keyLocator">The KeyLocator to copy.</param> public KeyLocator(KeyLocator keyLocator) { this.type_ = net.named_data.jndn.KeyLocatorType.NONE; this.keyData_ = new Blob(); this.keyName_ = new ChangeCounter(new Name()); this.changeCount_ = 0; type_ = keyLocator.type_; keyData_ = keyLocator.keyData_; keyName_.set(new Name(keyLocator.getKeyName())); }
/// <summary> /// Create a new Sha256WithEcdsaSignature with a copy of the fields in the given /// signature object. /// </summary> /// /// <param name="signature">The signature object to copy.</param> public Sha256WithEcdsaSignature(Sha256WithEcdsaSignature signature) { this.signature_ = new Blob(); this.keyLocator_ = new ChangeCounter( new KeyLocator()); this.validityPeriod_ = new ChangeCounter( new ValidityPeriod()); this.changeCount_ = 0; signature_ = signature.signature_; keyLocator_.set(new KeyLocator(signature.getKeyLocator())); }
/// <summary> /// Create a new Data object with default values and where the signature is a /// blank Sha256WithRsaSignature. /// </summary> /// public Data() { this.signature_ = new ChangeCounter( new Sha256WithRsaSignature()); this.name_ = new ChangeCounter(new Name()); this.metaInfo_ = new ChangeCounter(new MetaInfo()); this.content_ = new Blob(); this.lpPacket_ = null; this.defaultWireEncoding_ = new SignedBlob(); this.defaultFullName_ = new Name(); this.getDefaultWireEncodingChangeCount_ = 0; this.changeCount_ = 0; }
/// <summary> /// Create a deep copy of the given data object, including a clone of the /// signature object. /// </summary> /// /// <param name="data">The data object to copy.</param> public Data(Data data) { this.signature_ = new ChangeCounter( new Sha256WithRsaSignature()); this.name_ = new ChangeCounter(new Name()); this.metaInfo_ = new ChangeCounter(new MetaInfo()); this.content_ = new Blob(); this.lpPacket_ = null; this.defaultWireEncoding_ = new SignedBlob(); this.defaultFullName_ = new Name(); this.getDefaultWireEncodingChangeCount_ = 0; this.changeCount_ = 0; try { signature_ .set((data.signature_ == null) ? (net.named_data.jndn.util.ChangeCountable) (new Sha256WithRsaSignature()) : (net.named_data.jndn.util.ChangeCountable) ((Signature) data.getSignature().Clone())); } catch (Exception e) { // We don't expect this to happen, so just treat it as if we got a null pointer. throw new NullReferenceException( "Data.setSignature: unexpected exception in clone(): " + e.Message); } name_.set(new Name(data.getName())); metaInfo_.set(new MetaInfo(data.getMetaInfo())); content_ = data.content_; setDefaultWireEncoding(data.defaultWireEncoding_, null); }
/// <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_); }