Permalink
Browse files

Constify the filter argument to pcap_offline_filter().

Make the filter argument to pcap_offline_filter() a "const struct
bpf_program *", to clarify that it reads but does *not* modify the
filter.
  • Loading branch information...
1 parent 77699f6 commit 99ab0bcf2d3275590a5abc0761d2b554899c7302 @guyharris guyharris committed Nov 25, 2012
Showing with 5 additions and 5 deletions.
  1. +2 −2 pcap.c
  2. +2 −2 pcap/pcap.h
  3. +1 −1 pcap_offline_filter.3pcap
View
4 pcap.c
@@ -1681,10 +1681,10 @@ pcap_close(pcap_t *p)
* the packet doesn't pass and non-zero if the packet does pass.
*/
int
-pcap_offline_filter(struct bpf_program *fp, const struct pcap_pkthdr *h,
+pcap_offline_filter(const struct bpf_program *fp, const struct pcap_pkthdr *h,
const u_char *pkt)
{
- struct bpf_insn *fcode = fp->bf_insns;
+ const struct bpf_insn *fcode = fp->bf_insns;
if (fcode != NULL)
return (bpf_filter(fcode, pkt, h->len, h->caplen));
View
4 pcap/pcap.h
@@ -370,8 +370,8 @@ int pcap_compile(pcap_t *, struct bpf_program *, const char *, int,
int pcap_compile_nopcap(int, int, struct bpf_program *,
const char *, int, bpf_u_int32);
void pcap_freecode(struct bpf_program *);
-int pcap_offline_filter(struct bpf_program *, const struct pcap_pkthdr *,
- const u_char *);
+int pcap_offline_filter(const struct bpf_program *,
+ const struct pcap_pkthdr *, const u_char *);
int pcap_datalink(pcap_t *);
int pcap_datalink_ext(pcap_t *);
int pcap_list_datalinks(pcap_t *, int **);
View
2 pcap_offline_filter.3pcap
@@ -29,7 +29,7 @@ pcap_offline_filter \- check whether a filter matches a packet
.ft
.LP
.ft B
-int pcap_offline_filter(struct bpf_program *fp,
+int pcap_offline_filter(const struct bpf_program *fp,
.ti +8
const struct pcap_pkthdr *h, const u_char *pkt)
.ft

0 comments on commit 99ab0bc

Please sign in to comment.