nmsg  0.14.0
input.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-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_INPUT_H
18 #define NMSG_INPUT_H
19 
54 typedef enum {
55  nmsg_input_type_stream, /*%< NMSG payloads from file or socket */
56  nmsg_input_type_pcap, /*%< pcap packets from file or interface */
57  nmsg_input_type_pres, /*%< presentation form */
58  nmsg_input_type_callback,
59  nmsg_input_type_json, /*%< JSON form */
61 
69 nmsg_input_t
70 nmsg_input_open_file(int fd);
71 
79 nmsg_input_t
80 nmsg_input_open_sock(int fd);
81 
89 nmsg_input_t
90 nmsg_input_open_xs(void *s);
91 
119 nmsg_input_t
120 nmsg_input_open_xs_endpoint(void *xs_ctx, const char *ep);
121 
134 nmsg_input_t
136 
149 nmsg_input_t
151 
162 nmsg_input_t
163 nmsg_input_open_pres(int fd, nmsg_msgmod_t msgmod);
164 
174 nmsg_input_t
175 nmsg_input_open_json(int fd);
176 
188 nmsg_input_t
189 nmsg_input_open_pcap(nmsg_pcap_t pcap, nmsg_msgmod_t msgmod);
190 
198 nmsg_res
199 nmsg_input_close(nmsg_input_t *input);
200 
217 nmsg_res
218 nmsg_input_loop(nmsg_input_t input, int count, nmsg_cb_message cb, void *user);
219 
225 void
226 nmsg_input_breakloop(nmsg_input_t input);
227 
242 nmsg_res
243 nmsg_input_read(nmsg_input_t input, nmsg_message_t *msg);
244 
271 nmsg_res
272 nmsg_input_read_null(nmsg_input_t input, uint8_t *buf, size_t buf_len,
273  struct timespec *ts, nmsg_message_t **msg, size_t *n_msg);
274 
289 void
290 nmsg_input_set_filter_msgtype(nmsg_input_t input,
291  unsigned vid, unsigned msgtype);
292 
302 nmsg_res
303 nmsg_input_set_filter_msgtype_byname(nmsg_input_t input,
304  const char *vname, const char *mname);
305 
315 void
316 nmsg_input_set_filter_source(nmsg_input_t input, unsigned source);
317 
327 void
328 nmsg_input_set_filter_operator(nmsg_input_t input, unsigned operator_);
329 
339 void
340 nmsg_input_set_filter_group(nmsg_input_t input, unsigned group);
341 
353 nmsg_res
354 nmsg_input_set_blocking_io(nmsg_input_t input, bool flag);
355 
371 nmsg_res
372 nmsg_input_set_byte_rate(nmsg_input_t input, size_t rate);
373 
387 nmsg_res
388 nmsg_input_set_verify_seqsrc(nmsg_input_t input, bool verify);
389 
403 nmsg_res
404 nmsg_input_get_count_container_received(nmsg_input_t input, uint64_t *count);
405 
420 nmsg_res
421 nmsg_input_get_count_container_dropped(nmsg_input_t input, uint64_t *count);
422 
423 #endif /* NMSG_INPUT_H */