Attention is currently required from: falconia.
pespin has posted comments on this change by falconia. ( https://gerrit.osmocom.org/c/libosmo-abis/+/39626?usp=email )
Change subject: rtp2trau HR to DL: validate ToC octet of RFC 5993 ......................................................................
Patch Set 1:
(1 comment)
File src/trau/trau_rtp_conv.c:
https://gerrit.osmocom.org/c/libosmo-abis/+/39626/comment/63160a5f_43132f69?... : PS1, Line 671: if (data[0] & 0xD0)
The objective is to accept 0x00 or 0x20 and no others in the upper nibble, while accepting anything […]
well, the purpose precisely is that I don't have to look at the exact structure of that byte each time I'm checking this code.
But if it makes it a lot easier then fine. Maybe adding a quick reference to the byte structure in the comment would be enough. I would at least add a reference to the specific section of RFC 5993 where I could fine the byte structure.
Something like (again I didn't really look at the structure):
#define RFC_5993_HDR_F_BITMASK (0x01 << 3) #define RFC_5993_HDR_FT_BITMASK (0x0f << 4) #define RFC_5993_HDR_FT(num) (num << 5)
if (data[0] & RFC_5993_HDR_F_BITMASK) return -EINVAL; if ((data[0] & RFC_5993_HDR_FT_BITMASK) != RFC_5993_HDR_FT(0) || (data[0] & RFC_5993_HDR_FT_BITMASK) != RFC_5993_HDR_FT(2)) return -EINVAL;
This are just suggestions, feel free to improve as you see.