add support for pcap receive statistics (used by net-mgmt/darkstat)
This commit is contained in:
parent
3a0d4ba309
commit
72d6cdcd97
@ -20,3 +20,4 @@ BSD netmap
|
||||
---------------------------------------------------
|
||||
0.77 3.82 ports/trafshow (version 5)
|
||||
0.94 7.7 net-mgmt/ipcad (ip accounting daemon)
|
||||
0.9 5.0 net-mgmt/darkstat (ip accounting + graphing)
|
||||
|
@ -154,6 +154,8 @@ int pcap_setdirection(pcap_t *p, pcap_direction_t d);
|
||||
char *pcap_lookupdev(char *errbuf);
|
||||
int pcap_inject(pcap_t *p, const void *buf, size_t size);
|
||||
int pcap_fileno(pcap_t *p);
|
||||
const char *pcap_lib_version(void);
|
||||
|
||||
|
||||
struct eproto {
|
||||
const char *s;
|
||||
@ -318,6 +320,11 @@ struct eproto eproto_db[] = {
|
||||
};
|
||||
|
||||
|
||||
const char *pcap_lib_version(void)
|
||||
{
|
||||
return pcap_version;
|
||||
}
|
||||
|
||||
int
|
||||
pcap_findalldevs(pcap_if_t **alldevsp, __unused char *errbuf)
|
||||
{
|
||||
@ -532,10 +539,8 @@ pcap_stats(pcap_t *p, struct pcap_stat *ps)
|
||||
struct my_ring *me = p;
|
||||
ND("");
|
||||
|
||||
me->st.ps_recv += 10;
|
||||
*ps = me->st;
|
||||
sprintf(me->msg, "stats not supported");
|
||||
return -1;
|
||||
return 0; /* accumulate from pcap_dispatch() */
|
||||
};
|
||||
|
||||
char *
|
||||
@ -670,6 +675,7 @@ pcap_dispatch(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
|
||||
got++;
|
||||
}
|
||||
}
|
||||
me->st.ps_recv += got;
|
||||
return got;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user