nmsg 1.1.1
pcap_input.h
1/*
2 * Copyright (c) 2009-2015 by Farsight Security, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef NMSG_PCAP_H
18#define NMSG_PCAP_H
19
33typedef enum {
34 nmsg_pcap_type_file,
35 nmsg_pcap_type_live
36} nmsg_pcap_type;
37
46nmsg_pcap_t
47nmsg_pcap_input_open(pcap_t *phandle);
48
54nmsg_res
55nmsg_pcap_input_close(nmsg_pcap_t *pcap);
56
71nmsg_res
72nmsg_pcap_input_read(nmsg_pcap_t pcap, struct nmsg_ipdg *dg,
73 struct timespec *ts);
74
90nmsg_res
91nmsg_pcap_input_read_raw(nmsg_pcap_t pcap, struct pcap_pkthdr **pkt_hdr,
92 const uint8_t **pkt_data, struct timespec *ts);
93
107nmsg_res
108nmsg_pcap_input_setfilter(nmsg_pcap_t pcap, const char *bpfstr);
109
122nmsg_res
123nmsg_pcap_input_setfilter_raw(nmsg_pcap_t pcap, const char *bpfstr);
124
133void
134nmsg_pcap_input_set_raw(nmsg_pcap_t pcap, bool raw);
135
143int
144nmsg_pcap_snapshot(nmsg_pcap_t pcap);
145
154nmsg_pcap_type
155nmsg_pcap_get_type(nmsg_pcap_t pcap);
156
162int
163nmsg_pcap_get_datalink(nmsg_pcap_t pcap);
164
177bool
178nmsg_pcap_filter(nmsg_pcap_t pcap, const uint8_t *pkt, size_t len);
179
180#endif /* NMSG_PCAP_H */