Encapsulates a TCP header. More...
#include <DwmIpv4TcpHeader.hh>


Public Member Functions | |
| Ipv4TcpHeader () | |
| Constructor. | |
| Ipv4TcpHeader (const Ipv4PacketHeader &ipHeader) | |
| Construct from an Ipv4PacketHeader which points at the IP header in a TCP packet. More... | |
| Ipv4TcpHeader (const Ipv4TcpHeader &tcpHeader) | |
| Copy constructor. | |
| Ipv4TcpHeader (struct tcphdr *tcpHdr) | |
| Construct from a pointer to a struct tcphdr. More... | |
| Ipv4TcpHeader (const struct tcphdr &tcpHdr) | |
| Construct by copying from a struct tcphdr. | |
| Ipv4TcpHeader & | operator= (const Ipv4TcpHeader &tcpHeader) |
| operator = | |
| ~Ipv4TcpHeader () | |
| Destructor. | |
| uint16_t | SourcePort () const |
| Returns the source port. | |
| uint16_t | SourcePort (uint16_t port) |
| Sets and returns the source port. | |
| uint16_t | DestinationPort () const |
| Returns the destination port. | |
| uint16_t | DestinationPort (uint16_t port) |
| Sets and returns the destination port. | |
| uint32_t | SequenceNumber () const |
| Returns the sequence number. | |
| uint32_t | SequenceNumber (uint32_t seq) |
| Sets and returns the sequence number. | |
| uint32_t | AckNumber () const |
| Returns the ACK nuber. | |
| uint32_t | AckNumber (uint32_t ack) |
| Sets and returns the ACK number. | |
| uint8_t | DataOffset () const |
| The number of 32 bit words in the TCP header. More... | |
| uint8_t | DataOffset (uint8_t offset) |
| Sets the number of 32 bit words in the TCP header. More... | |
| uint8_t | Flags () const |
| Returns the flags. | |
| uint8_t | Flags (uint8_t flags) |
| Sets and returns the flags. | |
| uint16_t | Window () const |
| Returns the window. | |
| uint16_t | Window (uint16_t window) |
| Sets and returns the window. | |
| uint16_t | Checksum () const |
| Returns the checksum. | |
| void | SetChecksum (const Ipv4PacketHeader &ipHeader, const std::string &data) |
| Sets the checksum, for which we need the IP header and the data. | |
| uint16_t | UrgentPointer () const |
| Returns the urgent pointer. | |
| uint16_t | UrgentPointer (uint16_t urgent) |
| Sets the urgent pointer. | |
| std::istream & | Read (std::istream &is) |
| Reads from an istream. Returns the istream. | |
| std::ostream & | Write (std::ostream &os) const |
| Writes to an ostream. Returns the ostream. | |
| ssize_t | Read (int fd) |
Reads from the given file descriptor fd. More... | |
| ssize_t | Write (int fd) const |
Writes to the given file descriptor fd. More... | |
| size_t | Read (FILE *f) |
Reads from the given FILE pointer f. More... | |
| size_t | Write (FILE *f) const |
Writes to the given FILE pointer f. More... | |
| int | Read (gzFile gzf) |
Reads from the given gzFile gzf. More... | |
| int | Write (gzFile gzf) const |
Writes to the given gzFile gzf. More... | |
| int | BZRead (BZFILE *bzf) |
Reads from the given BZFILE pointer bzf. More... | |
| int | BZWrite (BZFILE *bzf) const |
Writes to the given BZFILE pointer bzf. More... | |
| uint32_t | StreamedLength () const |
| Returns the number of bytes that would be written if one of the Write() members were called. More... | |
| bool | operator== (const Ipv4TcpHeader &tcpHeader) const |
| operator == | |
| std::ostream & | PrintXML (std::ostream &os, const std::string &pre="") const |
| Prints the TCP header to an ostream as pseudo-XML. More... | |
| uint8_t * | End () const |
| Returns the address of the end of the TCP header. More... | |
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 a TCP header.
| Dwm::Ipv4TcpHeader::Ipv4TcpHeader | ( | const Ipv4PacketHeader & | ipHeader | ) |
Construct from an Ipv4PacketHeader which points at the IP header in a TCP packet.
DO NOT FREE THE UNDERLYING MEMORY WHILE THE Ipv4TcpHeader IS STILL IN USE!
| Dwm::Ipv4TcpHeader::Ipv4TcpHeader | ( | struct tcphdr * | tcpHdr | ) |
Construct from a pointer to a struct tcphdr.
We don't copy, so don't free the data into which tcpHdr points until after the Ipv4TcpHeader is no longer in use.
|
virtual |
Reads from the given BZFILE pointer bzf.
Returns the number of bytes read on success, -1 on failure.
Implements Dwm::BZ2Readable.
|
virtual |
Writes to the given BZFILE pointer bzf.
Returns the number of bytes written on success, -1 on failure.
Implements Dwm::BZ2Writable.
| uint8_t Dwm::Ipv4TcpHeader::DataOffset | ( | ) | const |
The number of 32 bit words in the TCP header.
This indicates where the data begins. The TCP header (even one including options) is an integral number of 32 bits long.
| uint8_t Dwm::Ipv4TcpHeader::DataOffset | ( | uint8_t | offset | ) |
Sets the number of 32 bit words in the TCP header.
This indicates where the data begins. The TCP header (even one including options) is an integral number of 32 bits long.
| uint8_t* Dwm::Ipv4TcpHeader::End | ( | ) | const |
Returns the address of the end of the TCP header.
If our TCP header points into an existing TCP packet, this will be the first byte of the user data.
| std::ostream& Dwm::Ipv4TcpHeader::PrintXML | ( | std::ostream & | os, |
| const std::string & | pre = "" |
||
| ) | const |
Prints the TCP header to an ostream as pseudo-XML.
Each line will be prefixed with pre.
|
virtual |
Reads from the given file descriptor fd.
Returns the number of bytes read on success, -1 on failure.
Implements Dwm::Readable.
|
virtual |
Reads from the given FILE pointer f.
Returns 1 on success, 0 on failure (fread() semantics).
Implements Dwm::Readable.
|
virtual |
Reads from the given gzFile gzf.
Returns the number of bytes read on success, -1 on failure.
Implements Dwm::GZReadable.
|
virtual |
Returns the number of bytes that would be written if one of the Write() members were called.
Implements Dwm::Writable.
|
virtual |
Writes to the given file descriptor fd.
Returns the number of bytes written on success, -1 on failure.
Implements Dwm::Writable.
|
virtual |
Writes to the given FILE pointer f.
Returns 1 on success, 0 on failure (fwrite() semantics).
Implements Dwm::Writable.
|
virtual |
Writes to the given gzFile gzf.
Returns the number of bytes written on success, -1 on failure.
Implements Dwm::GZWritable.