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 classIGMP.IGMPv2static classIGMP.IGMPv3
-
Field Summary
Fields Modifier and Type Field Description protected shortchecksumprotected byteigmpTypeprotected byteresFieldstatic byteTYPE_IGMPV1_MEMBERSHIP_REPORTstatic byteTYPE_IGMPV2_LEAVE_GROUPstatic byteTYPE_IGMPV2_MEMBERSHIP_REPORTstatic byteTYPE_IGMPV3_MEMBERSHIP_QUERYstatic byteTYPE_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 booleanaddGroup(IGMPGroup group)Add a multicast group to this IGMP message.static Deserializer<IGMP>deserializer()Deserializer function for IPv4 packets.booleanequals(java.lang.Object obj)shortgetChecksum()Get the checksum of this message.java.util.List<IGMPGroup>getGroups()Get the list of IGMPGroups.bytegetIgmpType()Get the IGMP message type.bytegetMaxRespField()get the Max Resp Code.inthashCode()byte[]serialize()Serialize this IGMP packet.voidsetIgmpType(byte msgType)Set the IGMP message type.abstract voidsetMaxRespCode(byte respCode)Set the Max Resp Code.java.lang.StringtoString()protected abstract booleanvalidChecksum()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:
equalsin classBasePacket
-
hashCode
public int hashCode()
- Overrides:
hashCodein classBasePacket
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-