CVJCompressor Class Reference

class CVJCompressor : public CVJCompressorIf

Van Jacobson TCP/IP header compressor (RFC 1144)

Inherits from

Public Member Functions
CVJCompressor ()
~CVJCompressor ()
void ConstructL ( CVJCompFactory *, TUint , TBool )
TInt VJCompressFrame ( RMBufChain &)
Private Member Functions
TBool CompressAck ( TUint8 **, TUint8 *, ThdrTCP *, ThdrTCP *)
TBool CompressFrame ( RMBufChain &, ThdrIP *, ThdrTCP *, TUint , ThdrIP *, ThdrTCP *)
TBool CompressIPId ( TUint8 **, TUint8 *, ThdrIP *, ThdrIP *)
TBool CompressPush ( TUint8 *, ThdrTCP *)
TBool CompressSeq ( TUint8 **, TUint8 *, ThdrTCP *, ThdrTCP *)
TBool CompressSpecialCases ( TUint8 **, TUint8 *const , TUint8 *, ThdrTCP *, ThdrTCP *, ThdrIP *, ThdrIP *)
TBool CompressUrgentPtr ( TUint8 **, TUint8 *, ThdrTCP *, ThdrTCP *)
TBool CompressWindow ( TUint8 **, TUint8 *, ThdrTCP *, ThdrTCP *)
void ConvertFrameToUncompVJ ( ThdrIP *, TUint )
void CopyInNewTxHeader ( RMBufChain &, TUint8 *, TUint , TUint )
void CopyTxHeader ( ThdrIP *, TUint )
void DecrementPacketLen ( RMBufChain &, TUint )
void EncodeDelta ( TUint8 **, TInt16 )
ThdrIP * GetIPHeader ( RMBufChain &)
TBool GetStoredTxHeader ( TUint *, ThdrIP *, ThdrTCP *, ThdrIP *, ThdrTCP *)
TUint8 * GetTCPOpts ( ThdrTCP *)
TBool IPAddressesMatch ( ThdrIP *, ThdrIP *)
TBool IsDeltaCompressible ( TUint32 )
TBool IsIPCompressible ( ThdrIP *, ThdrIP *)
TBool IsSameConnAsLast ( TUint *, TUint )
TBool IsTCPCompressible ( ThdrTCP *, ThdrTCP *)
TBool SendAsRawIP ( ThdrIP *, ThdrTCP *)
void SetFirstFewBytes ( TUint8 *, TBool , TUint8 **, ThdrTCP *, TUint )
TBool SuitableForVJCompression ( ThdrIP *, ThdrTCP *, TUint *, ThdrIP *, ThdrTCP *)
TBool TCPPortsMatch ( ThdrTCP *, ThdrTCP *)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
CObject::AccessCount()const
CObject::CObject()
CObject::Close()
CObject::Dec()
CObject::Extension_(TUint,TAny *&,TAny *)
CObject::FullName()const
CObject::Inc()
CObject::Name()const
CObject::Open()
CObject::Owner()const
CObject::SetName(const TDesC *)
CObject::SetNameL(const TDesC *)
CObject::SetOwner(CObject *)
CObject::UniqueID()const
CObject::~CObject()
CVJCompressorIf::CVJCompressorIf()
CVJCompressorIf::~CVJCompressorIf()
Private Attributes
TBool iCompressConnId
TUint iLastTxConn
TVJCompHdr * iLastTxHdr
TUint iMaxVJSlots
TVJCompHdr * iTxStates
Inherited Attributes
CVJCompressorIf::iFactory

Constructor & Destructor Documentation

CVJCompressor()

CVJCompressor ( )

~CVJCompressor()

~CVJCompressor ( )

Member Functions Documentation

CompressAck(TUint8 **, TUint8 *, ThdrTCP *, ThdrTCP *)

TBool CompressAck ( TUint8 ** aVJPtr,
TUint8 * aChanges,
ThdrTCP * aTCPHeader,
ThdrTCP * aRetrievedTCPHdr
) [private]

Compresses the TCP Acknowledgement Number field.

Parameters

TUint8 ** aVJPtr Pointer to the pointer within the VJ header to be modified; returns pointing one past the last header location used
TUint8 * aChanges The VJ change mask to be updated
ThdrTCP * aTCPHeader TCP header
ThdrTCP * aRetrievedTCPHdr Cached TCP header from which to make a delta for aTCPHeader

CompressFrame(RMBufChain &, ThdrIP *, ThdrTCP *, TUint, ThdrIP *, ThdrTCP *)

