internet: Use constexpr for PROT_NUMBERs
This commit is contained in:
@@ -28,9 +28,6 @@ NS_LOG_COMPONENT_DEFINE("Icmpv4L4Protocol");
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED(Icmpv4L4Protocol);
|
||||
|
||||
// see rfc 792
|
||||
const uint8_t Icmpv4L4Protocol::PROT_NUMBER = 1;
|
||||
|
||||
TypeId
|
||||
Icmpv4L4Protocol::GetTypeId()
|
||||
{
|
||||
|
||||
@@ -40,7 +40,8 @@ class Icmpv4L4Protocol : public IpL4Protocol
|
||||
* @return the object TypeId
|
||||
*/
|
||||
static TypeId GetTypeId();
|
||||
static const uint8_t PROT_NUMBER; //!< ICMP protocol number (0x1)
|
||||
|
||||
static constexpr uint8_t PROT_NUMBER = 1; //!< ICMP protocol number (see \RFC{792})
|
||||
|
||||
Icmpv4L4Protocol();
|
||||
~Icmpv4L4Protocol() override;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "icmpv6-l4-protocol.h"
|
||||
|
||||
#include "ipv4-interface.h"
|
||||
#include "ipv6-interface.h"
|
||||
#include "ipv6-l3-protocol.h"
|
||||
#include "ipv6-route.h"
|
||||
|
||||
@@ -36,8 +36,6 @@ namespace ns3
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE("Ipv4L3Protocol");
|
||||
|
||||
const uint16_t Ipv4L3Protocol::PROT_NUMBER = 0x0800;
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED(Ipv4L3Protocol);
|
||||
|
||||
TypeId
|
||||
|
||||
@@ -77,7 +77,8 @@ class Ipv4L3Protocol : public Ipv4
|
||||
* @return the object TypeId
|
||||
*/
|
||||
static TypeId GetTypeId();
|
||||
static const uint16_t PROT_NUMBER; //!< Protocol number (0x0800)
|
||||
|
||||
static constexpr uint16_t PROT_NUMBER = 0x0800; //!< Protocol number
|
||||
|
||||
Ipv4L3Protocol();
|
||||
~Ipv4L3Protocol() override;
|
||||
|
||||
@@ -44,8 +44,6 @@ NS_LOG_COMPONENT_DEFINE("Ipv6L3Protocol");
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED(Ipv6L3Protocol);
|
||||
|
||||
const uint16_t Ipv6L3Protocol::PROT_NUMBER = 0x86DD;
|
||||
|
||||
TypeId
|
||||
Ipv6L3Protocol::GetTypeId()
|
||||
{
|
||||
|
||||
@@ -61,7 +61,7 @@ class Ipv6L3Protocol : public Ipv6
|
||||
/**
|
||||
* @brief The protocol number for IPv6 (0x86DD).
|
||||
*/
|
||||
static const uint16_t PROT_NUMBER;
|
||||
static constexpr uint16_t PROT_NUMBER = 0x86DD;
|
||||
|
||||
/**
|
||||
* @enum DropReason
|
||||
|
||||
@@ -56,9 +56,6 @@ NS_OBJECT_ENSURE_REGISTERED(TcpL4Protocol);
|
||||
std::clog << " [node " << m_node->GetId() << "] "; \
|
||||
}
|
||||
|
||||
/* see http://www.iana.org/assignments/protocol-numbers */
|
||||
const uint8_t TcpL4Protocol::PROT_NUMBER = 6;
|
||||
|
||||
TypeId
|
||||
TcpL4Protocol::GetTypeId()
|
||||
{
|
||||
|
||||
@@ -74,7 +74,9 @@ class TcpL4Protocol : public IpL4Protocol
|
||||
* @return the object TypeId
|
||||
*/
|
||||
static TypeId GetTypeId();
|
||||
static const uint8_t PROT_NUMBER; //!< protocol number (0x6)
|
||||
|
||||
/// Protocol number (see http://www.iana.org/assignments/protocol-numbers)
|
||||
static constexpr uint8_t PROT_NUMBER = 6;
|
||||
|
||||
TcpL4Protocol();
|
||||
~TcpL4Protocol() override;
|
||||
|
||||
@@ -36,9 +36,6 @@ NS_LOG_COMPONENT_DEFINE("UdpL4Protocol");
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED(UdpL4Protocol);
|
||||
|
||||
/* see http://www.iana.org/assignments/protocol-numbers */
|
||||
const uint8_t UdpL4Protocol::PROT_NUMBER = 17;
|
||||
|
||||
TypeId
|
||||
UdpL4Protocol::GetTypeId()
|
||||
{
|
||||
|
||||
@@ -57,7 +57,9 @@ class UdpL4Protocol : public IpL4Protocol
|
||||
* @return the object TypeId
|
||||
*/
|
||||
static TypeId GetTypeId();
|
||||
static const uint8_t PROT_NUMBER; //!< protocol number (0x11)
|
||||
|
||||
/// Protocol number (see http://www.iana.org/assignments/protocol-numbers)
|
||||
static constexpr uint8_t PROT_NUMBER = 17;
|
||||
|
||||
UdpL4Protocol();
|
||||
~UdpL4Protocol() override;
|
||||
|
||||
Reference in New Issue
Block a user