View | Details | Raw Unified | Return to bug 2304
Collapse All | Expand All

(-)a/src/internet/model/ipv4-header.cc (-2 / +2 lines)
 Lines 90-96    Link Here 
90
{
90
{
91
  NS_LOG_FUNCTION (this << dscp);
91
  NS_LOG_FUNCTION (this << dscp);
92
  m_tos &= 0x3; // Clear out the DSCP part, retain 2 bits of ECN
92
  m_tos &= 0x3; // Clear out the DSCP part, retain 2 bits of ECN
93
  m_tos |= dscp;
93
  m_tos |= (dscp << 2);
94
}
94
}
95
95
96
void
96
void
 Lines 106-112    Link Here 
106
{
106
{
107
  NS_LOG_FUNCTION (this);
107
  NS_LOG_FUNCTION (this);
108
  // Extract only first 6 bits of TOS byte, i.e 0xFC
108
  // Extract only first 6 bits of TOS byte, i.e 0xFC
109
  return DscpType (m_tos & 0xFC);
109
  return DscpType ((m_tos & 0xFC) >> 2);
110
}
110
}
111
111
112
std::string 
112
std::string 
(-)a/src/internet/model/ipv4-header.h (-23 / +24 lines)
 Lines 53-61    Link Here 
53
   * \param tos the 8 bits of Ipv4 TOS.
53
   * \param tos the 8 bits of Ipv4 TOS.
54
   */
54
   */
55
  void SetTos (uint8_t tos);
55
  void SetTos (uint8_t tos);
