Class ZrtpRawPacket

  • All Implemented Interfaces:
    org.jitsi.utils.ByteArrayBuffer

    public class ZrtpRawPacket
    extends RawPacket
    ZRTP packet representation. This class extends the RawPacket class and adds some methods required by the ZRTP transformer.
    Author:
    Werner Dittmann <Werner.Dittmann@t-online.de>
    • Field Detail

      • ZRTP_MAGIC

        public static final byte[] ZRTP_MAGIC
        Each ZRTP packet contains this magic number/cookie.
    • Constructor Detail

      • ZrtpRawPacket

        public ZrtpRawPacket​(RawPacket pkt)
        Construct an input ZrtpRawPacket using a received RTP raw packet.
        Parameters:
        pkt - a raw RTP packet as received
      • ZrtpRawPacket

        public ZrtpRawPacket​(byte[] buf,
                             int off,
                             int len)
        Construct an output ZrtpRawPacket using specified value. Initialize this packet and set the ZRTP magic value to mark it as a ZRTP packet.
        Parameters:
        buf - Byte array holding the content of this Packet
        off - Start offset of packet content inside buffer
        len - Length of the packet's data
    • Method Detail

      • isZrtpPacket

        protected boolean isZrtpPacket()
        Check if it could be a ZRTP packet. The method checks if the first byte of the received data matches the defined ZRTP pattern 0x10
        Returns:
        true if could be a ZRTP packet, false otherwise.
      • hasMagic

        protected boolean hasMagic()
        Check if it is really a ZRTP packet. The method checks if the packet contains the ZRTP magic number.
        Returns:
        true if packet contains the magic number, false otherwise.
      • setSeqNum

        protected void setSeqNum​(short seq)
        Set the sequence number in this packet.
        Parameters:
        seq - sequence number
      • checkCrc

        protected boolean checkCrc()
        Check if the CRC of this packet is ok.
        Returns:
        true if the CRC is valid, false otherwise
      • setCrc

        protected void setCrc()
        Set ZRTP CRC in this packet