Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] How to get Destination IP in plugin

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Thu, 3 Jan 2008 17:49:11 -0800

On Jan 3, 2008, at 4:08 PM, Diaconou, Alex wrote:

What about extracting the column info?

That's not a supported feature; the data in the address columns is generated from pinfo->{dl_src,net_src,src} and pinfo->{dl_dst,net_dst, dst}.

Can I get the IP address as a
string from the SOURCe or DESTINATION column of the packet(s) in
question?

No, but you can get the address as a binary value from pinfo- >{src,dst} and then convert it to a string using ip_to_str() or ip_to_str_buf() for IPv4 addresses and ip6_to_str() or ip6_to_str_buf() for IPv6 addresses (or address_to_str() or address_to_str_buf() if you have an address structure and want to handle all possible address types). The expectation is that the address-as-a-string would be used only for stuff to be shown directly to users, and that a dissector would do all the other work with binary addresses.