Add Basic Encoding Rules (BER) to Data Inspector

Wishlists for new functionality and features.
Post Reply
Posts: 3
Joined: 01 Jun 2016 20:03

Add Basic Encoding Rules (BER) to Data Inspector

Post by akrutsinger »

There are many types of encoding that would be nice to have in the data inspector and it obviously doesn't make sense to add them all within the Data Inspector frame. With that said, perhaps a scripting / plugin capability would enhance this? If not a plugin/scripting capability, the below code would help facilitate the quick decoding of BER.

Code: Select all

static uint64_t get_ber_length(uint8_t *p)
    uint64_t size = *p++;
    if (size & 0x80) { /* long form */
        int bytes_num = size & 0x7f;
        /* Different implementations might have different uses for BER. */
        /* KLV data from UAV's for example follow 379M standards */
        /* SMPTE 379M 5.3.4 guarantee that bytes_num must not exceed 8 bytes */
        if (bytes_num > 8)
            return 0xFF;
        size = 0;
        /* should probably include a check that byte_num doesn't put us past the end of the file/data */
        while (bytes_num--)
            size = size << 8 | *p++;
    return size;

Post Reply