summaryrefslogtreecommitdiffstats
path: root/src/tsnif.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tsnif.c')
-rw-r--r--src/tsnif.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/tsnif.c b/src/tsnif.c
index ef83561..d68a8bb 100644
--- a/src/tsnif.c
+++ b/src/tsnif.c
@@ -16,6 +16,7 @@
static struct tsnif_handle handle;
static struct tsnif_term term;
+static struct tsnif_np_args np_args;
static struct tsnif_storage_opts storage_opts = {
.flags = TSNIF_STORAGE_OPT_WRITE,
@@ -125,6 +126,8 @@ static int get_args(int argc, char **argv)
{
int ret = 0;
+ memset(&np_args, 0x0, sizeof(np_args));
+
while (1) {
int c;
int option_index = 0;
@@ -132,6 +135,9 @@ static int get_args(int argc, char **argv)
{"type", required_argument, 0, 't'},
{"idx", required_argument, 0, 'i'},
{"store", required_argument, 0, 's'},
+ {"list", required_argument, 0, 'l'},
+ {"udp", required_argument, 0, 'u'},
+ {"tcp", required_argument, 0, 't'},
{"version", no_argument, 0, 'V'},
{"debug", required_argument, 0, 'd'},
{"verbose", required_argument, 0, 'v'},
@@ -227,7 +233,7 @@ int main(int argc, char **argv)
if (get_args(argc, argv))
usage();
- err = tsnif_init(&handle, &ops);
+ err = tsnif_init(&handle, &ops, &np_args);
if (err)
return err;
@@ -271,25 +277,22 @@ int main(int argc, char **argv)
while(!killed) {
fd_set rfds;
struct timeval tv = { 1, 0};
- int ts_fd = tsnif_fd(&handle);
+ int max_fd;
int in_fd = 0;
- FD_ZERO(&rfds);
- FD_SET(ts_fd, &rfds);
+ max_fd = tsnif_fd(&handle, &rfds);
FD_SET(in_fd, &rfds);
- err = select(ts_fd + 1, &rfds, NULL, NULL, &tv);
+ err = select(max_fd + 1, &rfds, NULL, NULL, &tv);
if (err == -1) {
perror("select()");
continue;
} else if (!err)
continue;
- if (FD_ISSET(ts_fd, &rfds)) {
- err = tsnif_process(&handle);
- if (err)
- longjmp(env, 3);
- }
+ err = tsnif_process(&handle, &rfds);
+ if (err)
+ longjmp(env, 3);
if (FD_ISSET(in_fd, &rfds)) {
err = process_input();