nmsg 1.1.2
Data Structures | Macros | Typedefs | Functions
nmsg.h File Reference

Base nmsg support header. More...

Go to the source code of this file.

Data Structures

struct  nmsg_idname
 Generic ID to name map. More...
 

Macros

#define NMSG_LIBRARY_VERSION_NUMBER   1001002
 

Typedefs

typedef enum nmsg_res nmsg_res
 
typedef struct nmsg_container * nmsg_container_t
 
typedef struct nmsg_fltmod * nmsg_fltmod_t
 
typedef struct nmsg_io * nmsg_io_t
 
typedef struct nmsg_rate * nmsg_rate_t
 
typedef struct nmsg_random * nmsg_random_t
 
typedef struct nmsg_zbuf * nmsg_zbuf_t
 
typedef void(* nmsg_cb_message) (nmsg_message_t msg, void *user)
 Callback function for processing nmsg messages.
 
typedef nmsg_res(* nmsg_cb_message_read) (nmsg_message_t *msg, void *user)
 Callback function for generating nmsg messages.
 

Functions

nmsg_res nmsg_init (void)
 Initialize the libnmsg library.
 
void nmsg_set_autoclose (bool autoclose)
 Configure automatic close() behavior of nmsg inputs and outputs.
 
void nmsg_set_debug (int debug)
 Set debug level.
 
int nmsg_get_debug (void)
 Retrieve the current debug level.
 
const char * nmsg_get_version (void)
 Retrieve the semantic library version as a string.
 
uint32_t nmsg_get_version_number (void)
 Retrieve the semantic library version as a packed integer.
 

Detailed Description

Base nmsg support header.

This header ensures that needed constants, functions, result codes, vendor definitions, and opaque pointer types are defined.

Definition in file nmsg.h.

Typedef Documentation

◆ nmsg_res

typedef enum nmsg_res nmsg_res

Definition at line 44 of file nmsg.h.

◆ nmsg_container_t

typedef struct nmsg_container* nmsg_container_t

Definition at line 46 of file nmsg.h.

◆ nmsg_fltmod_t

typedef struct nmsg_fltmod* nmsg_fltmod_t

Definition at line 47 of file nmsg.h.

◆ nmsg_io_t

typedef struct nmsg_io* nmsg_io_t

Definition at line 49 of file nmsg.h.

◆ nmsg_rate_t

typedef struct nmsg_rate* nmsg_rate_t

Definition at line 55 of file nmsg.h.

◆ nmsg_random_t

typedef struct nmsg_random* nmsg_random_t

Definition at line 56 of file nmsg.h.

◆ nmsg_zbuf_t

typedef struct nmsg_zbuf* nmsg_zbuf_t

Definition at line 58 of file nmsg.h.

◆ nmsg_cb_message

typedef void(* nmsg_cb_message) (nmsg_message_t msg, void *user)

Callback function for processing nmsg messages.

Parameters
[in]msgValid nmsg message.
[in]userUser-provided pointer.
See also
nmsg_input_loop()
nmsg_output_open_callback()

Definition at line 78 of file nmsg.h.

◆ nmsg_cb_message_read

typedef nmsg_res(* nmsg_cb_message_read) (nmsg_message_t *msg, void *user)

Callback function for generating nmsg messages.

Parameters
[out]msgPointer to where an nmsg_message_t object may be stored.
[in]userUser-provided pointer.
See also
nmsg_input_open_callback()
Returns
nmsg_res_success
nmsg_res_failure
nmsg_res_again
nmsg_res_eof

Definition at line 94 of file nmsg.h.

Function Documentation

◆ nmsg_init()

nmsg_res nmsg_init ( void  )

Initialize the libnmsg library.

This function MUST be called before using any other libnmsg function. The caller MUST also check that this function returned nmsg_res_success before using any other libnmsg function. The library should only be initialized once.

Returns
nmsg_res_success On successful library initialization.
nmsg_res_failure If libnmsg is not usable, or if nmsg_init() was called more than once.

◆ nmsg_set_autoclose()

void nmsg_set_autoclose ( bool  autoclose)

Configure automatic close() behavior of nmsg inputs and outputs.

The default behavior is for nmsg_input_close(), nmsg_output_close(), and nmsg_io_destroy() to automatically close the underlying file descriptors for libnmsg inputs and outputs.

Parameters
autocloseFalse to disable automatic close() behavior, true to re-enable.

◆ nmsg_set_debug()

void nmsg_set_debug ( int  debug)

Set debug level.

If the debug level is greater than 0, some libnmsg functions will emit debugging information to stderr. Higher values increase verbosity.

◆ nmsg_get_version_number()

uint32_t nmsg_get_version_number ( void  )

Retrieve the semantic library version as a packed integer.

The number is a combination of the major, minor, and patchelevel numbers as per: MAJOR * 1000000 + MINOR * 1000 + PATCHLEVEL.