1 /*
2  * Copyright (c) 2004-2007 The Trustees of the University of Tennessee.
3  *                         All rights reserved.
4  * $COPYRIGHT$
5  *
6  * Additional copyrights may follow
7  *
8  * $HEADER$
9  */
10 
11 #ifndef __INCLUDE_VPROTOCOL_PESSIMIST_REQUEST_H_
12 #define __INCLUDE_VPROTOCOL_PESSIMIST_REQUEST_H_
13 
14 #include "ompi_config.h"
15 #include "ompi/request/request.h"
16 #include "../base/vprotocol_base_request.h"
17 #include "vprotocol_pessimist_event.h"
18 #include "vprotocol_pessimist_sender_based_types.h"
19 
20 BEGIN_C_DECLS
21 
22 typedef struct mca_vprotocol_pessimist_request_t {
23     opal_list_item_t list_item; /* must always be first field */
24     ompi_request_free_fn_t pml_req_free;
25     vprotocol_pessimist_clock_t reqid;
26     mca_vprotocol_pessimist_event_t *event;
27     vprotocol_pessimist_sender_based_request_t sb;
28 } mca_vprotocol_pessimist_request_t;
29 
30 typedef mca_vprotocol_pessimist_request_t mca_vprotocol_pessimist_recv_request_t;
31 typedef mca_vprotocol_pessimist_request_t mca_vprotocol_pessimist_send_request_t;
32 
33 OBJ_CLASS_DECLARATION(mca_vprotocol_pessimist_recv_request_t);
34 OBJ_CLASS_DECLARATION(mca_vprotocol_pessimist_send_request_t);
35 
36 #define VPESSIMIST_FTREQ(req) \
37     ((mca_vprotocol_pessimist_request_t *) VPROTOCOL_FTREQ(req))
38 
39 #define VPESSIMIST_RECV_FTREQ(req) \
40     ((mca_vprotocol_pessimist_recv_request_t *) VPROTOCOL_RECV_FTREQ(req))
41 
42 #define VPESSIMIST_SEND_FTREQ(req) \
43     ((mca_vprotocol_pessimist_send_request_t *) VPROTOCOL_SEND_FTREQ(req))
44 
45 #define VPESSIMIST_FTREQ_INIT(req) do {                                         \
46         VPESSIMIST_FTREQ(req)->reqid = mca_vprotocol_pessimist.clock++;        \
47 } while(0)
48 
49 int mca_vprotocol_pessimist_request_free(ompi_request_t **req);
50 
51 END_C_DECLS
52 
53 #endif /* __INCLUDE_VPROTOCOL_PESSIMIST_REQUEST_H_ */
54