module_func_block Struct Reference

Module functionality block. More...

#include <module.h>

Data Fields

const char * name
 text string name of module
 
int(* startup )(struct module_env *env, int id)
 Set up the module for start. More...
 
void(* destartup )(struct module_env *env, int id)
 Close down the module for stop. More...
 
int(* init )(struct module_env *env, int id)
 Initialise the module. More...
 
void(* deinit )(struct module_env *env, int id)
 Deinitialise the module, undo stuff done during init(). More...
 
void(* operate )(struct module_qstate *qstate, enum module_ev event, int id, struct outbound_entry *outbound)
 accept a new query, or work further on existing query. More...
 
void(* inform_super )(struct module_qstate *qstate, int id, struct module_qstate *super)
 inform super querystate about the results from this subquerystate. More...
 
void(* clear )(struct module_qstate *qstate, int id)
 clear module specific data
 
size_t(* get_mem )(struct module_env *env, int id)
 How much memory is the module specific data using. More...
 

Detailed Description

Module functionality block.

Field Documentation

◆ startup

int(* module_func_block::startup) (struct module_env *env, int id)

Set up the module for start.

This is called only once at startup. Privileged operations like opening device files may be done here. The function ptr can be NULL, if it is not used.

Parameters
envmodule environment.
idmodule id number. return: 0 on error

Referenced by modstack_call_init().

◆ destartup

void(* module_func_block::destartup) (struct module_env *env, int id)

Close down the module for stop.

This is called only once before shutdown to free resources allocated during startup(). Closing privileged ports or files must be done here. The function ptr can be NULL, if it is not used.

Parameters
envmodule environment.
idmodule id number.

Referenced by modstack_call_destartup(), and modstack_call_init().

◆ init

int(* module_func_block::init) (struct module_env *env, int id)

Initialise the module.

Called when restarting or reloading the daemon. This is the place to apply settings from the config file.

Parameters
envmodule environment.
idmodule id number. return: 0 on error

Referenced by modstack_call_init().

◆ deinit

void(* module_func_block::deinit) (struct module_env *env, int id)

Deinitialise the module, undo stuff done during init().

Called before reloading the daemon.

Parameters
envmodule environment.
idmodule id number.

Referenced by modstack_call_deinit().

◆ operate

void(* module_func_block::operate) (struct module_qstate *qstate, enum module_ev event, int id, struct outbound_entry *outbound)

accept a new query, or work further on existing query.

Changes the qstate->ext_state to be correct on exit.

Parameters
evevent that causes the module state machine to (re-)activate.
qstatethe query state. Note that this method is not allowed to change the query state 'identity', that is query info, qflags, and priming status. Attach a subquery to get results to a different query.
idmodule id number that operate() is called on.
outboundif not NULL this event is due to the reply/timeout or error on this outbound query.
Returns
: if at exit the ext_state is: o wait_module: next module is started. (with pass event). o error or finished: previous module is resumed. o otherwise it waits until that event happens (assumes the service routine to make subrequest or send message have been called.

Referenced by mesh_run().

◆ inform_super

void(* module_func_block::inform_super) (struct module_qstate *qstate, int id, struct module_qstate *super)

inform super querystate about the results from this subquerystate.

Is called when the querystate is finished. The method invoked is the one from the current module active in the super querystate.

Parameters
qstatethe query state that is finished. Examine return_rcode and return_reply in the qstate.
idmodule id for this module. This coincides with the current module for the super qstate.
superthe super querystate that needs to be informed.

Referenced by mesh_walk_supers().

◆ get_mem

size_t(* module_func_block::get_mem) (struct module_env *env, int id)

How much memory is the module specific data using.

Parameters
envmodule environment.
idthe module id.
Returns
the number of bytes that are alloced.

Referenced by mod_get_mem().


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