Some binary protocols have nullable types, fields that are valid for all values but a single sentinel value which signifies that this field exists on the wire but is unused for this specific packet. A common example would be a single byte quantity field that was not valid if the wire value was 255. Is there any simple, standard built in functionality to display the regular value in cases where it exists and something like No Value (255) in cases where the field contains the sentinel value?
This brute force example source prints “Quantity: 255 [No value]” but I am wondering if there is some built in function like the value mask. I tried a value mask of {[255]=“No Value”} but this mask prints unknown on regular values. Thoughts? asked 12 Oct ‘16, 08:47 william edited 16 Oct ‘16, 13:35 Lekensteyn |
One Answer:
No this is not possible, you have to explicitly check for the value. When you specify a mask, then you must specify all possible values or else these will show up as Unknown as you have observed. Checking for answered 16 Oct '16, 13:38 Lekensteyn |