This source file includes following definitions.
- opal_dss_peek
- opal_dss_peek_type
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #include "opal_config.h"
20
21 #include "opal/dss/dss_internal.h"
22
23 int opal_dss_peek(opal_buffer_t *buffer, opal_data_type_t *type,
24 int32_t *num_vals)
25 {
26 int ret;
27 opal_buffer_t tmp;
28 int32_t n=1;
29 opal_data_type_t local_type;
30
31
32 if (buffer == NULL) {
33 return OPAL_ERR_BAD_PARAM;
34 }
35
36
37
38 if (buffer->unpack_ptr >= buffer->base_ptr + buffer->bytes_used) {
39 *type = OPAL_NULL;
40 *num_vals = 0;
41 return OPAL_ERR_UNPACK_READ_PAST_END_OF_BUFFER;
42 }
43
44
45
46
47
48 if (OPAL_DSS_BUFFER_FULLY_DESC != buffer->type) {
49 *type = OPAL_UNDEF;
50 *num_vals = 0;
51 return OPAL_ERR_UNKNOWN_DATA_TYPE;
52 }
53
54
55
56 tmp = *buffer;
57
58 if (OPAL_SUCCESS != (ret = opal_dss_get_data_type(&tmp, &local_type))) {
59 *type = OPAL_NULL;
60 *num_vals = 0;
61 return ret;
62 }
63 if (OPAL_INT32 != local_type) {
64 *type = OPAL_NULL;
65 *num_vals = 0;
66 return OPAL_ERR_UNPACK_FAILURE;
67 }
68 if (OPAL_SUCCESS != (ret = opal_dss_unpack_int32(&tmp, num_vals, &n, OPAL_INT32))) {
69 *type = OPAL_NULL;
70 *num_vals = 0;
71 return ret;
72 }
73 if (OPAL_SUCCESS != (ret = opal_dss_get_data_type(&tmp, type))) {
74 *type = OPAL_NULL;
75 *num_vals = 0;
76 }
77
78 return ret;
79 }
80
81 int opal_dss_peek_type(opal_buffer_t *buffer, opal_data_type_t *type)
82 {
83 int ret;
84 opal_buffer_t tmp;
85
86
87 if (buffer == NULL) {
88 return OPAL_ERR_BAD_PARAM;
89 }
90
91
92
93
94
95 if (OPAL_DSS_BUFFER_FULLY_DESC != buffer->type) {
96 *type = OPAL_UNDEF;
97 return OPAL_ERR_UNKNOWN_DATA_TYPE;
98 }
99
100
101 if (buffer->unpack_ptr >= buffer->base_ptr + buffer->bytes_used) {
102 *type = OPAL_UNDEF;
103 return OPAL_ERR_UNPACK_READ_PAST_END_OF_BUFFER;
104 }
105
106
107
108 tmp = *buffer;
109
110 if (OPAL_SUCCESS != (ret = opal_dss_get_data_type(&tmp, type))) {
111 *type = OPAL_UNDEF;
112 return ret;
113 }
114
115 return OPAL_SUCCESS;
116 }