Click
Loading...
Searching...
No Matches
Public Member Functions | List of all members
IPHelper Class Reference

This class provides several methods that can be used by elements that inherits from it in order to manage IP packets. More...

#include <iphelper.hh>

Inheritance diagram for IPHelper:
TCPHelper

Public Member Functions

uint16_t packetTotalLength (Packet *packet) const
 Return the length of the IP packet, obtained from the header.
 
uint16_t getIPHeaderOffset (Packet *packet) const
 Return the offset in the packet at which the IP header starts.
 
void setPacketTotalLength (WritablePacket *packet, unsigned length) const
 Set the length of the IP packet in the header.
 
uint32_t getDestinationAddress (Packet *packet) const
 Return the IP destination address of the packet.
 
uint32_t getSourceAddress (Packet *packet) const
 Return the IP source address of the packet.
 
void computeIPChecksum (WritablePacket *packet) const
 Recompute the IP checksum of the packet and set it in the IP header.
 
void rewrite_ipport (WritablePacket *p, IPAddress ip, uint16_t port, const int shift, bool is_tcp)
 

Detailed Description

This class provides several methods that can be used by elements that inherits from it in order to manage IP packets.

Member Function Documentation

◆ packetTotalLength()

uint16_t IPHelper::packetTotalLength ( Packet *  packet) const
inline

Return the length of the IP packet, obtained from the header.

Parameters
packetThe IP packet
Returns
The length of the given IP packet, obtained from the IP header

◆ getIPHeaderOffset()

uint16_t IPHelper::getIPHeaderOffset ( Packet *  packet) const
inline

Return the offset in the packet at which the IP header starts.

Parameters
packetThe IP packet
Returns
The offset in the packet at which the IP header starts

◆ setPacketTotalLength()

void IPHelper::setPacketTotalLength ( WritablePacket *  packet,
unsigned  length 
) const
inline

Set the length of the IP packet in the header.

Parameters
packetThe IP packet
lengthThe new length of the given IP packet

◆ getDestinationAddress()

uint32_t IPHelper::getDestinationAddress ( Packet *  packet) const
inline

Return the IP destination address of the packet.

Parameters
packetThe IP packet
Returns
The IP destination address of the packet

◆ getSourceAddress()

uint32_t IPHelper::getSourceAddress ( Packet *  packet) const
inline

Return the IP source address of the packet.

Parameters
packetThe IP packet
Returns
The IP source address of the packet

◆ computeIPChecksum()

void IPHelper::computeIPChecksum ( WritablePacket *  packet) const
inline

Recompute the IP checksum of the packet and set it in the IP header.

Parameters
packetThe IP packet

◆ rewrite_ipport()

void IPHelper::rewrite_ipport ( WritablePacket *  p,
IPAddress  ip,
uint16_t  port,
const int  shift,
bool  is_tcp 
)
inline

Rewrite the src or dst IP address and src or dst port of the packet.


The documentation for this class was generated from the following file: