libDwm-0.6.0
Dwm::Ipv4IcmpEchoRequest Class Reference

Encapsulates an ICMP echo request. More...

#include <DwmIpv4IcmpEchoRequest.hh>

Inheritance diagram for Dwm::Ipv4IcmpEchoRequest:
Collaboration diagram for Dwm::Ipv4IcmpEchoRequest:

Public Member Functions

 Ipv4IcmpEchoRequest ()
 Default constructor.
 
 Ipv4IcmpEchoRequest (uint16_t id, uint16_t seq, const std::string &data)
 Construct from the given identifier id, sequence number seq and data. More...
 
 Ipv4IcmpEchoRequest (uint8_t *buf, uint16_t len)
 
uint16_t Identifier () const
 Returns the identifier.
 
uint16_t Identifier (uint16_t id)
 Sets and returns the identifier.
 
uint16_t SequenceNumber () const
 Returns the sequence number.
 
uint16_t SequenceNumber (uint16_t seq)
 Sets and returns the sequence number.
 
std::string Data () const
 Returns the data as a string.
 
std::string Data (const std::string &data)
 Sets the data to the given data. Returns the data.
 
template<typename T >
bool SetData (const T &data)
 Sets the data to the given data. More...
 
template<typename T >
bool GetData (T &data) const
 Copies the enacapsulated data into data. More...
 
bool SendTo (Socket &s, const Ipv4Address &destination)
 Sends the echo request to the given destination via the given Socket s. More...
 
- Public Member Functions inherited from Dwm::Ipv4IcmpMessage
 Ipv4IcmpMessage ()
 Default constructor.
 
 ~Ipv4IcmpMessage ()
 Destructor.
 
uint8_t Type () const
 Returns the ICMP message type.
 
uint8_t Type (uint8_t type)
 Sets and returns the ICMP message type.
 
uint8_t Code () const
 Returns the ICMP message code.
 
uint8_t Code (uint8_t code)
 Sets and returns the ICMP message code.
 
uint16_t Checksum ()
 Returns the ICMP checksum.
 
void SetChecksum ()
 Computes and sets the checksum.
 
std::istream & Read (std::istream &is, uint16_t len)
 Reads the message of length len from an istream. More...
 
std::ostream & Write (std::ostream &os) const
 Writes the message to an ostream. Returns the ostream.
 
ssize_t Read (int fd, uint16_t len)
 Reads the message of length len from a file descriptor. More...
 
ssize_t Write (int fd) const
 Writes the message to a file descriptor. More...
 
size_t Read (FILE *f, uint16_t len)
 Reads the message of length len from a FILE. More...
 
size_t Write (FILE *f) const
 Writes the message to a FILE. Returns 1 on success, 0 on failure.
 
int Read (gzFile gzf, uint16_t len)
 Reads the message of length len from a gzFile. More...
 
int Write (gzFile gzf) const
 Writes the message to a gzFile. More...
 
int BZRead (BZFILE *bzf, uint16_t len)
 Reads the message of length len from a BZFILE. More...
 
int BZWrite (BZFILE *bzf) const
 Writes the message to a BZFILE. More...
 
uint32_t StreamedLength () const
 Returns the number of bytes that would be written if we called one of the Write() members. More...
 
bool operator== (const Ipv4IcmpMessage &msg) const
 operator ==
 
- Public Member Functions inherited from Dwm::Writable
virtual ~Writable ()
 Destructor.
 
- Public Member Functions inherited from Dwm::GZWritable
virtual ~GZWritable ()
 destructor
 

Additional Inherited Members

- Protected Member Functions inherited from Dwm::Ipv4IcmpMessage
void Free ()
 
void Allocate (uint16_t len)
 
void Reallocate (uint16_t len)
 
- Protected Attributes inherited from Dwm::Ipv4IcmpMessage
std::pair< uint16_t, uint8_t * > _data
 
bool _ownData
 

Detailed Description

Encapsulates an ICMP echo request.

Constructor & Destructor Documentation

◆ Ipv4IcmpEchoRequest()

Dwm::Ipv4IcmpEchoRequest::Ipv4IcmpEchoRequest ( uint16_t  id,
uint16_t  seq,
const std::string &  data 
)

Construct from the given identifier id, sequence number seq and data.

Member Function Documentation

◆ GetData()

template<typename T >
bool Dwm::Ipv4IcmpEchoRequest::GetData ( T &  data) const
inline

Copies the enacapsulated data into data.

Note that data must be readable via Dwm::IO, which emans it must be a type supported by Dwm::IO or a type derived from Dwm::Readable. Returns true on success, false on failure.

Here is the call graph for this function:

◆ SendTo()

bool Dwm::Ipv4IcmpEchoRequest::SendTo ( Socket s,
const Ipv4Address destination 
)

Sends the echo request to the given destination via the given Socket s.

Returns true on success, false on failure.

◆ SetData()

template<typename T >
bool Dwm::Ipv4IcmpEchoRequest::SetData ( const T &  data)
inline

Sets the data to the given data.

Note that data must be writable via Dwm::IO, which emans it must be a type supported by Dwm::IO or a type derived from Dwm::Writable. Returns true on success, false on failure.

Here is the call graph for this function:

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