Ejemplo n.º 1
0
static PARCCryptoHash *
_computeContentObjectHash(const uint8_t *packet)
{
    assertNotNull(packet, "Parameter packet must be non-null");

    _MetisTlvFixedHeaderV1 *hdr = (_MetisTlvFixedHeaderV1 *) packet;
    if (hdr->packetType == METIS_PACKET_TYPE_CONTENT) {
        const size_t endHeaders = _totalHeaderLength(packet);
        const size_t endPacket = _totalPacketLength(packet);

        return _computeHash(packet, endHeaders, endPacket);
    }

    return NULL;
}
Ejemplo n.º 2
0
static PARCCryptoHash *
_computeContentObjectHash(const uint8_t *packet)
{
    assertNotNull(packet, "Parameter packet must be non-null");

    _MetisTlvFixedHeaderV0 *hdr = (_MetisTlvFixedHeaderV0 *) packet;
    if (hdr->packetType == METIS_PACKET_TYPE_CONTENT) {
        size_t headerLength = htons(hdr->headerLength);
        size_t endHeaders = FIXED_HEADER_LEN + headerLength;
        size_t endPacket = TotalPacketLength(hdr);

        return _computeHash(packet, endHeaders, endPacket);
    }

    return NULL;
}