source: trunk/com-on-air_cs-linux/tools/dect_cli.h @ 40

Last change on this file since 40 was 40, checked in by mazzoo, 11 years ago

dect_cli: preliminary support for US/DECT6.0, see command "band"
for now it doesn't work, still the driver has to support it
but dect_cli shows how to do it

File size: 2.7 KB
Line 
1/*
2 * dect_cli async and sync interface to DECT, can dump pcap files
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * authors:
9 * (C) 2008  Andreas Schuler <krater at badterrorist dot com>
10 * (C) 2008  Matthias Wenzel <dect at mazzoo dot de>
11 *
12 */
13
14#ifndef DECT_CLI_H
15#define DECT_CLI_H
16
17#define DEV "/dev/coa"
18
19// too verbose #define LOG(fmt, args...) printf("%s(): " fmt, __FUNCTION__, ##args)
20#define LOG(fmt, args...) printf(fmt, ##args)
21
22
23#define TYPE_FP 23
24#define TYPE_PP 42
25
26struct dect_station
27{
28        struct dect_station   * next;
29        uint8_t               RFPI[5];
30        uint32_t              RSSI;
31        uint8_t               channel;
32        uint8_t               type;
33        uint32_t              first_seen;
34        uint32_t              last_seen;
35        uint32_t              count_seen;
36};
37
38struct sniffed_packet
39{
40        unsigned char rssi;
41        unsigned char channel;
42        unsigned char slot;
43        struct timespec   timestamp;
44        unsigned char data[53];
45};
46
47
48struct rfpi_list
49{
50        struct rfpi_list * next;
51        uint8_t RFPI[5];
52};
53
54
55#define MODE_STOP     0x00000001
56#define MODE_FPSCAN   0x00000002
57#define MODE_PPSCAN   0x00000004
58#define MODE_CALLSCAN 0x00000008
59#define MODE_JAM      0x00000010
60
61#define DECT_BAND_EMEA 0x01
62#define DECT_BAND_US   0x02
63
64struct cli_info
65{
66        uint8_t               RFPI[5];
67        uint32_t              channel;
68        uint32_t              slot;
69        int                   hop;
70        int                   hop_ch_time; /* in sec */
71        uint32_t              last_hop;
72
73        uint8_t               band;      /* DECT_BAND_EMEA, DECT_BAND_US       */
74        uint8_t               hop_start; /* 0 for DECT/EMEA, 10 for US/DECT6.0 */
75        uint8_t               hop_end;   /* 9 for DECT/EMEA, 14 for US/DECT6.0 */
76
77        uint32_t              mode;
78
79        int                   in; /* stdin */
80        int                   fd; /* filehandle to the DECT-trx */
81
82        int                   verbose;
83        int                   autorec;
84        int                   autorec_timeout;
85        int                   autorec_last_bfield;
86
87        /* fpscan (async) list of stations */
88        struct dect_station   station;
89        struct dect_station   * station_list;
90
91        /* ignored RFPIs */
92        struct rfpi_list * ignored_rfpis;
93
94        /* ppscan (sync) */
95        struct sniffed_packet packet;
96        pcap_t                * pcap;
97        pcap_dumper_t         * pcap_d;
98};
99
100uint32_t ch2etsi[15] =
101{
102        9,  /* "normal" EMEA DECT, 10 channels     */
103        8,  /* with a weired (historic?) counting  */
104        7,  /* 1881.792 MHz - 1897.344 MHz         */
105        6,  /* 1728 kHz channel spacing            */
106        5,
107        4,
108        3,
109        2,
110        1,
111        0,
112
113        23, /* DECT 6.0, th US variant, 5 channels */
114        24, /* 1921.536 MHz - 1928.448 MHz         */
115        25, /* 1728 kHz channel spacing            */
116        26,
117        27
118};
119
120
121#endif /* DECT_CLI_H */
Note: See TracBrowser for help on using the repository browser.