From f32fad8c916d11f6b76ead5de9f999370b808d17 Mon Sep 17 00:00:00 2001 From: Gerard Wagener Date: Mon, 18 Mar 2019 08:58:34 +0100 Subject: [PATCH] chg: [pibs] added command line option for writing pcaps --- bin/pibs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/pibs.c b/bin/pibs.c index bd3fd8c..e47ce0c 100644 --- a/bin/pibs.c +++ b/bin/pibs.c @@ -91,6 +91,7 @@ typedef struct pibs_s { int show_stats; int should_create_shm; int should_attach; + int should_writepcap; //TODO use self contained data structure that can be easily serialized //Put data structure in an entire block to easier serialize uint8_t *data; @@ -103,6 +104,7 @@ typedef struct pibs_s { item_t* items; int shmid; char shmid_file [FILENAME_MAX]; + char outputfile[FILENAME_MAX]; } pibs_t; int load_shmid_file(pibs_t* pibs) @@ -446,7 +448,7 @@ int main(int argc, char* argv[]) fprintf(stderr, "[INFO] pid = %d\n",(int)getpid()); - while ((opt = getopt(argc, argv, "r:dbsni:au:z:p:")) != -1) { + while ((opt = getopt(argc, argv, "r:dbsni:au:z:p:w:")) != -1) { switch (opt) { case 'r': strncpy(pibs->filename, optarg, FILENAME_MAX); @@ -478,6 +480,10 @@ int main(int argc, char* argv[]) case 'p': pibs->port=atoi(optarg); break; + case 'w': + strncpy(pibs->outputfile,optarg, FILENAME_MAX); + pibs->should_writepcap = 1; + break; default: /* '?' */