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

I want to get the PDUs length, I think it is found here:

tvbuff_t *tvb -> length

or

packet_info *pinfo -> gssapi_decrypted_tvb -> length

But when I compile, I get an error from the compiler:

error C2037: left of 'length' specifies undefined struct/union 'tvbuff'

Does someone know what it is?

member "length" exists. you can see it here.

Thanks

asked 03 Jul '13, 06:27

hudac's gravatar image

hudac
61111317
accept rate: 50%


The length member is "private", to get the length use the function tvb_length() on a tvb pointer. Careful though, the tvb may not contain all the data expected for a PDU, e.g. because the capture was made with a small snaplen.

Also note the correct reference for Wireshark source code would be the actual Wireshark repository which can be found here.

permanent link

answered 03 Jul '13, 06:41

grahamb's gravatar image

grahamb ♦
19.8k330206
accept rate: 22%

I want to get the PDUs length, I think it is found here:

tvbuff_t *tvb -> length

Remember, many capture programs, including Wireshark/TShark/dumpcap, tcpdump, and a number of other sniffers, let you limit the number of bytes captured and saved, so that if the snapshot length is N, and the packet is M bytes long, where M > N, only the first N bytes of the packet will be captured.

So if you want the actual packet length, rather than the number of bytes of the packet that happen to have been captured, you want reported_length, and you get that by calling tvb_reported_length().

permanent link

answered 03 Jul '13, 11:43

Guy%20Harris's gravatar image

Guy Harris ♦♦
17.4k335196
accept rate: 19%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×1,620
×752
×637
×12
×8

question asked: 03 Jul '13, 06:27

question was seen: 3,976 times

last updated: 03 Jul '13, 11:43

p​o​w​e​r​e​d by O​S​Q​A