42 #ifndef _DWMIPV4ICMPECHOREQUEST_HH_ 43 #define _DWMIPV4ICMPECHOREQUEST_HH_ 105 std::string
Data()
const;
110 std::string
Data(
const std::string & data);
118 template <
typename T>
123 Reallocate(dataLen + 8);
124 std::ostringstream os;
126 memcpy((
char *)_data.second + 8, os.str().c_str(), dataLen);
138 template <
typename T>
143 std::istringstream is(std::string((
char *)_data.second + 8,
145 rc = (
IO::Read(is, data) ? true :
false);
160 #endif // _DWMIPV4ICMPECHOREQUEST_HH_ This class abstracts a UNIX socket descriptor.
Definition: DwmSocket.hh:62
Base class for ICMP messages.
Definition: DwmIpv4IcmpMessage.hh:60
std::string Data() const
Returns the data as a string.
This class encapsulates an IPv4 address.
Definition: DwmIpv4Address.hh:62
uint16_t Identifier() const
Returns the identifier.
bool GetData(T &data) const
Copies the enacapsulated data into data.
Definition: DwmIpv4IcmpEchoRequest.hh:139
Ipv4IcmpEchoRequest()
Default constructor.
Dwm::Socket class definition.
static std::ostream & Write(std::ostream &os, char c)
Writes c to os. Returns os.
bool SetData(const T &data)
Sets the data to the given data.
Definition: DwmIpv4IcmpEchoRequest.hh:119
static std::istream & Read(std::istream &is, char &c)
Reads c from is. Returns is.
Definition: DwmBZ2IO.hh:67
Dwm::IO class definition.
Dwm::Ipv4IcmpMessage class definition.
Dwm::Ipv4Address class definition.
static uint32_t StreamedLength(char c)
Returns the number of bytes that would be written if we called Write() for a char.
Definition: DwmIO.hh:92
Encapsulates an ICMP echo request.
Definition: DwmIpv4IcmpEchoRequest.hh:62
uint16_t SequenceNumber() const
Returns the sequence number.
bool SendTo(Socket &s, const Ipv4Address &destination)
Sends the echo request to the given destination via the given Socket s.