TBool CompressFrame ( RMBufChain & aPacket,
ThdrIP * aIPHeader,
ThdrTCP * aTCPHeader,
TUint aConnection,
ThdrIP * aRetrievedIPHdr,
ThdrTCP * aRetrievedTCPHdr
) [private]

Compresses a TCP/IP header if possible.

Parameters

RMBufChain & aPacket MBuf chain containing packet
ThdrIP * aIPHeader IP header
ThdrTCP * aTCPHeader TCP header
TUint aConnection VJ connection number
ThdrIP * aRetrievedIPHdr Cached IP packet header
ThdrTCP * aRetrievedTCPHdr Cached TCP packet header

CompressIPId(TUint8 **, TUint8 *, ThdrIP *, ThdrIP *)

TBool CompressIPId ( TUint8 ** aVJPtr,
TUint8 * aChanges,
ThdrIP * aIPHeader,
ThdrIP * aRetrievedIPHdr
) [private]

Compresses the IP Packet ID field.

Parameters

TUint8 ** aVJPtr Pointer to the pointer within the VJ header to be modified; returns pointing one past the last header location used
TUint8 * aChanges The VJ change mask to be updated
ThdrIP * aIPHeader IP header
ThdrIP * aRetrievedIPHdr Cached IP header from which to make a delta for aIPHeader

CompressPush(TUint8 *, ThdrTCP *)

TBool CompressPush ( TUint8 * aChanges,
ThdrTCP * aTCPHeader
) [private]

Compresses the TCP Push flag.

Parameters

TUint8 * aChanges The VJ change mask to be updated
ThdrTCP * aTCPHeader TCP header

CompressSeq(TUint8 **, TUint8 *, ThdrTCP *, ThdrTCP *)

TBool CompressSeq ( TUint8 ** aVJPtr,
TUint8 * aChanges,
ThdrTCP * aTCPHeader,
ThdrTCP * aRetrievedTCPHdr
) [private]

Compresses the TCP Sequence Number field.

Parameters

TUint8 ** aVJPtr Pointer to the pointer within the VJ header to be modified; returns pointing one past the last header location used
TUint8 * aChanges The VJ change mask to be updated
ThdrTCP * aTCPHeader TCP header
ThdrTCP * aRetrievedTCPHdr Cached TCP header from which to make a delta for aTCPHeader

CompressSpecialCases(TUint8 **, TUint8 *const, TUint8 *, ThdrTCP *, ThdrTCP *, ThdrIP *, ThdrIP *)

TBool CompressSpecialCases ( TUint8 ** aVJPtr,
TUint8 *const aVJInitialDeltaPtr,
TUint8 * aChanges,
ThdrTCP * aTCPHeader,
ThdrTCP * aRetrievedTCPHdr,
ThdrIP * aIPHeader,
ThdrIP * aRetrievedIPHdr
) [private]

Compresses special case TCP/IP packets. See RFC 1144 sec. 3.2.3

Pre-condition
aChanges must reflect the compressed header except for the KVjCompMaskPush and KVjCompMaskIp bits which must be clear.

Parameters

TUint8 ** aVJPtr Pointer to the pointer within the VJ header to be modified; returns pointing one past the last header location used
TUint8 *const aVJInitialDeltaPtr Beginning of the compressed VJ header
TUint8 * aChanges The VJ change mask to be updated
ThdrTCP * aTCPHeader TCP header
ThdrTCP * aRetrievedTCPHdr Cached TCP header from which to make a delta for aTCPHeader
ThdrIP * aIPHeader IP header
ThdrIP * aRetrievedIPHdr Cached IP header from which to make a delta for aIPHeader

CompressUrgentPtr(TUint8 **, TUint8 *, ThdrTCP *, ThdrTCP *)

TBool CompressUrgentPtr ( TUint8 ** aVJPtr,
TUint8 * aChanges,
ThdrTCP * aTCPHeader,
ThdrTCP * aRetrievedTCPHdr
) [private]

Compresses the TCP Urgent pointer field.

Parameters

TUint8 ** aVJPtr Pointer to the pointer within the VJ header to be modified; returns pointing one past the last header location used
TUint8 * aChanges The VJ change mask to be updated
ThdrTCP * aTCPHeader TCP header
ThdrTCP * aRetrievedTCPHdr Cached TCP header from which to make a delta for aTCPHeader

CompressWindow(TUint8 **, TUint8 *, ThdrTCP *, ThdrTCP *)

TBool CompressWindow ( TUint8 ** aVJPtr,
TUint8 * aChanges,
ThdrTCP * aTCPHeader,
ThdrTCP * aRetrievedTCPHdr
) [private]

Compresses the TCP Window field.

Parameters

