Wireshark-dev: Re: [Wireshark-dev] 4bytes to IP number (string)
From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Thu, 28 Aug 2008 19:22:06 +0200
Hi,

That would be proto_tree_add_ipv4_format_value();

Thanx,
Jaap

Tom Stevens wrote:
That's it, Thank you very much!

Here the code:
{ &hf_my_proto_ip_address,
{ "IP Address", "my_proto.ip_address", FT_IPv4, BASE_NONE, NULL, 0x0,
         "My Proto_ip_address", HFILL }},
....

proto_tree_add_item( sub_tree, hf_my_proto_ip_address, tvb, offset, 4, FALSE );

Output:
IP Address: 172.19.0.242 <http://172.19.0.242> (172.19.0.242 <http://172.19.0.242>)

How can i get rid of the second output of the IP Address in the parentheses.

How can i get following output:
IP Address: 172.19.0.242 <http://172.19.0.242>

Greetings Tom(*Germany*)

2008/8/28 Anders Broman <a.broman@xxxxxxxxx <mailto:a.broman@xxxxxxxxx>>


To just add it to the tre use proto_tree_add_item() and use FT_IPv4

    ------------------------------------------------------------------------

    *Från:* wireshark-dev-bounces@xxxxxxxxxxxxx
    <mailto:wireshark-dev-bounces@xxxxxxxxxxxxx>
    [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx
    <mailto:wireshark-dev-bounces@xxxxxxxxxxxxx>] *För *Tom Stevens
    *Skickat:* den 28 augusti 2008 18:28
    *Till:* Wireshark-dev@xxxxxxxxxxxxx <mailto:Wireshark-dev@xxxxxxxxxxxxx>
    *Ämne:* [Wireshark-dev] 4bytes to IP number (string)

    Hi!


    Is there a built-in function that converts 4 bytes to a string,
    according to the generally accepted IP Notation?
    Example: C0 A8 D3 0D --->  192.168.211.13 <http://192.168.211.13>
    Or, do i have to write my own function? Although it's not tough, but
    why reinvent the wheel?

    Greetings Tom(Germany)