forked from kismetwireless/kismet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
datasource_rtladsb.cc
87 lines (63 loc) · 2.53 KB
/
datasource_rtladsb.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
This file is part of Kismet
Kismet 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.
Kismet 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 Kismet; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "kis_datasource.h"
#include "datasource_rtladsb.h"
#include "phy_rtladsb.h"
kis_datasource_rtladsb::kis_datasource_rtladsb(shared_datasource_builder in_builder) :
kis_datasource(in_builder) {
std::string devnum = munge_to_printable(get_definition_opt("device"));
if (devnum != "") {
set_int_source_cap_interface("rtladsbusb#" + devnum);
} else {
set_int_source_cap_interface("rtladsbusb");
}
set_int_source_hardware("rtlsdr");
set_int_source_ipc_binary("kismet_cap_sdr_rtladsb");
suppress_gps = true;
}
kis_datasource_rtladsb::~kis_datasource_rtladsb() {
}
void kis_datasource_rtladsb::open_interface(std::string in_definition, unsigned int in_transaction,
open_callback_t in_cb) {
kis_datasource::open_interface(in_definition, in_transaction, in_cb);
}
#if 0
int kis_datasource_rtladsb::httpd_post_complete(kis_net_httpd_connection *concls) {
std::string stripped = httpd_strip_suffix(concls->url);
std::vector<std::string> tokenurl = str_tokenize(stripped, "/");
// Anything involving POST here requires a login
if (!httpd->has_valid_session(concls, true)) {
return 1;
}
if (tokenurl.size() < 5)
return MHD_NO;
if (tokenurl[1] != "datasource")
return MHD_NO;
if (tokenurl[2] != "by-uuid")
return MHD_NO;
if (tokenurl[3] != get_source_uuid().uuid_to_string())
return MHD_NO;
if (tokenurl[4] == "update") {
packetchain_comp_datasource *datasrcinfo = new packetchain_comp_datasource();
datasrcinfo->ref_source = this;
packet->insert(pack_comp_datasrc, datasrcinfo);
inc_source_num_packets(1);
get_source_packet_rrd()->add_sample(1, time(0));
packetchain->process_packet(packet);
}
return MHD_NO;
}
#endif