OpenMPI  0.1.1
btl_sctp_proc.h
1 /*
2  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3  * University Research and Technology
4  * Corporation. All rights reserved.
5  * Copyright (c) 2004-2011 The University of Tennessee and The University
6  * of Tennessee Research Foundation. All rights
7  * reserved.
8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9  * University of Stuttgart. All rights reserved.
10  * Copyright (c) 2004-2005 The Regents of the University of California.
11  * All rights reserved.
12  * $COPYRIGHT$
13  *
14  * Additional copyrights may follow
15  *
16  * $HEADER$
17  */
18 
19 #ifndef MCA_BTL_SCTP_PROC_H
20 #define MCA_BTL_SCTP_PROC_H
21 
22 #include "opal/class/opal_object.h"
23 #include "ompi/proc/proc.h"
24 #include "btl_sctp.h"
25 #include "btl_sctp_addr.h"
26 #include "btl_sctp_endpoint.h"
27 #include <netinet/sctp.h>
28 
29 BEGIN_C_DECLS
30 
31 /**
32  * Represents the state of a remote process and the set of addresses
33  * that it exports. Also cache an instance of mca_btl_base_endpoint_t for
34  * each
35  * BTL instance that attempts to open a connection to the process.
36  */
39  /**< allow proc to be placed on a list */
40 
42  /**< pointer to corresponding ompi_proc_t */
43 
45  /**< array of addresses exported by peer */
46 
47  size_t proc_addr_count;
48  /**< number of addresses published by endpoint */
49 
51  /**< array of endpoints that have been created to access this proc */
52 
54  /**< number of endpoints */
55 
57  /**< lock to protect against concurrent access to proc state */
58 };
61 
62 mca_btl_sctp_proc_t* mca_btl_sctp_proc_create(ompi_proc_t* ompi_proc);
63 mca_btl_sctp_proc_t* mca_btl_sctp_proc_lookup(const orte_process_name_t* name);
64 int mca_btl_sctp_proc_insert(mca_btl_sctp_proc_t*, mca_btl_base_endpoint_t*);
65 int mca_btl_sctp_proc_remove(mca_btl_sctp_proc_t*, mca_btl_base_endpoint_t*);
66 bool mca_btl_sctp_proc_accept(mca_btl_sctp_proc_t*, struct sockaddr_in*, int);
67 
68 
69 /**
70  * Inlined function to return local SCTP proc instance.
71  */
72 
73 static inline mca_btl_sctp_proc_t* mca_btl_sctp_proc_local(void)
74 {
75  if(NULL == mca_btl_sctp_component.sctp_local) {
76  mca_btl_sctp_component.sctp_local = mca_btl_sctp_proc_create(ompi_proc_local());
77  }
78  return mca_btl_sctp_component.sctp_local;
79 }
80 
81 enum {
82  INVALID_ENTRY = 0,
83  VALID_ENTRY = 1
84 };
85 /* Table of procs indexed by SCTP association id used by the receiver to
86  * identify senders. It is initialized to 0 in mca_btl_sctp_component_init().
87  * NOTE: 256 matches the size of the proc hash_table
88  */
89 #define MCA_BTL_SCTP_PROC_TABLE_SIZE 256
91  int valid;
92  sctp_assoc_t sctp_assoc_id;
93  orte_vpid_t vpid;
94  struct mca_btl_sctp_proc_t *proc;
95 };
97 
98 extern struct mca_btl_sctp_proc_table_node *recvr_proc_table;
99 extern struct mca_btl_sctp_proc_table_node *sender_proc_table;
100 
101 int mca_btl_sctp_proc_check_vpid(orte_vpid_t vpid, struct mca_btl_sctp_proc_table_node *table);
102 int mca_btl_sctp_proc_check_assoc_id(sctp_assoc_t id, struct mca_btl_sctp_proc_table_node *table);
103 void mca_btl_sctp_proc_add_vpid(orte_vpid_t vpid, struct mca_btl_sctp_proc_t *proc, struct mca_btl_sctp_proc_table_node *table);
104 void mca_btl_sctp_proc_add_assoc_id(sctp_assoc_t id, struct mca_btl_sctp_proc_t *proc, struct mca_btl_sctp_proc_table_node *table);
105 mca_btl_sctp_proc_t *mca_btl_sctp_proc_get(sctp_assoc_t id, struct mca_btl_sctp_proc_table_node *table);
106 
107 END_C_DECLS
108 #endif
struct mca_btl_sctp_proc_t * sctp_local
local proc struct
Definition: btl_sctp.h:69
size_t proc_endpoint_count
number of endpoints
Definition: btl_sctp_proc.h:53
struct mca_btl_sctp_addr_t * proc_addrs
array of addresses exported by peer
Definition: btl_sctp_proc.h:44
static ompi_proc_t * ompi_proc_local(void)
Returns a pointer to the local process.
Definition: proc.h:225
Definition: types.h:146
Definition: mutex_unix.h:53
opal_list_item_t super
allow proc to be placed on a list
Definition: btl_sctp_proc.h:38
Process identification structure interface.
Remote Open MPI process structure.
Definition: proc.h:56
size_t proc_addr_count
number of addresses published by endpoint
Definition: btl_sctp_proc.h:47
Definition: opal_list.h:98
State of ELAN endpoint connection.
Definition: btl_elan_endpoint.h:33
Structure used to publish SCTP connection information to peers.
Definition: btl_sctp_addr.h:38
struct mca_btl_base_endpoint_t ** proc_endpoints
array of endpoints that have been created to access this proc
Definition: btl_sctp_proc.h:50
Definition: btl_sctp_proc.h:90
A simple C-language object-oriented system with single inheritance and ownership-based memory managem...
ompi_proc_t * proc_ompi
pointer to corresponding ompi_proc_t
Definition: btl_sctp_proc.h:41
opal_mutex_t proc_lock
lock to protect against concurrent access to proc state
Definition: btl_sctp_proc.h:56
Represents the state of a remote process and the set of addresses that it exports.
Definition: btl_sctp_proc.h:37
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236