1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 #ifndef MCA_BTL_TCP_ENDPOINT_H
21 #define MCA_BTL_TCP_ENDPOINT_H
22
23 #include "opal/class/opal_list.h"
24 #include "opal/mca/event/event.h"
25 #include "btl_tcp2_frag.h"
26 #include "btl_tcp2.h"
27 BEGIN_C_DECLS
28
29 #define MCA_BTL_TCP_ENDPOINT_CACHE 1
30
31
32
33
34
35 typedef enum {
36 MCA_BTL_TCP_CONNECTING = 0,
37 MCA_BTL_TCP_CONNECT_ACK,
38 MCA_BTL_TCP_CLOSED,
39 MCA_BTL_TCP_FAILED,
40 MCA_BTL_TCP_CONNECTED
41 } mca_btl_tcp2_state_t;
42
43
44
45
46
47
48
49
50 struct mca_btl_base_endpoint_t {
51 opal_list_item_t super;
52 struct mca_btl_tcp2_module_t* endpoint_btl;
53 struct mca_btl_tcp2_proc_t* endpoint_proc;
54 struct mca_btl_tcp2_addr_t* endpoint_addr;
55 int endpoint_sd;
56 #if MCA_BTL_TCP_ENDPOINT_CACHE
57 char* endpoint_cache;
58 char* endpoint_cache_pos;
59 size_t endpoint_cache_length;
60 #endif
61 struct mca_btl_tcp2_frag_t* endpoint_send_frag;
62 struct mca_btl_tcp2_frag_t* endpoint_recv_frag;
63 mca_btl_tcp2_state_t endpoint_state;
64 size_t endpoint_retries;
65 opal_list_t endpoint_frags;
66 opal_mutex_t endpoint_send_lock;
67 opal_mutex_t endpoint_recv_lock;
68 opal_event_t endpoint_send_event;
69 opal_event_t endpoint_recv_event;
70 bool endpoint_nbo;
71 };
72
73 typedef struct mca_btl_base_endpoint_t mca_btl_base_endpoint_t;
74 typedef mca_btl_base_endpoint_t mca_btl_tcp2_endpoint_t;
75 OBJ_CLASS_DECLARATION(mca_btl_tcp2_endpoint_t);
76
77 void mca_btl_tcp2_set_socket_options(int sd);
78 void mca_btl_tcp2_endpoint_close(mca_btl_base_endpoint_t*);
79 int mca_btl_tcp2_endpoint_send(mca_btl_base_endpoint_t*, struct mca_btl_tcp2_frag_t*);
80 bool mca_btl_tcp2_endpoint_accept(mca_btl_base_endpoint_t*, struct sockaddr*, int);
81 void mca_btl_tcp2_endpoint_shutdown(mca_btl_base_endpoint_t*);
82
83 END_C_DECLS
84 #endif