1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Fixed endianness bug in UDP's getters.

This commit is contained in:
Matias Fontanini
2011-09-15 10:21:23 -03:00
parent 28f7e3ed1e
commit ff21304852
2 changed files with 4 additions and 4 deletions

View File

@@ -24,6 +24,7 @@
#include "pdu.h"
#include "utils.h"
namespace Tins {
@@ -67,19 +68,19 @@ namespace Tins {
* \brief Getter for the destination port.
* \return The datagram's destination port.
*/
inline uint16_t dport() const { return _udp.dport; }
inline uint16_t dport() const { return Utils::net_to_host_s(_udp.dport); }
/**
* \brief Getter for the source port.
* \return The datagram's source port.
*/
inline uint16_t sport() const { return _udp.sport; }
inline uint16_t sport() const { return Utils::net_to_host_s(_udp.sport); }
/**
* \brief Getter for the length of the datagram.
* \return The length of the datagram.
*/
inline uint16_t length() const { return _udp.len; }
inline uint16_t length() const { return Utils::net_to_host_s(_udp.len); }
/**
* \brief Set the destination port.

View File

@@ -22,7 +22,6 @@
#include <stdexcept>
#include <cassert>
#include <cstring>
#include "utils.h"
#include "udp.h"
#include "constants.h"
#include "ip.h"