nmsg  1.0.1
nmsg.h
Go to the documentation of this file.
1 #ifndef NMSG_H
2 #define NMSG_H
3 
4 /*
5  * Copyright (c) 2008-2015 by Farsight Security, Inc.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #include <netinet/in.h>
32 #include <arpa/inet.h>
33 #include <sys/socket.h>
34 #include <sys/types.h>
35 #include <stdarg.h>
36 #include <stdbool.h>
37 #include <stddef.h>
38 #include <stdint.h>
39 #include <time.h>
40 
41 #include <pcap.h>
42 
43 #include <nmsg/res.h>
44 typedef enum nmsg_res nmsg_res;
45 
46 typedef struct nmsg_container * nmsg_container_t;
47 typedef struct nmsg_fltmod * nmsg_fltmod_t;
48 typedef struct nmsg_input * nmsg_input_t;
49 typedef struct nmsg_io * nmsg_io_t;
50 typedef struct nmsg_message * nmsg_message_t;
51 typedef struct nmsg_msgmod * nmsg_msgmod_t;
52 typedef struct nmsg_output * nmsg_output_t;
53 typedef struct nmsg_pcap * nmsg_pcap_t;
54 typedef struct nmsg_pres * nmsg_pres_t;
55 typedef struct nmsg_rate * nmsg_rate_t;
56 typedef struct nmsg_random * nmsg_random_t;
57 typedef struct nmsg_strbuf * nmsg_strbuf_t;
58 typedef struct nmsg_zbuf * nmsg_zbuf_t;
59 
63 struct nmsg_idname {
64  unsigned id; /*%< ID number */
65  const char *name; /*%< Human readable name */
66 };
67 
78 typedef void (*nmsg_cb_message)(nmsg_message_t msg, void *user);
79 
94 typedef nmsg_res (*nmsg_cb_message_read)(nmsg_message_t *msg, void *user);
95 
96 #include <nmsg/alias.h>
97 #include <nmsg/asprintf.h>
98 #include <nmsg/chalias.h>
99 #include <nmsg/compat.h>
100 #include <nmsg/constants.h>
101 #include <nmsg/container.h>
102 #include <nmsg/filter.h>
103 #include <nmsg/fltmod.h>
104 #include <nmsg/input.h>
105 #include <nmsg/io.h>
106 #include <nmsg/ipdg.h>
107 #include <nmsg/message.h>
108 #include <nmsg/msgmod.h>
109 #include <nmsg/output.h>
110 #include <nmsg/pcap_input.h>
111 #include <nmsg/random.h>
112 #include <nmsg/rate.h>
113 #include <nmsg/sock.h>
114 #include <nmsg/strbuf.h>
115 #include <nmsg/timespec.h>
116 #include <nmsg/vendors.h>
117 #include <nmsg/version.h>
118 #include <nmsg/zbuf.h>
119 
130 #if __GNUC__ >= 4
131 __attribute__ ((warn_unused_result))
132 #endif
134 
144 void nmsg_set_autoclose(bool autoclose);
145 
151 void nmsg_set_debug(int debug);
152 
156 int nmsg_get_debug(void);
157 
161 const char *nmsg_get_version(void);
162 
168 uint32_t nmsg_get_version_number(void);
169 #ifdef __cplusplus
170 }
171 #endif
172 
405 #endif /* NMSG_H */
Nmsg payload operator and group aliasing.
Asprintf utility functions.
Nmsg channel aliases.
Nmsg constants.
Functions for marshalling NMSG containers.
Message filtering API.
Loading and calling external message filter modules.
Convert input streams to nmsg format.
Multi-threaded nmsg I/O processing.
IP datagram parsing functions.
Create, load, inspect, and manipulate message objects. Message objects are proxy objects that bind to...
Message modules.
nmsg_res nmsg_init(void)
Initialize the libnmsg library.
void nmsg_set_debug(int debug)
Set debug level.
nmsg_res(* nmsg_cb_message_read)(nmsg_message_t *msg, void *user)
Callback function for generating nmsg messages.
Definition: nmsg.h:94
const char * nmsg_get_version(void)
Retrieve the semantic library version as a string.
void nmsg_set_autoclose(bool autoclose)
Configure automatic close() behavior of nmsg inputs and outputs.
uint32_t nmsg_get_version_number(void)
Retrieve the semantic library version as a packed integer.
void(* nmsg_cb_message)(nmsg_message_t msg, void *user)
Callback function for processing nmsg messages.
Definition: nmsg.h:78
int nmsg_get_debug(void)
Retrieve the current debug level.
Write nmsg containers to output streams.
Reassembled IP datagram interface to libpcap.
Random number generator.
Rate-limiting.
Possible result codes for nmsg functions.
nmsg_res
nmsg result code
Definition: res.h:25
Socket utilities.
String buffers.
Generic ID to name map.
Definition: nmsg.h:63
const char * name
Human readable name.
Definition: nmsg.h:65
unsigned id
ID number.
Definition: nmsg.h:64
String buffer.
Definition: strbuf.h:27
Sleeping and getting the current time.
NMSG vendor ID values.
Compressed buffers.