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: [email protected] 
[mailto:[email protected]] On Behalf Of Jo
Sent: Mon, November 09, 2015 4:14 AM
To: [email protected]
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 <[email protected]>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:[email protected]?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 <[email protected]>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:[email protected]?subject=unsubscribe

Reply via email to