2004-03-26 14:15:20 +00:00
|
|
|
/*
|
2004-11-22 01:38:40 +00:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
|
|
|
* All rights reserved.
|
2004-11-28 20:09:25 +00:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 12:43:37 +00:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-11-22 01:38:40 +00:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-01-16 00:34:05 +00:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
2004-03-26 14:15:20 +00:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
*/
|
2004-01-16 00:34:05 +00:00
|
|
|
#ifndef MCA_PTL_TCP_PEER_H
|
|
|
|
#define MCA_PTL_TCP_PEER_H
|
|
|
|
|
2004-10-22 16:06:05 +00:00
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
2004-01-16 00:34:05 +00:00
|
|
|
#include <sys/types.h>
|
2004-10-22 16:06:05 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_SOCKET_H
|
2004-01-16 00:34:05 +00:00
|
|
|
#include <sys/socket.h>
|
2004-10-22 16:06:05 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_NETINET_IN_H
|
2004-01-16 00:34:05 +00:00
|
|
|
#include <netinet/in.h>
|
2004-10-22 16:06:05 +00:00
|
|
|
#endif
|
2005-07-03 16:22:16 +00:00
|
|
|
#include "opal/class/opal_list.h"
|
2005-07-03 23:09:55 +00:00
|
|
|
#include "opal/event/event.h"
|
2004-03-17 18:45:16 +00:00
|
|
|
#include "mca/pml/pml.h"
|
|
|
|
#include "mca/ptl/ptl.h"
|
2004-10-20 22:31:03 +00:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2004-01-16 00:34:05 +00:00
|
|
|
|
2004-06-03 22:13:01 +00:00
|
|
|
/**
|
|
|
|
* State of TCP peer connection.
|
|
|
|
*/
|
2004-01-16 00:34:05 +00:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
MCA_PTL_TCP_CLOSED,
|
|
|
|
MCA_PTL_TCP_CONNECTING,
|
|
|
|
MCA_PTL_TCP_CONNECT_ACK,
|
|
|
|
MCA_PTL_TCP_CONNECTED,
|
2004-09-16 13:01:32 +00:00
|
|
|
MCA_PTL_TCP_SHUTDOWN,
|
2004-01-16 00:34:05 +00:00
|
|
|
MCA_PTL_TCP_FAILED
|
|
|
|
} mca_ptl_tcp_state_t;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An abstraction that represents a connection to a peer process.
|
2004-02-05 00:50:37 +00:00
|
|
|
* An instance of mca_ptl_base_peer_t is associated w/ each process
|
2004-01-28 22:52:51 +00:00
|
|
|
* and PTL pair at startup. However, connections to the peer
|
2004-01-16 00:34:05 +00:00
|
|
|
* are established dynamically on an as-needed basis:
|
|
|
|
*/
|
2004-02-05 00:50:37 +00:00
|
|
|
struct mca_ptl_base_peer_t {
|
2005-07-03 16:22:16 +00:00
|
|
|
opal_list_item_t super;
|
2004-10-14 07:07:05 +00:00
|
|
|
struct mca_ptl_tcp_module_t* peer_ptl; /**< PTL instance that created this connection */
|
|
|
|
struct mca_ptl_tcp_proc_t* peer_proc; /**< proc structure corresponding to peer */
|
|
|
|
struct mca_ptl_tcp_addr_t* peer_addr; /**< address of peer */
|
|
|
|
int peer_sd; /**< socket connection to peer */
|
|
|
|
struct mca_ptl_tcp_send_frag_t* peer_send_frag; /**< current send frag being processed */
|
|
|
|
struct mca_ptl_tcp_recv_frag_t* peer_recv_frag; /**< current recv frag being processed */
|
|
|
|
mca_ptl_tcp_state_t peer_state; /**< current state of the connection */
|
|
|
|
size_t peer_retries; /**< number of connection retries attempted */
|
2005-07-03 16:22:16 +00:00
|
|
|
opal_list_t peer_frags; /**< list of pending frags to send */
|
2005-07-03 22:45:48 +00:00
|
|
|
opal_mutex_t peer_send_lock; /**< lock for concurrent access to peer state */
|
|
|
|
opal_mutex_t peer_recv_lock; /**< lock for concurrent access to peer state */
|
2005-07-03 23:09:55 +00:00
|
|
|
opal_event_t peer_send_event; /**< event for async processing of send frags */
|
|
|
|
opal_event_t peer_recv_event; /**< event for async processing of recv frags */
|
2004-11-17 22:47:08 +00:00
|
|
|
bool peer_nbo; /**< convert headers to network byte order? */
|
2004-01-16 00:34:05 +00:00
|
|
|
};
|
2004-02-05 00:50:37 +00:00
|
|
|
typedef struct mca_ptl_base_peer_t mca_ptl_base_peer_t;
|
2004-01-16 00:34:05 +00:00
|
|
|
|
2005-07-03 16:06:07 +00:00
|
|
|
extern opal_class_t mca_ptl_tcp_peer_t_class;
|
2004-02-10 16:53:41 +00:00
|
|
|
typedef struct mca_ptl_base_peer_t mca_ptl_tcp_peer_t;
|
2004-01-16 00:34:05 +00:00
|
|
|
|
2004-04-23 01:38:41 +00:00
|
|
|
void mca_ptl_tcp_set_socket_options(int sd);
|
2004-02-05 00:50:37 +00:00
|
|
|
void mca_ptl_tcp_peer_close(mca_ptl_base_peer_t*);
|
2004-10-14 07:07:05 +00:00
|
|
|
int mca_ptl_tcp_peer_send(mca_ptl_base_peer_t*, struct mca_ptl_tcp_send_frag_t*, int);
|
2004-02-05 00:50:37 +00:00
|
|
|
bool mca_ptl_tcp_peer_accept(mca_ptl_base_peer_t*, struct sockaddr_in*, int);
|
2004-09-16 13:01:32 +00:00
|
|
|
void mca_ptl_tcp_peer_shutdown(mca_ptl_base_peer_t*);
|
2004-01-16 00:34:05 +00:00
|
|
|
|
2004-10-20 22:31:03 +00:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
2004-01-16 00:34:05 +00:00
|
|
|
#endif
|
|
|
|
|