Package gnu.java.zrtp.packets
Class ZrtpPacketBase
- java.lang.Object
-
- gnu.java.zrtp.packets.ZrtpPacketBase
-
- Direct Known Subclasses:
ZrtpPacketCommit,ZrtpPacketConf2Ack,ZrtpPacketConfirm,ZrtpPacketDHPart,ZrtpPacketError,ZrtpPacketErrorAck,ZrtpPacketHello,ZrtpPacketHelloAck,ZrtpPacketPing,ZrtpPacketPingAck,ZrtpPacketRelayAck,ZrtpPacketSASRelay
public class ZrtpPacketBase extends Object
This is the base class for all ZRTP packets All other ZRTP packet classes inherit from this class. It does not have an implementation of its own.- Author:
- Werner Dittmann <Werner.Dittmann@t-online.de>
-
-
Field Summary
Fields Modifier and Type Field Description static intCLIENT_ID_SIZEstatic intCRC_SIZEThe size of the ZRTP specific CRC field.static intHASH_IMAGE_SIZEstatic intHMAC_SIZEstatic intHVI_SIZEprotected byte[]packetBufferstatic intZID_SIZEprotected static intZRTP_HEADER_LENGTHThe length of the standard ZRTP packet headerstatic intZRTP_WORD_SIZEA word in ZRTP is 4 bytes long.
-
Constructor Summary
Constructors Modifier Constructor Description protectedZrtpPacketBase(byte[] pb)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getHeaderBase()shortgetLength()StringgetMessageType()booleanisZrtpPacket()Check if packet buffer contains the generic ZRTP id field.protected voidsetLength(int length)Set the length of the packet (in ZRTP words) into the packet header.voidsetMessageType(byte[] messageType)Copy the message type to the ZRTP packet header.protected voidsetZrtpId()Copy the unique ZRTP id into the ZRTP packer header
-
-
-
Field Detail
-
ZRTP_WORD_SIZE
public static final int ZRTP_WORD_SIZE
A word in ZRTP is 4 bytes long.- See Also:
- Constant Field Values
-
ZID_SIZE
public static final int ZID_SIZE
- See Also:
- Constant Field Values
-
CLIENT_ID_SIZE
public static final int CLIENT_ID_SIZE
- See Also:
- Constant Field Values
-
HASH_IMAGE_SIZE
public static final int HASH_IMAGE_SIZE
- See Also:
- Constant Field Values
-
HVI_SIZE
public static final int HVI_SIZE
- See Also:
- Constant Field Values
-
HMAC_SIZE
public static final int HMAC_SIZE
- See Also:
- Constant Field Values
-
CRC_SIZE
public static final int CRC_SIZE
The size of the ZRTP specific CRC field.- See Also:
- Constant Field Values
-
ZRTP_HEADER_LENGTH
protected static final int ZRTP_HEADER_LENGTH
The length of the standard ZRTP packet header- See Also:
- Constant Field Values
-
packetBuffer
protected byte[] packetBuffer
-
-
Method Detail
-
getHeaderBase
public final byte[] getHeaderBase()
-
isZrtpPacket
public final boolean isZrtpPacket()
Check if packet buffer contains the generic ZRTP id field.- Returns:
- true if packet buffer contains ZRTP id, false otherwise.
-
getLength
public final short getLength()
-
getMessageType
public final String getMessageType()
-
setZrtpId
protected final void setZrtpId()
Copy the unique ZRTP id into the ZRTP packer header
-
setLength
protected final void setLength(int length)
Set the length of the packet (in ZRTP words) into the packet header. The method first converts the integer into network order.- Parameters:
length- The length of the packet in ZRTP words
-
setMessageType
public final void setMessageType(byte[] messageType)
Copy the message type to the ZRTP packet header.- Parameters:
messageType- The message type name.
-
-