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