本文整理汇总了C#中net.named_data.jndn.Interest.getMustBeFresh方法的典型用法代码示例。如果您正苦于以下问题:C# Interest.getMustBeFresh方法的具体用法?C# Interest.getMustBeFresh怎么用?C# Interest.getMustBeFresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.named_data.jndn.Interest
的用法示例。
在下文中一共展示了Interest.getMustBeFresh方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: encodeSelectors
/// <summary>
/// Encode the interest selectors. If no selectors are written, do not output
/// a Selectors TLV.
/// </summary>
///
private static void encodeSelectors(Interest interest, TlvEncoder encoder)
{
int saveLength = encoder.getLength();
// Encode backwards.
if (interest.getMustBeFresh())
encoder.writeTypeAndLength(net.named_data.jndn.encoding.tlv.Tlv.MustBeFresh, 0);
encoder.writeOptionalNonNegativeIntegerTlv(net.named_data.jndn.encoding.tlv.Tlv.ChildSelector,
interest.getChildSelector());
if (interest.getExclude().size() > 0)
encodeExclude(interest.getExclude(), encoder);
if (interest.getKeyLocator().getType() != net.named_data.jndn.KeyLocatorType.NONE)
encodeKeyLocator(net.named_data.jndn.encoding.tlv.Tlv.PublisherPublicKeyLocator,
interest.getKeyLocator(), encoder);
encoder.writeOptionalNonNegativeIntegerTlv(net.named_data.jndn.encoding.tlv.Tlv.MaxSuffixComponents,
interest.getMaxSuffixComponents());
encoder.writeOptionalNonNegativeIntegerTlv(net.named_data.jndn.encoding.tlv.Tlv.MinSuffixComponents,
interest.getMinSuffixComponents());
// Only output the type and length if values were written.
if (encoder.getLength() != saveLength)
encoder.writeTypeAndLength(net.named_data.jndn.encoding.tlv.Tlv.Selectors, encoder.getLength()
- saveLength);
}
示例2: dumpInterest
static void dumpInterest(Interest interest)
{
Console.Out.WriteLine("name: " + interest.getName().toUri());
Console.Out.WriteLine("minSuffixComponents: " +
(interest.getMinSuffixComponents() >= 0 ?
"" + interest.getMinSuffixComponents() : "<none>"));
Console.Out.WriteLine("maxSuffixComponents: " +
(interest.getMaxSuffixComponents() >= 0 ?
"" + interest.getMaxSuffixComponents() : "<none>"));
Console.Out.Write("keyLocator: ");
if (interest.getKeyLocator().getType() == KeyLocatorType.NONE)
Console.Out.WriteLine("<none>");
else if (interest.getKeyLocator().getType() ==KeyLocatorType.KEY_LOCATOR_DIGEST)
Console.Out.WriteLine("KeyLocatorDigest: " + interest.getKeyLocator().getKeyData().toHex());
else if (interest.getKeyLocator().getType() == KeyLocatorType.KEYNAME)
Console.Out.WriteLine("KeyName: " + interest.getKeyLocator().getKeyName().toUri());
else
Console.Out.WriteLine("<unrecognized ndn_KeyLocatorType>");
Console.Out.WriteLine
("exclude: " + (interest.getExclude().size() > 0 ?
interest.getExclude().toUri() : "<none>"));
Console.Out.WriteLine("lifetimeMilliseconds: " +
(interest.getInterestLifetimeMilliseconds() >= 0 ?
"" + interest.getInterestLifetimeMilliseconds() : "<none>"));
Console.Out.WriteLine("childSelector: " +
(interest.getChildSelector() >= 0 ?
"" + interest.getChildSelector() : "<none>"));
Console.Out.WriteLine("mustBeFresh: " + interest.getMustBeFresh());
Console.Out.WriteLine("nonce: " +
(interest.getNonce().size() > 0 ?
"" + interest.getNonce().toHex() : "<none>"));
}
示例3: 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;
}