chg: [pibs] added callback mechansims for matched packets
parent
4770c2f197
commit
a6e70c500f
|
@ -36,6 +36,11 @@ void usage(void)
|
|||
printf("<directory>/port/year/month/year-month-day.txt\n");
|
||||
}
|
||||
|
||||
void frame_to_bgpr(pibs_t* pibs, wtap *wth, uint8_t* eth,
|
||||
struct ip* ipv4, struct tcphdr* tcp)
|
||||
{
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
pibs_t* pibs;
|
||||
|
@ -55,6 +60,9 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
}
|
||||
|
||||
//Set call back function
|
||||
pibs->synseen_callback = &frame_to_bgpr;
|
||||
|
||||
if (pibs->filename[0]) {
|
||||
process_file(pibs);
|
||||
}
|
||||
|
|
|
@ -111,6 +111,7 @@ typedef struct pibs_s {
|
|||
pcap_dumper_t* dumper;
|
||||
pcap_t* outcap;
|
||||
uint32_t redisdb;
|
||||
void* synseen_callback;
|
||||
} pibs_t;
|
||||
|
||||
int load_shmid_file(pibs_t* pibs);
|
||||
|
@ -127,4 +128,8 @@ void synseen_process_frame(pibs_t *pibs, wtap *wth, uint8_t* eth,
|
|||
struct ip* ipv4, struct tcphdr* tcp);
|
||||
int synseen_init(pibs_t* pibs);
|
||||
pibs_t* init(void);
|
||||
|
||||
typedef void (* synseen_callback_t)(pibs_t* pibs, wtap *wth, uint8_t* eth,
|
||||
struct ip* ipv4, struct tcphdr* tcp);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -140,6 +140,7 @@ void pibs_dump_stats(pibs_t* pibs)
|
|||
void synseen_process_frame(pibs_t *pibs, wtap *wth, uint8_t* eth,
|
||||
struct ip* ipv4, struct tcphdr* tcp)
|
||||
{
|
||||
synseen_callback_t synseen_callback;
|
||||
int_fast64_t lastseen;
|
||||
uint32_t ip;
|
||||
struct pcap_pkthdr pchdr;
|
||||
|
@ -174,6 +175,10 @@ void synseen_process_frame(pibs_t *pibs, wtap *wth, uint8_t* eth,
|
|||
pchdr.len = wth->rec.rec_header.packet_header.len;
|
||||
pcap_dump((u_char*)pibs->dumper, &pchdr, eth);
|
||||
}
|
||||
if (pibs->synseen_callback) {
|
||||
synseen_callback = pibs->synseen_callback;
|
||||
synseen_callback(pibs, wth, eth, ip, tcp);
|
||||
}
|
||||
}
|
||||
|
||||
int synseen_init(pibs_t* pibs)
|
||||
|
|
Loading…
Reference in New Issue