diff --git a/include/udp.h b/include/udp.h index ae7fbc9..ad38be8 100644 --- a/include/udp.h +++ b/include/udp.h @@ -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. diff --git a/src/udp.cpp b/src/udp.cpp index 0fa8d2d..227d127 100644 --- a/src/udp.cpp +++ b/src/udp.cpp @@ -22,7 +22,6 @@ #include #include #include -#include "utils.h" #include "udp.h" #include "constants.h" #include "ip.h"