[sr-dev] git:master:2200b214: sipcapture: fix timestamp byte order
Spencer Thomason
spencer at whiteskycommunications.com
Thu Jul 7 12:57:23 CEST 2016
Module: kamailio
Branch: master
Commit: 2200b214a314047697b4e080bc82b469933ff44b
URL: https://github.com/kamailio/kamailio/commit/2200b214a314047697b4e080bc82b469933ff44b
Author: Spencer Thomason <spencer at whiteskycommunications.com>
Committer: Spencer Thomason <spencer at 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/2200b214a314047697b4e080bc82b469933ff44b.diff
Patch: https://github.com/kamailio/kamailio/commit/2200b214a314047697b4e080bc82b469933ff44b.patch
---
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;
More information about the sr-dev
mailing list