1NetPacket::IGMP(3) User Contributed Perl Documentation NetPacket::IGMP(3)
2
3
4
6 NetPacket::IGMP - Assemble and disassemble IGMP (Internet Group
7 Management Protocol) packets.
8
10 version 1.7.2
11
13 use NetPacket::IGMP;
14
15 $igmp_obj = NetPacket::IGMP->decode($raw_pkt);
16 $igmp_pkt = NetPacket::IGMP->encode(params...); # Not implemented
17 $igmp_data = NetPacket::IGMP::strip($raw_pkt);
18
20 "NetPacket::IGMP" provides a set of routines for assembling and
21 disassembling packets using IGMP (Internet Group Management Protocol).
22
23 Methods
24 "NetPacket::IGMP->decode([RAW PACKET])"
25 Decode the raw packet data given and return an object containing
26 instance data. This method will quite happily decode garbage
27 input. It is the responsibility of the programmer to ensure valid
28 packet data is passed to this method.
29
30 "NetPacket::IGMP->encode(param => value)"
31 Return an IGMP packet encoded with the instance data specified.
32 Not implemented.
33
34 Functions
35 "NetPacket::IGMP::strip([RAW PACKET])"
36 Return the encapsulated data (or payload) contained in the IGMP
37 packet. This function returns undef as there is no encapsulated
38 data in an IGMP packet.
39
40 Instance data
41 The instance data for the "NetPacket::IGMP" object consists of the
42 following fields.
43
44 version
45 The IGMP version of this packet.
46
47 type
48 The message type for this packet.
49
50 len The length (including length of header) in bytes for this packet.
51
52 subtype
53 The message subtype for this packet.
54
55 cksum
56 The checksum for this packet.
57
58 group_addr
59 The group address specified in this packet.
60
61 data
62 The encapsulated data (payload) for this packet.
63
64 Exports
65 default
66 none
67
68 exportable
69 IGMP_VERSION_RFC998 IGMP_VERSION_RFC1112 IGMP_HOST_MQUERY
70 IGMP_HOST_MREPORT IGMP_IP_NO_HOSTS IGMP_IP_ALL_HOSTS
71 IGMP_IP_ALL_ROUTERS
72
73 tags
74 The following tags group together related exportable items.
75
76 ":strip"
77 Import the strip function "igmp_strip".
78
79 ":versions"
80 IGMP_VERSION_RFC998 IGMP_VERSION_RFC1112
81
82 ":msgtypes"
83 IGMP_HOST_MQUERY IGMP_HOST_MREPORT
84
85 ":group_addrs"
86 IGMP_IP_NO_HOSTS IGMP_IP_ALL_HOSTS IGMP_IP_ALL_ROUTERS
87
88 ":ALL"
89 All the above exportable items.
90
92 The following script dumps UDP frames by IP address and UDP port to
93 standard output.
94
95 #!/usr/bin/perl -w
96
97 use strict;
98 use Net::PcapUtils;
99 use NetPacket::Ethernet qw(:strip);
100 use NetPacket::IP;
101 use NetPacket::IGMP;
102
103 sub process_pkt {
104 my($arg, $hdr, $pkt) = @_;
105
106 my $ip_obj = NetPacket::IP->decode(eth_strip($pkt));
107 my $igmp_obj = NetPacket::IGMP->decode($ip_obj->{data});
108
109 print("$ip_obj->{src_ip} -> $ip_obj->{dest_ip} ",
110 "$igmp_obj->{type}/$igmp_obj->{subtype} ",
111 "$igmp_obj->{group_addr}\n");
112 }
113
114 Net::PcapUtils::loop(\&process_pkt, FILTER => 'igmp');
115
117 Implement encode() function
118
120 Copyright (c) 2001 Tim Potter.
121
122 Copyright (c) 1995,1996,1997,1998,1999 ANU and CSIRO on behalf of the
123 participants in the CRC for Advanced Computational Systems ('ACSys').
124
125 This module is free software. You can redistribute it and/or modify it
126 under the terms of the Artistic License 2.0.
127
128 This program is distributed in the hope that it will be useful, but
129 without any warranty; without even the implied warranty of
130 merchantability or fitness for a particular purpose.
131
133 Tim Potter <tpot@samba.org>
134
135
136
137perl v5.32.0 2020-07-28 NetPacket::IGMP(3)