"NetPacket::IPv6" - Assembling and disassembling IPv6 (Internet Protocol Version 6) packets. use NetPacket::IPv6; $ip6_obj = NetPacket::IPv6->decode($raw_pkt); $ip6_pkt = NetPacket::IPv6->encode(); $ip6_data = NetPacket::IPv6::strip($raw_pkt); "NetPacket::IPv6" provides a set of routines for assembling and disassembling IPv6 (Internet 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 IPv6 packet encoded with the instance data specified. This will infer the packet length automatically from the payload length.

Functions
Return the encapsulated data (or payload) contained in the IPv6 packet. This data is suitable to be used as input for other "NetPacket::*" modules. This function is equivalent to creating an object using the "decode()" constructor and returning the "data" field of that object.

Instance data
The instance data for the "NetPacket::IPv6" object consists of the following fields. The IPv6 version number of this packet. This must always be 6. The IPv6 traffic class. The IPv6 flow label. The payload length. This is the length of the payload (data); it does not include the length of the packet header. The next header. This field identifies the type of header that follows the IPv6 header. It uses the same values as the IPv4 "protocol" header. The hop limit. Each router that handles the packet will decrement this field by 1. Once the field reaches 0, the packet is discarded. Similar to the "TTL" field in the IPv4 header. The source IPv6 address. The address is expressed as a colon-separated hex string. Leading zeros within the hex numbers are removed. The destination IPv6 address. The address is expressed as a colon-separated hex string. Leading zeros within the hex numbers are removed. The encapsulated data (payload).

Exports
none Protocols: IP_PROTO_IPV6 IP_PROTO_ICMPV6 IPv6 version number: IP_VERSION_IPv6 IPV6_VERSION Maximum IPv6 packet size: IPV6_MAXPACKET Strip function: ipv6_strip The following tags can be used to export certain items: IP_PROTO_IPV6 IP_PROTO_ICMPV6 IP_VERSION_IPv6 IPV6_VERSION The function "ipv6_strip" All the above exportable items The following prints the source and destination IPv6 address along with the value of the "next header" field. #!/usr/bin/perl -w use strict; use Net::PcapUtils; use NetPacket::Ethernet qw(:strip); use NetPacket::IPv6; sub process_pkt { my ($user, $hdr, $pkt) = @_; my $ip6_obj = NetPacket::IPv6->decode(eth_strip($pkt)); print("$ip6_obj->{src_ip} -> $ip6_obj->{dest_ip} "); print("$ip6_obj->{nxt}\n"); } Net::PcapUtils::loop(\&process_pkt, FILTER => 'ip6'); 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>