nmsg
0.9.0
Main Page
Data Structures
Files
File List
Globals
nmsg
pcap_input.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009, 2011 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
#include <
nmsg.h
>
34
#include <pcap.h>
35
36
typedef
enum
{
37
nmsg_pcap_type_file,
38
nmsg_pcap_type_live
39
} nmsg_pcap_type;
40
49
nmsg_pcap_t
50
nmsg_pcap_input_open
(pcap_t *phandle);
51
57
nmsg_res
58
nmsg_pcap_input_close
(nmsg_pcap_t *pcap);
59
74
nmsg_res
75
nmsg_pcap_input_read
(nmsg_pcap_t pcap,
struct
nmsg_ipdg
*dg,
76
struct
timespec *ts);
77
93
nmsg_res
94
nmsg_pcap_input_read_raw
(nmsg_pcap_t pcap,
struct
pcap_pkthdr **pkt_hdr,
95
const
uint8_t **pkt_data,
struct
timespec *ts);
96
110
nmsg_res
111
nmsg_pcap_input_setfilter
(nmsg_pcap_t pcap,
const
char
*bpfstr);
112
125
nmsg_res
126
nmsg_pcap_input_setfilter_raw
(nmsg_pcap_t pcap,
const
char
*bpfstr);
127
136
void
137
nmsg_pcap_input_set_raw
(nmsg_pcap_t pcap,
bool
raw);
138
146
int
147
nmsg_pcap_snapshot
(nmsg_pcap_t pcap);
148
157
nmsg_pcap_type
158
nmsg_pcap_get_type
(nmsg_pcap_t pcap);
159
165
int
166
nmsg_pcap_get_datalink
(nmsg_pcap_t pcap);
167
180
bool
181
nmsg_pcap_filter
(nmsg_pcap_t pcap,
const
uint8_t *pkt,
size_t
len);
182
183
#endif
/* NMSG_PCAP_H */
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.
Definition:
pcap_input.c:351
nmsg_res
nmsg_res
nmsg result code
Definition:
res.h:25
nmsg_pcap_get_datalink
int nmsg_pcap_get_datalink(nmsg_pcap_t pcap)
Get the datalink type of the underlying pcap handle.
Definition:
pcap_input.c:346
nmsg.h
Base nmsg support header.
nmsg_ipdg
Parsed IP datagram.
Definition:
ipdg.h:34
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.
Definition:
pcap_input.c:207
nmsg_pcap_input_set_raw
void nmsg_pcap_input_set_raw(nmsg_pcap_t pcap, bool raw)
Set raw mode.
Definition:
pcap_input.c:127
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.
Definition:
pcap_input.c:26
nmsg_pcap_get_type
nmsg_pcap_type nmsg_pcap_get_type(nmsg_pcap_t pcap)
Get the type of the underlying pcap handle.
Definition:
pcap_input.c:341
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.
Definition:
pcap_input.c:70
nmsg_pcap_snapshot
int nmsg_pcap_snapshot(nmsg_pcap_t pcap)
Get the snapshot length of the underlying pcap handle.
Definition:
pcap_input.c:336
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.
Definition:
pcap_input.c:100
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.
Definition:
pcap_input.c:53
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.
Definition:
pcap_input.c:132
Generated on Sun Sep 14 2014 19:42:26 for nmsg by
1.8.7