ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

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

From: "Diaconou, Alex" <alex.diaconou@xxxxxxxx>
Date: Fri, 04 Jan 2008 12:32:56 -0700
Guy,

Thanks a lot for the help, I got it working how I needed!

Alex

-----Original Message-----
From: wireshark-dev-bounces@xxxxxxxxxxxxx
[mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of Guy Harris
Sent: Thursday, January 03, 2008 5:49 PM
To: Developer support list for Wireshark
Subject: Re: [Wireshark-dev] How to get Destination IP in plugin


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.
_______________________________________________
Wireshark-dev mailing list
Wireshark-dev@xxxxxxxxxxxxx
http://www.wireshark.org/mailman/listinfo/wireshark-dev