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-2005 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 (c) 2011 Cisco Systems, Inc. All rights reserved.
13 * $COPYRIGHT$
14 *
15 * Additional copyrights may follow
16 *
17 * $HEADER$
18 */
19
20 #ifndef MCA_BTL_TCP_HDR_H
21 #define MCA_BTL_TCP_HDR_H
22
23
24 #include "ompi_config.h"
25 #include "ompi/mca/btl/base/base.h"
26 #include "btl_tcp2.h"
27
28 BEGIN_C_DECLS
29
30 /**
31 * TCP header.
32 */
33
34 #define MCA_BTL_TCP_HDR_TYPE_SEND 1
35 #define MCA_BTL_TCP_HDR_TYPE_PUT 2
36 #define MCA_BTL_TCP_HDR_TYPE_GET 3
37
38 struct mca_btl_tcp2_hdr_t {
39 mca_btl_base_header_t base;
40 uint8_t type;
41 uint16_t count;
42 uint32_t size;
43 };
44 typedef struct mca_btl_tcp2_hdr_t mca_btl_tcp2_hdr_t;
45
46 #define MCA_BTL_TCP_HDR_HTON(hdr) \
47 do { \
48 hdr.count = htons(hdr.count); \
49 hdr.size = htonl(hdr.size); \
50 } while (0)
51
52 #define MCA_BTL_TCP_HDR_NTOH(hdr) \
53 do { \
54 hdr.count = ntohs(hdr.count); \
55 hdr.size = ntohl(hdr.size); \
56 } while (0)
57
58 END_C_DECLS
59 #endif