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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user