nmsg  0.9.0
output.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2012 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_OUTPUT_H
18 #define NMSG_OUTPUT_H
19 
34 #include <nmsg.h>
35 
40 typedef enum {
41  nmsg_output_type_stream,
42  nmsg_output_type_pres,
43  nmsg_output_type_callback
45 
58 nmsg_output_t
59 nmsg_output_open_file(int fd, size_t bufsz);
60 
74 nmsg_output_t
75 nmsg_output_open_sock(int fd, size_t bufsz);
76 
86 nmsg_output_t
87 nmsg_output_open_xs(void *s, size_t bufsz);
88 
118 nmsg_output_t
119 nmsg_output_open_xs_endpoint(void *xs_ctx, const char *ep, size_t bufsz);
120 
128 nmsg_output_t
129 nmsg_output_open_pres(int fd);
130 
143 nmsg_output_t
145 
159 nmsg_res
160 nmsg_output_flush(nmsg_output_t output);
161 
175 nmsg_res
176 nmsg_output_write(nmsg_output_t output, nmsg_message_t msg);
177 
185 nmsg_res
186 nmsg_output_close(nmsg_output_t *output);
187 
198 void
199 nmsg_output_set_buffered(nmsg_output_t output, bool buffered);
200 
215 void
216 nmsg_output_set_filter_msgtype(nmsg_output_t output, unsigned vid, unsigned msgtype);
217 
227 nmsg_res
228 nmsg_output_set_filter_msgtype_byname(nmsg_output_t output,
229  const char *vname, const char *mname);
230 
238 void
239 nmsg_output_set_rate(nmsg_output_t output, nmsg_rate_t rate);
240 
249 void
250 nmsg_output_set_endline(nmsg_output_t output, const char *endline);
251 
262 void
263 nmsg_output_set_source(nmsg_output_t output, unsigned source);
264 
275 void
276 nmsg_output_set_operator(nmsg_output_t output, unsigned operator_);
277 
288 void
289 nmsg_output_set_group(nmsg_output_t output, unsigned group);
290 
298 void
299 nmsg_output_set_zlibout(nmsg_output_t output, bool zlibout);
300 
301 #endif /* NMSG_OUTPUT_H */
nmsg_output_t nmsg_output_open_pres(int fd)
Initialize a new presentation format (ASCII lines) nmsg output.
Definition: output.c:62
nmsg_res
nmsg result code
Definition: res.h:25
void nmsg_output_set_rate(nmsg_output_t output, nmsg_rate_t rate)
Limit the payload output rate.
Definition: output.c:214
void nmsg_output_set_filter_msgtype(nmsg_output_t output, unsigned vid, unsigned msgtype)
Filter an nmsg_output_t for a given vendor ID / message type.
Definition: output.c:182
nmsg_output_t nmsg_output_open_xs(void *s, size_t bufsz)
Initialize a new XS socket NMSG output.
void(* nmsg_cb_message)(nmsg_message_t msg, void *user)
Callback function for processing nmsg messages.
Definition: nmsg.h:69
void nmsg_output_set_zlibout(nmsg_output_t output, bool zlibout)
Enable or disable zlib compression of output NMSG containers.
Definition: output.c:223
nmsg_output_t nmsg_output_open_xs_endpoint(void *xs_ctx, const char *ep, size_t bufsz)
Create an XS socket and initialize a new NMSG stream output from it.
Base nmsg support header.
void nmsg_output_set_source(nmsg_output_t output, unsigned source)
Set the 'source' field on all output NMSG payloads.
Definition: output.c:239
nmsg_res nmsg_output_write(nmsg_output_t output, nmsg_message_t msg)
Write an nmsg message to an nmsg_output_t object.
Definition: output.c:115
nmsg_output_t nmsg_output_open_callback(nmsg_cb_message cb, void *user)
Initialize a new nmsg output closure.
Definition: output.c:89
nmsg_res nmsg_output_set_filter_msgtype_byname(nmsg_output_t output, const char *vname, const char *mname)
Filter an nmsg_output_t for a given vendor ID / message type.
Definition: output.c:193
nmsg_output_t nmsg_output_open_sock(int fd, size_t bufsz)
Initialize a new datagram socket nmsg output.
Definition: output.c:35
void nmsg_output_set_group(nmsg_output_t output, unsigned group)
Set the 'group' field on all output NMSG payloads.
Definition: output.c:251
void nmsg_output_set_buffered(nmsg_output_t output, bool buffered)
Make an nmsg_output_t socket output buffered or unbuffered.
Definition: output.c:173
nmsg_output_type
An enum identifying the underlying implementation of an nmsg_output_t object.
Definition: output.h:40
void nmsg_output_set_endline(nmsg_output_t output, const char *endline)
Set the line continuation string for presentation format output.
Definition: output.c:230
void nmsg_output_set_operator(nmsg_output_t output, unsigned operator_)
Set the 'operator' field on all output NMSG payloads.
Definition: output.c:245
nmsg_res nmsg_output_flush(nmsg_output_t output)
Flush an nmsg_output_t object.
Definition: output.c:110
nmsg_res nmsg_output_close(nmsg_output_t *output)
Close an nmsg_output_t object.
Definition: output.c:134
nmsg_output_t nmsg_output_open_file(int fd, size_t bufsz)
Initialize a new byte-stream nmsg output.
Definition: output.c:30