1 /* packet-ppi-geolocation-common.c
2 * Routines for PPI-GEOLOCATION dissection
3 * Copyright 2010, Harris Corp, jellch@harris.com
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 #include "packet-ppi-geolocation-common.h"
32 * input: a unsigned 32-bit (native endian) value between 0 and 3600000000 (inclusive)
33 * output: a signed floating point value betwen -180.0000000 and + 180.0000000, inclusive)
35 gdouble
ppi_fixed3_7_to_gdouble(guint32 in
) {
36 gint32 remapped_in
= in
- (180 * 10000000);
37 gdouble ret
= (gdouble
) ((gdouble
) remapped_in
/ 10000000);
41 * input: a native 32 bit unsigned value between 0 and 999999999
42 * output: a positive floating point value between 000.0000000 and 999.9999999
45 gdouble
ppi_fixed3_6_to_gdouble(guint32 in
) {
46 gdouble ret
= (gdouble
) in
/ 1000000.0;
51 * input: a native 32 bit unsigned value between 0 and 3600000000
52 * output: a signed floating point value between -180000.0000 and +180000.0000
54 gdouble
ppi_fixed6_4_to_gdouble(guint32 in
) {
55 gint32 remapped_in
= in
- (180000 * 10000);
56 gdouble ret
= (gdouble
) ((gdouble
) remapped_in
/ 10000);
60 gdouble
ppi_ns_counter_to_gdouble(guint32 in
) {
62 ret
= (gdouble
) in
/ 1000000000;
72 * indent-tabs-mode: nil
75 * ex: set shiftwidth=4 tabstop=8 expandtab:
76 * :indentSize=4:tabSize=8:noTabs=true: