TInet6HeaderIP4 Class Reference

class TInet6HeaderIP4

Encapsulates an IPv4 IP header.

  ************************
  Extract from the RFC-791
  ************************
  0                   1                   2                   3
  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |Version|  IHL  |Type of Service|          Total Length         |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |         Identification        |Flags|      Fragment Offset    |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |  Time to Live |    Protocol   |         Header Checksum       |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                       Source Address                          |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                    Destination Address                        |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                    Options                    |    Padding    |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  
  Version:  4 bits = 4
  IHL:  4 bits

    Internet Header Length is the length of the internet header in 32
    bit words, and thus points to the beginning of the data.  Note that
    the minimum value for a correct header is 5

  Type of Service:  8 bits
      Bits 0-2:  Precedence.
      Bit    3:  0 = Normal Delay,      1 = Low Delay.
      Bits   4:  0 = Normal Throughput, 1 = High Throughput.
      Bits   5:  0 = Normal Relibility, 1 = High Relibility.
      Bit  6-7:  Reserved for Future Use.

	  Precedence

          111 - Network Control
          110 - Internetwork Control
          101 - CRITIC/ECP
          100 - Flash Override
          011 - Flash
          010 - Immediate
          001 - Priority
          000 - Routine
  Total Length:  16 bits
    Total Length is the length of the datagram, measured in octets,
    including internet header and data.

  Identification:  16 bits
    An identifying value assigned by the sender to aid in assembling the
    fragments of a datagram.

  Flags:  3 bits
    Various Control Flags.

      Bit 0: reserved, must be zero
      Bit 1: (DF) 0 = May Fragment,  1 = Don't Fragment.
      Bit 2: (MF) 0 = Last Fragment, 1 = More Fragments.

  Fragment Offset:  13 bits

    This field indicates where in the datagram this fragment belongs.
    The fragment offset is measured in units of 8 octets (64 bits).  The
    first fragment has offset zero.

  Time to Live:  8 bits
  Protocol:  8 bits
  Header Checksum:  16 bits
  Source Address:  32 bits
  Destination Address:  32 bits
Since
v7.0

Member Functions Documentation

Checksum()

TInt Checksum()const [inline]

Gets the Header Checksum from the header.

DF()

TInt DF()const [inline]

Gets the DF flag from the header.

DstAddr()

TUint32 DstAddr()const [inline]

Gets the destination address from the header.

DstAddrRef()

TUint32 &DstAddrRef()const [inline]

Gets a raw reference to the destination address in network byte order.

EcnIsCongestion()

TBool EcnIsCongestion()[inline]

Gets ECN congestion status.

see RFC-3168 for details.

EndPtr()

TUint8 *EndPtr()[inline]
Gets a pointer to the byte following the header.
Since
v7.0

Flags()

TInt Flags()const [inline]
Gets the Flags from the header.
Note:

returns flags byte as is, may include bits of fragment offset!

FragmentOffset()

TInt FragmentOffset()const [inline]

Gets the Fragment Offset from the header.

HeaderLength()

TInt HeaderLength()const [inline]

Gets the header length.

HostHeaderLength()

TInt HostHeaderLength()const [inline]

HostProtocol()

TInt HostProtocol()const [inline]

Gets the Protocol from a header that is in Host byte order. There is no reason to use swapped headers

Identification()

TInt Identification()const [inline]

Gets the Identification from the header.

Init(TInt)

voidInit(TIntaTOS = 0)[inline]

Initialises the IPv4 header to basic initial values.

  • Version = 4

  • IHL = 5

  • Total Length = 20

  • Identification = 0

  • Fragment Offset = 0

  • Flags = 0

  • TTL = 0

  • Checksum = 0

  • TOS = aTOS (optional parameter, default = 0)

However, address fields are not touched, because they are most often set separately in any case.

Parameters

TInt aTOS = 0initial value for TOS (= 0)

MF()

TInt MF()const [inline]

Gets the MF flag from the header.

MaxHeaderLength()

TInt MaxHeaderLength()[static, inline]
Gets the maximum header length.
Since
v7.0

MinHeaderLength()

TInt MinHeaderLength()[static, inline]
Gets the minimum header length.
Since
v7.0

Options()