56
public:
56
  /**
57
  /**
57
   * \enum DscpType
58
   * \enum DscpType
58
   * \brief DiffServ Code Points 
59
   * \brief DiffServ Code Points
59
   * Code Points defined in
60
   * Code Points defined in
60
   * Assured Forwarding (AF) \RFC{2597}
61
   * Assured Forwarding (AF) \RFC{2597}
61
   * Expedited Forwarding (EF) \RFC{2598}
62
   * Expedited Forwarding (EF) \RFC{2598}
 Lines 66-97    Link Here 
66
      DscpDefault = 0x00,
67
      DscpDefault = 0x00,
67
68
68
      // Prefixed with "DSCP" to avoid name clash (bug 1723)
69
      // Prefixed with "DSCP" to avoid name clash (bug 1723)
69
      DSCP_CS1 = 0x20,
70
      DSCP_CS1  = 0x08, // octal 010
70
      DSCP_AF11 = 0x28,
71
      DSCP_AF11 = 0x0A, // octal 012
71
      DSCP_AF12 = 0x30,
72
      DSCP_AF12 = 0x0C, // octal 014
72
      DSCP_AF13 = 0x38,
73
      DSCP_AF13 = 0x0E, // octal 016
73
74
74
      DSCP_CS2 = 0x40,
75
      DSCP_CS2  = 0x10, // octal 020
75
      DSCP_AF21 = 0x48,
76
      DSCP_AF21 = 0x12, // octal 022
76
      DSCP_AF22 = 0x50,
77
      DSCP_AF22 = 0x14, // octal 024
77
      DSCP_AF23 = 0x58,
78
      DSCP_AF23 = 0x16, // octal 026
78
79
79
      DSCP_CS3 = 0x60,
80
      DSCP_CS3  = 0x18, // octal 030
80
      DSCP_AF31 = 0x68,
81
      DSCP_AF31 = 0x1A, // octal 032
81
      DSCP_AF32 = 0x70,
82
      DSCP_AF32 = 0x1C, // octal 034
82
      DSCP_AF33 = 0x78,
83
      DSCP_AF33 = 0x1E, // octal 036
83
84
84
      DSCP_CS4 = 0x80,
85
      DSCP_CS4  = 0x20, // octal 040
85
      DSCP_AF41 = 0x88,
86
      DSCP_AF41 = 0x22, // octal 042
86
      DSCP_AF42 = 0x90,
87
      DSCP_AF42 = 0x24, // octal 044
87
      DSCP_AF43 = 0x98,
88
      DSCP_AF43 = 0x26, // octal 046
88
89
89
      DSCP_CS5 = 0xA0,
90
      DSCP_CS5  = 0x28, // octal 050
90
      DSCP_EF = 0xB8,
91
      DSCP_EF   = 0x2E, // octal 056
91
      
92
92
      DSCP_CS6 = 0xC0,
93
      DSCP_CS6  = 0x30, // octal 060
93
      DSCP_CS7 = 0xE0
94
      DSCP_CS7  = 0x38  // octal 070
94
      
95
95
    };
96
    };
96
  /**
97
  /**
97
   * \brief Set DSCP Field
98
   * \brief Set DSCP Field
(-)a/src/internet/model/ipv6-header.cc (-2 / +2 lines)
 Lines 189-202    Link Here 
189
{
189
{
190
  NS_LOG_FUNCTION (this << dscp);
190
  NS_LOG_FUNCTION (this << dscp);
191
  m_trafficClass &= 0x3; // Clear out the DSCP part, retain 2 bits of ECN
191
  m_trafficClass &= 0x3; // Clear out the DSCP part, retain 2 bits of ECN
192
  m_trafficClass |= dscp;
192
  m_trafficClass |= (dscp << 2);
193
}
193
}
194
194
195
Ipv6Header::DscpType Ipv6Header::GetDscp (void) const
195
Ipv6Header::DscpType Ipv6Header::GetDscp (void) const
196
{
196
{
197
  NS_LOG_FUNCTION (this);
197
  NS_LOG_FUNCTION (this);
198
  // Extract only first 6 bits of TOS byte, i.e 0xFC
198
  // Extract only first 6 bits of TOS byte, i.e 0xFC
199
  return DscpType (m_trafficClass & 0xFC);
199
  return DscpType ((m_trafficClass & 0xFC) >> 2);
200
}
200
}
201
201
202
std::string Ipv6Header::DscpTypeToString (DscpType dscp) const
202
std::string Ipv6Header::DscpTypeToString (DscpType dscp) const
(-)a/src/internet/model/ipv6-header.h (-20 / +20 lines)
 Lines 46-76    Link Here 
46
      DscpDefault = 0x00,
46
      DscpDefault = 0x00,
47
47
48
      // Prefixed with "DSCP" to avoid name clash (bug 1723)
48
      // Prefixed with "DSCP" to avoid name clash (bug 1723)
49
      DSCP_CS1 = 0x20,
49
      DSCP_CS1  = 0x08, // octal 010
50
      DSCP_AF11 = 0x28,
50
      DSCP_AF11 = 0x0A, // octal 012
51
      DSCP_AF12 = 0x30,
51
      DSCP_AF12 = 0x0C, // octal 014
52
      DSCP_AF13 = 0x38,
52
      DSCP_AF13 = 0x0E, // octal 016
53
53
54
      DSCP_CS2 = 0x40,
54
      DSCP_CS2  = 0x10, // octal 020
55
      DSCP_AF21 = 0x48,
55
      DSCP_AF21 = 0x12, // octal 022
56
      DSCP_AF22 = 0x50,
56
      DSCP_AF22 = 0x14, // octal 024
57
      DSCP_AF23 = 0x58,
57
      DSCP_AF23 = 0x16, // octal 026
58
58
59
      DSCP_CS3 = 0x60,
59
      DSCP_CS3  = 0x18, // octal 030
60
      DSCP_AF31 = 0x68,
60
      DSCP_AF31 = 0x1A, // octal 032
61
      DSCP_AF32 = 0x70,
61
      DSCP_AF32 = 0x1C, // octal 034
62
      DSCP_AF33 = 0x78,
62
      DSCP_AF33 = 0x1E, // octal 036
63
63
64
      DSCP_CS4 = 0x80,
64
      DSCP_CS4  = 0x20, // octal 040
65
      DSCP_AF41 = 0x88,
65
      DSCP_AF41 = 0x22, // octal 042
66
      DSCP_AF42 = 0x90,
66
      DSCP_AF42 = 0x24, // octal 044
67
      DSCP_AF43 = 0x98,
67
      DSCP_AF43 = 0x26, // octal 046
68
68
69
      DSCP_CS5 = 0xA0,
69
      DSCP_CS5  = 0x28, // octal 050
70
      DSCP_EF = 0xB8,
70
      DSCP_EF   = 0x2E, // octal 056
71
71
72
      DSCP_CS6 = 0xC0,
72
      DSCP_CS6  = 0x30, // octal 060
73
      DSCP_CS7 = 0xE0
73
      DSCP_CS7  = 0x38  // octal 070
74
74
75
    };
75
    };
76
76

Return to bug 2304