summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/main.c b/main.c
index 7307d64..d76fab3 100644
--- a/main.c
+++ b/main.c
@@ -1,6 +1,9 @@
+
#include <string.h>
#include <getopt.h>
#include "submodule/log.c-patched/src/log.h"
+#include <stdint.h>
+#include <stdlib.h>
#define dbgchr(x) log_info("%c", x)
@@ -11,6 +14,9 @@ enum tcpf_mode {
struct runtime_opts {
enum tcpf_mode mode;
+ uint16_t srcport;
+ uint16_t destport;
+
};
static int parseopt(int argc, char **argv, struct runtime_opts *r_opts)
@@ -20,12 +26,14 @@ static int parseopt(int argc, char **argv, struct runtime_opts *r_opts)
static struct option opt_table[] = {
{"mode", required_argument, 0, 'm'},
+ {"srcport", required_argument, 0, 's'},
+ {"destport", required_argument, 0, 'd'},
// {"mode", required_argument, 0, 'm'},4
{0, 0, 0, 0}
};
while(1) {
- c = getopt_long(argc, argv, "m:", opt_table, &optcounter);
+ c = getopt_long(argc, argv, "m:s:d:", opt_table, &optcounter);
// dbgchr(c);
if (c == -1)
@@ -41,6 +49,14 @@ static int parseopt(int argc, char **argv, struct runtime_opts *r_opts)
r_opts->mode = TCPF_CLIENT;
}
break;
+
+ case 's':
+ r_opts->srcport = atoi(optarg);
+ break;
+
+ case 'd':
+ r_opts->destport = atoi(optarg);
+ break;
}