TUint8 ** aVJPtr Pointer to the pointer within the VJ header to be modified; returns pointing one past the last header location used
TUint8 * aChanges The VJ change mask to be updated
ThdrTCP * aTCPHeader TCP header
ThdrTCP * aRetrievedTCPHdr Cached TCP header from which to make a delta for aTCPHeader

ConstructL(CVJCompFactory *, TUint, TBool)

void ConstructL ( CVJCompFactory * aFactory,
TUint aMaxSlot,
TBool aCompressConnId
)

Construct the CVJCompressor object.

Parameters

CVJCompFactory * aFactory Factory that created this object
TUint aMaxSlot Value of the highest VJ connection number to be sent
TBool aCompressConnId Whether to compress the connection number

ConvertFrameToUncompVJ(ThdrIP *, TUint)

void ConvertFrameToUncompVJ ( ThdrIP * aIPHeader,
TUint aConnection
) [private]

The frame is to be sent as an Uncompressed VJ frame, so set the connection number in place of the protocol type, and save the header.

Parameters

ThdrIP * aIPHeader TCP/IP header
TUint aConnection VJ connection number

CopyInNewTxHeader(RMBufChain &, TUint8 *, TUint, TUint)

void CopyInNewTxHeader ( RMBufChain & aPacket,
TUint8 * aCompressedHdr,
TUint aOldHeaderLength,
TUint aNewHeaderLength
) [private]

Copies the compressed header into the packet.

Parameters

RMBufChain & aPacket MBuf chain containing packet
TUint8 * aCompressedHdr VJ compressed header
TUint aOldHeaderLength Length of the current TCP/IP header in aPacket
TUint aNewHeaderLength Length of VJ compressed header

CopyTxHeader(ThdrIP *, TUint)

void CopyTxHeader ( ThdrIP * aIPHeader,
TUint aConnection
) [private]

Copies the given TCP/IP header into the storage slot for the given connection number.

Parameters

ThdrIP * aIPHeader TCP/IP header
TUint aConnection VJ connection number

DecrementPacketLen(RMBufChain &, TUint)

void DecrementPacketLen ( RMBufChain & aPacket,
TUint SizeDecrease
) [private]

There is a header prepended to the frame, one element is the length which has now changed, so change it

Parameters

RMBufChain & aPacket MBuf chain containing packet
TUint SizeDecrease Amount by which to reduce the length metadata

EncodeDelta(TUint8 **, TInt16)

void EncodeDelta ( TUint8 ** aVJCompHeader,
TInt16 aValue
) [private]

Encodes a delta value in VJ compressed format.

Parameters

TUint8 ** aVJCompHeader Pointer to pointer into VJ header buffer to store encoded value; returns with pointer incremented one past end of value
TInt16 aValue Value to store

GetIPHeader(RMBufChain &)

ThdrIP * GetIPHeader ( RMBufChain & aChain ) [private]

Get the IP Header even though there is a buffer of Info on the front. This is used in VJ, to avoid the awful hack in the main receive path. PRR 20-11-97

Parameters

RMBufChain & aChain MBuf chain containing packet

GetStoredTxHeader(TUint *, ThdrIP *, ThdrTCP *, ThdrIP *, ThdrTCP *)

TBool GetStoredTxHeader ( TUint * aConnection,
ThdrIP * aIPHeader,
ThdrTCP * aTCPHeader,
ThdrIP * aRetrievedIPHdr,
ThdrTCP * aRetrievedTCPHdr
) [private]

Retrieves a packet header from the VJ connection cache. The packet must match on the IP source and destination address and on the TCP source and destination port numbers.

Parameters

TUint * aConnection Returns the matching VJ connection number
ThdrIP * aIPHeader IP packet header
ThdrTCP * aTCPHeader TCP header
ThdrIP * aRetrievedIPHdr Returns the cached IP packet header
ThdrTCP * aRetrievedTCPHdr Returns the cached TCP packet header

GetTCPOpts(ThdrTCP *)

TUint8 * GetTCPOpts ( ThdrTCP * aTCPHeader ) const [private, inline]

Returns a pointer to the start of the TCP options (if there are any).

Parameters

ThdrTCP * aTCPHeader TCP header

IPAddressesMatch(ThdrIP *, ThdrIP *)

TBool IPAddressesMatch ( ThdrIP * aIPHeader,
ThdrIP * aNotherIPHdr
) [private]

Compares the addresses in two IP headers.

Parameters

ThdrIP * aIPHeader First IP header
ThdrIP * aNotherIPHdr Second IP header

IsDeltaCompressible(TUint32)

TBool IsDeltaCompressible ( TUint32 aDelta ) const [private, inline]

