forked from osmocom/wireshark
Made the executable portable; it will now work on machines other than my
own. It allocates and fills in its own wtap struct. svn path=/trunk/; revision=257
This commit is contained in:
parent
1bb6e6ae3a
commit
1f8cc10010
|
@ -15,7 +15,7 @@ char *bpf_image(struct bpf_instruction *p, int n);
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
wtap *wth;
|
wtap *wth;
|
||||||
char *fsyntax = "";
|
char *fsyntax;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (argc <= 1) {
|
if (argc <= 1) {
|
||||||
|
@ -23,15 +23,24 @@ int main(int argc, char **argv)
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 1; i < argc; i++) {
|
fsyntax = g_strdup(argv[1]);
|
||||||
|
|
||||||
|
for (i = 2; i < argc; i++) {
|
||||||
fsyntax = g_strjoin(" ", fsyntax, argv[i], NULL);
|
fsyntax = g_strjoin(" ", fsyntax, argv[i], NULL);
|
||||||
}
|
}
|
||||||
|
wth = (wtap*)g_malloc(sizeof(wtap));
|
||||||
|
|
||||||
|
/* initialization */
|
||||||
|
wth->file_encap = WTAP_ENCAP_NONE;
|
||||||
|
wth->filter.offline = NULL;
|
||||||
|
wth->filter_type = WTAP_FILTER_NONE;
|
||||||
|
wth->filter_length = 0;
|
||||||
|
wth->offline_filter_lengths = NULL;
|
||||||
|
|
||||||
wth = wtap_open_offline("/home/gram/prj/sniff/test.trace");
|
|
||||||
wtap_offline_filter(wth, fsyntax);
|
wtap_offline_filter(wth, fsyntax);
|
||||||
/* wtap_offline_filter_compile(wth, WTAP_ENCAP_ETHERNET);*/
|
|
||||||
bpf_dump(wth);
|
bpf_dump(wth);
|
||||||
|
|
||||||
|
g_free(wth);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue