parseMaxPDU(DUL_MAXLENGTH * max, unsigned char *buf,
            unsigned long *itemLength, unsigned long availData)
{
    // We want to read 8 bytes of data, is there enough data?
    if (availData < 8)
        return makeLengthError("Max PDU", availData, 8);

    max->type = *buf++;
    max->rsv1 = *buf++;
    EXTRACT_SHORT_BIG(buf, max->length);
    buf += 2;
    EXTRACT_LONG_BIG(buf, max->maxLength);
    *itemLength = 2 + 2 + max->length;

    if (max->length != 4)
        DCMNET_WARN("Invalid length (" << max->length << ") for maximum length item, must be 4");

    // Is there less data than the length field claims there is?
    if (availData - 4 < max->length)
        return makeLengthError("Max PDU", availData, 0, max->length);

    DCMNET_TRACE("Maximum PDU Length: " << (unsigned long)max->maxLength);

    return EC_Normal;
}
parseMaxPDU(DUL_MAXLENGTH * max, unsigned char *buf,
            unsigned long *itemLength, unsigned long availData)
{
     
    if (availData < 8)
        return makeLengthError("Max PDU", availData, 8);

    max->type = *buf++;
    max->rsv1 = *buf++;
    EXTRACT_SHORT_BIG(buf, max->length);
    buf += 2;
    EXTRACT_LONG_BIG(buf, max->maxLength);
    *itemLength = 2 + 2 + max->length;

    if (max->length != 4)
        DCMNET_WARN("Invalid length (" << max->length << ") for maximum length item, must be 4");

     
    if (availData - 4 < max->length)
        return makeLengthError("Max PDU", availData, 0, max->length);

    DCMNET_TRACE("Maximum PDU Length: " << (unsigned long)max->maxLength);

    return EC_Normal;
}