hi everyone, What is the exact role of function "tvb_get_ntohs" , if we write : ch1 = tvb_get_ntohs(tvb, 0); ch2 = tvb_get_ntohs(tvb, 2); what does it mean exactly , i know that the tvb is buffer where our data is recorded, but the second element is an offset , What's that? and what does it mean this offset. Thank you. asked 04 Jul '13, 10:07 cruz |
One Answer:
The offset parameter is the offset into the buffer to get the value from, counting from 0. In your example, ch1 is set to the 16 bit value at offset 0 in the buffer and ch2 is set to the 16 bit value at offset 2 in the buffer. The ntohs part specifies that the data value in the buffer is in network order (big-endian) and it will be converted to the correct order for the host that the software is running on. answered 04 Jul '13, 13:41 grahamb ♦ edited 04 Jul '13, 13:43 |