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

Hello! I want to put the protocol information which is dissected by Wireshark into SQL Server. Now I am planning to add codes in the function of add_packet_to_packet_list in file.c. And the place to insert new codes is somewhere after the line of

    row = packet_list_append(cinfo, fdata, &edt.pi);

I have figured out that the row equals to the column number minus one. However, I could not print out the source address and destination address. The parameter &edt.pi is used to save the protocol tree information including the src address and dst address. And I have noticed that for the parameter edt.pi.dl_src.data, its type is const void *. How could I get the string type of source address from this parameter? I am very confused. So Would you like to help me make it out? Thank you very much!

asked 05 Jul '13, 00:36

constance's gravatar image

constance
10224
accept rate: 0%

edited 07 Jul '13, 11:00

Guy%20Harris's gravatar image

Guy Harris ♦♦
17.4k335196


Its type is const void * because it points to a blob of address-type-dependent binary data.

If you want a human-readable text form for the address, you would have to use one of the address_to_str functions declared in epan/to_str.h.

permanent link

answered 07 Jul '13, 10:58

Guy%20Harris's gravatar image

Guy Harris ♦♦
17.4k335196
accept rate: 19%

Thank you! I have solved this problem by printing out ip_to_str( (const guint8 *)edt.pi.net_src.data) if it's an IPV4 address.

(09 Jul '13, 21:19) constance
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:

×6
×5

question asked: 05 Jul '13, 00:36

question was seen: 1,326 times

last updated: 09 Jul '13, 21:19

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