1
1

Adding functions to initialize a ner peer description.

Minor documentation changes

This commit was SVN r1530.
Этот коммит содержится в:
Tim Prins 2004-07-01 17:45:34 +00:00
родитель 8cfc45bbee
Коммит 6564f8403c
6 изменённых файлов: 112 добавлений и 7 удалений

Просмотреть файл

@ -28,6 +28,7 @@ libmca_oob_base_la_SOURCES = \
oob_base_send_nb.c \
oob_base_pack.c
# Conditionally install the header files
if WANT_INSTALL_HEADERS

Просмотреть файл

@ -9,7 +9,6 @@
#include "include/constants.h"
#include "mca/mca.h"
#include "mca/base/base.h"
#include "mca/oob/oob.h"
#include "mca/oob/base/base.h"

Просмотреть файл

@ -6,7 +6,6 @@
#include "mca/mca.h"
#include "mca/base/base.h"
#include "mca/oob/oob.h"
#include "mca/oob/base/base.h"

Просмотреть файл

@ -56,7 +56,7 @@ extern "C" {
#endif
/**
* Similiar to unix send(2).
* Similiar to unix writev(2).
*
* @param peer (IN) Opaque name of peer process.
* @param msg (IN) Array of iovecs describing user buffers and lengths.
@ -91,7 +91,7 @@ int mca_oob_send_hton(
/**
* Similiar to unix recv(2)
* Similiar to unix readv(2)
*
* @param peer (IN) Opaque name of peer process or OOB_NAME_ANY for wildcard receive.
* @param msg (IN) Array of iovecs describing user buffers and lengths.

Просмотреть файл

@ -1,5 +1,13 @@
#include "mca/oob/tcp/oob_tcp_peer.h"
OBJ_CLASS_INSTANCE(
mca_oob_tcp_peer_t,
ompi_list_item_t,
&mca_oob_tcp_peer_construct,
&mca_oob_tcp_peer_destruct);
/*
* The function to compare 2 peers. Used for the rb tree
*
@ -24,3 +32,70 @@ int mca_oob_tcp_peer_comp(void * key1, void * key2)
return(0);
}
/*
* This is the constructor function for the mca_oob_tcp_peer
* struct. Note that this function and OBJ_NEW should NEVER
* be called directly. Instead, use mca_oob_tcp_add_peer
*
* @param peer a pointer to the mca_oob_tcp_peer_t struct to be initialized
* @retval none
*/
void mca_oob_tcp_peer_construct(mca_oob_tcp_peer_t* peer)
{
OBJ_CONSTRUCT(&(peer->peer_send), ompi_list_t);
OBJ_CONSTRUCT(&(peer->peer_recv), ompi_list_t);
OBJ_CONSTRUCT(&(peer->peer_lock), ompi_mutex_t);
}
/*
* This is the destructor function for the mca_oob_tcp_peer
* struct. Note that this function and OBJ_RELEASE should NEVER
* be called directly. Instead, use mca_oob_tcp_del_peer
*
* @param peer a pointer to the mca_oob_tcp_peer_t struct to be destroyed
* @retval none
*/
void mca_oob_tcp_peer_destruct(mca_oob_tcp_peer_t * peer)
{
OBJ_DESTRUCT(&(peer->peer_send));
OBJ_DESTRUCT(&(peer->peer_recv));
OBJ_DESTRUCT(&(peer->peer_lock));
}
/*
* Creates a peer structure and adds to the tree and list.
*
* @param peer_name the name of the peer
*
* @retval pointer to the newly created struture
* @retval NULL if there was a problem
*/
mca_oob_tcp_peer_t * mca_oob_tcp_add_peer(ompi_process_name_t peer_name)
{
mca_oob_tcp_peer_t * new_peer = OBJ_NEW(mca_oob_tcp_peer_t);
new_peer->peer_name = peer_name;
if(OMPI_SUCCESS != ompi_rb_tree_insert(&mca_oob_tcp_peer_tree, &new_peer, NULL)) {
free(new_peer);
return NULL;
}
ompi_list_prepend(&mca_oob_tcp_peer_list, (ompi_list_item_t *) new_peer);
return new_peer;
}
/*
* Deletes a peer structure from the tree and lists and frees its memory
*
* @param peer_name the name of the peer
*
* @retval OMPI_SUCCESS
*/
int mca_oob_tcp_del_peer(ompi_process_name_t peer_name)
{
mca_oob_tcp_peer_t * peer = ompi_rb_tree_find(&mca_oob_tcp_peer_tree, &peer_name);
ompi_rb_tree_delete(&mca_oob_tcp_peer_tree, peer);
ompi_list_remove_item(&mca_oob_tcp_peer_list, (ompi_list_item_t *)peer);
OBJ_RELEASE(peer);
return OMPI_SUCCESS;
}

Просмотреть файл

@ -11,8 +11,12 @@
#include "mca/ns/ns.h"
#include "class/ompi_list.h"
#include "class/ompi_rb_tree.h"
#include <netinet/in.h>
#include "threads/mutex.h"
#include <string.h>
#include "mca/oob/tcp/oob_tcp.h"
/**
* the state of the connection
*/
@ -46,10 +50,34 @@ struct mca_oob_tcp_peer_t {
mca_oob_tcp_addr_t peer_addr; /**< the address of the peer process */
ompi_mutex_t peer_lock; /**< make sure only one thread accesses it at a time */
ompi_list_t peer_send; /**< list of items to send */
ompi_list_t peer_recieved; /**< list of items to recieve */
ompi_list_t peer_recv; /**< list of items to recieve */
};
typedef struct mca_oob_tcp_peer_t mca_oob_tcp_peer_t;
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/**
* This is the constructor function for the mca_oob_tcp_peer
* struct. Note that this function and OBJ_NEW should NEVER
* be called directly. Instead, use mca_oob_tcp_add_peer
*
* @param peer a pointer to the mca_oob_tcp_peer_t struct to be initialized
* @retval none
*/
void mca_oob_tcp_peer_construct(mca_oob_tcp_peer_t* peer);
/**
* This is the destructor function for the mca_oob_tcp_peer
* struct. Note that this function and OBJ_RELEASE should NEVER
* be called directly. Instead, use mca_oob_tcp_del_peer
*
* @param peer a pointer to the mca_oob_tcp_peer_t struct to be destroyed
* @retval none
*/
void mca_oob_tcp_peer_destruct(mca_oob_tcp_peer_t * peer);
/**
* The function to compare 2 peers. Used for the rb tree
*
@ -78,9 +106,12 @@ mca_oob_tcp_peer_t * mca_oob_tcp_add_peer(ompi_process_name_t peer_name);
* @param peer_name the name of the peer
*
* @retval OMPI_SUCCESS
* @retval OMPI_ERROR
*/
int mca_oob_tcp_del_peer(ompi_process_name_t peer_name);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* _MCA_OOB_TCP_PEER_H */