mmirabent / sniffle

TCP handshake sniffer
Apache License 2.0
1 stars 0 forks source link

Move ack_table and syn_table init code into session.c #6

Open mmirabent opened 8 years ago

mmirabent commented 8 years ago

Make init_ack and init_syn functions in session.c

Also make the init functions take an integer argument to set the table size.

mmirabent commented 8 years ago

syn_table_size and ack_table_size should be a static integer defined in session.c, and not in session.h to keep it from getting messed with.

mmirabent commented 8 years ago

Beware. In pull request #17 in order to squelch a warning, I made the syn_table and syn_table_idx variables extern variables and added declarations to the main.c file. This means they are declared external in the header file and declared for real in ONE AND ONLY ONE translation unit (i.e. .c source file). What this means is that when the syn_table initialization code is moved into session.c, the declaration needs to happen in session.c and not in main. Also, the extern declaration should be removed from the header file entirely, and the variables should be declared statically in session.c, like the ack_table and ack_table_idx variables are.