1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-27 12:14:26 +01:00

Fixed compilation error in OSX. Fixed bug when sending IP PDUs in BSD.

This commit is contained in:
Matias Fontanini
2012-12-04 16:15:08 -03:00
parent 647ba1f46e
commit 356fe00aad
4 changed files with 16 additions and 21 deletions

View File

@@ -33,16 +33,14 @@
#include <stdint.h>
#include "macros.h"
#if defined(BSD)
#if defined(__APPLE__)
#include <sys/types.h>
#define TINS_IS_LITTLE_ENDIAN (BYTE_ORDER == LITTLE_ENDIAN)
#define TINS_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN)
#else
#include <sys/endian.h>
#define TINS_IS_LITTLE_ENDIAN (_BYTE_ORDER == _LITTLE_ENDIAN)
#define TINS_IS_BIG_ENDIAN (_BYTE_ORDER == _BIG_ENDIAN)
#endif
#if defined(__APPLE__)
#include <sys/types.h>
#define TINS_IS_LITTLE_ENDIAN (BYTE_ORDER == LITTLE_ENDIAN)
#define TINS_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN)
#elif defined(BSD)
#include <sys/endian.h>
#define TINS_IS_LITTLE_ENDIAN (_BYTE_ORDER == _LITTLE_ENDIAN)
#define TINS_IS_BIG_ENDIAN (_BYTE_ORDER == _BIG_ENDIAN)
#elif defined(WIN32)
// Assume windows == little endian. fixme later
#define TINS_IS_LITTLE_ENDIAN 1

View File

@@ -260,12 +260,7 @@ namespace Tins {
* \return The total length of this IP PDU.
*/
uint16_t tot_len() const {
// FreeBSD wants this in host byte order............
#ifdef __FreeBSD__
return _ip.tot_len;
#else
return Endian::be_to_host(_ip.tot_len);
#endif
}
/**