Tests if the delta value is compressible into the 16 bit VJ delta format. The aDelta value actually needs a 33 bit signed integer to hold the entire possible range, but the twos complement math works out if it's just stored as a 32 bit unsigned integer.

Parameters

TUint32 aDelta Delta value to test

IsIPCompressible(ThdrIP *, ThdrIP *)

TBool IsIPCompressible ( ThdrIP * aIPHeader,
ThdrIP * aRetrievedIPHdr
) [private]

Compares two IP headers to see if the seldom-changing fields match.

Parameters

ThdrIP * aIPHeader First IP packet header
ThdrIP * aRetrievedIPHdr Second IP packet header

IsSameConnAsLast(TUint *, TUint)

TBool IsSameConnAsLast ( TUint * aCompressedHdrLen,
TUint aConnection
) [private]

Determines whether the given VJ connection number is the same as that of the last compressed packet sent and returns the size of the compressed header.

Parameters

TUint * aCompressedHdrLen Returns the length of the compressed header
TUint aConnection VJ connection number

IsTCPCompressible(ThdrTCP *, ThdrTCP *)

TBool IsTCPCompressible ( ThdrTCP * aTCPHeader,
ThdrTCP * aRetrievedTCPHdr
) [private]

Compares two TCP headers to see if the options, ECN & reserved bits match. Everything else in the TCP header is handled specially by the VJ compression algorithm.

Parameters

ThdrTCP * aTCPHeader First TCP header
ThdrTCP * aRetrievedTCPHdr Second TCP header

SendAsRawIP(ThdrIP *, ThdrTCP *)

TBool SendAsRawIP ( ThdrIP * aIPHeader,
ThdrTCP * aTCPHeader
) [private]

Determines if the packet must bypass VJ compression altogether. This happens with fragmented IP packets and certain TCP flags.

Parameters

ThdrIP * aIPHeader First IP packet header
ThdrTCP * aTCPHeader TCP header

SetFirstFewBytes(TUint8 *, TBool, TUint8 **, ThdrTCP *, TUint)

void SetFirstFewBytes ( TUint8 * aChanges,
TBool aNewConnection,
TUint8 ** aVJHeader,
ThdrTCP * aTCPHeader,
TUint aConnection
) [private]

Sets the change mask, connection number (if necessary) and TCP checksum bytes in the VJ compressed header.

Parameters

TUint8 * aChanges The VJ change mask to be copied and potentially modified
TBool aNewConnection Whether this is a new connection, requiring the number in the header
TUint8 ** aVJHeader Pointer to the pointer to the VJ header to be modified
ThdrTCP * aTCPHeader TCP header
TUint aConnection VJ connection number

SuitableForVJCompression(ThdrIP *, ThdrTCP *, TUint *, ThdrIP *, ThdrTCP *)

TBool SuitableForVJCompression ( ThdrIP * aIPHeader,
ThdrTCP * aTCPHeader,
TUint * aConnection,
ThdrIP * aRetrievedIPHdr,
ThdrTCP * aRetrievedTCPHdr
) [private]

Sees if a packet header is stored in the VJ connection cache.

Parameters

ThdrIP * aIPHeader IP packet header
ThdrTCP * aTCPHeader TCP header
TUint * aConnection Returns the matching VJ connection number
ThdrIP * aRetrievedIPHdr Returns the cached IP packet header
ThdrTCP * aRetrievedTCPHdr Returns the cached TCP packet header

TCPPortsMatch(ThdrTCP *, ThdrTCP *)

TBool TCPPortsMatch ( ThdrTCP * aHeader,
ThdrTCP * aNotherHdr
) [private]

Compares the TCP port numbers TCP headers.

Parameters

ThdrTCP * aHeader First TCP header
ThdrTCP * aNotherHdr Second TCP header

VJCompressFrame(RMBufChain &)

TInt VJCompressFrame ( RMBufChain & aPacket ) [virtual]

Takes a packet and transforms it for sending. It may end up VJ compressed, VJ uncompressed or untouched.

Parameters

RMBufChain & aPacket MBuf chain containing packet

Member Data Documentation

TBool iCompressConnId

TBool iCompressConnId [private]

Whether VJ was configured to compress the connection number

TUint iLastTxConn

TUint iLastTxConn [private]

Connection number of the last packet compressed

TVJCompHdr * iLastTxHdr

TVJCompHdr * iLastTxHdr [private]

Pointer to the last element in the LRU circular list

TUint iMaxVJSlots

TUint iMaxVJSlots [private]

Maximum number of VJ connections

TVJCompHdr * iTxStates

TVJCompHdr * iTxStates [private]

Pointer to start of array of VJ connections