mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-01-21 02:14:07 +01:00
monitor: track current PCAP size
This will come into play when support for rolling captures is added to iwmon.
This commit is contained in:
parent
c352b35bf1
commit
43f895142c
@ -60,6 +60,7 @@ struct pcap {
|
|||||||
bool closed;
|
bool closed;
|
||||||
uint32_t type;
|
uint32_t type;
|
||||||
uint32_t snaplen;
|
uint32_t snaplen;
|
||||||
|
size_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pcap *pcap_open(const char *pathname)
|
struct pcap *pcap_open(const char *pathname)
|
||||||
@ -152,6 +153,8 @@ struct pcap *pcap_create(const char *pathname)
|
|||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pcap->size += len;
|
||||||
|
|
||||||
return pcap;
|
return pcap;
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
@ -188,6 +191,11 @@ uint32_t pcap_get_snaplen(struct pcap *pcap)
|
|||||||
return pcap->snaplen;
|
return pcap->snaplen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t pcap_get_size(struct pcap *pcap)
|
||||||
|
{
|
||||||
|
return pcap->size;
|
||||||
|
}
|
||||||
|
|
||||||
bool pcap_read(struct pcap *pcap, struct timeval *tv,
|
bool pcap_read(struct pcap *pcap, struct timeval *tv,
|
||||||
void *data, uint32_t size, uint32_t *len, uint32_t *real_len)
|
void *data, uint32_t size, uint32_t *len, uint32_t *real_len)
|
||||||
{
|
{
|
||||||
@ -279,5 +287,7 @@ bool pcap_write(struct pcap *pcap, const struct timeval *tv,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pcap->size += written;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ void pcap_close(struct pcap *pcap);
|
|||||||
|
|
||||||
uint32_t pcap_get_type(struct pcap *pcap);
|
uint32_t pcap_get_type(struct pcap *pcap);
|
||||||
uint32_t pcap_get_snaplen(struct pcap *pcap);
|
uint32_t pcap_get_snaplen(struct pcap *pcap);
|
||||||
|
size_t pcap_get_size(struct pcap *pcap);
|
||||||
|
|
||||||
bool pcap_read(struct pcap *pcap, struct timeval *tv,
|
bool pcap_read(struct pcap *pcap, struct timeval *tv,
|
||||||
void *data, uint32_t size, uint32_t *len, uint32_t *real_len);
|
void *data, uint32_t size, uint32_t *len, uint32_t *real_len);
|
||||||
|
Loading…
Reference in New Issue
Block a user