Encapsulates an IPv4 packet header. More...
#include <DwmIpv4PacketHeader.hh>


Public Member Functions | |
| Ipv4PacketHeader () | |
| Constructor. The new object will own the underlying memory. | |
| Ipv4PacketHeader (const Ipv4PacketHeader &ipHeader) | |
| Copy constructor. | |
| Ipv4PacketHeader (const struct ip &ip) | |
| Construct from a struct ip. More... | |
| Ipv4PacketHeader (struct ip *ip) | |
| Construct from a pointer to a struct ip. More... | |
| ~Ipv4PacketHeader () | |
| Destructor. More... | |
| Ipv4PacketHeader & | operator= (const Ipv4PacketHeader &ipHeader) |
| operator = | |
| bool | operator== (const Ipv4PacketHeader &ipHeader) const |
| operator == | |
| void | Set (const struct ip &ip) |
Copy the contents of ip into the object. | |
| uint8_t | HeaderLength () const |
| Returns the IP header length. | |
| uint8_t | HeaderLength (uint8_t headerLength) |
| Sets and returns the IP header length. | |
| uint8_t | TypeOfService () const |
| Returns the type-of-service. | |
| uint8_t | TypeOfService (uint8_t typeOfService) |
| Sets and returns the type-of-service. | |
| uint16_t | TotalLength () const |
| Returns the total length field in host byte order. | |
| uint16_t | TotalLength (uint16_t totalLength) |
| Sets and returns total length field in host byte order. | |
| uint16_t | Id () const |
| Returns the IP ID field in host byte order. | |
| uint16_t | Id (uint16_t id) |
| Sets and returns the IP ID field in host byte order. | |
| uint16_t | FragmentOffset () const |
| Returns the fragment offset field in host byte order. | |
| uint16_t | FragmentOffset (uint16_t fragmentOffset) |
| Sets and returns the fragment offset field in host byte order. | |
| uint8_t | TimeToLive () const |
| Returns the time-to-live field. | |
| uint8_t | TimeToLive (uint8_t timeToLive) |
| Sets and returns the time-to-live field. | |
| uint8_t | Protocol () const |
| Returns the protocol field. | |
| uint8_t | Protocol (uint8_t protocol) |
| Sets and returns the protocol field. | |
| uint16_t | Checksum () const |
| Returns the checksum field in host byte order. | |
| Ipv4Address | SourceAddress () const |
| Returns the source IP address. | |
| Ipv4Address | SourceAddress (const Ipv4Address &sourceAddress) |
| Sets and returns the source IP address. | |
| Ipv4Address | DestinationAddress () const |
| Returns the destination IP address. | |
| Ipv4Address | DestinationAddress (const Ipv4Address &destinationAddress) |
| Sets and returns the destination IP address. | |
| void | SetChecksum () |
| Computes and stores the IP header checksum. | |
| std::istream & | Read (std::istream &is) |
| Reads the header from an istream. Returns the istream. | |
| std::ostream & | Write (std::ostream &os) const |
| Writes the header to an ostream. Returns the ostream. | |
| ssize_t | Read (int fd) |
| Reads the header from a file descriptor. More... | |
| ssize_t | Write (int fd) const |
| Writes the header to a file descriptor. More... | |
| size_t | Read (FILE *f) |
| Reads the header from a FILE. Returns 1 on success, 0 on failure. | |
| size_t | Write (FILE *f) const |
| Writes the header to a FILE. Returns 1 on success, 0 on failure. | |
| uint32_t | StreamedLength () const |
| Returns the number of bytes that should be written if we called one of the Write() members. More... | |
| int | Read (gzFile gzf) |
| Reads the header from a gzFile. More... | |
| int | Write (gzFile gzf) const |
| Writes the header to a gzFile. More... | |
| int | BZRead (BZFILE *bzf) |
| Reads the header from a BZFILE. More... | |
| int | BZWrite (BZFILE *bzf) const |
| Writes the header to a BZFILE. More... | |
| std::ostream & | PrintXML (std::ostream &os, const std::string &pre="") const |
| Prints the header is pseudo-XML. More... | |
| uint8_t * | End () const |
Public Member Functions inherited from Dwm::Readable | |
| virtual | ~Readable () |
| destructor | |
Public Member Functions inherited from Dwm::Writable | |
| virtual | ~Writable () |
| Destructor. | |
Public Member Functions inherited from Dwm::GZReadable | |
| virtual | ~GZReadable () |
| destructor | |
Public Member Functions inherited from Dwm::GZWritable | |
| virtual | ~GZWritable () |
| destructor | |
Encapsulates an IPv4 packet header.
| Dwm::Ipv4PacketHeader::Ipv4PacketHeader | ( | const struct ip & | ip | ) |
Construct from a struct ip.
The new object will own the underlying memory.
| Dwm::Ipv4PacketHeader::Ipv4PacketHeader | ( | struct ip * | ip | ) |
Construct from a pointer to a struct ip.
The caller will still own the memory at ip, and ip must remain unfreed while the new Ipv4PacketHeader object is in use.
| Dwm::Ipv4PacketHeader::~Ipv4PacketHeader | ( | ) |
Destructor.
If the underlying memory is owned by the object, it will be freed.
|
virtual |
Reads the header from a BZFILE.
Returns the number of bytes read on success, -1 on failure.
Implements Dwm::BZ2Readable.
|
virtual |
Writes the header to a BZFILE.
Returns the number of bytes written on success, -1 on failure.
Implements Dwm::BZ2Writable.
| std::ostream& Dwm::Ipv4PacketHeader::PrintXML | ( | std::ostream & | os, |
| const std::string & | pre = "" |
||
| ) | const |
Prints the header is pseudo-XML.
Each line will be prefixed by pre.
|
virtual |
Reads the header from a file descriptor.
Returns the number of bytes read on success, -1 on failure.
Implements Dwm::Readable.
|
virtual |
Reads the header from a gzFile.
Returns the number of bytes read on success, -1 on failure.
Implements Dwm::GZReadable.
|
virtual |
Returns the number of bytes that should be written if we called one of the Write() members.
Implements Dwm::Writable.
|
virtual |
Writes the header to a file descriptor.
Returns the number of bytes written on success, -1 on failure.
Implements Dwm::Writable.
|
virtual |
Writes the header to a gzFile.
Returns the number of bytes written on success, -1 on failure.
Implements Dwm::GZWritable.