Wireshark mailing list archives

Re: Determine address type of string


From: Jo <wireshark () rueschel de>
Date: Wed, 11 Nov 2015 09:49:53 +0100

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?

Bye,
Jo

2015-11-09 15:12 GMT+01:00 Maynard, Chris <Christopher.Maynard () igt com>:
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 () wireshark org [mailto:wireshark-dev-bounces () wireshark org] On Behalf Of Jo
Sent: Mon, November 09, 2015 4:14 AM
To: wireshark-dev () wireshark org
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 () wireshark org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?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 () wireshark org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: