dns/hostaddress.cpp
dns/timetolive.cpp
host/hoststatusanalyzer.cpp
+ host/messagepayload.cpp
host/pinger.cpp
host/pingerfactory.cpp
host/pinginterval.cpp
icmp/icmpgenericmessage.cpp
icmp/icmpheader.cpp
icmp/icmpmessage.cpp
- icmp/icmpmessagepayload.cpp
icmp/icmppacket.cpp
icmp/icmppinger.cpp
ip/ipv4header.cpp
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#include "icmp/icmpmessagepayload.h"
+#include "host/messagepayload.h"
#include <limits>
using I2n::Logger::GlobalLogger;
//-----------------------------------------------------------------------------
-// IcmpMessagePayload
+// MessagePayload
//-----------------------------------------------------------------------------
/**
* @param payload_size_in_bytes the size of the payload (ie the internal buffer)
*/
-IcmpMessagePayload::IcmpMessagePayload(
+MessagePayload::MessagePayload(
const std::size_t &payload_size_in_bytes
) :
PayloadSizeInBytes( payload_size_in_bytes ),
fill( Payload.get(), Payload.get() + PayloadSizeInBytes, 0 );
}
-IcmpMessagePayload::~IcmpMessagePayload()
+MessagePayload::~MessagePayload()
{
// Payload automatically delete by smart pointer scope end
}
* @brief The element access operator to provide access syntax like regular
* arrays.
*/
-const uint8_t& IcmpMessagePayload::operator[]( size_t offset ) const
+const uint8_t& MessagePayload::operator[]( size_t offset ) const
{
BOOST_ASSERT( offset < PayloadSizeInBytes );
* @brief The element access operator to provide access syntax like regular
* arrays.
*/
-uint8_t& IcmpMessagePayload::operator[]( size_t offset )
+uint8_t& MessagePayload::operator[]( size_t offset )
{
BOOST_ASSERT( offset < PayloadSizeInBytes );
* @return a concatenation of the byte indexed by left_byte with the byte
* indexed by right_byte
*/
-uint16_t IcmpMessagePayload::decode16(
+uint16_t MessagePayload::decode16(
const int left_byte,
const int right_byte
) const
*
* @param left_byte the index of the left byte
* @param right_byte the index of the right byte
- *
* @param value a 16 bits data be saved in the bytes indexed by left_byte and
* right_byte.
+ *
+ * @return void
*/
-void IcmpMessagePayload::encode16(
+void MessagePayload::encode16(
const int left_byte,
const int right_byte,
const uint16_t value
/**
* @brief Read all the data from the payload and stores in the istream.
*/
-istream& IcmpMessagePayload::read( istream &is )
+istream& MessagePayload::read( istream &is )
{
char *payload_data_array = reinterpret_cast<char *> ( Payload.get() );
(void) is.read( payload_data_array, PayloadSizeInBytes );
/**
* @brief Writes all the data present in the ostream to the payload buffer.
*/
-ostream& IcmpMessagePayload::write( ostream &os ) const
+ostream& MessagePayload::write( ostream &os ) const
{
const char *data_array = reinterpret_cast<const char *> ( Payload.get() );
return os.write( data_array, PayloadSizeInBytes );
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#ifndef ICMPMESSAGEPAYLOAD_H
-#define ICMPMESSAGEPAYLOAD_H
+#ifndef MESSAGE_PAYLOAD_H
+#define MESSAGE_PAYLOAD_H
#include <stdint.h>
Class & operator= ( const Class & );
//-----------------------------------------------------------------------------
-// IcmpMessagePayload
+// MessagePayload
//-----------------------------------------------------------------------------
/**
* @brief This class represents the contents of the network messages. It
- * provides means for encode and decode, and also can be treated like an
- * ordinary array.
+ * provides means for encode and decode (i.e. deal with endianness), and also
+ * can be treated like an ordinary array.
*/
-class IcmpMessagePayload
+class MessagePayload
{
public:
- explicit IcmpMessagePayload( const std::size_t &payload_size_in_bytes );
- ~IcmpMessagePayload();
+ explicit MessagePayload( const std::size_t &payload_size_in_bytes );
+ ~MessagePayload();
const uint8_t& operator[]( std::size_t offset ) const;
uint8_t& operator[]( std::size_t offset );
/// the payload buffer
boost::scoped_array<uint8_t> Payload;
- NONCOPYABLE( IcmpMessagePayload )
+ NONCOPYABLE( MessagePayload )
};
-#endif /* ICMPMESSAGEPAYLOAD_H */
+#endif // MESSAGE_PAYLOAD_H
#include <ostream>
#include "icmp/icmpmessage.h"
-#include "icmp/icmpmessagepayload.h"
+#include "host/messagepayload.h"
//-----------------------------------------------------------------------------
// IcmpDestinationUnreachableMessage
private:
/// packet payload object
- IcmpMessagePayload Payload;
+ MessagePayload Payload;
};
#include <ostream>
#include "icmp/icmpmessage.h"
-#include "icmp/icmpmessagepayload.h"
+#include "host/messagepayload.h"
//-----------------------------------------------------------------------------
// IcmpEchoReplyMessage
private:
/// packet payload object
- IcmpMessagePayload Payload;
+ MessagePayload Payload;
};
#include <ostream>
#include "icmp/icmpmessage.h"
-#include "icmp/icmpmessagepayload.h"
+#include "host/messagepayload.h"
//-----------------------------------------------------------------------------
// IcmpEchoRequestMessage
private:
/// packet payload object
- IcmpMessagePayload Payload;
+ MessagePayload Payload;
};