Left: | ||
Right: |
OLD | NEW |
---|---|
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2005 INRIA | 3 * Copyright (c) 2005 INRIA |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 } | 102 } |
103 | 103 |
104 Ipv4Header::DscpType· | 104 Ipv4Header::DscpType· |
105 Ipv4Header::GetDscp (void) const | 105 Ipv4Header::GetDscp (void) const |
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); |
110 } | 110 } |
111 | 111 |
112 uint8_t | |
113 Ipv4Header::DscpTypeToClassOfService (DscpType dscp) const | |
Tommaso Pecorella
2015/12/05 12:18:48
Please add to IPv6 header as well
| |
114 { | |
115 NS_LOG_FUNCTION (this << dscp); | |
116 switch (dscp) | |
Stefano Avallone
2016/01/04 16:17:31
Did you take this mapping from:
https://datatrack
| |
117 { | |
118 case DscpDefault: | |
119 return 0; | |
120 case DSCP_CS7: | |
121 return 7; | |
122 case DSCP_CS6: | |
123 return 6; | |
124 case DSCP_EF: | |
125 case DSCP_CS5: | |
126 return 5; | |
127 case DSCP_AF41: | |
128 case DSCP_AF42: | |
129 case DSCP_AF43: | |
130 case DSCP_CS4: | |
131 return 4; | |
132 case DSCP_AF31: | |
133 case DSCP_AF32: | |
134 case DSCP_AF33: | |
135 case DSCP_CS3: | |
136 return 3; | |
137 case DSCP_AF21: | |
138 case DSCP_AF22: | |
139 case DSCP_AF23: | |
140 case DSCP_CS2: | |
141 return 2; | |
142 case DSCP_AF11: | |
143 case DSCP_AF12: | |
144 case DSCP_AF13: | |
145 case DSCP_CS1: | |
146 return 1; | |
147 default: | |
148 NS_LOG_WARN ("Unmatched DSCP " << dscp); | |
149 return 0; | |
150 }; | |
151 } | |
152 | |
112 std::string· | 153 std::string· |
113 Ipv4Header::DscpTypeToString (DscpType dscp) const | 154 Ipv4Header::DscpTypeToString (DscpType dscp) const |
114 { | 155 { |
115 NS_LOG_FUNCTION (this << dscp); | 156 NS_LOG_FUNCTION (this << dscp); |
116 switch (dscp) | 157 switch (dscp) |
117 { | 158 { |
118 case DscpDefault: | 159 case DscpDefault: |
119 return "Default"; | 160 return "Default"; |
120 case DSCP_CS1: | 161 case DSCP_CS1: |
121 return "CS1"; | 162 return "CS1"; |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
460 i = start; | 501 i = start; |
461 uint16_t checksum = i.CalculateIpChecksum (headerSize); | 502 uint16_t checksum = i.CalculateIpChecksum (headerSize); |
462 NS_LOG_LOGIC ("checksum=" <<checksum); | 503 NS_LOG_LOGIC ("checksum=" <<checksum); |
463 | 504 |
464 m_goodChecksum = (checksum == 0); | 505 m_goodChecksum = (checksum == 0); |
465 } | 506 } |
466 return GetSerializedSize (); | 507 return GetSerializedSize (); |
467 } | 508 } |
468 | 509 |
469 } // namespace ns3 | 510 } // namespace ns3 |
OLD | NEW |