TPtrC8 Options()const [inline]
Gets the Options from the header (const overload).
Note:

This relies on correct value of IHL! Must not be used with corrupt headers (will panic if IHL < 5!).

Options()

TPtr8 Options()[inline]
Gets the Options from the header.
Note:

This relies on correct value of IHL! Must not be used with corrupt headers (will panic if IHL < 5!).

Protocol()

TInt Protocol()const [inline]

Gets the Protocol from the header.

SetChecksum(TInt)

voidSetChecksum(TIntaSum)[inline]

Sets the Header Checksum in the header.

Parameters

TInt aSumHeader Checksum [0..65535] (16 least significant bits stored as is (assumed to be in NETWORK byte order).

SetDstAddr(TUint32)

voidSetDstAddr(TUint32aAddr)[inline]

Sets the destination address in the header.

Parameters

TUint32 aAddrDestination IPv4 address (32 bit integer) in host byte order

SetFlags(TUint8)

voidSetFlags(TUint8aFlags)[inline]

Sets the Flags in the header.

Flags are assumed to be in the three most significant bits of aFlags, in their proper positions. (No individual settings provided, if you need to set a flag without affecting others, use Flags() to get old values, update and store the result with SetFlags()).

Parameters

TUint8 aFlagscontains the new flags

SetFragmentOffset(TUint16)

voidSetFragmentOffset(TUint16aOffset)[inline]

Sets the Fragment Offset in the header.

Parameters

TUint16 aOffsetFragment Offset (8 octet units, not in bytes)

SetHeaderLength(TInt)

voidSetHeaderLength(TIntaLength)[inline]

Sets the header length (IHL).

Parameters

TInt aLengththe length of the IPv4 header in BYTES. The IHL is computed from this, without any sanity checks. The valid range is [20..60].

SetIdentification(TInt)

voidSetIdentification(TIntaId)[inline]

Sets the Identification in the header.

Parameters

TInt aIdthe value to be set (only 16 least significant bits are used, rest is ignored).

SetProtocol(TInt)

voidSetProtocol(TIntaProtocol)[inline]

Sets the Protocol in the header.

Parameters

TInt aProtocolProtocol [0..255]

SetSrcAddr(TUint32)

voidSetSrcAddr(TUint32aAddr)[inline]

Sets the source address in the header.

Parameters

TUint32 aAddrSource address (IPv4, 32 bit integer in host byte order)

SetTOS(TInt)

voidSetTOS(TIntaTos)[inline]

Sets the TOS in the header.

Parameters

TInt aTosThe TOS value to set [0..255]

SetTotalLength(TInt)

voidSetTotalLength(TIntaLength)[inline]

Sets the Total Length in the header.

Parameters

TInt aLengththe length of combined header and payload in bytes (no sanity checks, but the value should be in range [20..65535]). Only 16 least significant bits used.

SetTtl(TInt)

voidSetTtl(TIntaTTL)[inline]

Sets the Time to Live in the header.

Parameters

TInt aTTLTime to Live [0..255]

SetVersion(TInt)

voidSetVersion(TIntaVersion)[inline]

Sets the IP version in the header.

Parameters

TInt aVersionthe value to be set [0..15]

SrcAddr()

TUint32 SrcAddr()const [inline]

Gets the source address from the header.

SrcAddrRef()

TUint32 &SrcAddrRef()const [inline]

Gets a raw reference to the source address in network byte order.

Swap()

voidSwap()[inline]

Swaps the byte order in the header. There is no reason to use swapped headers

TOS()

TInt TOS()const [inline]

Gets the TOS from the header.

TotalLength()

TInt TotalLength()const [inline]

Gets the Total Length from the header.

Ttl()

TInt Ttl()const [inline]

Gets the Time to Live from the header.

Version()

TInt Version()const [inline]

Gets the IP version from the header.

Member Enumerations Documentation

Enum TOffsets

Enumerators

O_TotalLength = 2
O_FragmentOffset = 6
O_TTL = 8
O_Protocol = 9

Member Data Documentation

union TInet6HeaderIP4::@34 @35

union TInet6HeaderIP4::@34@35[private]

TUint8 i

TUint8 i

TUint32 iAlign

TUint32 iAlign