1 /*
2 * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2006 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) 2006-2013 Los Alamos National Security, LLC.
13 * All rights reserved.
14 * Copyright (c) 2010-2011 Cisco Systems, Inc. All rights reserved.
15 * Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
16 * Copyright (c) 2017 Research Organization for Information Science
17 * and Technology (RIST). All rights reserved.
18 *
19 * $COPYRIGHT$
20 *
21 * Additional copyrights may follow
22 *
23 * $HEADER$
24 */
25
26 #ifndef _MCA_OOB_TCP_HDR_H_
27 #define _MCA_OOB_TCP_HDR_H_
28
29 #include "orte_config.h"
30
31 /* define several internal-only message
32 * types this component uses for its own
33 * handshake operations, plus one indicating
34 * the message came from an external (to
35 * this component) source
36 */
37 typedef uint8_t mca_oob_tcp_msg_type_t;
38
39 #define MCA_OOB_TCP_IDENT 1
40 #define MCA_OOB_TCP_PROBE 2
41 #define MCA_OOB_TCP_PING 3
42 #define MCA_OOB_TCP_USER 4
43
44 #define ORTE_MAX_RTD_SIZE 31
45
46 /* header for tcp msgs */
47 typedef struct {
48 /* the originator of the message - if we are routing,
49 * it could be someone other than me
50 */
51 orte_process_name_t origin;
52 /* the intended final recipient - if we don't have
53 * a path directly to that process, then we will
54 * attempt to route. If we have no route to that
55 * process, then we should have rejected the message
56 * and let some other module try to send it
57 */
58 orte_process_name_t dst;
59 /* the rml tag where this message is headed */
60 orte_rml_tag_t tag;
61 /* the seq number of this message */
62 uint32_t seq_num;
63 /* number of bytes in message */
64 uint32_t nbytes;
65 /* type of message */
66 mca_oob_tcp_msg_type_t type;
67 /* routed module to be used */
68 char routed[ORTE_MAX_RTD_SIZE+1];
69 } mca_oob_tcp_hdr_t;
70 /**
71 * Convert the message header to host byte order
72 */
73 #define MCA_OOB_TCP_HDR_NTOH(h) \
74 ORTE_PROCESS_NAME_NTOH((h)->origin); \
75 ORTE_PROCESS_NAME_NTOH((h)->dst); \
76 (h)->tag = ORTE_RML_TAG_NTOH((h)->tag); \
77 (h)->nbytes = ntohl((h)->nbytes);
78
79 /**
80 * Convert the message header to network byte order
81 */
82 #define MCA_OOB_TCP_HDR_HTON(h) \
83 ORTE_PROCESS_NAME_HTON((h)->origin); \
84 ORTE_PROCESS_NAME_HTON((h)->dst); \
85 (h)->tag = ORTE_RML_TAG_HTON((h)->tag); \
86 (h)->nbytes = htonl((h)->nbytes);
87
88 #endif /* _MCA_OOB_TCP_HDR_H_ */