11 struct wprobe_filter_hdr
{
16 int main (int argc
, char ** argv
)
18 struct bpf_program filter
;
24 fprintf(stderr
, "Usage: %s <name> <expression>\n", argv
[0]);
28 pc
= pcap_open_dead(DLT_IEEE802_11_RADIO
, 256);
29 if (pcap_compile(pc
, &filter
, argv
[2], 1, 0) != 0)
31 pcap_perror(pc
, argv
[0]);
35 /* fix up for linux */
36 for (i
= 0; i
< filter
.bf_len
; i
++) {
37 struct bpf_insn
*bi
= &filter
.bf_insns
[i
];
38 switch(BPF_CLASS(bi
->code
)) {
40 if (BPF_MODE(bi
->code
) == BPF_K
) {
46 bi
->code
= ntohs(bi
->code
);
50 memset(&hdr
, 0, sizeof(hdr
));
51 strncpy(hdr
.name
, argv
[1], sizeof(hdr
.name
));
52 hdr
.len
= htonl(filter
.bf_len
);
53 fwrite(&hdr
, sizeof(hdr
), 1, stdout
);
54 fwrite(filter
.bf_insns
, 8, filter
.bf_len
, stdout
);
This page took 0.046611 seconds and 5 git commands to generate.