nmsg
1.1.2
nmsg
pcap_input.h
Go to the documentation of this file.
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
33
typedef
enum
{
34
nmsg_pcap_type_file,
35
nmsg_pcap_type_live
36
} nmsg_pcap_type;
37
46
nmsg_pcap_t
47
nmsg_pcap_input_open
(pcap_t *phandle);
48
54
nmsg_res
55
nmsg_pcap_input_close
(nmsg_pcap_t *pcap);
56
71
nmsg_res
72
nmsg_pcap_input_read
(nmsg_pcap_t pcap,
struct
nmsg_ipdg
*dg,
73
struct
timespec *ts);
74
90
nmsg_res
91
nmsg_pcap_input_read_raw
(nmsg_pcap_t pcap,
struct
pcap_pkthdr **pkt_hdr,
92
const
uint8_t **pkt_data,
struct
timespec *ts);
93
107
nmsg_res
108
nmsg_pcap_input_setfilter
(nmsg_pcap_t pcap,
const
char
*bpfstr);
109
122
nmsg_res
123
nmsg_pcap_input_setfilter_raw
(nmsg_pcap_t pcap,
const
char
*bpfstr);
124
133
void
134
nmsg_pcap_input_set_raw
(nmsg_pcap_t pcap,
bool
raw);
135
143
int
144
nmsg_pcap_snapshot
(nmsg_pcap_t pcap);
145
154
nmsg_pcap_type
155
nmsg_pcap_get_type
(nmsg_pcap_t pcap);
156
162
int
163
nmsg_pcap_get_datalink
(nmsg_pcap_t pcap);
164
177
bool
178
nmsg_pcap_filter
(nmsg_pcap_t pcap,
const
uint8_t *pkt,
size_t
len);
179
180
#endif
/* NMSG_PCAP_H */
nmsg_pcap_snapshot
int nmsg_pcap_snapshot(nmsg_pcap_t pcap)
Get the snapshot length of the underlying pcap handle.
nmsg_pcap_input_setfilter_raw
nmsg_res nmsg_pcap_input_setfilter_raw(nmsg_pcap_t pcap, const char *bpfstr)
Set a bpf filter on an nmsg_pcap_t object.
nmsg_pcap_input_open
nmsg_pcap_t nmsg_pcap_input_open(pcap_t *phandle)
Initialize a new nmsg_pcap_t input from a libpcap source.
nmsg_pcap_input_set_raw
void nmsg_pcap_input_set_raw(nmsg_pcap_t pcap, bool raw)
Set raw mode.
nmsg_pcap_input_read
nmsg_res nmsg_pcap_input_read(nmsg_pcap_t pcap, struct nmsg_ipdg *dg, struct timespec *ts)
Read an IP datagram from an nmsg_pcap_t input, performing reassembly if necessary.
nmsg_pcap_filter
bool nmsg_pcap_filter(nmsg_pcap_t pcap, const uint8_t *pkt, size_t len)
Return the result of filtering a packet.
nmsg_pcap_get_datalink
int nmsg_pcap_get_datalink(nmsg_pcap_t pcap)
Get the datalink type of the underlying pcap handle.
nmsg_pcap_get_type
nmsg_pcap_type nmsg_pcap_get_type(nmsg_pcap_t pcap)
Get the type of the underlying pcap handle.
nmsg_pcap_input_close
nmsg_res nmsg_pcap_input_close(nmsg_pcap_t *pcap)
Close an nmsg_pcap_t object and release all associated resources.
nmsg_pcap_input_read_raw
nmsg_res nmsg_pcap_input_read_raw(nmsg_pcap_t pcap, struct pcap_pkthdr **pkt_hdr, const uint8_t **pkt_data, struct timespec *ts)
Read a raw packet from an nmsg_pcap_t input.
nmsg_pcap_input_setfilter
nmsg_res nmsg_pcap_input_setfilter(nmsg_pcap_t pcap, const char *bpfstr)
Set a bpf filter on an nmsg_pcap_t object.
nmsg_res
nmsg_res
nmsg result code
Definition
res.h:25
nmsg_ipdg
Parsed IP datagram.
Definition
ipdg.h:31
Generated by
1.9.8