30,8 → 30,8 |
* @{ |
*/ |
|
/** |
* @file |
/** @file |
* Character string to module map. |
*/ |
|
#ifndef __NET_MODULES_MAP_H__ |
45,23 → 45,76 |
|
#include "generic_char_map.h" |
|
/** Type definition of the module structure. |
* @see module_struct |
*/ |
typedef struct module_struct module_t; |
|
/** Type definition of the module structure pointer. |
* @see module_struct |
*/ |
typedef module_t * module_ref; |
|
/** Module map. |
* Sorted by module names. |
* @see generic_char_map.h |
*/ |
GENERIC_CHAR_MAP_DECLARE( modules, module_t ) |
|
/** Module structure. |
*/ |
struct module_struct{ |
/** Module task identifier if running. |
*/ |
task_id_t task_id; |
/** Module service identifier. |
*/ |
services_t service; |
/** Module phone if running and connected. |
*/ |
int phone; |
/** Usage counter. |
*/ |
int usage; |
/** Module name. |
*/ |
char * name; |
/** Module full path filename. |
*/ |
char * filename; |
/** Connecting function. |
*/ |
connect_module_t * connect_module; |
}; |
|
/** Adds module to the module map. |
* @param module The module structure added. Output parameter. |
* @param modules The module map. Input parameter. |
* @param name The module name. Input parameter. |
* @param filename The full path filename. Input parameter. |
* @param service The module service. Input parameter. |
* @param task_id The module current task identifier. Zero (0) means not running. Input parameter. |
* @param connect_module The module connecting function. Input parameter. |
* @returns EOK on success. |
* @returns ENOMEM if there is not enough memory left. |
*/ |
int add_module( module_ref * module, modules_ref modules, char * name, char * filename, services_t service, task_id_t task_id, connect_module_t * connect_module ); |
|
/** Searches and returns the specified module. |
* If the module is not running, the module filaname is spawned. |
* If the module is not connected, the connect_function is called. |
* @param modules The module map. Input parameter. |
* @param name The module name. Input parameter. |
* @returns The running module found. It does not have to be connected. |
* @returns NULL if there is no such module. |
*/ |
module_ref get_running_module( modules_ref modules, char * name ); |
|
/** Starts the given module. |
* @param fname The module full or relative path filename. Input parameter. |
* @returns The new module task identifier on success. |
* @returns 0 if there is no such module. |
*/ |
task_id_t spawn( char * fname ); |
|
#endif |