Wireshark-dev: Re: [Wireshark-dev] Determine address type of string
From: Alexis La Goutte <alexis.lagoutte@xxxxxxxxx>
Date: Fri, 27 Nov 2015 22:48:11 +0100


On Wed, Nov 11, 2015 at 9:49 AM, Jo <wireshark@xxxxxxxxxxx> wrote:
Hello Chris,

I really like this idea but IIRC not the complete API is exposed to
plugins and so str_to_ip and str_to_ip6 are not available in a
standard installation for plugins (they are not included in the
libwireshark.def file which I do not have on my windows development
machine anyway but these entries are missing from a libwireshark.def
file I found on the internet).

Do you have any idea where I can request these two functions to be
added to plugin API?
Only need to propose a patch on gerrit with export of 2 functions...

Cheers

Bye,
Jo

2015-11-09 15:12 GMT+01:00 Maynard, Chris <Christopher.Maynard@xxxxxxx>:
> You could first call str_to_ip() and if it fails, call str_to_ip6(), and if that too fails then assume it's a FQDN.  The str_to_ip() and str_to_ip6() functions are just wrappers for inet_pton(); they are declared in epan/addr_resolv.h.
>
> - Chris
>
> -----Original Message-----
> From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of Jo
> Sent: Mon, November 09, 2015 4:14 AM
> To: wireshark-dev@xxxxxxxxxxxxx
> Subject: [Wireshark-dev] Determine address type of string
>
> Hello,
>
> I am writing a custom dissector as a plugin. There I need to determine the address type of a string in a TLV. It can be either an IPv4 address, IPv6 address or a FQDN.
>
> What is the best way to parse this string into the Wireshark data types?
>
> My idea was to check which delimieters occur ("." -> IPv4, ":" ->
> IPv6) iand if there dots, to check whether the parts between the dots are numerical.
>
> Bye,
> Jo
> ___________________________________________________________________________
> Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
> Archives:    https://www.wireshark.org/lists/wireshark-dev
> Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
>              mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe
>
>
> --
>
>
>
> CONFIDENTIALITY NOTICE: This message is the property of International Game Technology PLC and/or its subsidiaries and may contain proprietary, confidential or trade secret information.  This message is intended solely for the use of the addressee.  If you are not the intended recipient and have received this message in error, please delete this message from your system. Any unauthorized reading, distribution, copying, or other use of this message or its attachments is strictly prohibited.
>
> ___________________________________________________________________________
> Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
> Archives:    https://www.wireshark.org/lists/wireshark-dev
> Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
>              mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe