"NetPacket::ICMPv6" - Assemble and disassemble ICMPv6 (Internet Control Message Protocol Version 6) packets. use NetPacket::ICMPv6; $icmp6_obj = NetPacket::ICMPv6->decode($raw_pkt); $icmp6_pkt = NetPacket::ICMPv6->encode($ip6_obj); $icmp6_data = NetPacket::ICMPv6::strip($raw_pkt); $cksum = $icmp6_obj->checksum($ip6_obj); "NetPacket::ICMPv6" provides a set of routines for assembling and disassembling ICMPv6 (Internet Control Message Protocol Version 6) packets.

Methods
Decode the raw packet data given and return an object containing instance data. This method will quite happily decode garbage input. It is the responsibility of the programmer to ensure valid packet data is passed to this method. Return an ICMPv6 packet encoded with the instance data specified. The "NetPacket::IPv6" object that the ICMPv6 packet was encapsulated in must be passed to encode() because some of the IPv6 header fields are used in the ICMPv6 checksum calculation. Calculate the ICMPv6 checksum based on the instance data of the "NetPacket::ICMPv6" object. The "NetPacket::IPv6" object that the ICMPv6 packet was/will be encapsulated in must be specified as some of the IPv6 header fields are used in the ICMPv6 calculation.

Functions
Return the encapsulated data (or payload) contained in the ICMPv6 packet.

Instance data
The instance data for the "NetPacket::ICMPv6" object consists of the following fields. The ICMPv6 message type of this packet. The ICMPv6 message code of this packet. The checksum for this packet. The encapsulated data (payload) for this packet.

Type-Specific Instance Data
Identification number used to match Echo Requests with Echo Replies. (Echo Request, Echo Reply) Sequence number used to match Echo Requests with Echo Replies. (Echo Request, Echo Reply) The Maximum Transmission Unit of the next-hop link. (Packet Too Big) Problem pointer. Identifies the location in the original packet where the problem was. (Parameter Problem) These ICMPv6 types contain an unused header field: Destination Unreachable, Time Exceeded.

Exports
none ICMPv6 message types: ICMPV6_DST_UNREACH ICMPV6_PACKET_TOO_BIG ICMPV6_TIME_EXCEEDED ICMPV6_PARAM_PROB ICMPV6_ECHO_REQUEST ICMPV6_ECHO_REPLY Strip function: icmpv6_strip The following tags group together related exportable items. Import the strip function "icmpv6_strip". Import the above ICMPv6 message types. All the above exportable items. The following example prints the ICMPv6 type, code, and checksum fields. #!/usr/bin/perl -w use strict; use Net::PcapUtils; use NetPacket::Ethernet qw(:strip); use NetPacket::IPv6 qw(:strip); use NetPacket::ICMPv6; sub process_pkt { my ($user, $hdr, $pkt) = @_; my $ip6_obj = NetPacket::IPv6->decode(eth_strip($pkt)); my $icmp6_obj = NetPacket::ICMPv6->decode(ipv6_strip($ip6_obj)); print("Type: $icmp6_obj->{type}\n"); print("Code: $icmp6_obj->{code}\n"); print("Checksum: $icmp6_obj->{cksum}\n\n"); } Net::PcapUtils::loop(\&process_pkt, FILTER => 'icmp6'); Nothing at this time. Copyright (c) 2003, 2004 Joel Knight <enabled@myrealbox.com> Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Joel Knight <enabled@myrealbox.com>