|
| IpHeaderv4 () |
| Constructor that initializes all fields with 0.
|
|
| IpHeaderv4 (vector< bool > frame) |
| Constructor that extracts the Ipv4 header from a network frame. More...
|
|
| ~IpHeaderv4 () |
| Destructor.
|
|
void | calculateHeaderLength () |
| Calculates the length of the header and sets the corresponding field. More...
|
|
void | calculateChecksum () |
| Calculates the checksum and sets the corresponding field.
|
|
void | print () |
| Prints the content of the ip header as hexadecimal.
|
|
string | info () |
| Creates a string which lists all fields and values in humanly readable form. More...
|
|
vector< bool > | toVector () |
|
unsigned int | version () |
| Returns the IP-Version (4 or 6) (4 bit)
|
|
unsigned int | ipHeaderLength () |
| Returns the length of the IP header : length * 32 bit (4 bit)
|
|
unsigned int | typeOfService () |
| Returns the type of service, which is used for packet prioritization (8 bit)
|
|
unsigned int | totalLength () |
| Returns the total length of the packet in byte(maximum 65536 Byte = 64 KiB) (16 bit)
|
|
unsigned int | identification () |
| Returns the unique identifier to reassemble fragmented IP-Datagrams (16 bit)
|
|
bool | flagReserved () |
| Returns the reserved flag, has to be 0 (1 bit)
|
|
bool | flagDontFragment () |
| Returns the 'don't fragment' bit.
|
|
bool | flagFragmented () |
| Returns a flag that indicates, wether there are more fragments coming or not (0 if only or last fragment) (1 bit)
|
|
unsigned int | offset () |
| Returns the fragment position (0 if not fragmented) (12 bit)
|
|
unsigned int | timeToLive () |
| Returns the time to live, drop packet if 0, reduce at each hop (4 bit)
|
|
unsigned int | protocol () |
| Returns the application layer protocol id (4 bit)
|
|
unsigned int | checksum () |
| Returns the Ip header checksum (16 bit)
|
|
unsigned long | sourceIp () |
| Returns the Ip address of the sender (32 bit)
|
|
string | sourceIpDotted () |
| Returns the ip address of the sender in dotted form.
|
|
unsigned long | destinationIp () |
| Returns the Ip address of the receiver(32 bit)
|
|
string | destinationIpDotted () |
| Returns the Ip address of the receiver in dotted form.
|
|
void | setVersion (unsigned int version) |
| Sets the IP-Version (4 or 6) (4 bit)
|
|
void | setTypeOfService (unsigned int tos) |
| Sets the type of service, which is used for packet prioritization (8 bit)
|
|
void | setTotalLength (unsigned int total_length) |
| Sets the total length of the packet in byte (maximum 65536 Byte = 64 KiB) (16 bit)
|
|
void | setIdentification (unsigned int identification) |
| Sets the unique identifier to reassemble fragmented IP-Datagrams (16 bit)
|
|
void | setFlagReserved (bool flag) |
| Sets the reserved flag, has to be 0 (1 bit)
|
|
void | setFlagdontFragment (bool flag) |
| Sets the 'don't fragment' bit.
|
|
void | setFlagFragmented (bool flag) |
| Sets a flag that indicates, wether there are more fragments coming or not (0 if only or last fragment) (1 bit)
|
|
void | setOffset (unsigned int offset) |
| Sets the fragment position (0 if not fragmented) (12 bit)
|
|
void | setTimeToLive (unsigned int ttl) |
| Sets the time to live, drop packet if 0, reduce at each hop (4 bit)
|
|
void | setProtocol (unsigned int protocol_id) |
| Sets the application layer protocol id (4 bit)
|
|
void | setSourceIp (unsigned long source_ip) |
| Sets the Ip address of the sender (32 bit)
|
|
void | setSourceIp (string source_ip) |
| Sets the ip address of the sender in dotted form.
|
|
void | setDestinationIp (unsigned long destination_ip) |
| Sets the Ip address of the receiver(32 bit)
|
|
void | setDestinationIp (string destination_ip) |
| Sets the Ip address of the receiver in dotted form.
|
|
Represents an Ipv4 header.
This class provides getters and setters for all Ipv4 header fields, except the options-field. The content is exported as binary by using 'toVector'.