Package org.onlab.packet
Class IGMP
- java.lang.Object
-
- org.onlab.packet.BasePacket
-
- org.onlab.packet.IGMP
-
- All Implemented Interfaces:
IPacket
- Direct Known Subclasses:
IGMP.IGMPv2
,IGMP.IGMPv3
public abstract class IGMP extends BasePacket
Implements IGMP control packet format.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
IGMP.IGMPv2
static class
IGMP.IGMPv3
-
Field Summary
Fields Modifier and Type Field Description protected short
checksum
protected byte
igmpType
protected byte
resField
static byte
TYPE_IGMPV1_MEMBERSHIP_REPORT
static byte
TYPE_IGMPV2_LEAVE_GROUP
static byte
TYPE_IGMPV2_MEMBERSHIP_REPORT
static byte
TYPE_IGMPV3_MEMBERSHIP_QUERY
static byte
TYPE_IGMPV3_MEMBERSHIP_REPORT
-
Fields inherited from class org.onlab.packet.BasePacket
parent, payload
-
-
Constructor Summary
Constructors Constructor Description IGMP()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
addGroup(IGMPGroup group)
Add a multicast group to this IGMP message.static Deserializer<IGMP>
deserializer()
Deserializer function for IPv4 packets.boolean
equals(java.lang.Object obj)
short
getChecksum()
Get the checksum of this message.java.util.List<IGMPGroup>
getGroups()
Get the list of IGMPGroups.byte
getIgmpType()
Get the IGMP message type.byte
getMaxRespField()
get the Max Resp Code.int
hashCode()
byte[]
serialize()
Serialize this IGMP packet.void
setIgmpType(byte msgType)
Set the IGMP message type.abstract void
setMaxRespCode(byte respCode)
Set the Max Resp Code.java.lang.String
toString()
protected abstract boolean
validChecksum()
Validates the message's checksum.-
Methods inherited from class org.onlab.packet.BasePacket
clone, getParent, getPayload, resetChecksum, setParent, setPayload
-
-
-
-
Field Detail
-
TYPE_IGMPV3_MEMBERSHIP_QUERY
public static final byte TYPE_IGMPV3_MEMBERSHIP_QUERY
- See Also:
- Constant Field Values
-
TYPE_IGMPV1_MEMBERSHIP_REPORT
public static final byte TYPE_IGMPV1_MEMBERSHIP_REPORT
- See Also:
- Constant Field Values
-
TYPE_IGMPV2_MEMBERSHIP_REPORT
public static final byte TYPE_IGMPV2_MEMBERSHIP_REPORT
- See Also:
- Constant Field Values
-
TYPE_IGMPV2_LEAVE_GROUP
public static final byte TYPE_IGMPV2_LEAVE_GROUP
- See Also:
- Constant Field Values
-
TYPE_IGMPV3_MEMBERSHIP_REPORT
public static final byte TYPE_IGMPV3_MEMBERSHIP_REPORT
- See Also:
- Constant Field Values
-
igmpType
protected byte igmpType
-
resField
protected byte resField
-
checksum
protected short checksum
-
-
Method Detail
-
getIgmpType
public byte getIgmpType()
Get the IGMP message type.- Returns:
- the IGMP message type
-
setIgmpType
public void setIgmpType(byte msgType)
Set the IGMP message type.- Parameters:
msgType
- IGMP message type
-
getChecksum
public short getChecksum()
Get the checksum of this message.- Returns:
- the checksum
-
getMaxRespField
public byte getMaxRespField()
get the Max Resp Code.- Returns:
- The Maximum Time allowed before before sending a responding report.
-
setMaxRespCode
public abstract void setMaxRespCode(byte respCode)
Set the Max Resp Code.- Parameters:
respCode
- the Maximum Response Code.
-
getGroups
public java.util.List<IGMPGroup> getGroups()
Get the list of IGMPGroups. The group objects will be either IGMPQuery or IGMPMembership depending on the IGMP message type. For IGMP Query, the groups list should only be one group.- Returns:
- The list of IGMP groups.
-
addGroup
public abstract boolean addGroup(IGMPGroup group)
Add a multicast group to this IGMP message.- Parameters:
group
- the IGMPGroup will be IGMPQuery or IGMPMembership depending on the message type.- Returns:
- true if group was valid and added, false otherwise.
-
serialize
public byte[] serialize()
Serialize this IGMP packet. This will take care of serializing IGMPv3 Queries and IGMPv3 Membership Reports.- Returns:
- the serialized IGMP message
-
deserializer
public static Deserializer<IGMP> deserializer()
Deserializer function for IPv4 packets.- Returns:
- deserializer function
-
validChecksum
protected abstract boolean validChecksum()
Validates the message's checksum.- Returns:
- true if valid, false if not
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classBasePacket
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classBasePacket
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-