This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

tvbuff_t* tvb_new_real_data()

0
void
tvb_set_real_data(tvbuff_t* tvb, const guint8* data, const guint length, const gint reported_length)

Hi all, could i use the above function to create a tvb by passing a packet in hex string into its parameters?

Thanks

Regards,

Eddie Choo

asked 04 Aug '11, 00:49

eddie%20choo's gravatar image

eddie choo
6691715
accept rate: 66%

edited 04 Aug '11, 16:14

helloworld's gravatar image

helloworld
3.1k42041

1
(04 Aug '11, 16:16) helloworld

Hi helloworld, i was thinking that i should open a new question because i wanted to be more specified in getting response only for this tvb_set_real_data function.Thanks

Eddie Choo

(04 Aug '11, 19:11) eddie choo

One Answer:

1

What do you mean by a "hex string"? Do you mean the ASCII hex representation of some 8 bit binary values, e.g. given the values 01, 66, 255, you have a string "0142FF"?

If so, it all depends on what the consumer of the tvb is expecting. If the consumer is expecting a hex string, all will be OK, if the consumer is expecting the binary values that the hex string represents then things won't go so well.

However if your "hex string" is in fact a pointer to the binary representation then you should be OK.

An example would help to clarify your question.

answered 04 Aug '11, 01:14

grahamb's gravatar image

grahamb ♦
19.8k330206
accept rate: 22%

Hi Graham, I wanted to use the wireshark dissectors to dissect the packet in hex string format, which is something like this: 03b1682daa0980030e160b12950012042618061003020812060012045649734162 3f4804ba1411b66b1e281c060700118605010101a011600f80020780a1090607040 000010 002036c17a115020100020103a30d040825054373236300f50a0100 I have now found a temporary solution, which is to explore deeper in the tvb_get_uintX() function and modified slightly so that it only deals with the real_data parameter of the tvb, in which i hope is in the hex format. Thanks for your reply

Eddie Choo

(04 Aug '11, 19:15) eddie choo