nmsg  0.14.0
msgmod.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_MSGMOD_H
18 #define NMSG_MSGMOD_H
19 
71 typedef enum {
74 
77 
83 
89 
95 
98 
101 
104 
107 
110 
113 
116 
120 
121 #define NMSG_MSGMOD_FIELD_REPEATED 0x01 /*%< field is repeated */
122 #define NMSG_MSGMOD_FIELD_REQUIRED 0x02 /*%< field is required */
123 #define NMSG_MSGMOD_FIELD_HIDDEN 0x04 /*%< hide field from the message API */
124 #define NMSG_MSGMOD_FIELD_NOPRINT 0x08 /*%< don't print the field */
125 
140 nmsg_res
141 nmsg_msgmod_init(nmsg_msgmod_t mod, void **clos);
142 
155 nmsg_res
156 nmsg_msgmod_fini(nmsg_msgmod_t mod, void **clos);
157 
183 nmsg_res
184 nmsg_msgmod_pres_to_payload(nmsg_msgmod_t mod, void *clos, const char *pres);
185 
205 nmsg_res
206 nmsg_msgmod_pres_to_payload_finalize(nmsg_msgmod_t mod, void *clos, uint8_t **pbuf,
207  size_t *sz);
208 
230 nmsg_res
231 nmsg_msgmod_ipdg_to_payload(nmsg_msgmod_t mod, void *clos,
232  const struct nmsg_ipdg *dg,
233  uint8_t **pbuf, size_t *sz);
234 
256 nmsg_res
257 nmsg_msgmod_pkt_to_payload(struct nmsg_msgmod *mod, void *clos,
258  nmsg_pcap_t pcap, nmsg_message_t *m);
259 
271 nmsg_msgmod_t
272 nmsg_msgmod_lookup(unsigned vid, unsigned msgtype);
273 
285 nmsg_msgmod_t
286 nmsg_msgmod_lookup_byname(const char *vname, const char *mname);
287 
298 unsigned
299 nmsg_msgmod_mname_to_msgtype(unsigned vid, const char *mname);
300 
312 const char *
313 nmsg_msgmod_msgtype_to_mname(unsigned vid, unsigned msgtype);
314 
323 const char *
324 nmsg_msgmod_vid_to_vname(unsigned vid);
325 
334 unsigned
335 nmsg_msgmod_vname_to_vid(const char *vname);
336 
340 unsigned
342 
348 unsigned
349 nmsg_msgmod_get_max_msgtype(unsigned vid);
350 
351 #endif /* NMSG_MSGMOD_H */