MetaInfo Class

The MetaInfo class is used by Data and represents the fields of an NDN MetaInfo. The MetaInfo type specifies the type of the content in the Data packet (usually BLOB).

[C++]:
#include <ndn-cpp/meta-info.hpp>
Namespace: ndn
[Python]:Module: pyndn
[Java]:Package: net.named_data.jndn

MetaInfo Constructors

MetaInfo Constructor (default)

Create a new MetaInfo where type is the default value BLOB.

[C++]:
MetaInfo();
[Python]:
def __init__(self)
[JavaScript]:
var MetaInfo = function MetaInfo()
[Java]:
public MetaInfo()

MetaInfo Constructor (copy)

Create a new MetaInfo as a deep copy of the given metaInfo.

[C++]:
MetaInfo(
    const MetaInfo& metaInfo
);
[Python]:
def __init__(self,
    metaInfo  # MetaInfo
)
[JavaScript]:
var MetaInfo = function MetaInfo(
    metaInfo  // MetaInfo
)
[Java]:
public MetaInfo(
    MetaInfo metaInfo
)
Parameters:
  • metaInfo
    The MetaInfo to copy.

MetaInfo Get Methods

MetaInfo.getFinalBlockId Method

Get the final block ID.

[C++]:
const Name::Component& getFinalBlockId() const;
[Python]:
# Returns Name.Component
def getFinalBlockId(self)
[JavaScript]:
// Returns Name.Component
MetaInfo.prototype.getFinalBlockId = function()
[Java]:
public final Name.Component getFinalBlockId()
Returns:

The final block ID as a Name.Component. If the Name.Component getValue().size() is 0, then the final block ID is not specified.

MetaInfo.getFreshnessPeriod Method

Get the data packet freshness period.

[C++]:
Milliseconds getFreshnessPeriod() const;
[Python]:
# Returns float
def getFreshnessPeriod(self)
[JavaScript]:
// Returns number
MetaInfo.prototype.getFreshnessPeriod = function()
[Java]:
public final double getFreshnessPeriod()
Returns:

The freshness period in milliseconds. If not specified, return -1 (C++ and Java) or None (Python) or undefined (JavaScript).

MetaInfo.getOtherTypeCode Method

Get the content type code from the packet which is other than a recognized ContentType enum value. This is only meaningful if getType() is OTHER_CODE.

[C++]:
int getOtherTypeCode() const;
[Python]:
# Returns int
def getOtherTypeCode(self)
[JavaScript]:
// Returns number
MetaInfo.prototype.getOtherTypeCode = function()
[Java]:
public final int getOtherTypeCode()
Returns:

The type code.

MetaInfo.getType Method

Get the content type.

[C++]:
ndn_ContentType getType() const;
[Python]:
# Returns int
def getType(self)
[JavaScript]:
// Returns number
MetaInfo.prototype.getType = function()
[Java]:
public final ContentType getType()
Returns:

The content type enum value which is BLOB, LINK, KEY, NACK, or OTHER_CODE as follows. If this is OTHER_CODE, then call getOtherTypeCode() to get the unrecognized content type code.

  • C++: ndn_ContentType_BLOB, ndn_ContentType_LINK, ndn_ContentType_KEY, ndn_ContentType_NACK or ndn_ContentType_OTHER_CODE
  • Python: ContentType.BLOB, ContentType.LINK, ContentType.KEY, ContentType.NACK or ContentType.OTHER_CODE
  • JavaScript: ContentType.BLOB, ContentType.LINK, ContentType.KEY, ContentType.NACK or ContentType.OTHER_CODE
  • Java: ContentType.BLOB, ContentType.LINK, ContentType.KEY, ContentType.NACK or ContentType.OTHER_CODE

MetaInfo Set Methods

MetaInfo.setFinalBlockId Method

Set the final block ID.

[C++]:
void setFinalBlockId(
    const Name::Component& finalBlockId
);
[Python]:
def setFinalBlockId(self,
    finalBlockId  # Name.Component
)
[JavaScript]:
MetaInfo.prototype.setFinalBlockId = function(
    finalBlockId  // Name.Component
)
[Java]:
public final void setFinalBlockId(
    Name.Component finalBlockId
)
Parameters:
  • finalBlockId
    The final block ID as a Name.Component. If not specified, set to a new default Name.Component(), or to a Name.Component where getValue().size() is 0.

MetaInfo.setFreshnessPeriod Method

Set the freshness period.

[C++]:
void setFreshnessPeriod(
    Milliseconds freshnessPeriod
);
[Python]:
def setFreshnessPeriod(self,
    freshnessPeriod  # float
)
[JavaScript]:
MetaInfo.prototype.setFreshnessPeriod = function(
    freshnessPeriod  // number
)
[Java]:
public final void setFreshnessPeriod(
    double freshnessPeriod
)
Parameters:
  • freshnessPeriod
    The freshness period in milliseconds. If not specified, set to -1 (C++ and Java) or None (Python) or undefined (JavaScript).

MetaInfo.setOtherTypeCode Method

Set the packet’s content type code to use when the content type enum is OTHER_CODE. If the packet’s content type code is a recognized enum value, just call setType().

[C++]:
void setOtherTypeCode(
    int otherTypeCode
);
[Python]:
def setOtherTypeCode(self,
    otherTypeCode  # int
)
[JavaScript]:
MetaInfo.prototype.setOtherTypeCode = function(
    otherTypeCode  // number
)
[Java]:
public final void setOtherTypeCode(
    int otherTypeCode
)
Parameters:
  • otherTypeCode

    The packet’s unrecognized content type code, which must be non-negative.

MetaInfo.setType Method

Set the content type.

[C++]:
void setType(
    ndn_ContentType type
);
[Python]:
def setType(self,
    type  # int
)
[JavaScript]:
MetaInfo.prototype.setType = function(
    type  // number
)
[Java]:
public final void setType(
    ContentType type
)
Parameters:
  • type

    The content type enum value which is BLOB, LINK, KEY or NACK as follows. If the packet’s content type is not a recognized ContentType enum value, use OTHER_CODE and call setOtherTypeCode().

    • C++: ndn_ContentType_BLOB, ndn_ContentType_LINK, ndn_ContentType_KEY, ndn_ContentType_NACK or ndn_ContentType_OTHER_CODE
    • Python: ContentType.BLOB, ContentType.LINK, ContentType.KEY, ContentType.NACK or ContentType.OTHER_CODE
    • JavaScript: ContentType.BLOB, ContentType.LINK, ContentType.KEY, ContentType.NACK or ContentType.OTHER_CODE
    • Java: ContentType.BLOB, ContentType.LINK, ContentType.KEY, ContentType.NACK or ContentType.OTHER_CODE