OpenMPI  0.1.1
oob_tcp.h File Reference

Defines the functions for the tcp module. More...

#include "orte_config.h"
#include "orte/types.h"
#include "opal/mca/base/base.h"
#include "opal/class/opal_free_list.h"
#include "opal/class/opal_hash_table.h"
#include "opal/threads/mutex.h"
#include "opal/threads/condition.h"
#include "opal/threads/threads.h"
#include "opal/mca/timer/base/base.h"
#include "orte/mca/oob/oob.h"
#include "orte/mca/oob/base/base.h"
#include "orte/mca/oob/tcp/oob_tcp_peer.h"
#include "orte/mca/oob/tcp/oob_tcp_msg.h"

Go to the source code of this file.

Data Structures

struct  mca_oob_tcp_component_t
 OOB TCP Component. More...
 
struct  mca_oob_tcp_pending_connection_t
 
struct  mca_oob_tcp_device_t
 

Macros

#define OOB_TCP_DEBUG_CONNECT_FAIL   1 /* debug connection establishment failures */
 
#define OOB_TCP_DEBUG_CONNECT   2 /* other connection information */
 
#define OOB_TCP_DEBUG_INFO   3 /* information about startup, connection establish, etc. */
 
#define OOB_TCP_DEBUG_ALL   4 /* everything else */
 
#define CLOSE_THE_SOCKET(socket)
 

Typedefs

typedef struct
mca_oob_tcp_component_t 
mca_oob_tcp_component_t
 Convenience Typedef.
 
typedef struct
mca_oob_tcp_pending_connection_t 
mca_oob_tcp_pending_connection_t
 
typedef struct mca_oob_tcp_device_t mca_oob_tcp_device_t
 

Enumerations

enum  mca_oob_tcp_listen_type_t { OOB_TCP_EVENT, OOB_TCP_LISTEN_THREAD }
 

Functions

mca_oob_tmca_oob_tcp_component_init (int *priority)
 
int mca_oob_tcp_init (void)
 Hook function to allow the selected oob components to register their contact info with the registry.
 
int mca_oob_tcp_fini (void)
 Cleanup resources during shutdown.
 
int mca_oob_tcp_process_name_compare (const orte_process_name_t *n1, const orte_process_name_t *n2)
 Compare two process names for equality. More...
 
