diff --git a/src/internet/model/tcp-header.cc b/src/internet/model/tcp-header.cc index 3fa09ec19..cc3b7f7da 100644 --- a/src/internet/model/tcp-header.cc +++ b/src/internet/model/tcp-header.cc @@ -35,25 +35,6 @@ NS_LOG_COMPONENT_DEFINE("TcpHeader"); NS_OBJECT_ENSURE_REGISTERED(TcpHeader); -TcpHeader::TcpHeader() - : m_sourcePort(0), - m_destinationPort(0), - m_sequenceNumber(0), - m_ackNumber(0), - m_length(5), - m_flags(0), - m_windowSize(0xffff), - m_urgentPointer(0), - m_calcChecksum(false), - m_goodChecksum(true), - m_optionsLen(0) -{ -} - -TcpHeader::~TcpHeader() -{ -} - std::string TcpHeader::FlagsToString(uint8_t flags, const std::string& delimiter) { diff --git a/src/internet/model/tcp-header.h b/src/internet/model/tcp-header.h index 96c9aef04..1d7a94804 100644 --- a/src/internet/model/tcp-header.h +++ b/src/internet/model/tcp-header.h @@ -45,9 +45,6 @@ namespace ns3 class TcpHeader : public Header { public: - TcpHeader(); - ~TcpHeader() override; - typedef std::list> TcpOptionList; //!< List of TcpOption /** @@ -331,25 +328,25 @@ class TcpHeader : public Header */ uint8_t CalculateHeaderLength() const; - uint16_t m_sourcePort; //!< Source port - uint16_t m_destinationPort; //!< Destination port - SequenceNumber32 m_sequenceNumber; //!< Sequence number - SequenceNumber32 m_ackNumber; //!< ACK number - uint8_t m_length; //!< Length (really a uint4_t) in words. - uint8_t m_flags; //!< Flags (really a uint6_t) - uint16_t m_windowSize; //!< Window size - uint16_t m_urgentPointer; //!< Urgent pointer + uint16_t m_sourcePort{0}; //!< Source port + uint16_t m_destinationPort{0}; //!< Destination port + SequenceNumber32 m_sequenceNumber{0}; //!< Sequence number + SequenceNumber32 m_ackNumber{0}; //!< ACK number + uint8_t m_length{5}; //!< Length (really a uint4_t) in words. + uint8_t m_flags{0}; //!< Flags (really a uint6_t) + uint16_t m_windowSize{0xffff}; //!< Window size + uint16_t m_urgentPointer{0}; //!< Urgent pointer Address m_source; //!< Source IP address Address m_destination; //!< Destination IP address - uint8_t m_protocol; //!< Protocol number + uint8_t m_protocol{6}; //!< Protocol number - bool m_calcChecksum; //!< Flag to calculate checksum - bool m_goodChecksum; //!< Flag to indicate that checksum is correct + bool m_calcChecksum{false}; //!< Flag to calculate checksum + bool m_goodChecksum{true}; //!< Flag to indicate that checksum is correct static const uint8_t m_maxOptionsLen = 40; //!< Maximum options length TcpOptionList m_options; //!< TcpOption present in the header - uint8_t m_optionsLen; //!< Tcp options length. + uint8_t m_optionsLen{0}; //!< Tcp options length. }; } // namespace ns3 diff --git a/src/internet/model/udp-header.cc b/src/internet/model/udp-header.cc index 3d6c49011..ec03f19ba 100644 --- a/src/internet/model/udp-header.cc +++ b/src/internet/model/udp-header.cc @@ -26,26 +26,6 @@ namespace ns3 NS_OBJECT_ENSURE_REGISTERED(UdpHeader); -/* The magic values below are used only for debugging. - * They can be used to easily detect memory corruption - * problems so you can see the patterns in memory. - */ -UdpHeader::UdpHeader() - : m_sourcePort(0xfffd), - m_destinationPort(0xfffd), - m_checksum(0), - m_calcChecksum(false), - m_goodChecksum(true) -{ -} - -UdpHeader::~UdpHeader() -{ - m_sourcePort = 0xfffe; - m_destinationPort = 0xfffe; - m_payloadSize = 0xfffe; -} - void UdpHeader::EnableChecksums() { diff --git a/src/internet/model/udp-header.h b/src/internet/model/udp-header.h index 43fba6e6a..52400714f 100644 --- a/src/internet/model/udp-header.h +++ b/src/internet/model/udp-header.h @@ -40,14 +40,6 @@ namespace ns3 class UdpHeader : public Header { public: - /** - * \brief Constructor - * - * Creates a null header - */ - UdpHeader(); - ~UdpHeader() override; - /** * \brief Enable checksum calculation for UDP */ @@ -167,17 +159,21 @@ class UdpHeader : public Header * \returns the checksum */ uint16_t CalculateHeaderChecksum(uint16_t size) const; - uint16_t m_sourcePort; //!< Source port - uint16_t m_destinationPort; //!< Destination port - uint16_t m_payloadSize{0}; //!< Payload size - uint16_t m_forcedPayloadSize{0}; //!< Payload size (forced) - Address m_source; //!< Source IP address - Address m_destination; //!< Destination IP address - uint8_t m_protocol; //!< Protocol number - uint16_t m_checksum; //!< Forced Checksum value - bool m_calcChecksum; //!< Flag to calculate checksum - bool m_goodChecksum; //!< Flag to indicate that checksum is correct + // The magic values below are used only for debugging. + // They can be used to easily detect memory corruption + // problems so you can see the patterns in memory. + uint16_t m_sourcePort{0xfffd}; //!< Source port + uint16_t m_destinationPort{0xfffd}; //!< Destination port + uint16_t m_payloadSize{0}; //!< Payload size + uint16_t m_forcedPayloadSize{0}; //!< Payload size (forced) + + Address m_source; //!< Source IP address + Address m_destination; //!< Destination IP address + uint8_t m_protocol{17}; //!< Protocol number + uint16_t m_checksum{0}; //!< Forced Checksum value + bool m_calcChecksum{false}; //!< Flag to calculate checksum + bool m_goodChecksum{true}; //!< Flag to indicate that checksum is correct }; } // namespace ns3