icmp/icmpechoreplymessage.cpp
icmp/icmpechorequestmessage.cpp
icmp/icmpgenericmessage.cpp
- icmp/icmpheader.cpp
+ icmp/icmpv4header.cpp
icmp/icmpmessage.cpp
icmp/icmppacket.cpp
icmp/icmppinger.cpp
ip/ipv4header.cpp
+ ip/ipv6header.cpp
link/linkstatusanalyzer.cpp
link/statusnotifiercommand.cpp
tcp/tcpheader.cpp
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include "icmp/icmppacket.h"
+
#include <iostream>
using namespace std;
* @param icmp_data The ICMP payload data.
*/
IcmpPacket::IcmpPacket(
- const IcmpHeader &icmp_header,
+ const Icmpv4Header &icmp_header,
const IcmpData &icmp_data
) :
IpHeader(),
*
* @return The ICMP header object.
*/
-IcmpHeader IcmpPacket::get_icmp_header() const
+Icmpv4Header IcmpPacket::get_icmp_header() const
{
return IcmpPayloadHeader;
}
#include <boost/asio.hpp>
-#include "icmp/icmpheader.h"
+#include "icmp/icmpv4header.h"
#include "icmp/icmpdata.h"
#include "icmp/icmptype.h"
#include "ip/ipv4header.h"
public:
IcmpPacket();
IcmpPacket(
- const IcmpHeader &icmp_header,
+ const Icmpv4Header &icmp_header,
const IcmpData &icmp_data
);
virtual ~IcmpPacket();
Ipv4Header get_ip_header() const;
- IcmpHeader get_icmp_header() const;
+ Icmpv4Header get_icmp_header() const;
IcmpData get_icmp_data() const;
bool match(
/// The IP header.
Ipv4Header IpHeader;
/// The ICMP packet header.
- IcmpHeader IcmpPayloadHeader;
+ Icmpv4Header IcmpPayloadHeader;
/// The ICMP packet payload (data).
IcmpData IcmpPayloadData;
};
#include "icmp/icmpchecksum.h"
#include "icmp/icmpdata.h"
-#include "icmp/icmpheader.h"
+#include "icmp/icmpv4header.h"
#include "icmp/icmppacket.h"
#include "icmp/icmptype.h"
#include "ip/ipv4header.h"
uint16_t checksum = calculator.compute(
type, code, Identifier, sequence_number
);
- IcmpHeader icmp_header(
+ Icmpv4Header icmp_header(
type, code, checksum, Identifier, sequence_number
);
BOOST_ASSERT( icmp_packet.get_icmp_header().get_type() == IcmpType_EchoReply );
Ipv4Header ipv4_header = icmp_packet.get_ip_header();
- IcmpHeader icmp_header = icmp_packet.get_icmp_header();
+ Icmpv4Header icmp_header = icmp_packet.get_icmp_header();
size_t bytes_received = bytes_transferred - ipv4_header.get_header_length();
string remote_address = ipv4_header.get_source_address().to_string();
BOOST_ASSERT( icmp_packet.get_icmp_header().get_type() == IcmpType_DestinationUnreachable );
Ipv4Header ipv4_hdr = icmp_packet.get_ip_header();
- IcmpHeader icmp_hdr = icmp_packet.get_icmp_header();
+ Icmpv4Header icmp_hdr = icmp_packet.get_icmp_header();
string local_address = ipv4_hdr.get_destination_address().to_string();
uint16_t sequence_number = icmp_hdr.get_sequence_number();
// 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/icmpheader.h"
+#include "icmp/icmpv4header.h"
#include "icmp/icmpdestinationunreachablemessage.h"
#include "icmp/icmpechoreplymessage.h"
using boost::shared_ptr;
//-----------------------------------------------------------------------------
-// IcmpHeader
+// Icmpv4Header
//-----------------------------------------------------------------------------
-IcmpHeader::IcmpHeader() :
+Icmpv4Header::Icmpv4Header() :
MessageFormat()
{
}
-IcmpHeader::IcmpHeader(
+Icmpv4Header::Icmpv4Header(
IcmpType type,
uint8_t code,
uint16_t checksum,
set_sequence_number( sequence_number );
}
-IcmpType IcmpHeader::get_type() const
+IcmpType Icmpv4Header::get_type() const
{
return get_icmp_message_format()->get_type();
}
-void IcmpHeader::set_type( IcmpType type )
+void Icmpv4Header::set_type( IcmpType type )
{
get_icmp_message_format()->set_type( type );
}
-uint8_t IcmpHeader::get_code() const
+uint8_t Icmpv4Header::get_code() const
{
return get_icmp_message_format()->get_code();
}
-void IcmpHeader::set_code( uint8_t code )
+void Icmpv4Header::set_code( uint8_t code )
{
get_icmp_message_format()->set_code( code );
}
-uint16_t IcmpHeader::get_checksum() const
+uint16_t Icmpv4Header::get_checksum() const
{
return get_icmp_message_format()->get_checksum();
}
-void IcmpHeader::set_checksum( uint16_t checksum )
+void Icmpv4Header::set_checksum( uint16_t checksum )
{
get_icmp_message_format()->set_checksum( checksum );
}
-uint16_t IcmpHeader::get_identifier() const
+uint16_t Icmpv4Header::get_identifier() const
{
return get_icmp_message_format()->get_identifier();
}
-void IcmpHeader::set_identifier( uint16_t identifier )
+void Icmpv4Header::set_identifier( uint16_t identifier )
{
get_icmp_message_format()->set_identifier( identifier );
}
-uint16_t IcmpHeader::get_sequence_number() const
+uint16_t Icmpv4Header::get_sequence_number() const
{
return get_icmp_message_format()->get_sequence_number();
}
-void IcmpHeader::set_sequence_number( uint16_t sequence_number )
+void Icmpv4Header::set_sequence_number( uint16_t sequence_number )
{
get_icmp_message_format()->set_sequence_number( sequence_number );
}
-shared_ptr<IcmpMessage> IcmpHeader::get_icmp_message_format() const
+shared_ptr<IcmpMessage> Icmpv4Header::get_icmp_message_format() const
{
BOOST_ASSERT( MessageFormat.get() != NULL );
return MessageFormat;
}
-void IcmpHeader::set_icmp_message_format( IcmpType type )
+void Icmpv4Header::set_icmp_message_format( IcmpType type )
{
BOOST_ASSERT( MessageFormat.get() == NULL );
BOOST_ASSERT( MessageFormat->get_type() != IcmpType_InvalidLast );
}
-void IcmpHeader::set_icmp_message_format( std::istream &is )
+void Icmpv4Header::set_icmp_message_format( std::istream &is )
{
// read the first byte, which contains the type of the ICMP message
char first_byte;
std::istream& operator>>(
std::istream &is,
- IcmpHeader &header
+ Icmpv4Header &header
)
{
// select the message format which will parse the fields
std::ostream& operator<<(
std::ostream &os,
- const IcmpHeader &header
+ const Icmpv4Header &header
)
{
// delegate the writing of the fields to a specialized encoder
// 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 ICMP_HEADER_H
-#define ICMP_HEADER_H
+#ifndef ICMPV4_HEADER_H
+#define ICMPV4_HEADER_H
#include <stdint.h>
#include "icmp/icmptype.h"
//-----------------------------------------------------------------------------
-// IcmpHeader
+// Icmpv4Header
//-----------------------------------------------------------------------------
/**
- * @brief This class represents the ICMP Packet Header.
+ * @brief This class represents the ICMP version 4 Packet Header.
*
* The ICMP Generic Header Format is:
*
* +-------------------------------+------------------------------+
* @endcode
*/
-class IcmpHeader
+class Icmpv4Header
{
public:
- IcmpHeader();
- IcmpHeader(
+ Icmpv4Header();
+ Icmpv4Header(
IcmpType type,
uint8_t code,
uint16_t checksum,
friend std::istream& operator>>(
std::istream &is,
- IcmpHeader &header
+ Icmpv4Header &header
);
friend std::ostream& operator<<(
std::ostream &os,
- const IcmpHeader &header
+ const Icmpv4Header &header
);
private:
};
-#endif // ICMP_HEADER_H
+#endif // ICMPV4_HEADER_H