diff --git a/src/base/bang-module-api.c b/src/base/bang-module-api.c index 66f2d76..9c14c47 100644 --- a/src/base/bang-module-api.c +++ b/src/base/bang-module-api.c @@ -84,11 +84,12 @@ void BANG_get_me_peers(BANG_module_info *info) { BANG_linked_list *peers_to_bug = BANG_not_route_get_peer_id(valid_routes); int *cur; + BANG_request *req; - BANG_request *req = new_BANG_request(BANG_MODULE_PEER_REQUEST,NULL,0); /* TODO: Put the module info inside the data... */ while ((cur = BANG_linked_list_pop(peers_to_bug)) != NULL) { + req = new_BANG_request(BANG_MODULE_PEER_REQUEST,NULL,0); BANG_request_peer_id(*cur,req); free(cur); } diff --git a/src/base/bang-module-registry.h b/src/base/bang-module-registry.h new file mode 100644 index 0000000..d9d6a05 --- /dev/null +++ b/src/base/bang-module-registry.h @@ -0,0 +1,49 @@ +/** + * \file bang-module-registry.h + * \author Nikhil Bysani + * \date March 11, 2009 + * + * \brief Keeps track of all running modules. + */ + +#ifndef __BANG_MODULE_REGISTRY_H +#define __BANG_MODULE_REGISTRY_H + +/** + * \param path The file system path to the module. + * \param module_name The function puts the name of the module here. + * \param module_version The function puts the version of the module here. + * + * \brief Creates a new module in the registry, and tells you its name and version. + */ +void BANG_new_module(char *path, char **module_name, unsigned char **module_version); + +/** + * \param module_name The name of the module you are trying to get. + * \param module_version The version of the module you are trying to get. + * + * \brief Gets you the internal representation of a module. + * + * \return A BANG_module with the matching name and version. + */ +BANG_module* BANG_get_module(char *module_name, unsigned char *module_version); + +/** + * \param module_name The name of the module to start. + * \param module_version The version of the module to start. + * + * \brief Starts a module of the given name and version. + * + * \return Returns 0 on success, something else on error. + */ +int BANG_start_module(char *module_name, unsigned char *module_version); + +/** + * \param module_name The name of the module that is running. + * \param module_version The version of the module that is running. + * \param new_peer The new peer of the module. + * + * \brief If the given module is running, tells it about the new peer. + */ +void BANG_module_inform_new_peer(char *module_name, unsigned char *module_version, uuid_t new_peer); +#endif