Wireshark  4.3.0
The Wireshark network protocol analyzer
packet-ppi-geolocation-common.h
1 /* packet-ppi-geolocation-common.h
2  * Routines for PPI-GEOLOCATION dissection
3  * Copyright 2010, Harris Corp, jellch@harris.com
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * SPDX-License-Identifier: GPL-2.0-or-later
10  */
11 
12 #ifndef __PPI_GEOLOCATION_COMMON_H
13 #define __PPI_GEOLOCATION_COMMON_H
14 
15 /*
16  * Declarations from shared PPI-GEOLOCATION functions.
17  *
18  */
19 
20 /*
21  * these constants are offsets into base_geotag header, which is bitwise-compatible
22  * with a radiotap header
23  */
24 #define PPI_GEOBASE_MIN_HEADER_LEN 8 /* minimum header length */
25 #define PPI_GEOBASE_VERSION_OFFSET 0 /* offset of version field */
26 #define PPI_GEOBASE_LENGTH_OFFSET 2 /* offset of length field */
27 #define PPI_GEOBASE_PRESENT_OFFSET 4 /* offset of "present" field */
28 /*
29  * These BITNO macros were accquired from the radiotap parser. maybe we can share them
30  * eventually
31  */
32 #define BITNO_32(x) (((x) >> 16) ? 16 + BITNO_16((x) >> 16) : BITNO_16((x)))
33 #define BITNO_16(x) (((x) >> 8) ? 8 + BITNO_8((x) >> 8) : BITNO_8((x)))
34 #define BITNO_8(x) (((x) >> 4) ? 4 + BITNO_4((x) >> 4) : BITNO_4((x)))
35 #define BITNO_4(x) (((x) >> 2) ? 2 + BITNO_2((x) >> 2) : BITNO_2((x)))
36 #define BITNO_2(x) (((x) & 2) ? 1 : 0)
37 #define BIT(n) (1 << n)
38 
39 
40 
41 /*
42  * Floating point numbers are stored on disk in a handful of fixed-point formats (fixedX_Y)
43  * designed to preserve the appropriate amount of precision vs range. These functions convert
44  * the fixedX_Y fixed point values into 'native' gdoubles for displaying.
45  * Documentation on these formats can be found in the PPI-GEOLOCATION specification
46  */
47 gdouble ppi_fixed3_7_to_gdouble(guint32 in);
48 gdouble ppi_fixed3_6_to_gdouble(guint32 in);
49 gdouble ppi_fixed6_4_to_gdouble(guint32 in);
50 /*
51  * Some values are encoded as 32-bit unsigned nano-second counters.
52  * Usually we want to display these values as doubles.
53  */
54 gdouble ppi_ns_counter_to_gdouble(guint32 in);
55 
56 
57 typedef enum {
58  PPI_GEOLOCATION_HARRIS = 0x00485253 /* 00SRH */
59 } ppi_geolocation_appstr_num;
60 
61 
62 #endif
63 
64 /*
65  * Editor modelines
66  *
67  * Local Variables:
68  * c-basic-offset: 4
69  * tab-width: 8
70  * indent-tabs-mode: nil
71  * End:
72  *
73  * ex: set shiftwidth=4 tabstop=8 expandtab:
74  * :indentSize=4:tabSize=8:noTabs=true:
75  */
76 
77