nmsg 1.1.2
Data Fields
nmsg_msgmod_plugin Struct Reference

Structure exported by message modules to implement a new message type. More...

#include <msgmod_plugin.h>

Data Fields

int msgver
 Module interface version.
 
nmsg_msgmod_type type
 Module type.
 
struct nmsg_idname vendor
 Vendor ID and name.
 
struct nmsg_idname msgtype
 Message type and name.
 
nmsg_msgmod_init_fp init
 Module initialization function.
 
nmsg_msgmod_fini_fp fini
 Module finalization function.
 
nmsg_msgmod_msg_load_fp msg_load
 Per-message load function.
 
nmsg_msgmod_msg_fini_fp msg_fini
 Per-message finalization function.
 
nmsg_msgmod_payload_to_pres_fp payload_to_pres
 Module function to convert protobuf payloads to presentation form.
 
nmsg_msgmod_ipdg_to_payload_fp ipdg_to_payload
 Module function to convert reassembled IP datagrams to NMSG payloads.
 
const ProtobufCMessageDescriptor * pbdescr
 Pointer to the ProtobufCMessageDescriptor for the protocol buffer schema.
 
struct nmsg_msgmod_fieldfields
 Array mapping protobuf fields to nmsg types.
 
nmsg_msgmod_pkt_to_payload_fp pkt_to_payload
 Module function to convert raw IP packets to NMSG payloads.
 
uint32_t protobuf_c_version_number
 protobuf-c version number.
 
nmsg_msgmod_pcap_init_fp pcap_init
 Optional module function to perform further initialization of pcap inputs (e.g., setting up custom filters).
 

Detailed Description

Structure exported by message modules to implement a new message type.

A module developer may choose to make a module "transparent" or "opaque" by setting the type field to the appropriate value and setting certain fields and leaving other fields unset. The transparent module interface is intended for modules that do not implement IP datagram parsing and whose structure can be restricted (in particular, a transparent module message type cannot embed other message types). A transparent module developer must provide a mapping between protobuf field types and nmsg msgmod field types and generic functions will be provided to convert to and from presentation form.

Definition at line 207 of file msgmod_plugin.h.

Field Documentation

◆ msgver

int nmsg_msgmod_plugin::msgver

Module interface version.

Must be set to NMSG_MSGMOD_VERSION or the module will be rejected at load time.

Definition at line 213 of file msgmod_plugin.h.

◆ type

nmsg_msgmod_type nmsg_msgmod_plugin::type

Module type.

Definition at line 218 of file msgmod_plugin.h.

◆ vendor

struct nmsg_idname nmsg_msgmod_plugin::vendor

Vendor ID and name.

Must always be set.

Definition at line 224 of file msgmod_plugin.h.

◆ msgtype

struct nmsg_idname nmsg_msgmod_plugin::msgtype

Message type and name.

Must always be set.

Definition at line 230 of file msgmod_plugin.h.

◆ init

nmsg_msgmod_init_fp nmsg_msgmod_plugin::init

Module initialization function.

May be NULL.

Definition at line 235 of file msgmod_plugin.h.

◆ fini

nmsg_msgmod_fini_fp nmsg_msgmod_plugin::fini

Module finalization function.

May be NULL.

Definition at line 240 of file msgmod_plugin.h.

◆ msg_load

nmsg_msgmod_msg_load_fp nmsg_msgmod_plugin::msg_load

Per-message load function.

This function is called when loading serialized messages, but not when initializing messages from scratch.

Definition at line 247 of file msgmod_plugin.h.

◆ msg_fini

nmsg_msgmod_msg_fini_fp nmsg_msgmod_plugin::msg_fini

Per-message finalization function.

Definition at line 252 of file msgmod_plugin.h.

◆ payload_to_pres

nmsg_msgmod_payload_to_pres_fp nmsg_msgmod_plugin::payload_to_pres

Module function to convert protobuf payloads to presentation form.

May be set.

If not set for transparent modules, a generic function will be used. If not set for opaque modules, an error will be returned to the caller.

Definition at line 262 of file msgmod_plugin.h.

◆ ipdg_to_payload

nmsg_msgmod_ipdg_to_payload_fp nmsg_msgmod_plugin::ipdg_to_payload

Module function to convert reassembled IP datagrams to NMSG payloads.

Must be unset for transparent modules. May be set for opaque modules.

Definition at line 270 of file msgmod_plugin.h.

◆ pbdescr

const ProtobufCMessageDescriptor* nmsg_msgmod_plugin::pbdescr

Pointer to the ProtobufCMessageDescriptor for the protocol buffer schema.

This is generated by the protobuf-c compiler and usually ends in "__descriptor". Must be set for transparent modules. Must be unset for opaque modules.

Definition at line 279 of file msgmod_plugin.h.

◆ fields

struct nmsg_msgmod_field* nmsg_msgmod_plugin::fields

Array mapping protobuf fields to nmsg types.

Must be set for transparent modules. Must be unset for opaque modules.

Definition at line 286 of file msgmod_plugin.h.

◆ pkt_to_payload

nmsg_msgmod_pkt_to_payload_fp nmsg_msgmod_plugin::pkt_to_payload

Module function to convert raw IP packets to NMSG payloads.

Must be unset for transparent modules. May be set for opaque modules. If set, the ipdg_to_payload field will be ignored.

Definition at line 294 of file msgmod_plugin.h.

◆ protobuf_c_version_number

uint32_t nmsg_msgmod_plugin::protobuf_c_version_number

protobuf-c version number.

Compared at runtime to avoid mismatches between libnmsg and the message module. This is the PROTOBUF_C_VERSION_NUMBER value used to compile the message module.

This field is only checked if .type is nmsg_msgmod_type_transparent.

Definition at line 304 of file msgmod_plugin.h.

◆ pcap_init

nmsg_msgmod_pcap_init_fp nmsg_msgmod_plugin::pcap_init

Optional module function to perform further initialization of pcap inputs (e.g., setting up custom filters).

Definition at line 310 of file msgmod_plugin.h.


The documentation for this struct was generated from the following file: