Changeset 89c57b6 in mainline for uspace/lib/net/include/adt/module_map.h
- Timestamp:
- 2011-04-13T14:45:41Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 88634420
- Parents:
- cefb126 (diff), 17279ead (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/net/include/adt/module_map.h
rcefb126 r89c57b6 27 27 */ 28 28 29 /** @addtogroup net30 * 29 /** @addtogroup libnet 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * 34 * Character string to module map. 35 35 */ 36 36 37 #ifndef __NET_MODULES_MAP_H__38 #define __NET_MODULES_MAP_H__37 #ifndef LIBNET_MODULES_MAP_H_ 38 #define LIBNET_MODULES_MAP_H_ 39 39 40 40 #include <task.h> 41 42 41 #include <ipc/services.h> 43 44 #include <net_modules.h> 45 42 #include <net/modules.h> 46 43 #include <adt/generic_char_map.h> 47 44 48 45 /** Type definition of the module structure. 49 * 46 * @see module_struct 50 47 */ 51 typedef struct module_struct module_t; 52 53 /** Type definition of the module structure pointer. 54 * @see module_struct 55 */ 56 typedef module_t * module_ref; 48 typedef struct module_struct module_t; 57 49 58 50 /** Module map. 59 * 60 * 51 * Sorted by module names. 52 * @see generic_char_map.h 61 53 */ 62 54 GENERIC_CHAR_MAP_DECLARE(modules, module_t) 63 55 64 /** Module structure. 65 */ 66 struct module_struct{ 67 /** Module task identifier if running. 68 */ 56 /** Module structure. */ 57 struct module_struct { 58 /** Module task identifier if running. */ 69 59 task_id_t task_id; 70 /** Module service identifier. 71 */ 60 /** Module service identifier. */ 72 61 services_t service; 73 /** Module phone if running and connected. 74 */ 62 /** Module phone if running and connected. */ 75 63 int phone; 76 /** Usage counter. 77 */ 64 /** Usage counter. */ 78 65 int usage; 79 /** Module name. 80 */ 81 const char * name; 82 /** Module full path filename. 83 */ 84 const char * filename; 85 /** Connecting function. 86 */ 87 connect_module_t * connect_module; 66 /** Module name. */ 67 const uint8_t *name; 68 /** Module full path filename. */ 69 const uint8_t *filename; 70 /** Connecting function. */ 71 connect_module_t *connect_module; 88 72 }; 89 73 90 /** Adds module to the module map. 91 * @param[out] module The module structure added. 92 * @param[in] modules The module map. 93 * @param[in] name The module name. 94 * @param[in] filename The full path filename. 95 * @param[in] service The module service. 96 * @param[in] task_id The module current task identifier. Zero (0) means not running. 97 * @param[in] connect_module The module connecting function. 98 * @returns EOK on success. 99 * @returns ENOMEM if there is not enough memory left. 100 */ 101 int add_module(module_ref * module, modules_ref modules, const char * name, const char * filename, services_t service, task_id_t task_id, connect_module_t * connect_module); 102 103 /** Searches and returns the specified module. 104 * If the module is not running, the module filaname is spawned. 105 * If the module is not connected, the connect_function is called. 106 * @param[in] modules The module map. 107 * @param[in] name The module name. 108 * @returns The running module found. It does not have to be connected. 109 * @returns NULL if there is no such module. 110 */ 111 module_ref get_running_module(modules_ref modules, char * name); 112 113 /** Starts the given module. 114 * @param[in] fname The module full or relative path filename. 115 * @returns The new module task identifier on success. 116 * @returns 0 if there is no such module. 117 */ 118 task_id_t spawn(const char * fname); 74 extern int add_module(module_t **, modules_t *, const uint8_t *, 75 const uint8_t *, services_t, task_id_t, connect_module_t *); 76 extern module_t *get_running_module(modules_t *, uint8_t *); 77 extern task_id_t net_spawn(const uint8_t *); 119 78 120 79 #endif
Note:
See TracChangeset
for help on using the changeset viewer.