Wireshark-dev: Re: [Wireshark-dev] ipv6 address help
From: "Anders Broman" <a.broman@xxxxxxxxx>
Date: Tue, 26 Jan 2010 21:26:29 +0100
Hi, Why do you persist using the add_format versions they are to be used as exeptions when special formatting is required, just use ...add_item and use the apropriate FT_ type for the hf variable. There is plenty of code examples to look at. Anders -----Ursprungligt meddelande----- Från: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] För Brian Oleksa Skickat: den 26 januari 2010 20:58 Till: Developer support list for Wireshark Ämne: [Wireshark-dev] ipv6 address help Wiresharkers I was able to successfully dissect my ipv4 address by using the built in routines. guint32 addr; addr = tvb_get_ipv4(tvb,offset); proto_tree_add_ipv4_format_value(helen_sub_tree, hf_helen_ipv4, tvb, offset, 4, addr, "Address: %d.%d.%d.%d", addr & 0xff, (addr >> 8) & 0xff, (addr >> 16) & 0xff, addr >> 24); I am now trying to do the same for ipv6 addresses (unfortunately.. I do not have a way to test it)....but I would like to get the code in place. I have found the code in the wireshark developers readme file.... but not sure what to do with "struct e_in6_addr *addr" in the void tvb_get_ipv6 function. void tvb_get_ipv6(tvbuff_t*, gint offset, struct e_in6_addr *addr); proto_tree_add_ipv6_format_value... I have created a hf_helen_ipv6 routine here is what I have put together....but would like to use the built in wireshark routines: guint32 addr1, addr2, addr3, addr4; if (swap) { addr1 = swap32(addr1); addr2 = swap32(addr2); addr3 = swap32(addr3); addr4 = swap32(addr4); } proto_tree_add_uint_format(helen_sub_tree, hf_helen_length, tvb, offset, 16, 0, "Address: %d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d", addr1 >> 24, (addr1 >> 16) & 0xff, (addr1 >> 8) & 0xff, addr1 & 0xff, addr2 >> 24, (addr2 >> 16) & 0xff, (addr2 >> 8) & 0xff, addr2 & 0xff, addr3 >> 24, (addr3 >> 16) & 0xff, (addr3 >> 8) & 0xff, addr3 & 0xff, addr4 >> 24, (addr4 >> 16) & 0xff, (addr4 >> 8) & 0xff, addr4 & 0xff ); offset += 16; Any help is greatly appreciated. Thanks, Brian ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe
- References:
- [Wireshark-dev] ipv6 address help
- From: Brian Oleksa
- [Wireshark-dev] ipv6 address help
- Prev by Date: Re: [Wireshark-dev] ipv6 address help
- Next by Date: Re: [Wireshark-dev] ipv6 address help
- Previous by thread: Re: [Wireshark-dev] ipv6 address help
- Next by thread: [Wireshark-dev] New packetlist and Update list of packets in real time & autoscrolling
- Index(es):