diff options
author | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2012-10-07 12:50:15 +0000 |
---|---|---|
committer | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2012-10-07 12:50:15 +0000 |
commit | 6babc9b91ab6cdd9305b270f269b8622c527a88e (patch) | |
tree | b1bd865ddc103600da0e66dbdaf6233a0ae3dd96 /package/wprobe/src/filter | |
parent | a81aed2f57aef263f83f31c8d405d086776f7415 (diff) |
move a few unmaintained packages from trunk to /packages
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@33634 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/wprobe/src/filter')
-rw-r--r-- | package/wprobe/src/filter/README.txt | 1 | ||||
-rwxr-xr-x | package/wprobe/src/filter/gen_filter.pl | 63 | ||||
-rw-r--r-- | package/wprobe/src/filter/pfc.c | 58 |
3 files changed, 0 insertions, 122 deletions
diff --git a/package/wprobe/src/filter/README.txt b/package/wprobe/src/filter/README.txt deleted file mode 100644 index 6fa265e4f..000000000 --- a/package/wprobe/src/filter/README.txt +++ /dev/null @@ -1 +0,0 @@ -To compile pfc you need at least libpcap version 1.0, as it requires proper radiotap header support diff --git a/package/wprobe/src/filter/gen_filter.pl b/package/wprobe/src/filter/gen_filter.pl deleted file mode 100755 index f03f477a4..000000000 --- a/package/wprobe/src/filter/gen_filter.pl +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/perl -use strict; - -# helpers for custom packet format -# bytes 0-7 are used by a dummy radiotap header -my $WLAN_LEN = "radio[8:2]"; -my $SNR = "radio[10:1]"; -my $DEFAULT = undef; - -my $MAGIC = "WPFF"; -my $VERSION = 1; # filter binary format version -my $HDRLEN = 3; # assumed storage space for custom fields - -my $output = "filter.bin"; -my $config = { - "packetsize" => [ - [ "small", "$WLAN_LEN < 250" ], - [ "medium", "$WLAN_LEN < 800" ], - [ "big", $DEFAULT ], - ], - "snr" => [ - [ "low", "$SNR < 10" ], - [ "medium", "$SNR < 20" ], - [ "high", $DEFAULT ], - ], - "type" => [ - [ "beacon", "type mgt subtype beacon" ], - [ "data", "type data subtype data" ], - [ "qosdata", "type data subtype qos-data" ], - [ "other", "$DEFAULT" ] - ] -}; - -sub escape_q($) { - my $str = shift; - $str =~ s/'/'\\''/g; - return $str; -} - -my $GROUPS = scalar(keys %$config); -open OUTPUT, ">$output" or die "Cannot open output file: $!\n"; -print OUTPUT pack("a4CCn", $MAGIC, $VERSION, $HDRLEN, $GROUPS); - -foreach my $groupname (keys %$config) { - my $default = 0; - my $group = $config->{$groupname}; - print OUTPUT pack("a32N", $groupname, scalar(@$group)); - foreach my $filter (@$group) { - if (!$filter->[1]) { - $default > 0 and print "Cannot add more than one default filter per group: $groupname -> ".$filter->[0]."\n"; - print OUTPUT pack("a32N", $filter->[0], 0); - $default++; - } else { - open FILTER, "./pfc '".escape_q($filter->[0])."' '".escape_q($filter->[1])."' |" - or die "Failed to run filter command for '".$filter->[0]."': $!\n"; - while (<FILTER>) { - print OUTPUT $_; - } - close FILTER; - $? and die "Filter '".$filter->[0]."' did not compile.\n"; - } - } -} diff --git a/package/wprobe/src/filter/pfc.c b/package/wprobe/src/filter/pfc.c deleted file mode 100644 index 76fb1412a..000000000 --- a/package/wprobe/src/filter/pfc.c +++ /dev/null @@ -1,58 +0,0 @@ -#include <arpa/inet.h> -#include <sys/types.h> -#include <sys/time.h> -#include <string.h> -#include <stdint.h> -#include <stdlib.h> - -#include <pcap.h> -#include <pcap-bpf.h> - -struct wprobe_filter_hdr { - char name[32]; - uint32_t len; -} hdr; - -int main (int argc, char ** argv) -{ - struct bpf_program filter; - pcap_t *pc; - int i; - - if (argc != 3) - { - fprintf(stderr, "Usage: %s <name> <expression>\n", argv[0]); - return 1; - } - - pc = pcap_open_dead(DLT_IEEE802_11_RADIO, 256); - if (pcap_compile(pc, &filter, argv[2], 1, 0) != 0) - { - pcap_perror(pc, argv[0]); - exit(1); - } - - /* fix up for linux */ - for (i = 0; i < filter.bf_len; i++) { - struct bpf_insn *bi = &filter.bf_insns[i]; - switch(BPF_CLASS(bi->code)) { - case BPF_RET: - if (BPF_MODE(bi->code) == BPF_K) { - if (bi->k != 0) - bi->k = 65535; - } - break; - } - bi->code = ntohs(bi->code); - bi->k = ntohl(bi->k); - } - - memset(&hdr, 0, sizeof(hdr)); - strncpy(hdr.name, argv[1], sizeof(hdr.name)); - hdr.len = htonl(filter.bf_len); - fwrite(&hdr, sizeof(hdr), 1, stdout); - fwrite(filter.bf_insns, 8, filter.bf_len, stdout); - fflush(stdout); - - return 0; -} |