aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ppi-geolocation-common.c
diff options
context:
space:
mode:
authorStephen Fisher <steve@stephen-fisher.com>2010-11-18 20:54:14 +0000
committerStephen Fisher <steve@stephen-fisher.com>2010-11-18 20:54:14 +0000
commitdbf10b1dc8f1f98c42f9500769dcec9f9633b7d9 (patch)
treef13ac99fb8bcf68ace7cf3c95a2db4a6faa1de5e /epan/dissectors/packet-ppi-geolocation-common.c
parent1d42ee3ebba160fc76352ddbf9e7ef3da1d17879 (diff)
From Jon Ellch via bug #5175: Add PPI-GPS protocol dissector patch
Minor changes by me as detailed in the bug's comment #8. svn path=/trunk/; revision=34956
Diffstat (limited to 'epan/dissectors/packet-ppi-geolocation-common.c')
-rw-r--r--epan/dissectors/packet-ppi-geolocation-common.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/epan/dissectors/packet-ppi-geolocation-common.c b/epan/dissectors/packet-ppi-geolocation-common.c
new file mode 100644
index 0000000000..094c8fc5c9
--- /dev/null
+++ b/epan/dissectors/packet-ppi-geolocation-common.c
@@ -0,0 +1,74 @@
+/* packet-ppi-geolocation-common.c
+ * Routines for PPI-GEOLOCATION dissection
+ * Copyright 2010, Harris Corp, jellch@harris.com
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "packet-ppi-geolocation-common.h"
+
+/*
+ * input: a unsigned 32-bit (native endian) value between 0 and 3600000000 (inclusive)
+ * output: a signed floating point value betwen -180.0000000 and + 180.0000000, inclusive)
+ */
+gdouble fixed3_7_to_gdouble(guint32 in) {
+ gint32 remapped_in = in - (180 * 10000000);
+ gdouble ret = (gdouble) ((gdouble) remapped_in / 10000000);
+ return ret;
+}
+/*
+ * input: a native 32 bit unsigned value between 0 and 999999999
+ * output: a positive floating point value between 000.0000000 and 999.9999999
+ */
+
+gdouble fixed3_6_to_gdouble(guint32 in) {
+ gdouble ret = (gdouble) in / 1000000.0;
+ return ret;
+
+}
+/*
+ * input: a native 32 bit unsigned value between 0 and 3600000000
+ * output: a signed floating point value between -180000.0000 and +180000.0000
+ */
+gdouble fixed6_4_to_gdouble(guint32 in) {
+ gint32 remapped_in = in - (180000 * 10000);
+ gdouble ret = (gdouble) ((gdouble) remapped_in / 10000);
+ return ret;
+}
+
+gdouble ns_counter_to_gdouble(guint32 in) {
+ gdouble ret;
+ ret = (gdouble) in / 1000000000;
+ return ret;
+}
+
+/*
+ * Editor modelines
+ *
+ * Local Variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */