Module: kamailio
Branch: master
Commit: 2200b214a314047697b4e080bc82b469933ff44b
URL:
https://github.com/kamailio/kamailio/commit/2200b214a314047697b4e080bc82b46…
Author: Spencer Thomason <spencer(a)whiteskycommunications.com>
Committer: Spencer Thomason <spencer(a)whiteskycommunications.com>
Date: 2016-07-07T02:55:09-07:00
sipcapture: fix timestamp byte order
- swap timestamp byte order on big endian machines
---
Modified: modules/sipcapture/hep.c
Modified: modules/sipcapture/hep.h
---
Diff:
https://github.com/kamailio/kamailio/commit/2200b214a314047697b4e080bc82b46…
Patch:
https://github.com/kamailio/kamailio/commit/2200b214a314047697b4e080bc82b46…
---
diff --git a/modules/sipcapture/hep.c b/modules/sipcapture/hep.c
index 3114f2c..1ca2904 100644
--- a/modules/sipcapture/hep.c
+++ b/modules/sipcapture/hep.c
@@ -176,8 +176,8 @@ int hepv2_received(char *buf, unsigned int len, struct receive_info
*ri){
hep_offset+=sizeof(struct hep_timehdr);
heptime_tmp = (struct hep_timehdr*) hep_payload;
- heptime->tv_sec = heptime_tmp->tv_sec;
- heptime->tv_usec = heptime_tmp->tv_usec;
+ heptime->tv_sec = to_le(heptime_tmp->tv_sec);
+ heptime->tv_usec = to_le(heptime_tmp->tv_usec);
heptime->captid = heptime_tmp->captid;
}
diff --git a/modules/sipcapture/hep.h b/modules/sipcapture/hep.h
index c2433db..3135b6b 100644
--- a/modules/sipcapture/hep.h
+++ b/modules/sipcapture/hep.h
@@ -24,6 +24,13 @@
#ifndef _hep_h
#define _hep_h
+#include "../../endianness.h"
+
+#ifdef __IS_BIG_ENDIAN
+#define to_le(x) bswap32(x)
+#else
+#define to_le(x) (x)
+#endif
#ifdef __OS_solaris
typedef uint8_t u_int8_t;