17#ifndef NMSG_MSGMOD_PLUGIN_H 
   18#define NMSG_MSGMOD_PLUGIN_H 
   22#include <protobuf-c/protobuf-c.h> 
   23#include <nmsg/nmsg.pb-c.h> 
   28#define NMSG_MSGMOD_VERSION     9 
   31typedef nmsg_res (*nmsg_msgmod_init_fp)(
void **clos);
 
   34typedef nmsg_res (*nmsg_msgmod_fini_fp)(
void **clos);
 
   37typedef nmsg_res (*nmsg_msgmod_payload_to_pres_fp)(Nmsg__NmsgPayload *np,
 
   42typedef nmsg_res (*nmsg_msgmod_ipdg_to_payload_fp)(
void *clos,
 
   44                                                   uint8_t **pbuf, 
size_t *sz);
 
   46typedef nmsg_res (*nmsg_msgmod_pkt_to_payload_fp)(
void *clos,
 
   50typedef nmsg_res (*nmsg_msgmod_pcap_init_fp)(
void *clos, nmsg_pcap_t pcap);
 
   53typedef nmsg_res (*nmsg_msgmod_msg_load_fp)(nmsg_message_t m, 
void **msg_clos);
 
   56typedef nmsg_res (*nmsg_msgmod_msg_fini_fp)(nmsg_message_t m, 
void *msg_clos);
 
   59typedef nmsg_res (*nmsg_msgmod_field_print_fp)(nmsg_message_t m,
 
   66typedef nmsg_res (*nmsg_msgmod_field_get_fp)(nmsg_message_t m,
 
   74typedef nmsg_res (*nmsg_msgmod_field_format_fp)(nmsg_message_t m,
 
   81typedef nmsg_res (*nmsg_msgmod_field_parse_fp)(nmsg_message_t m,
 
   89#define NMSG_MSGMOD_FIELD_PRINTER(funcname) \ 
   90        nmsg_res funcname(nmsg_message_t m, \ 
   91                          struct nmsg_msgmod_field *field, \ 
   93                          struct nmsg_strbuf *sb, \ 
   97#define NMSG_MSGMOD_FIELD_GETTER(funcname) \ 
   98        nmsg_res funcname(nmsg_message_t m, \ 
   99                          struct nmsg_msgmod_field *field, \ 
  106#define NMSG_MSGMOD_FIELD_FORMATTER(funcname) \ 
  107        nmsg_res funcname(nmsg_message_t m, \ 
  108                          struct nmsg_msgmod_field *field, \ 
  110                          struct nmsg_strbuf *sb, \ 
  114#define NMSG_MSGMOD_FIELD_PARSER(funcname) \ 
  115        nmsg_res funcname(nmsg_message_t m, \ 
  116                          struct nmsg_msgmod_field *field, \ 
  123#define NMSG_MSGMOD_REQUIRED_INIT \ 
  124        .msgver = NMSG_MSGMOD_VERSION, \ 
  125        .protobuf_c_version_number = PROTOBUF_C_VERSION_NUMBER 
  158        nmsg_msgmod_field_get_fp                
get;
 
  161        const ProtobufCFieldDescriptor          *descr;
 
  164        nmsg_msgmod_field_format_fp             format;
 
  167        nmsg_msgmod_field_parse_fp              parse;
 
 
  175#define NMSG_MSGMOD_FIELD_END   { 0, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL } 
  191        nmsg_msgmod_type_transparent,
 
  192        nmsg_msgmod_type_opaque
 
nmsg_msgmod_field_type
Enum mapping protocol buffer schema types to nmsg-specific types for "transparent" modules.
 
Base nmsg support header.
 
Structure mapping protocol buffer schema fields to nmsg_msgmod_field_type values for "transparent" mo...
 
nmsg_msgmod_field_type type
Intended (nmsg) type of this protobuf field.
 
nmsg_msgmod_field_print_fp print
Optional custom field printer function.
 
unsigned flags
Flags for this field.
 
nmsg_msgmod_field_get_fp get
Optional custom field getter function.
 
const char * name
Name of the field.
 
Structure exported by message modules to implement a new message type.
 
struct nmsg_idname vendor
Vendor ID and name.
 
nmsg_msgmod_ipdg_to_payload_fp ipdg_to_payload
Module function to convert reassembled IP datagrams to NMSG payloads.
 
nmsg_msgmod_fini_fp fini
Module finalization function.
 
nmsg_msgmod_init_fp init
Module initialization function.
 
uint32_t protobuf_c_version_number
protobuf-c version number.
 
nmsg_msgmod_payload_to_pres_fp payload_to_pres
Module function to convert protobuf payloads to presentation form.
 
struct nmsg_idname msgtype
Message type and name.
 
const ProtobufCMessageDescriptor * pbdescr
Pointer to the ProtobufCMessageDescriptor for the protocol buffer schema.
 
nmsg_msgmod_pkt_to_payload_fp pkt_to_payload
Module function to convert raw IP packets to NMSG payloads.
 
nmsg_msgmod_pcap_init_fp pcap_init
Optional module function to perform further initialization of pcap inputs (e.g., setting up custom fi...
 
nmsg_msgmod_type type
Module type.
 
int msgver
Module interface version.
 
nmsg_msgmod_msg_load_fp msg_load
Per-message load function.
 
nmsg_msgmod_msg_fini_fp msg_fini
Per-message finalization function.
 
struct nmsg_msgmod_field * fields
Array mapping protobuf fields to nmsg types.