java.lang.Object
org.pcap4j.packet.AbstractPacket.AbstractHeader
org.pcap4j.packet.GtpV1Packet.GtpV1Header
- All Implemented Interfaces:
Serializable,Packet.Header
- Enclosing class:
GtpV1Packet
GTPv1 Header
8 7 6 5 4 3 2 1
+-----+-----+-----+-----+-----+-----+-----+-----+
| Version | PT | (*) | E | S | PN |
+-----+-----+-----+-----+-----+-----+-----+-----+
| Message Type |
+-----+-----+-----+-----+-----+-----+-----+-----+
| Length (1st Octet) |
+-----+-----+-----+-----+-----+-----+-----+-----+
| Length (2nd Octet) |
+-----+-----+-----+-----+-----+-----+-----+-----+
| Tunnel Endpoint Identifier (1st Octet) |
+-----+-----+-----+-----+-----+-----+-----+-----+
| Tunnel Endpoint Identifier (2nd Octet) |
+-----+-----+-----+-----+-----+-----+-----+-----+
| Tunnel Endpoint Identifier (3rd Octet) |
+-----+-----+-----+-----+-----+-----+-----+-----+
| Tunnel Endpoint Identifier (4th Octet) |
+-----+-----+-----+-----+-----+-----+-----+-----+
| Sequence Number (1st Octet) |
+-----+-----+-----+-----+-----+-----+-----+-----+
| Sequence Number (2nd Octet) |
+-----+-----+-----+-----+-----+-----+-----+-----+
| N-PDU Number |
+-----+-----+-----+-----+-----+-----+-----+-----+
| Next Extension Header Type |
+-----+-----+-----+-----+-----+-----+-----+-----+
- Since:
- pcap4j 1.6.6
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprivate static final intprivate static final intprivate static final intprivate static final intprivate final shortprivate static final intprivate static final intprivate final GtpV1MessageTypeprivate static final intprivate static final intprivate static final intprivate static final intprivate final GtpV1ExtensionHeaderTypeprivate static final intprivate static final intprivate final Byteprivate final booleanprivate final GtpV1Packet.ProtocolTypeprivate final booleanprivate static final intprivate static final intprivate final Shortprivate final booleanprivate static final longprivate final intprivate static final intprivate static final intprivate final GtpVersion -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateGtpV1Header(byte[] rawData, int offset, int length) privateGtpV1Header(GtpV1Packet.Builder builder, int payloadLen) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringThis method builds the valuetoString()will return.protected intThis method builds the valuehashCode()will return using the byte arraygetRawData()returns.protected intThis method calculates the valuelength()will return by adding up the lengths of byte arrays in the listgetRawFields()returns.booleanIndicates whether some other object is "equal to" this one using return values ofgetRawData().shortintprotected List<byte[]> Returns a list of byte arrays which represents this header's fields.booleanintgetTeid()longbooleanbooleanbooleanMethods inherited from class org.pcap4j.packet.AbstractPacket.AbstractHeader
buildHexString, buildRawData, getRawData, hashCode, length, toHexString, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
FIRST_OCTET_OFFSET
private static final int FIRST_OCTET_OFFSET- See Also:
-
FIRST_OCTET_SIZE
private static final int FIRST_OCTET_SIZE- See Also:
-
MSG_TYPE_OFFSET
private static final int MSG_TYPE_OFFSET- See Also:
-
MSG_TYPE_SIZE
private static final int MSG_TYPE_SIZE- See Also:
-
LENGTH_OFFSET
private static final int LENGTH_OFFSET- See Also:
-
LENGTH_SIZE
private static final int LENGTH_SIZE- See Also:
-
TUNNEL_ID_OFFSET
private static final int TUNNEL_ID_OFFSET- See Also:
-
TUNNEL_ID_SIZE
private static final int TUNNEL_ID_SIZE- See Also:
-
GTP_V1_HEADER_MIM_SIZE
private static final int GTP_V1_HEADER_MIM_SIZE- See Also:
-
SEQ_OFFSET
private static final int SEQ_OFFSET- See Also:
-
SEQ_SIZE
private static final int SEQ_SIZE- See Also:
-
NPDU_OFFSET
private static final int NPDU_OFFSET- See Also:
-
NPDU_SIZE
private static final int NPDU_SIZE- See Also:
-
NEXT_HEADER_OFFSET
private static final int NEXT_HEADER_OFFSET- See Also:
-
NEXT_HEADER_SIZE
private static final int NEXT_HEADER_SIZE- See Also:
-
GTP_V1_HEADER_MAX_SIZE
private static final int GTP_V1_HEADER_MAX_SIZE- See Also:
-
version
-
protocolType
-
reserved
private final boolean reserved -
extensionHeaderFlag
private final boolean extensionHeaderFlag -
sequenceNumberFlag
private final boolean sequenceNumberFlag -
nPduNumberFlag
private final boolean nPduNumberFlag -
messageType
-
length
private final short length -
teid
private final int teid -
sequenceNumber
-
nPduNumber
-
nextExtensionHeaderType
-
-
Constructor Details
-
GtpV1Header
- Throws:
IllegalRawDataException
-
GtpV1Header
-
-
Method Details
-
getVersion
- Returns:
- version
-
getProtocolType
- Returns:
- protocolType.
-
getReserved
public boolean getReserved()- Returns:
- true if the reserved field is set to 1; false otherwise.
-
isExtensionHeaderFieldPresent
public boolean isExtensionHeaderFieldPresent()- Returns:
- true if the extension header flag is set to 1; false otherwise.
-
isSequenceNumberFieldPresent
public boolean isSequenceNumberFieldPresent()- Returns:
- true if the sequence number flag is set to 1; false otherwise.
-
isNPduNumberFieldPresent
public boolean isNPduNumberFieldPresent()- Returns:
- true if the N-PDU number flag is set to 1; false otherwise.
-
getMessageType
- Returns:
- messageType
-
getLength
public short getLength()- Returns:
- length
-
getLengthAsInt
public int getLengthAsInt()- Returns:
- length
-
getTeid
public int getTeid()- Returns:
- teid
-
getTeidAsLong
public long getTeidAsLong()- Returns:
- teid
-
getSequenceNumber
- Returns:
- sequenceNumber. May be null.
-
getSequenceNumberAsInt
- Returns:
- sequenceNumber. May be null.
-
getNPduNumber
- Returns:
- nPduNumber. May be null.
-
getNPduNumberAsInt
- Returns:
- nPduNumber. May be null.
-
getNextExtensionHeaderType
- Returns:
- nextExtensionHeaderType. May be null.
-
getRawFields
Description copied from class:AbstractPacket.AbstractHeaderReturns a list of byte arrays which represents this header's fields. This method is called bycalcLength()andbuildRawData().- Specified by:
getRawFieldsin classAbstractPacket.AbstractHeader- Returns:
- a list of byte arrays which represents this header's fields
-
calcLength
protected int calcLength()Description copied from class:AbstractPacket.AbstractHeaderThis method calculates the valuelength()will return by adding up the lengths of byte arrays in the listgetRawFields()returns.- Overrides:
calcLengthin classAbstractPacket.AbstractHeader- Returns:
- a calculated length
-
buildString
Description copied from class:AbstractPacket.AbstractHeaderThis method builds the valuetoString()will return.- Overrides:
buildStringin classAbstractPacket.AbstractHeader- Returns:
- a string representation of this object
-
calcHashCode
protected int calcHashCode()Description copied from class:AbstractPacket.AbstractHeaderThis method builds the valuehashCode()will return using the byte arraygetRawData()returns. This method may be better to be overridden for performance reason.- Overrides:
calcHashCodein classAbstractPacket.AbstractHeader- Returns:
- a calculated hash code value for the object
-
equals
Description copied from class:AbstractPacket.AbstractHeaderIndicates whether some other object is "equal to" this one using return values ofgetRawData(). This method should be overridden so that it does more strict comparisons more efficiently.- Overrides:
equalsin classAbstractPacket.AbstractHeader
-