Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 virtual void Serialize (Buffer::Iterator start) const; | 125 virtual void Serialize (Buffer::Iterator start) const; |
126 virtual uint32_t Deserialize (Buffer::Iterator start); | 126 virtual uint32_t Deserialize (Buffer::Iterator start); |
127 | 127 |
128 /** | 128 /** |
129 * \brief Is the UDP checksum correct ? | 129 * \brief Is the UDP checksum correct ? |
130 * \returns true if the checksum is correct, false otherwise. | 130 * \returns true if the checksum is correct, false otherwise. |
131 */ | 131 */ |
132 bool IsChecksumOk (void) const; | 132 bool IsChecksumOk (void) const; |
133 | 133 |
134 /** | 134 /** |
135 * \brief Force the UDP checksum to a given value | 135 * \brief Force the UDP checksum to a given value. |
136 * \param checksum the checksum to use. | 136 * |
Tom Henderson
2013/11/29 15:40:50
specify endianness to use. Add brief comment abou
Tommaso Pecorella
2013/11/30 10:52:41
Done.
| |
137 * This might be useful for test purposes or to | |
138 * restore the UDP checksum when the UDP header | |
139 * has been compressed (e.g., in 6LoWPAN). | |
140 * Note that, normally, the header checksum is | |
141 * calculated on the fly when the packet is | |
142 * serialized. | |
143 * | |
144 * When this option is used, the UDP checksum is written in | |
145 * the header, regardless of the global ChecksumEnabled option. | |
146 * | |
147 * \note The checksum value must be a big endian number. | |
148 * | |
149 * \param checksum the checksum to use (big endian). | |
137 */ | 150 */ |
138 void ForceChecksum (uint16_t checksum); | 151 void ForceChecksum (uint16_t checksum); |
139 | 152 |
140 /** | 153 /** |
141 * \brief Force the UDP payload length to a given value | 154 * \brief Force the UDP payload length to a given value. |
155 * | |
156 * This might be useful when forging a packet for test | |
157 * purposes. | |
158 * | |
142 * \param payloadSize the payload length to use. | 159 * \param payloadSize the payload length to use. |
Tom Henderson
2013/11/29 15:40:50
specify endianness to use. Add brief comment abou
Tommaso Pecorella
2013/11/30 10:52:41
Done
| |
143 */ | 160 */ |
144 void ForcePayloadSize (uint16_t payloadSize); | 161 void ForcePayloadSize (uint16_t payloadSize); |
145 | 162 |
146 /** | 163 /** |
147 * \brief Return the checksum (only known after a Deserialize) | 164 * \brief Return the checksum (only known after a Deserialize) |
148 * \return The checksum for this UdpHeader | 165 * \return The checksum for this UdpHeader |
149 */ | 166 */ |
150 uint16_t GetChecksum (); | 167 uint16_t GetChecksum (); |
151 | 168 |
152 private: | 169 private: |
(...skipping 11 matching lines...) Expand all Loading... | |
164 Address m_destination; //!< Destination IP address | 181 Address m_destination; //!< Destination IP address |
165 uint8_t m_protocol; //!< Protocol number | 182 uint8_t m_protocol; //!< Protocol number |
166 uint16_t m_checksum; //!< Forced Checksum value | 183 uint16_t m_checksum; //!< Forced Checksum value |
167 bool m_calcChecksum; //!< Flag to calculate checksum | 184 bool m_calcChecksum; //!< Flag to calculate checksum |
168 bool m_goodChecksum; //!< Flag to indicate that checksum is correct | 185 bool m_goodChecksum; //!< Flag to indicate that checksum is correct |
169 }; | 186 }; |
170 | 187 |
171 } // namespace ns3 | 188 } // namespace ns3 |
172 | 189 |
173 #endif /* UDP_HEADER */ | 190 #endif /* UDP_HEADER */ |
LEFT | RIGHT |