chg: [pibs] added command line option for writing pcaps

master
Gerard Wagener 2019-03-18 08:58:34 +01:00
parent 1e4ab9e3cf
commit f32fad8c91
1 changed files with 7 additions and 1 deletions

View File

@ -91,6 +91,7 @@ typedef struct pibs_s {
int show_stats; int show_stats;
int should_create_shm; int should_create_shm;
int should_attach; int should_attach;
int should_writepcap;
//TODO use self contained data structure that can be easily serialized //TODO use self contained data structure that can be easily serialized
//Put data structure in an entire block to easier serialize //Put data structure in an entire block to easier serialize
uint8_t *data; uint8_t *data;
@ -103,6 +104,7 @@ typedef struct pibs_s {
item_t* items; item_t* items;
int shmid; int shmid;
char shmid_file [FILENAME_MAX]; char shmid_file [FILENAME_MAX];
char outputfile[FILENAME_MAX];
} pibs_t; } pibs_t;
int load_shmid_file(pibs_t* pibs) 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()); 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) { switch (opt) {
case 'r': case 'r':
strncpy(pibs->filename, optarg, FILENAME_MAX); strncpy(pibs->filename, optarg, FILENAME_MAX);
@ -478,6 +480,10 @@ int main(int argc, char* argv[])
case 'p': case 'p':
pibs->port=atoi(optarg); pibs->port=atoi(optarg);
break; break;
case 'w':
strncpy(pibs->outputfile,optarg, FILENAME_MAX);
pibs->should_writepcap = 1;
break;
default: /* '?' */ default: /* '?' */