Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4349 → Rev 4350

/branches/network/uspace/srv/net/structures/module_map.c
30,8 → 30,8
* @{
*/
 
/**
* @file
/** @file
* Character string to module map implementation.
*/
 
#include <malloc.h>
/branches/network/uspace/srv/net/structures/packet/packet_remote.c
30,8 → 30,9
* @{
*/
 
/**
* @file
/** @file
* Packet client interface implementation for standalone remote modules.
* @see packet_client.h
*/
 
#include <async.h>
/branches/network/uspace/srv/net/structures/packet/packet_messages.h
31,6 → 31,7
*/
 
/** @file
* Packet server module messages.
*/
 
#ifndef __NET_PACKET_MESSAGES__
40,11 → 41,28
 
#include "../../messages.h"
 
/** Packet server module messages.
*/
typedef enum {
/** Create packet message with specified content length.
* @see packet_get_1()
*/
NET_PACKET_CREATE_1 = NET_PACKET_FIRST,
/** Create packet message with specified address length, prefix, content and suffix.
* @see packet_get_4()
*/
NET_PACKET_CREATE_4,
/** Get packet message.
* @see packet_return()
*/
NET_PACKET_GET,
/** Get packet size message.
* @see packet_translate()
*/
NET_PACKET_GET_SIZE,
/** Release packet message.
* @see pq_release()
*/
NET_PACKET_RELEASE
} packet_messages;
 
/branches/network/uspace/srv/net/structures/module_map.h
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