Class IGMP

    • 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
    • Constructor Detail

      • IGMP

        public IGMP()
    • 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 class BasePacket
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object