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/pfc.c | |
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/pfc.c')
-rw-r--r-- | package/wprobe/src/filter/pfc.c | 58 |
1 files changed, 0 insertions, 58 deletions
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; -} |