char * mca_oob_tcp_get_addr (void)
 Obtain contact information for this host (e.g. More...
 
int mca_oob_tcp_set_addr (const orte_process_name_t *, const char *)
 Setup cached addresses for the peers.
 
int mca_oob_tcp_get_new_name (orte_process_name_t *name)
 
int mca_oob_tcp_ping (const orte_process_name_t *, const char *uri, const struct timeval *tv)
 A routine to ping a given process name to determine if it is reachable. More...
 
int mca_oob_tcp_send_nb (orte_process_name_t *target, orte_process_name_t *origin, struct iovec *msg, int count, int tag, int flags, orte_rml_callback_fn_t cbfunc, void *cbdata)
 
int mca_oob_tcp_recv_nb (orte_process_name_t *peer, struct iovec *msg, int count, int tag, int flags, orte_rml_callback_fn_t cbfunc, void *cbdata)
 Non-blocking version of mca_oob_recv(). More...
 
int mca_oob_tcp_recv_cancel (orte_process_name_t *peer, int tag)
 Cancel non-blocking receive. More...
 
int mca_oob_tcp_resolve (mca_oob_tcp_peer_t *)
 Attempt to map a peer name to its corresponding address.
 
int mca_oob_tcp_parse_uri (const char *uri, struct sockaddr *inaddr)
 Parse a URI string into an IP address and port number.
 
void mca_oob_tcp_set_socket_options (int sd)
 Setup socket options. More...
 
int mca_oob_tcp_ft_event (int state)
 
 OBJ_CLASS_DECLARATION (mca_oob_tcp_pending_connection_t)
 
 OBJ_CLASS_DECLARATION (mca_oob_tcp_device_t)
 

Variables

mca_oob_t mca_oob_tcp
 
ORTE_MODULE_DECLSPEC
mca_oob_tcp_component_t 
mca_oob_tcp_component
 
int mca_oob_tcp_output_handle
 

Detailed Description

Defines the functions for the tcp module.

Macro Definition Documentation

#define CLOSE_THE_SOCKET (   socket)
Value:
do { \
shutdown(socket, 2); \
close(socket); \
} while(0)

Function Documentation

char* mca_oob_tcp_get_addr ( void  )
int mca_oob_tcp_ping ( const orte_process_name_t ,
const char *  uri,
const struct timeval *  tv 
)

A routine to ping a given process name to determine if it is reachable.

Parameters
nameThe peer name.
tvThe length of time to wait on a connection/response.

Note that this routine blocks up to the specified timeout waiting for a connection / response from the specified peer. If the peer is unavailable an error status is returned.

References MCA_OOB_TCP_HDR_HTON, MCA_OOB_TCP_HDR_NTOH, mca_oob_tcp_parse_uri(), mca_oob_tcp_hdr_t::msg_type, opal_output(), and ORTE_PROC_MY_NAME.

int mca_oob_tcp_process_name_compare ( const orte_process_name_t n1,
const orte_process_name_t n2 
)

Compare two process names for equality.

Parameters
n1Process name 1.
n2Process name 2.
Returns
(-1 for n1<n2 0 for equality, 1 for n1>n2)

Note that the definition of < or > is somewhat arbitrary - just needs to be consistently applied to maintain an ordering when process names are used as indices.

int mca_oob_tcp_recv_cancel ( orte_process_name_t peer,
int  tag 
)

Cancel non-blocking receive.

Parameters
peer(IN) Opaque name of peer process or ORTE_NAME_WILDCARD for wildcard receive.
tag(IN) User defined tag for matching send/recv.
Returns
OMPI error code (<0) on error or number of bytes actually received.

References MCA_OOB_TCP_MSG_RETURN, mca_oob_tcp_msg_t::msg_hdr, mca_oob_tcp_msg_t::msg_peer, mca_oob_tcp_hdr_t::msg_tag, opal_list_get_end(), opal_list_get_first(), opal_list_get_next, opal_list_remove_item(), OPAL_THREAD_LOCK, OPAL_THREAD_UNLOCK, ORTE_NAME, mca_oob_tcp_msg_t::super, mca_oob_tcp_component_t::tcp_match_cond, mca_oob_tcp_component_t::tcp_match_count, mca_oob_tcp_component_t::tcp_match_lock, and mca_oob_tcp_component_t::tcp_msg_post.

int mca_oob_tcp_recv_nb ( orte_process_name_t peer,
struct iovec msg,
int  count,
int  tag,
int  flags,
orte_rml_callback_fn_t  cbfunc,
void *  cbdata 
)

Non-blocking version of mca_oob_recv().

Parameters
peer(IN) Opaque name of peer process or ORTE_NAME_WILDCARD for wildcard receive.
msg(IN) Array of iovecs describing user buffers and lengths.
count(IN) Number of elements in iovec array.
tag(IN) User defined tag for matching send/recv.
flags(IN) May be MCA_OOB_PEEK to return up to size bytes of msg w/out removing it from the queue,
cbfunc(IN) Callback function on recv completion.
cbdata(IN) User data that is passed to callback function.
Returns
OMPI error code (<0) on error or number of bytes actually received.

References MCA_OOB_TCP_MSG_ALLOC, mca_oob_tcp_msg_match_recv(), MCA_OOB_TCP_MSG_RETURN, mca_oob_tcp_msg_t::msg_cbdata, mca_oob_tcp_msg_t::msg_cbfunc, mca_oob_tcp_msg_t::msg_complete, mca_oob_tcp_msg_t::msg_flags, mca_oob_tcp_msg_t::msg_hdr, mca_oob_tcp_msg_t::msg_peer, mca_oob_tcp_msg_t::msg_rc, mca_oob_tcp_msg_t::msg_rwbuf, mca_oob_tcp_msg_t::msg_rwiov, mca_oob_tcp_hdr_t::msg_size, mca_oob_tcp_hdr_t::msg_tag, mca_oob_tcp_msg_t::msg_type, mca_oob_tcp_msg_t::msg_ucnt, mca_oob_tcp_msg_t::msg_uiov, opal_list_append, OPAL_THREAD_LOCK, OPAL_THREAD_UNLOCK, ORTE_PROC_MY_NAME, ORTE_RML_PERSISTENT, mca_oob_tcp_component_t::tcp_match_lock, and mca_oob_tcp_component_t::tcp_msg_post.

void mca_oob_tcp_set_socket_options ( int  sd)

Setup socket options.

Setup socket options.

References opal_output(), mca_oob_tcp_component_t::tcp_rcvbuf, and mca_oob_tcp_component_t::tcp_sndbuf.