A small memory footprint AMQP implimentation
Dependents: iothub_client_sample_amqp remote_monitoring simplesample_amqp
amqp_definitions.c@23:1111ee8bcba4, 2017-04-21 (annotated)
- Committer:
- AzureIoTClient
- Date:
- Fri Apr 21 14:50:32 2017 -0700
- Revision:
- 23:1111ee8bcba4
- Parent:
- 21:f9c433d8e6ca
- Child:
- 25:1101516ee67d
1.1.13
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Azure.IoT Build | 0:6ae2f7bca550 | 1 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3 | // Copyright (c) Microsoft. All rights reserved. |
Azure.IoT Build | 0:6ae2f7bca550 | 4 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
Azure.IoT Build | 0:6ae2f7bca550 | 5 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6 | #include <stdlib.h> |
AzureIoTClient | 19:000ab4e6a2c1 | 7 | #include "azure_c_shared_utility/optimize_size.h" |
AzureIoTClient | 21:f9c433d8e6ca | 8 | #include "azure_c_shared_utility/gballoc.h" |
Azure.IoT Build | 0:6ae2f7bca550 | 9 | #include "azure_uamqp_c/amqpvalue.h" |
Azure.IoT Build | 0:6ae2f7bca550 | 10 | #include "azure_uamqp_c/amqp_definitions.h" |
Azure.IoT Build | 0:6ae2f7bca550 | 11 | #include <stdlib.h> |
Azure.IoT Build | 0:6ae2f7bca550 | 12 | #include <stdbool.h> |
Azure.IoT Build | 0:6ae2f7bca550 | 13 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14 | /* role */ |
Azure.IoT Build | 0:6ae2f7bca550 | 15 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16 | AMQP_VALUE amqpvalue_create_role(role value) |
Azure.IoT Build | 0:6ae2f7bca550 | 17 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 18 | return amqpvalue_create_boolean(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 19 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 20 | |
Azure.IoT Build | 0:6ae2f7bca550 | 21 | /* sender-settle-mode */ |
Azure.IoT Build | 0:6ae2f7bca550 | 22 | |
Azure.IoT Build | 0:6ae2f7bca550 | 23 | AMQP_VALUE amqpvalue_create_sender_settle_mode(sender_settle_mode value) |
Azure.IoT Build | 0:6ae2f7bca550 | 24 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 25 | return amqpvalue_create_ubyte(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 26 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 27 | |
Azure.IoT Build | 0:6ae2f7bca550 | 28 | /* receiver-settle-mode */ |
Azure.IoT Build | 0:6ae2f7bca550 | 29 | |
Azure.IoT Build | 0:6ae2f7bca550 | 30 | AMQP_VALUE amqpvalue_create_receiver_settle_mode(receiver_settle_mode value) |
Azure.IoT Build | 0:6ae2f7bca550 | 31 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 32 | return amqpvalue_create_ubyte(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 33 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 34 | |
Azure.IoT Build | 0:6ae2f7bca550 | 35 | /* handle */ |
Azure.IoT Build | 0:6ae2f7bca550 | 36 | |
Azure.IoT Build | 0:6ae2f7bca550 | 37 | AMQP_VALUE amqpvalue_create_handle(handle value) |
Azure.IoT Build | 0:6ae2f7bca550 | 38 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 39 | return amqpvalue_create_uint(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 40 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 41 | |
Azure.IoT Build | 0:6ae2f7bca550 | 42 | /* seconds */ |
Azure.IoT Build | 0:6ae2f7bca550 | 43 | |
Azure.IoT Build | 0:6ae2f7bca550 | 44 | AMQP_VALUE amqpvalue_create_seconds(seconds value) |
Azure.IoT Build | 0:6ae2f7bca550 | 45 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 46 | return amqpvalue_create_uint(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 47 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 48 | |
Azure.IoT Build | 0:6ae2f7bca550 | 49 | /* milliseconds */ |
Azure.IoT Build | 0:6ae2f7bca550 | 50 | |
Azure.IoT Build | 0:6ae2f7bca550 | 51 | AMQP_VALUE amqpvalue_create_milliseconds(milliseconds value) |
Azure.IoT Build | 0:6ae2f7bca550 | 52 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 53 | return amqpvalue_create_uint(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 54 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 55 | |
Azure.IoT Build | 0:6ae2f7bca550 | 56 | /* delivery-tag */ |
Azure.IoT Build | 0:6ae2f7bca550 | 57 | |
Azure.IoT Build | 0:6ae2f7bca550 | 58 | AMQP_VALUE amqpvalue_create_delivery_tag(delivery_tag value) |
Azure.IoT Build | 0:6ae2f7bca550 | 59 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 60 | return amqpvalue_create_binary(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 61 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 62 | |
Azure.IoT Build | 0:6ae2f7bca550 | 63 | /* sequence-no */ |
Azure.IoT Build | 0:6ae2f7bca550 | 64 | |
Azure.IoT Build | 0:6ae2f7bca550 | 65 | AMQP_VALUE amqpvalue_create_sequence_no(sequence_no value) |
Azure.IoT Build | 0:6ae2f7bca550 | 66 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 67 | return amqpvalue_create_uint(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 68 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 69 | |
Azure.IoT Build | 0:6ae2f7bca550 | 70 | /* delivery-number */ |
Azure.IoT Build | 0:6ae2f7bca550 | 71 | |
Azure.IoT Build | 0:6ae2f7bca550 | 72 | AMQP_VALUE amqpvalue_create_delivery_number(delivery_number value) |
Azure.IoT Build | 0:6ae2f7bca550 | 73 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 74 | return amqpvalue_create_sequence_no(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 75 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 76 | |
Azure.IoT Build | 0:6ae2f7bca550 | 77 | /* transfer-number */ |
Azure.IoT Build | 0:6ae2f7bca550 | 78 | |
Azure.IoT Build | 0:6ae2f7bca550 | 79 | AMQP_VALUE amqpvalue_create_transfer_number(transfer_number value) |
Azure.IoT Build | 0:6ae2f7bca550 | 80 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 81 | return amqpvalue_create_sequence_no(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 82 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 83 | |
Azure.IoT Build | 0:6ae2f7bca550 | 84 | /* message-format */ |
Azure.IoT Build | 0:6ae2f7bca550 | 85 | |
Azure.IoT Build | 0:6ae2f7bca550 | 86 | AMQP_VALUE amqpvalue_create_message_format(message_format value) |
Azure.IoT Build | 0:6ae2f7bca550 | 87 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 88 | return amqpvalue_create_uint(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 89 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 90 | |
Azure.IoT Build | 0:6ae2f7bca550 | 91 | /* ietf-language-tag */ |
Azure.IoT Build | 0:6ae2f7bca550 | 92 | |
Azure.IoT Build | 0:6ae2f7bca550 | 93 | AMQP_VALUE amqpvalue_create_ietf_language_tag(ietf_language_tag value) |
Azure.IoT Build | 0:6ae2f7bca550 | 94 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 95 | return amqpvalue_create_symbol(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 96 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 97 | |
Azure.IoT Build | 0:6ae2f7bca550 | 98 | /* fields */ |
Azure.IoT Build | 0:6ae2f7bca550 | 99 | |
Azure.IoT Build | 0:6ae2f7bca550 | 100 | AMQP_VALUE amqpvalue_create_fields(AMQP_VALUE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 101 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 102 | return amqpvalue_clone(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 103 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 104 | |
Azure.IoT Build | 0:6ae2f7bca550 | 105 | /* error */ |
Azure.IoT Build | 0:6ae2f7bca550 | 106 | |
Azure.IoT Build | 0:6ae2f7bca550 | 107 | typedef struct ERROR_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 108 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 109 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 110 | } ERROR_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 111 | |
Azure.IoT Build | 0:6ae2f7bca550 | 112 | static ERROR_HANDLE error_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 113 | { |
AzureIoTClient | 21:f9c433d8e6ca | 114 | ERROR_INSTANCE* error_instance = (ERROR_INSTANCE*)malloc(sizeof(ERROR_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 115 | if (error_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 116 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 117 | error_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 118 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 119 | |
Azure.IoT Build | 0:6ae2f7bca550 | 120 | return error_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 121 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 122 | |
Azure.IoT Build | 0:6ae2f7bca550 | 123 | ERROR_HANDLE error_create(const char* condition_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 124 | { |
AzureIoTClient | 21:f9c433d8e6ca | 125 | ERROR_INSTANCE* error_instance = (ERROR_INSTANCE*)malloc(sizeof(ERROR_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 126 | if (error_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 127 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 128 | error_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(29); |
Azure.IoT Build | 0:6ae2f7bca550 | 129 | if (error_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 130 | { |
AzureIoTClient | 21:f9c433d8e6ca | 131 | free(error_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 132 | error_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 133 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 134 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 135 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 136 | AMQP_VALUE condition_amqp_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 137 | int result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 138 | |
Azure.IoT Build | 0:6ae2f7bca550 | 139 | condition_amqp_value = amqpvalue_create_symbol(condition_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 140 | if ((result == 0) && (amqpvalue_set_composite_item(error_instance->composite_value, 0, condition_amqp_value) != 0)) |
Azure.IoT Build | 0:6ae2f7bca550 | 141 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 142 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 143 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 144 | |
Azure.IoT Build | 0:6ae2f7bca550 | 145 | amqpvalue_destroy(condition_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 146 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 147 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 148 | |
Azure.IoT Build | 0:6ae2f7bca550 | 149 | return error_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 150 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 151 | |
Azure.IoT Build | 0:6ae2f7bca550 | 152 | ERROR_HANDLE error_clone(ERROR_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 153 | { |
AzureIoTClient | 21:f9c433d8e6ca | 154 | ERROR_INSTANCE* error_instance = (ERROR_INSTANCE*)malloc(sizeof(ERROR_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 155 | if (error_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 156 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 157 | error_instance->composite_value = amqpvalue_clone(((ERROR_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 158 | if (error_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 159 | { |
AzureIoTClient | 21:f9c433d8e6ca | 160 | free(error_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 161 | error_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 162 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 163 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 164 | |
Azure.IoT Build | 0:6ae2f7bca550 | 165 | return error_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 166 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 167 | |
Azure.IoT Build | 0:6ae2f7bca550 | 168 | void error_destroy(ERROR_HANDLE error) |
Azure.IoT Build | 0:6ae2f7bca550 | 169 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 170 | if (error != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 171 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 172 | ERROR_INSTANCE* error_instance = (ERROR_INSTANCE*)error; |
Azure.IoT Build | 0:6ae2f7bca550 | 173 | amqpvalue_destroy(error_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 174 | free(error_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 175 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 176 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 177 | |
Azure.IoT Build | 0:6ae2f7bca550 | 178 | AMQP_VALUE amqpvalue_create_error(ERROR_HANDLE error) |
Azure.IoT Build | 0:6ae2f7bca550 | 179 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 180 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 181 | |
Azure.IoT Build | 0:6ae2f7bca550 | 182 | if (error == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 183 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 184 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 185 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 186 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 187 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 188 | ERROR_INSTANCE* error_instance = (ERROR_INSTANCE*)error; |
Azure.IoT Build | 0:6ae2f7bca550 | 189 | result = amqpvalue_clone(error_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 190 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 191 | |
Azure.IoT Build | 0:6ae2f7bca550 | 192 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 193 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 194 | |
Azure.IoT Build | 0:6ae2f7bca550 | 195 | bool is_error_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 196 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 197 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 198 | |
Azure.IoT Build | 0:6ae2f7bca550 | 199 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 200 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 201 | (descriptor_ulong == 29)) |
Azure.IoT Build | 0:6ae2f7bca550 | 202 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 203 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 204 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 205 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 206 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 207 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 208 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 209 | |
Azure.IoT Build | 0:6ae2f7bca550 | 210 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 211 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 212 | |
Azure.IoT Build | 0:6ae2f7bca550 | 213 | |
Azure.IoT Build | 0:6ae2f7bca550 | 214 | int amqpvalue_get_error(AMQP_VALUE value, ERROR_HANDLE* error_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 215 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 216 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 217 | ERROR_INSTANCE* error_instance = (ERROR_INSTANCE*)error_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 218 | *error_handle = error_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 219 | if (*error_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 220 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 221 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 222 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 223 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 224 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 225 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 226 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 227 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 228 | error_destroy(*error_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 229 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 230 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 231 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 232 | { |
AzureIoTClient | 23:1111ee8bcba4 | 233 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 234 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 235 | { |
AzureIoTClient | 23:1111ee8bcba4 | 236 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 237 | } |
AzureIoTClient | 23:1111ee8bcba4 | 238 | else |
AzureIoTClient | 23:1111ee8bcba4 | 239 | { |
AzureIoTClient | 23:1111ee8bcba4 | 240 | do |
AzureIoTClient | 23:1111ee8bcba4 | 241 | { |
AzureIoTClient | 23:1111ee8bcba4 | 242 | AMQP_VALUE item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 243 | /* condition */ |
AzureIoTClient | 23:1111ee8bcba4 | 244 | if (list_item_count > 0) |
AzureIoTClient | 23:1111ee8bcba4 | 245 | { |
AzureIoTClient | 23:1111ee8bcba4 | 246 | item_value = amqpvalue_get_list_item(list_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 247 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 248 | { |
AzureIoTClient | 23:1111ee8bcba4 | 249 | { |
AzureIoTClient | 23:1111ee8bcba4 | 250 | error_destroy(*error_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 251 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 252 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 253 | } |
AzureIoTClient | 23:1111ee8bcba4 | 254 | } |
AzureIoTClient | 23:1111ee8bcba4 | 255 | else |
AzureIoTClient | 23:1111ee8bcba4 | 256 | { |
AzureIoTClient | 23:1111ee8bcba4 | 257 | const char* condition; |
AzureIoTClient | 23:1111ee8bcba4 | 258 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 259 | { |
AzureIoTClient | 23:1111ee8bcba4 | 260 | error_destroy(*error_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 261 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 262 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 263 | } |
AzureIoTClient | 23:1111ee8bcba4 | 264 | else |
AzureIoTClient | 23:1111ee8bcba4 | 265 | { |
AzureIoTClient | 23:1111ee8bcba4 | 266 | if (amqpvalue_get_symbol(item_value, &condition) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 267 | { |
AzureIoTClient | 23:1111ee8bcba4 | 268 | error_destroy(*error_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 269 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 270 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 271 | } |
AzureIoTClient | 23:1111ee8bcba4 | 272 | } |
AzureIoTClient | 23:1111ee8bcba4 | 273 | |
AzureIoTClient | 23:1111ee8bcba4 | 274 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 275 | } |
AzureIoTClient | 23:1111ee8bcba4 | 276 | } |
AzureIoTClient | 23:1111ee8bcba4 | 277 | else |
AzureIoTClient | 23:1111ee8bcba4 | 278 | { |
AzureIoTClient | 23:1111ee8bcba4 | 279 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 280 | } |
AzureIoTClient | 23:1111ee8bcba4 | 281 | /* description */ |
AzureIoTClient | 23:1111ee8bcba4 | 282 | if (list_item_count > 1) |
AzureIoTClient | 23:1111ee8bcba4 | 283 | { |
AzureIoTClient | 23:1111ee8bcba4 | 284 | item_value = amqpvalue_get_list_item(list_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 285 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 286 | { |
AzureIoTClient | 23:1111ee8bcba4 | 287 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 288 | } |
AzureIoTClient | 23:1111ee8bcba4 | 289 | else |
AzureIoTClient | 23:1111ee8bcba4 | 290 | { |
AzureIoTClient | 23:1111ee8bcba4 | 291 | const char* description; |
AzureIoTClient | 23:1111ee8bcba4 | 292 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 293 | { |
AzureIoTClient | 23:1111ee8bcba4 | 294 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 295 | } |
AzureIoTClient | 23:1111ee8bcba4 | 296 | else |
AzureIoTClient | 23:1111ee8bcba4 | 297 | { |
AzureIoTClient | 23:1111ee8bcba4 | 298 | if (amqpvalue_get_string(item_value, &description) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 299 | { |
AzureIoTClient | 23:1111ee8bcba4 | 300 | error_destroy(*error_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 301 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 302 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 303 | } |
AzureIoTClient | 23:1111ee8bcba4 | 304 | } |
AzureIoTClient | 23:1111ee8bcba4 | 305 | |
AzureIoTClient | 23:1111ee8bcba4 | 306 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 307 | } |
AzureIoTClient | 23:1111ee8bcba4 | 308 | } |
AzureIoTClient | 23:1111ee8bcba4 | 309 | /* info */ |
AzureIoTClient | 23:1111ee8bcba4 | 310 | if (list_item_count > 2) |
AzureIoTClient | 23:1111ee8bcba4 | 311 | { |
AzureIoTClient | 23:1111ee8bcba4 | 312 | item_value = amqpvalue_get_list_item(list_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 313 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 314 | { |
AzureIoTClient | 23:1111ee8bcba4 | 315 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 316 | } |
AzureIoTClient | 23:1111ee8bcba4 | 317 | else |
AzureIoTClient | 23:1111ee8bcba4 | 318 | { |
AzureIoTClient | 23:1111ee8bcba4 | 319 | fields info; |
AzureIoTClient | 23:1111ee8bcba4 | 320 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 321 | { |
AzureIoTClient | 23:1111ee8bcba4 | 322 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 323 | } |
AzureIoTClient | 23:1111ee8bcba4 | 324 | else |
AzureIoTClient | 23:1111ee8bcba4 | 325 | { |
AzureIoTClient | 23:1111ee8bcba4 | 326 | if (amqpvalue_get_fields(item_value, &info) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 327 | { |
AzureIoTClient | 23:1111ee8bcba4 | 328 | error_destroy(*error_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 329 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 330 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 331 | } |
AzureIoTClient | 23:1111ee8bcba4 | 332 | } |
AzureIoTClient | 23:1111ee8bcba4 | 333 | |
AzureIoTClient | 23:1111ee8bcba4 | 334 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 335 | } |
AzureIoTClient | 23:1111ee8bcba4 | 336 | } |
AzureIoTClient | 23:1111ee8bcba4 | 337 | |
AzureIoTClient | 23:1111ee8bcba4 | 338 | error_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 339 | |
AzureIoTClient | 23:1111ee8bcba4 | 340 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 341 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 342 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 343 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 344 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 345 | |
Azure.IoT Build | 0:6ae2f7bca550 | 346 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 347 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 348 | |
Azure.IoT Build | 0:6ae2f7bca550 | 349 | int error_get_condition(ERROR_HANDLE error, const char** condition_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 350 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 351 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 352 | |
Azure.IoT Build | 0:6ae2f7bca550 | 353 | if (error == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 354 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 355 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 356 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 357 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 358 | { |
AzureIoTClient | 23:1111ee8bcba4 | 359 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 360 | ERROR_INSTANCE* error_instance = (ERROR_INSTANCE*)error; |
AzureIoTClient | 23:1111ee8bcba4 | 361 | if (amqpvalue_get_composite_item_count(error_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 362 | { |
AzureIoTClient | 23:1111ee8bcba4 | 363 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 364 | } |
AzureIoTClient | 23:1111ee8bcba4 | 365 | else |
AzureIoTClient | 23:1111ee8bcba4 | 366 | { |
AzureIoTClient | 23:1111ee8bcba4 | 367 | if (item_count <= 0) |
AzureIoTClient | 23:1111ee8bcba4 | 368 | { |
AzureIoTClient | 23:1111ee8bcba4 | 369 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 370 | } |
AzureIoTClient | 23:1111ee8bcba4 | 371 | else |
AzureIoTClient | 23:1111ee8bcba4 | 372 | { |
AzureIoTClient | 23:1111ee8bcba4 | 373 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(error_instance->composite_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 374 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 375 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 376 | { |
AzureIoTClient | 23:1111ee8bcba4 | 377 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 378 | } |
AzureIoTClient | 23:1111ee8bcba4 | 379 | else |
AzureIoTClient | 23:1111ee8bcba4 | 380 | { |
AzureIoTClient | 23:1111ee8bcba4 | 381 | if (amqpvalue_get_symbol(item_value, condition_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 382 | { |
AzureIoTClient | 23:1111ee8bcba4 | 383 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 384 | } |
AzureIoTClient | 23:1111ee8bcba4 | 385 | else |
AzureIoTClient | 23:1111ee8bcba4 | 386 | { |
AzureIoTClient | 23:1111ee8bcba4 | 387 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 388 | } |
AzureIoTClient | 23:1111ee8bcba4 | 389 | } |
AzureIoTClient | 23:1111ee8bcba4 | 390 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 391 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 392 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 393 | |
Azure.IoT Build | 0:6ae2f7bca550 | 394 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 395 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 396 | |
Azure.IoT Build | 0:6ae2f7bca550 | 397 | int error_set_condition(ERROR_HANDLE error, const char* condition_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 398 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 399 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 400 | |
Azure.IoT Build | 0:6ae2f7bca550 | 401 | if (error == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 402 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 403 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 404 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 405 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 406 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 407 | ERROR_INSTANCE* error_instance = (ERROR_INSTANCE*)error; |
Azure.IoT Build | 0:6ae2f7bca550 | 408 | AMQP_VALUE condition_amqp_value = amqpvalue_create_symbol(condition_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 409 | if (condition_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 410 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 411 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 412 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 413 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 414 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 415 | if (amqpvalue_set_composite_item(error_instance->composite_value, 0, condition_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 416 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 417 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 418 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 419 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 420 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 421 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 422 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 423 | |
Azure.IoT Build | 0:6ae2f7bca550 | 424 | amqpvalue_destroy(condition_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 425 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 426 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 427 | |
Azure.IoT Build | 0:6ae2f7bca550 | 428 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 429 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 430 | |
Azure.IoT Build | 0:6ae2f7bca550 | 431 | int error_get_description(ERROR_HANDLE error, const char** description_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 432 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 433 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 434 | |
Azure.IoT Build | 0:6ae2f7bca550 | 435 | if (error == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 436 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 437 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 438 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 439 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 440 | { |
AzureIoTClient | 23:1111ee8bcba4 | 441 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 442 | ERROR_INSTANCE* error_instance = (ERROR_INSTANCE*)error; |
AzureIoTClient | 23:1111ee8bcba4 | 443 | if (amqpvalue_get_composite_item_count(error_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 444 | { |
AzureIoTClient | 23:1111ee8bcba4 | 445 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 446 | } |
AzureIoTClient | 23:1111ee8bcba4 | 447 | else |
AzureIoTClient | 23:1111ee8bcba4 | 448 | { |
AzureIoTClient | 23:1111ee8bcba4 | 449 | if (item_count <= 1) |
AzureIoTClient | 23:1111ee8bcba4 | 450 | { |
AzureIoTClient | 23:1111ee8bcba4 | 451 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 452 | } |
AzureIoTClient | 23:1111ee8bcba4 | 453 | else |
AzureIoTClient | 23:1111ee8bcba4 | 454 | { |
AzureIoTClient | 23:1111ee8bcba4 | 455 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(error_instance->composite_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 456 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 457 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 458 | { |
AzureIoTClient | 23:1111ee8bcba4 | 459 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 460 | } |
AzureIoTClient | 23:1111ee8bcba4 | 461 | else |
AzureIoTClient | 23:1111ee8bcba4 | 462 | { |
AzureIoTClient | 23:1111ee8bcba4 | 463 | if (amqpvalue_get_string(item_value, description_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 464 | { |
AzureIoTClient | 23:1111ee8bcba4 | 465 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 466 | } |
AzureIoTClient | 23:1111ee8bcba4 | 467 | else |
AzureIoTClient | 23:1111ee8bcba4 | 468 | { |
AzureIoTClient | 23:1111ee8bcba4 | 469 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 470 | } |
AzureIoTClient | 23:1111ee8bcba4 | 471 | } |
AzureIoTClient | 23:1111ee8bcba4 | 472 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 473 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 474 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 475 | |
Azure.IoT Build | 0:6ae2f7bca550 | 476 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 477 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 478 | |
Azure.IoT Build | 0:6ae2f7bca550 | 479 | int error_set_description(ERROR_HANDLE error, const char* description_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 480 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 481 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 482 | |
Azure.IoT Build | 0:6ae2f7bca550 | 483 | if (error == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 484 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 485 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 486 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 487 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 488 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 489 | ERROR_INSTANCE* error_instance = (ERROR_INSTANCE*)error; |
Azure.IoT Build | 0:6ae2f7bca550 | 490 | AMQP_VALUE description_amqp_value = amqpvalue_create_string(description_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 491 | if (description_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 492 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 493 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 494 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 495 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 496 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 497 | if (amqpvalue_set_composite_item(error_instance->composite_value, 1, description_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 498 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 499 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 500 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 501 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 502 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 503 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 504 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 505 | |
Azure.IoT Build | 0:6ae2f7bca550 | 506 | amqpvalue_destroy(description_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 507 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 508 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 509 | |
Azure.IoT Build | 0:6ae2f7bca550 | 510 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 511 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 512 | |
Azure.IoT Build | 0:6ae2f7bca550 | 513 | int error_get_info(ERROR_HANDLE error, fields* info_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 514 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 515 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 516 | |
Azure.IoT Build | 0:6ae2f7bca550 | 517 | if (error == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 518 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 519 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 520 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 521 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 522 | { |
AzureIoTClient | 23:1111ee8bcba4 | 523 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 524 | ERROR_INSTANCE* error_instance = (ERROR_INSTANCE*)error; |
AzureIoTClient | 23:1111ee8bcba4 | 525 | if (amqpvalue_get_composite_item_count(error_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 526 | { |
AzureIoTClient | 23:1111ee8bcba4 | 527 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 528 | } |
AzureIoTClient | 23:1111ee8bcba4 | 529 | else |
AzureIoTClient | 23:1111ee8bcba4 | 530 | { |
AzureIoTClient | 23:1111ee8bcba4 | 531 | if (item_count <= 2) |
AzureIoTClient | 23:1111ee8bcba4 | 532 | { |
AzureIoTClient | 23:1111ee8bcba4 | 533 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 534 | } |
AzureIoTClient | 23:1111ee8bcba4 | 535 | else |
AzureIoTClient | 23:1111ee8bcba4 | 536 | { |
AzureIoTClient | 23:1111ee8bcba4 | 537 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(error_instance->composite_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 538 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 539 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 540 | { |
AzureIoTClient | 23:1111ee8bcba4 | 541 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 542 | } |
AzureIoTClient | 23:1111ee8bcba4 | 543 | else |
AzureIoTClient | 23:1111ee8bcba4 | 544 | { |
AzureIoTClient | 23:1111ee8bcba4 | 545 | if (amqpvalue_get_fields(item_value, info_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 546 | { |
AzureIoTClient | 23:1111ee8bcba4 | 547 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 548 | } |
AzureIoTClient | 23:1111ee8bcba4 | 549 | else |
AzureIoTClient | 23:1111ee8bcba4 | 550 | { |
AzureIoTClient | 23:1111ee8bcba4 | 551 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 552 | } |
AzureIoTClient | 23:1111ee8bcba4 | 553 | } |
AzureIoTClient | 23:1111ee8bcba4 | 554 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 555 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 556 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 557 | |
Azure.IoT Build | 0:6ae2f7bca550 | 558 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 559 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 560 | |
Azure.IoT Build | 0:6ae2f7bca550 | 561 | int error_set_info(ERROR_HANDLE error, fields info_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 562 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 563 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 564 | |
Azure.IoT Build | 0:6ae2f7bca550 | 565 | if (error == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 566 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 567 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 568 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 569 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 570 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 571 | ERROR_INSTANCE* error_instance = (ERROR_INSTANCE*)error; |
Azure.IoT Build | 0:6ae2f7bca550 | 572 | AMQP_VALUE info_amqp_value = amqpvalue_create_fields(info_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 573 | if (info_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 574 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 575 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 576 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 577 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 578 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 579 | if (amqpvalue_set_composite_item(error_instance->composite_value, 2, info_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 580 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 581 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 582 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 583 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 584 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 585 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 586 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 587 | |
Azure.IoT Build | 0:6ae2f7bca550 | 588 | amqpvalue_destroy(info_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 589 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 590 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 591 | |
Azure.IoT Build | 0:6ae2f7bca550 | 592 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 593 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 594 | |
Azure.IoT Build | 0:6ae2f7bca550 | 595 | |
Azure.IoT Build | 0:6ae2f7bca550 | 596 | /* amqp-error */ |
Azure.IoT Build | 0:6ae2f7bca550 | 597 | |
Azure.IoT Build | 0:6ae2f7bca550 | 598 | AMQP_VALUE amqpvalue_create_amqp_error(amqp_error value) |
Azure.IoT Build | 0:6ae2f7bca550 | 599 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 600 | return amqpvalue_create_symbol(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 601 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 602 | |
Azure.IoT Build | 0:6ae2f7bca550 | 603 | /* connection-error */ |
Azure.IoT Build | 0:6ae2f7bca550 | 604 | |
Azure.IoT Build | 0:6ae2f7bca550 | 605 | AMQP_VALUE amqpvalue_create_connection_error(connection_error value) |
Azure.IoT Build | 0:6ae2f7bca550 | 606 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 607 | return amqpvalue_create_symbol(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 608 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 609 | |
Azure.IoT Build | 0:6ae2f7bca550 | 610 | /* session-error */ |
Azure.IoT Build | 0:6ae2f7bca550 | 611 | |
Azure.IoT Build | 0:6ae2f7bca550 | 612 | AMQP_VALUE amqpvalue_create_session_error(session_error value) |
Azure.IoT Build | 0:6ae2f7bca550 | 613 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 614 | return amqpvalue_create_symbol(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 615 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 616 | |
Azure.IoT Build | 0:6ae2f7bca550 | 617 | /* link-error */ |
Azure.IoT Build | 0:6ae2f7bca550 | 618 | |
Azure.IoT Build | 0:6ae2f7bca550 | 619 | AMQP_VALUE amqpvalue_create_link_error(link_error value) |
Azure.IoT Build | 0:6ae2f7bca550 | 620 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 621 | return amqpvalue_create_symbol(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 622 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 623 | |
Azure.IoT Build | 0:6ae2f7bca550 | 624 | /* open */ |
Azure.IoT Build | 0:6ae2f7bca550 | 625 | |
Azure.IoT Build | 0:6ae2f7bca550 | 626 | typedef struct OPEN_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 627 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 628 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 629 | } OPEN_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 630 | |
Azure.IoT Build | 0:6ae2f7bca550 | 631 | static OPEN_HANDLE open_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 632 | { |
AzureIoTClient | 21:f9c433d8e6ca | 633 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)malloc(sizeof(OPEN_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 634 | if (open_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 635 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 636 | open_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 637 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 638 | |
Azure.IoT Build | 0:6ae2f7bca550 | 639 | return open_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 640 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 641 | |
Azure.IoT Build | 0:6ae2f7bca550 | 642 | OPEN_HANDLE open_create(const char* container_id_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 643 | { |
AzureIoTClient | 21:f9c433d8e6ca | 644 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)malloc(sizeof(OPEN_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 645 | if (open_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 646 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 647 | open_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(16); |
Azure.IoT Build | 0:6ae2f7bca550 | 648 | if (open_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 649 | { |
AzureIoTClient | 21:f9c433d8e6ca | 650 | free(open_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 651 | open_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 652 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 653 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 654 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 655 | AMQP_VALUE container_id_amqp_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 656 | int result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 657 | |
Azure.IoT Build | 0:6ae2f7bca550 | 658 | container_id_amqp_value = amqpvalue_create_string(container_id_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 659 | if ((result == 0) && (amqpvalue_set_composite_item(open_instance->composite_value, 0, container_id_amqp_value) != 0)) |
Azure.IoT Build | 0:6ae2f7bca550 | 660 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 661 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 662 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 663 | |
Azure.IoT Build | 0:6ae2f7bca550 | 664 | amqpvalue_destroy(container_id_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 665 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 666 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 667 | |
Azure.IoT Build | 0:6ae2f7bca550 | 668 | return open_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 669 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 670 | |
Azure.IoT Build | 0:6ae2f7bca550 | 671 | OPEN_HANDLE open_clone(OPEN_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 672 | { |
AzureIoTClient | 21:f9c433d8e6ca | 673 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)malloc(sizeof(OPEN_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 674 | if (open_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 675 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 676 | open_instance->composite_value = amqpvalue_clone(((OPEN_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 677 | if (open_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 678 | { |
AzureIoTClient | 21:f9c433d8e6ca | 679 | free(open_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 680 | open_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 681 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 682 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 683 | |
Azure.IoT Build | 0:6ae2f7bca550 | 684 | return open_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 685 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 686 | |
Azure.IoT Build | 0:6ae2f7bca550 | 687 | void open_destroy(OPEN_HANDLE open) |
Azure.IoT Build | 0:6ae2f7bca550 | 688 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 689 | if (open != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 690 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 691 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open; |
Azure.IoT Build | 0:6ae2f7bca550 | 692 | amqpvalue_destroy(open_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 693 | free(open_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 694 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 695 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 696 | |
Azure.IoT Build | 0:6ae2f7bca550 | 697 | AMQP_VALUE amqpvalue_create_open(OPEN_HANDLE open) |
Azure.IoT Build | 0:6ae2f7bca550 | 698 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 699 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 700 | |
Azure.IoT Build | 0:6ae2f7bca550 | 701 | if (open == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 702 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 703 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 704 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 705 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 706 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 707 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open; |
Azure.IoT Build | 0:6ae2f7bca550 | 708 | result = amqpvalue_clone(open_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 709 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 710 | |
Azure.IoT Build | 0:6ae2f7bca550 | 711 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 712 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 713 | |
Azure.IoT Build | 0:6ae2f7bca550 | 714 | bool is_open_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 715 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 716 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 717 | |
Azure.IoT Build | 0:6ae2f7bca550 | 718 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 719 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 720 | (descriptor_ulong == 16)) |
Azure.IoT Build | 0:6ae2f7bca550 | 721 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 722 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 723 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 724 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 725 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 726 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 727 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 728 | |
Azure.IoT Build | 0:6ae2f7bca550 | 729 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 730 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 731 | |
Azure.IoT Build | 0:6ae2f7bca550 | 732 | |
Azure.IoT Build | 0:6ae2f7bca550 | 733 | int amqpvalue_get_open(AMQP_VALUE value, OPEN_HANDLE* open_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 734 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 735 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 736 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 737 | *open_handle = open_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 738 | if (*open_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 739 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 740 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 741 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 742 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 743 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 744 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 745 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 746 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 747 | open_destroy(*open_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 748 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 749 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 750 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 751 | { |
AzureIoTClient | 23:1111ee8bcba4 | 752 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 753 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 754 | { |
AzureIoTClient | 23:1111ee8bcba4 | 755 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 756 | } |
AzureIoTClient | 23:1111ee8bcba4 | 757 | else |
AzureIoTClient | 23:1111ee8bcba4 | 758 | { |
AzureIoTClient | 23:1111ee8bcba4 | 759 | do |
AzureIoTClient | 23:1111ee8bcba4 | 760 | { |
AzureIoTClient | 23:1111ee8bcba4 | 761 | AMQP_VALUE item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 762 | /* container-id */ |
AzureIoTClient | 23:1111ee8bcba4 | 763 | if (list_item_count > 0) |
AzureIoTClient | 23:1111ee8bcba4 | 764 | { |
AzureIoTClient | 23:1111ee8bcba4 | 765 | item_value = amqpvalue_get_list_item(list_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 766 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 767 | { |
AzureIoTClient | 23:1111ee8bcba4 | 768 | { |
AzureIoTClient | 23:1111ee8bcba4 | 769 | open_destroy(*open_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 770 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 771 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 772 | } |
AzureIoTClient | 23:1111ee8bcba4 | 773 | } |
AzureIoTClient | 23:1111ee8bcba4 | 774 | else |
AzureIoTClient | 23:1111ee8bcba4 | 775 | { |
AzureIoTClient | 23:1111ee8bcba4 | 776 | const char* container_id; |
AzureIoTClient | 23:1111ee8bcba4 | 777 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 778 | { |
AzureIoTClient | 23:1111ee8bcba4 | 779 | open_destroy(*open_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 780 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 781 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 782 | } |
AzureIoTClient | 23:1111ee8bcba4 | 783 | else |
AzureIoTClient | 23:1111ee8bcba4 | 784 | { |
AzureIoTClient | 23:1111ee8bcba4 | 785 | if (amqpvalue_get_string(item_value, &container_id) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 786 | { |
AzureIoTClient | 23:1111ee8bcba4 | 787 | open_destroy(*open_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 788 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 789 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 790 | } |
AzureIoTClient | 23:1111ee8bcba4 | 791 | } |
AzureIoTClient | 23:1111ee8bcba4 | 792 | |
AzureIoTClient | 23:1111ee8bcba4 | 793 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 794 | } |
AzureIoTClient | 23:1111ee8bcba4 | 795 | } |
AzureIoTClient | 23:1111ee8bcba4 | 796 | else |
AzureIoTClient | 23:1111ee8bcba4 | 797 | { |
AzureIoTClient | 23:1111ee8bcba4 | 798 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 799 | } |
AzureIoTClient | 23:1111ee8bcba4 | 800 | /* hostname */ |
AzureIoTClient | 23:1111ee8bcba4 | 801 | if (list_item_count > 1) |
AzureIoTClient | 23:1111ee8bcba4 | 802 | { |
AzureIoTClient | 23:1111ee8bcba4 | 803 | item_value = amqpvalue_get_list_item(list_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 804 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 805 | { |
AzureIoTClient | 23:1111ee8bcba4 | 806 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 807 | } |
AzureIoTClient | 23:1111ee8bcba4 | 808 | else |
AzureIoTClient | 23:1111ee8bcba4 | 809 | { |
AzureIoTClient | 23:1111ee8bcba4 | 810 | const char* hostname; |
AzureIoTClient | 23:1111ee8bcba4 | 811 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 812 | { |
AzureIoTClient | 23:1111ee8bcba4 | 813 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 814 | } |
AzureIoTClient | 23:1111ee8bcba4 | 815 | else |
AzureIoTClient | 23:1111ee8bcba4 | 816 | { |
AzureIoTClient | 23:1111ee8bcba4 | 817 | if (amqpvalue_get_string(item_value, &hostname) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 818 | { |
AzureIoTClient | 23:1111ee8bcba4 | 819 | open_destroy(*open_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 820 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 821 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 822 | } |
AzureIoTClient | 23:1111ee8bcba4 | 823 | } |
AzureIoTClient | 23:1111ee8bcba4 | 824 | |
AzureIoTClient | 23:1111ee8bcba4 | 825 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 826 | } |
AzureIoTClient | 23:1111ee8bcba4 | 827 | } |
AzureIoTClient | 23:1111ee8bcba4 | 828 | /* max-frame-size */ |
AzureIoTClient | 23:1111ee8bcba4 | 829 | if (list_item_count > 2) |
AzureIoTClient | 23:1111ee8bcba4 | 830 | { |
AzureIoTClient | 23:1111ee8bcba4 | 831 | item_value = amqpvalue_get_list_item(list_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 832 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 833 | { |
AzureIoTClient | 23:1111ee8bcba4 | 834 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 835 | } |
AzureIoTClient | 23:1111ee8bcba4 | 836 | else |
AzureIoTClient | 23:1111ee8bcba4 | 837 | { |
AzureIoTClient | 23:1111ee8bcba4 | 838 | uint32_t max_frame_size; |
AzureIoTClient | 23:1111ee8bcba4 | 839 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 840 | { |
AzureIoTClient | 23:1111ee8bcba4 | 841 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 842 | } |
AzureIoTClient | 23:1111ee8bcba4 | 843 | else |
AzureIoTClient | 23:1111ee8bcba4 | 844 | { |
AzureIoTClient | 23:1111ee8bcba4 | 845 | if (amqpvalue_get_uint(item_value, &max_frame_size) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 846 | { |
AzureIoTClient | 23:1111ee8bcba4 | 847 | open_destroy(*open_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 848 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 849 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 850 | } |
AzureIoTClient | 23:1111ee8bcba4 | 851 | } |
AzureIoTClient | 23:1111ee8bcba4 | 852 | |
AzureIoTClient | 23:1111ee8bcba4 | 853 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 854 | } |
AzureIoTClient | 23:1111ee8bcba4 | 855 | } |
AzureIoTClient | 23:1111ee8bcba4 | 856 | /* channel-max */ |
AzureIoTClient | 23:1111ee8bcba4 | 857 | if (list_item_count > 3) |
AzureIoTClient | 23:1111ee8bcba4 | 858 | { |
AzureIoTClient | 23:1111ee8bcba4 | 859 | item_value = amqpvalue_get_list_item(list_value, 3); |
AzureIoTClient | 23:1111ee8bcba4 | 860 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 861 | { |
AzureIoTClient | 23:1111ee8bcba4 | 862 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 863 | } |
AzureIoTClient | 23:1111ee8bcba4 | 864 | else |
AzureIoTClient | 23:1111ee8bcba4 | 865 | { |
AzureIoTClient | 23:1111ee8bcba4 | 866 | uint16_t channel_max; |
AzureIoTClient | 23:1111ee8bcba4 | 867 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 868 | { |
AzureIoTClient | 23:1111ee8bcba4 | 869 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 870 | } |
AzureIoTClient | 23:1111ee8bcba4 | 871 | else |
AzureIoTClient | 23:1111ee8bcba4 | 872 | { |
AzureIoTClient | 23:1111ee8bcba4 | 873 | if (amqpvalue_get_ushort(item_value, &channel_max) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 874 | { |
AzureIoTClient | 23:1111ee8bcba4 | 875 | open_destroy(*open_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 876 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 877 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 878 | } |
AzureIoTClient | 23:1111ee8bcba4 | 879 | } |
AzureIoTClient | 23:1111ee8bcba4 | 880 | |
AzureIoTClient | 23:1111ee8bcba4 | 881 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 882 | } |
AzureIoTClient | 23:1111ee8bcba4 | 883 | } |
AzureIoTClient | 23:1111ee8bcba4 | 884 | /* idle-time-out */ |
AzureIoTClient | 23:1111ee8bcba4 | 885 | if (list_item_count > 4) |
AzureIoTClient | 23:1111ee8bcba4 | 886 | { |
AzureIoTClient | 23:1111ee8bcba4 | 887 | item_value = amqpvalue_get_list_item(list_value, 4); |
AzureIoTClient | 23:1111ee8bcba4 | 888 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 889 | { |
AzureIoTClient | 23:1111ee8bcba4 | 890 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 891 | } |
AzureIoTClient | 23:1111ee8bcba4 | 892 | else |
AzureIoTClient | 23:1111ee8bcba4 | 893 | { |
AzureIoTClient | 23:1111ee8bcba4 | 894 | milliseconds idle_time_out; |
AzureIoTClient | 23:1111ee8bcba4 | 895 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 896 | { |
AzureIoTClient | 23:1111ee8bcba4 | 897 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 898 | } |
AzureIoTClient | 23:1111ee8bcba4 | 899 | else |
AzureIoTClient | 23:1111ee8bcba4 | 900 | { |
AzureIoTClient | 23:1111ee8bcba4 | 901 | if (amqpvalue_get_milliseconds(item_value, &idle_time_out) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 902 | { |
AzureIoTClient | 23:1111ee8bcba4 | 903 | open_destroy(*open_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 904 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 905 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 906 | } |
AzureIoTClient | 23:1111ee8bcba4 | 907 | } |
AzureIoTClient | 23:1111ee8bcba4 | 908 | |
AzureIoTClient | 23:1111ee8bcba4 | 909 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 910 | } |
AzureIoTClient | 23:1111ee8bcba4 | 911 | } |
AzureIoTClient | 23:1111ee8bcba4 | 912 | /* outgoing-locales */ |
AzureIoTClient | 23:1111ee8bcba4 | 913 | if (list_item_count > 5) |
AzureIoTClient | 23:1111ee8bcba4 | 914 | { |
AzureIoTClient | 23:1111ee8bcba4 | 915 | item_value = amqpvalue_get_list_item(list_value, 5); |
AzureIoTClient | 23:1111ee8bcba4 | 916 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 917 | { |
AzureIoTClient | 23:1111ee8bcba4 | 918 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 919 | } |
AzureIoTClient | 23:1111ee8bcba4 | 920 | else |
AzureIoTClient | 23:1111ee8bcba4 | 921 | { |
AzureIoTClient | 23:1111ee8bcba4 | 922 | ietf_language_tag outgoing_locales; |
AzureIoTClient | 23:1111ee8bcba4 | 923 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 924 | { |
AzureIoTClient | 23:1111ee8bcba4 | 925 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 926 | } |
AzureIoTClient | 23:1111ee8bcba4 | 927 | else |
AzureIoTClient | 23:1111ee8bcba4 | 928 | { |
AzureIoTClient | 23:1111ee8bcba4 | 929 | AMQP_VALUE outgoing_locales_array; |
AzureIoTClient | 23:1111ee8bcba4 | 930 | if ((amqpvalue_get_array(item_value, &outgoing_locales_array) != 0) && |
AzureIoTClient | 23:1111ee8bcba4 | 931 | (amqpvalue_get_ietf_language_tag(item_value, &outgoing_locales) != 0)) |
AzureIoTClient | 23:1111ee8bcba4 | 932 | { |
AzureIoTClient | 23:1111ee8bcba4 | 933 | open_destroy(*open_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 934 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 935 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 936 | } |
AzureIoTClient | 23:1111ee8bcba4 | 937 | } |
AzureIoTClient | 23:1111ee8bcba4 | 938 | |
AzureIoTClient | 23:1111ee8bcba4 | 939 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 940 | } |
AzureIoTClient | 23:1111ee8bcba4 | 941 | } |
AzureIoTClient | 23:1111ee8bcba4 | 942 | /* incoming-locales */ |
AzureIoTClient | 23:1111ee8bcba4 | 943 | if (list_item_count > 6) |
AzureIoTClient | 23:1111ee8bcba4 | 944 | { |
AzureIoTClient | 23:1111ee8bcba4 | 945 | item_value = amqpvalue_get_list_item(list_value, 6); |
AzureIoTClient | 23:1111ee8bcba4 | 946 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 947 | { |
AzureIoTClient | 23:1111ee8bcba4 | 948 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 949 | } |
AzureIoTClient | 23:1111ee8bcba4 | 950 | else |
AzureIoTClient | 23:1111ee8bcba4 | 951 | { |
AzureIoTClient | 23:1111ee8bcba4 | 952 | ietf_language_tag incoming_locales; |
AzureIoTClient | 23:1111ee8bcba4 | 953 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 954 | { |
AzureIoTClient | 23:1111ee8bcba4 | 955 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 956 | } |
AzureIoTClient | 23:1111ee8bcba4 | 957 | else |
AzureIoTClient | 23:1111ee8bcba4 | 958 | { |
AzureIoTClient | 23:1111ee8bcba4 | 959 | AMQP_VALUE incoming_locales_array; |
AzureIoTClient | 23:1111ee8bcba4 | 960 | if ((amqpvalue_get_array(item_value, &incoming_locales_array) != 0) && |
AzureIoTClient | 23:1111ee8bcba4 | 961 | (amqpvalue_get_ietf_language_tag(item_value, &incoming_locales) != 0)) |
AzureIoTClient | 23:1111ee8bcba4 | 962 | { |
AzureIoTClient | 23:1111ee8bcba4 | 963 | open_destroy(*open_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 964 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 965 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 966 | } |
AzureIoTClient | 23:1111ee8bcba4 | 967 | } |
AzureIoTClient | 23:1111ee8bcba4 | 968 | |
AzureIoTClient | 23:1111ee8bcba4 | 969 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 970 | } |
AzureIoTClient | 23:1111ee8bcba4 | 971 | } |
AzureIoTClient | 23:1111ee8bcba4 | 972 | /* offered-capabilities */ |
AzureIoTClient | 23:1111ee8bcba4 | 973 | if (list_item_count > 7) |
AzureIoTClient | 23:1111ee8bcba4 | 974 | { |
AzureIoTClient | 23:1111ee8bcba4 | 975 | item_value = amqpvalue_get_list_item(list_value, 7); |
AzureIoTClient | 23:1111ee8bcba4 | 976 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 977 | { |
AzureIoTClient | 23:1111ee8bcba4 | 978 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 979 | } |
AzureIoTClient | 23:1111ee8bcba4 | 980 | else |
AzureIoTClient | 23:1111ee8bcba4 | 981 | { |
AzureIoTClient | 23:1111ee8bcba4 | 982 | const char* offered_capabilities; |
AzureIoTClient | 23:1111ee8bcba4 | 983 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 984 | { |
AzureIoTClient | 23:1111ee8bcba4 | 985 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 986 | } |
AzureIoTClient | 23:1111ee8bcba4 | 987 | else |
AzureIoTClient | 23:1111ee8bcba4 | 988 | { |
AzureIoTClient | 23:1111ee8bcba4 | 989 | AMQP_VALUE offered_capabilities_array; |
AzureIoTClient | 23:1111ee8bcba4 | 990 | if ((amqpvalue_get_array(item_value, &offered_capabilities_array) != 0) && |
AzureIoTClient | 23:1111ee8bcba4 | 991 | (amqpvalue_get_symbol(item_value, &offered_capabilities) != 0)) |
AzureIoTClient | 23:1111ee8bcba4 | 992 | { |
AzureIoTClient | 23:1111ee8bcba4 | 993 | open_destroy(*open_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 994 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 995 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 996 | } |
AzureIoTClient | 23:1111ee8bcba4 | 997 | } |
AzureIoTClient | 23:1111ee8bcba4 | 998 | |
AzureIoTClient | 23:1111ee8bcba4 | 999 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 1000 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1001 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1002 | /* desired-capabilities */ |
AzureIoTClient | 23:1111ee8bcba4 | 1003 | if (list_item_count > 8) |
AzureIoTClient | 23:1111ee8bcba4 | 1004 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1005 | item_value = amqpvalue_get_list_item(list_value, 8); |
AzureIoTClient | 23:1111ee8bcba4 | 1006 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 1007 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1008 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 1009 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1010 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1011 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1012 | const char* desired_capabilities; |
AzureIoTClient | 23:1111ee8bcba4 | 1013 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 1014 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1015 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 1016 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1017 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1018 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1019 | AMQP_VALUE desired_capabilities_array; |
AzureIoTClient | 23:1111ee8bcba4 | 1020 | if ((amqpvalue_get_array(item_value, &desired_capabilities_array) != 0) && |
AzureIoTClient | 23:1111ee8bcba4 | 1021 | (amqpvalue_get_symbol(item_value, &desired_capabilities) != 0)) |
AzureIoTClient | 23:1111ee8bcba4 | 1022 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1023 | open_destroy(*open_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 1024 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1025 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 1026 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1027 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1028 | |
AzureIoTClient | 23:1111ee8bcba4 | 1029 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 1030 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1031 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1032 | /* properties */ |
AzureIoTClient | 23:1111ee8bcba4 | 1033 | if (list_item_count > 9) |
AzureIoTClient | 23:1111ee8bcba4 | 1034 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1035 | item_value = amqpvalue_get_list_item(list_value, 9); |
AzureIoTClient | 23:1111ee8bcba4 | 1036 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 1037 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1038 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 1039 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1040 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1041 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1042 | fields properties; |
AzureIoTClient | 23:1111ee8bcba4 | 1043 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 1044 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1045 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 1046 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1047 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1048 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1049 | if (amqpvalue_get_fields(item_value, &properties) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 1050 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1051 | open_destroy(*open_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 1052 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1053 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 1054 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1055 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1056 | |
AzureIoTClient | 23:1111ee8bcba4 | 1057 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 1058 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1059 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1060 | |
AzureIoTClient | 23:1111ee8bcba4 | 1061 | open_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 1062 | |
AzureIoTClient | 23:1111ee8bcba4 | 1063 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 1064 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 1065 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1066 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1067 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1068 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1069 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1070 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1071 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1072 | int open_get_container_id(OPEN_HANDLE open, const char** container_id_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 1073 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1074 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1075 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1076 | if (open == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1077 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1078 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1079 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1080 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1081 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1082 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 1083 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open; |
AzureIoTClient | 23:1111ee8bcba4 | 1084 | if (amqpvalue_get_composite_item_count(open_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 1085 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1086 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1087 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1088 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1089 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1090 | if (item_count <= 0) |
AzureIoTClient | 23:1111ee8bcba4 | 1091 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1092 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1093 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1094 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1095 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1096 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(open_instance->composite_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 1097 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 1098 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 1099 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1100 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1101 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1102 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1103 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1104 | if (amqpvalue_get_string(item_value, container_id_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 1105 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1106 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1107 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1108 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1109 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1110 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 1111 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1112 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1113 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1114 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1115 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1116 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1117 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1118 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1119 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1120 | int open_set_container_id(OPEN_HANDLE open, const char* container_id_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 1121 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1122 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1123 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1124 | if (open == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1125 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1126 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1127 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1128 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1129 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1130 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open; |
Azure.IoT Build | 0:6ae2f7bca550 | 1131 | AMQP_VALUE container_id_amqp_value = amqpvalue_create_string(container_id_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 1132 | if (container_id_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1133 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1134 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1135 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1136 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1137 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1138 | if (amqpvalue_set_composite_item(open_instance->composite_value, 0, container_id_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 1139 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1140 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1141 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1142 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1143 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1144 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 1145 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1146 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1147 | amqpvalue_destroy(container_id_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 1148 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1149 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1150 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1151 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1152 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1153 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1154 | int open_get_hostname(OPEN_HANDLE open, const char** hostname_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 1155 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1156 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1157 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1158 | if (open == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1159 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1160 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1161 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1162 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1163 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1164 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 1165 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open; |
AzureIoTClient | 23:1111ee8bcba4 | 1166 | if (amqpvalue_get_composite_item_count(open_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 1167 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1168 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1169 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1170 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1171 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1172 | if (item_count <= 1) |
AzureIoTClient | 23:1111ee8bcba4 | 1173 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1174 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1175 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1176 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1177 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1178 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(open_instance->composite_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 1179 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 1180 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 1181 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1182 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1183 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1184 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1185 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1186 | if (amqpvalue_get_string(item_value, hostname_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 1187 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1188 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1189 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1190 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1191 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1192 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 1193 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1194 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1195 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1196 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1197 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1198 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1199 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1200 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1201 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1202 | int open_set_hostname(OPEN_HANDLE open, const char* hostname_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 1203 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1204 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1205 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1206 | if (open == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1207 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1208 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1209 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1210 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1211 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1212 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open; |
Azure.IoT Build | 0:6ae2f7bca550 | 1213 | AMQP_VALUE hostname_amqp_value = amqpvalue_create_string(hostname_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 1214 | if (hostname_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1215 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1216 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1217 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1218 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1219 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1220 | if (amqpvalue_set_composite_item(open_instance->composite_value, 1, hostname_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 1221 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1222 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1223 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1224 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1225 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1226 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 1227 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1228 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1229 | amqpvalue_destroy(hostname_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 1230 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1231 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1232 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1233 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1234 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1235 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1236 | int open_get_max_frame_size(OPEN_HANDLE open, uint32_t* max_frame_size_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 1237 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1238 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1239 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1240 | if (open == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1241 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1242 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1243 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1244 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1245 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1246 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 1247 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open; |
AzureIoTClient | 23:1111ee8bcba4 | 1248 | if (amqpvalue_get_composite_item_count(open_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 1249 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1250 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1251 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1252 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1253 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1254 | if (item_count <= 2) |
AzureIoTClient | 23:1111ee8bcba4 | 1255 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1256 | *max_frame_size_value = 4294967295u; |
AzureIoTClient | 23:1111ee8bcba4 | 1257 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 1258 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1259 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1260 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1261 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(open_instance->composite_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 1262 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 1263 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 1264 | { |
AzureIoTClient | 16:22a72cf8e416 | 1265 | *max_frame_size_value = 4294967295u; |
AzureIoTClient | 16:22a72cf8e416 | 1266 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 1267 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1268 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1269 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1270 | if (amqpvalue_get_uint(item_value, max_frame_size_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 1271 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1272 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 1273 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1274 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1275 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1276 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1277 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1278 | *max_frame_size_value = 4294967295u; |
AzureIoTClient | 23:1111ee8bcba4 | 1279 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 1280 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1281 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1282 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1283 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1284 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 1285 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1286 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1287 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1288 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1289 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1290 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1291 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1292 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1293 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1294 | int open_set_max_frame_size(OPEN_HANDLE open, uint32_t max_frame_size_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 1295 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1296 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1297 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1298 | if (open == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1299 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1300 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1301 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1302 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1303 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1304 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open; |
Azure.IoT Build | 0:6ae2f7bca550 | 1305 | AMQP_VALUE max_frame_size_amqp_value = amqpvalue_create_uint(max_frame_size_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 1306 | if (max_frame_size_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1307 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1308 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1309 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1310 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1311 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1312 | if (amqpvalue_set_composite_item(open_instance->composite_value, 2, max_frame_size_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 1313 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1314 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1315 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1316 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1317 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1318 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 1319 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1320 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1321 | amqpvalue_destroy(max_frame_size_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 1322 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1323 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1324 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1325 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1326 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1327 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1328 | int open_get_channel_max(OPEN_HANDLE open, uint16_t* channel_max_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 1329 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1330 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1331 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1332 | if (open == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1333 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1334 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1335 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1336 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1337 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1338 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 1339 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open; |
AzureIoTClient | 23:1111ee8bcba4 | 1340 | if (amqpvalue_get_composite_item_count(open_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 1341 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1342 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1343 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1344 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1345 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1346 | if (item_count <= 3) |
AzureIoTClient | 23:1111ee8bcba4 | 1347 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1348 | *channel_max_value = 65535; |
AzureIoTClient | 23:1111ee8bcba4 | 1349 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 1350 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1351 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1352 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1353 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(open_instance->composite_value, 3); |
AzureIoTClient | 23:1111ee8bcba4 | 1354 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 1355 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 1356 | { |
AzureIoTClient | 16:22a72cf8e416 | 1357 | *channel_max_value = 65535; |
AzureIoTClient | 16:22a72cf8e416 | 1358 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 1359 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1360 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1361 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1362 | if (amqpvalue_get_ushort(item_value, channel_max_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 1363 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1364 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 1365 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1366 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1367 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1368 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1369 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1370 | *channel_max_value = 65535; |
AzureIoTClient | 23:1111ee8bcba4 | 1371 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 1372 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1373 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1374 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1375 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1376 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 1377 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1378 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1379 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1380 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1381 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1382 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1383 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1384 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1385 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1386 | int open_set_channel_max(OPEN_HANDLE open, uint16_t channel_max_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 1387 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1388 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1389 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1390 | if (open == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1391 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1392 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1393 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1394 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1395 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1396 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open; |
Azure.IoT Build | 0:6ae2f7bca550 | 1397 | AMQP_VALUE channel_max_amqp_value = amqpvalue_create_ushort(channel_max_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 1398 | if (channel_max_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1399 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1400 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1401 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1402 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1403 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1404 | if (amqpvalue_set_composite_item(open_instance->composite_value, 3, channel_max_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 1405 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1406 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1407 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1408 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1409 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1410 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 1411 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1412 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1413 | amqpvalue_destroy(channel_max_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 1414 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1415 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1416 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1417 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1418 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1419 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1420 | int open_get_idle_time_out(OPEN_HANDLE open, milliseconds* idle_time_out_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 1421 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1422 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1423 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1424 | if (open == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1425 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1426 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1427 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1428 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1429 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1430 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 1431 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open; |
AzureIoTClient | 23:1111ee8bcba4 | 1432 | if (amqpvalue_get_composite_item_count(open_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 1433 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1434 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1435 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1436 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1437 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1438 | if (item_count <= 4) |
AzureIoTClient | 23:1111ee8bcba4 | 1439 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1440 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1441 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1442 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1443 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1444 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(open_instance->composite_value, 4); |
AzureIoTClient | 23:1111ee8bcba4 | 1445 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 1446 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 1447 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1448 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1449 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1450 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1451 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1452 | if (amqpvalue_get_milliseconds(item_value, idle_time_out_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 1453 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1454 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1455 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1456 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1457 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1458 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 1459 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1460 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1461 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1462 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1463 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1464 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1465 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1466 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1467 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1468 | int open_set_idle_time_out(OPEN_HANDLE open, milliseconds idle_time_out_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 1469 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1470 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1471 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1472 | if (open == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1473 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1474 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1475 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1476 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1477 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1478 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open; |
Azure.IoT Build | 0:6ae2f7bca550 | 1479 | AMQP_VALUE idle_time_out_amqp_value = amqpvalue_create_milliseconds(idle_time_out_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 1480 | if (idle_time_out_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1481 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1482 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1483 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1484 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1485 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1486 | if (amqpvalue_set_composite_item(open_instance->composite_value, 4, idle_time_out_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 1487 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1488 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1489 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1490 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1491 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1492 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 1493 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1494 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1495 | amqpvalue_destroy(idle_time_out_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 1496 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1497 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1498 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1499 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1500 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1501 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1502 | int open_get_outgoing_locales(OPEN_HANDLE open, AMQP_VALUE* outgoing_locales_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 1503 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1504 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1505 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1506 | if (open == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1507 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1508 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1509 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1510 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1511 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1512 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 1513 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open; |
AzureIoTClient | 23:1111ee8bcba4 | 1514 | if (amqpvalue_get_composite_item_count(open_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 1515 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1516 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1517 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1518 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1519 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1520 | if (item_count <= 5) |
AzureIoTClient | 23:1111ee8bcba4 | 1521 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1522 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1523 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1524 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1525 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1526 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(open_instance->composite_value, 5); |
AzureIoTClient | 23:1111ee8bcba4 | 1527 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 1528 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 1529 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1530 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1531 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1532 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1533 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1534 | if (amqpvalue_get_array(item_value, outgoing_locales_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 1535 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1536 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1537 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1538 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1539 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1540 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 1541 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1542 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1543 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1544 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1545 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1546 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1547 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1548 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1549 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1550 | int open_set_outgoing_locales(OPEN_HANDLE open, AMQP_VALUE outgoing_locales_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 1551 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1552 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1553 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1554 | if (open == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1555 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1556 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1557 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1558 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1559 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1560 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open; |
AzureIoTClient | 23:1111ee8bcba4 | 1561 | AMQP_VALUE outgoing_locales_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 1562 | if (outgoing_locales_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 1563 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1564 | outgoing_locales_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 1565 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1566 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1567 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1568 | outgoing_locales_amqp_value = amqpvalue_clone(outgoing_locales_value); |
AzureIoTClient | 23:1111ee8bcba4 | 1569 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1570 | if (outgoing_locales_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1571 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1572 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1573 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1574 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1575 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1576 | if (amqpvalue_set_composite_item(open_instance->composite_value, 5, outgoing_locales_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 1577 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1578 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1579 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1580 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1581 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1582 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 1583 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1584 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1585 | amqpvalue_destroy(outgoing_locales_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 1586 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1587 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1588 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1589 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1590 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1591 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1592 | int open_get_incoming_locales(OPEN_HANDLE open, AMQP_VALUE* incoming_locales_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 1593 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1594 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1595 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1596 | if (open == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1597 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1598 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1599 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1600 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1601 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1602 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 1603 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open; |
AzureIoTClient | 23:1111ee8bcba4 | 1604 | if (amqpvalue_get_composite_item_count(open_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 1605 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1606 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1607 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1608 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1609 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1610 | if (item_count <= 6) |
AzureIoTClient | 23:1111ee8bcba4 | 1611 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1612 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1613 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1614 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1615 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1616 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(open_instance->composite_value, 6); |
AzureIoTClient | 23:1111ee8bcba4 | 1617 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 1618 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 1619 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1620 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1621 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1622 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1623 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1624 | if (amqpvalue_get_array(item_value, incoming_locales_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 1625 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1626 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1627 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1628 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1629 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1630 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 1631 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1632 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1633 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1634 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1635 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1636 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1637 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1638 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1639 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1640 | int open_set_incoming_locales(OPEN_HANDLE open, AMQP_VALUE incoming_locales_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 1641 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1642 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1643 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1644 | if (open == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1645 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1646 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1647 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1648 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1649 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1650 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open; |
AzureIoTClient | 23:1111ee8bcba4 | 1651 | AMQP_VALUE incoming_locales_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 1652 | if (incoming_locales_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 1653 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1654 | incoming_locales_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 1655 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1656 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1657 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1658 | incoming_locales_amqp_value = amqpvalue_clone(incoming_locales_value); |
AzureIoTClient | 23:1111ee8bcba4 | 1659 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1660 | if (incoming_locales_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1661 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1662 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1663 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1664 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1665 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1666 | if (amqpvalue_set_composite_item(open_instance->composite_value, 6, incoming_locales_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 1667 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1668 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1669 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1670 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1671 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1672 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 1673 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1674 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1675 | amqpvalue_destroy(incoming_locales_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 1676 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1677 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1678 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1679 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1680 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1681 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1682 | int open_get_offered_capabilities(OPEN_HANDLE open, AMQP_VALUE* offered_capabilities_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 1683 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1684 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1685 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1686 | if (open == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1687 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1688 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1689 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1690 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1691 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1692 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 1693 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open; |
AzureIoTClient | 23:1111ee8bcba4 | 1694 | if (amqpvalue_get_composite_item_count(open_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 1695 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1696 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1697 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1698 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1699 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1700 | if (item_count <= 7) |
AzureIoTClient | 23:1111ee8bcba4 | 1701 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1702 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1703 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1704 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1705 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1706 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(open_instance->composite_value, 7); |
AzureIoTClient | 23:1111ee8bcba4 | 1707 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 1708 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 1709 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1710 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1711 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1712 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1713 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1714 | if (amqpvalue_get_array(item_value, offered_capabilities_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 1715 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1716 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1717 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1718 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1719 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1720 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 1721 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1722 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1723 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1724 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1725 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1726 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1727 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1728 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1729 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1730 | int open_set_offered_capabilities(OPEN_HANDLE open, AMQP_VALUE offered_capabilities_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 1731 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1732 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1733 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1734 | if (open == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1735 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1736 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1737 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1738 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1739 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1740 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open; |
AzureIoTClient | 23:1111ee8bcba4 | 1741 | AMQP_VALUE offered_capabilities_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 1742 | if (offered_capabilities_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 1743 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1744 | offered_capabilities_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 1745 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1746 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1747 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1748 | offered_capabilities_amqp_value = amqpvalue_clone(offered_capabilities_value); |
AzureIoTClient | 23:1111ee8bcba4 | 1749 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1750 | if (offered_capabilities_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1751 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1752 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1753 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1754 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1755 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1756 | if (amqpvalue_set_composite_item(open_instance->composite_value, 7, offered_capabilities_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 1757 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1758 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1759 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1760 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1761 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1762 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 1763 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1764 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1765 | amqpvalue_destroy(offered_capabilities_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 1766 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1767 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1768 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1769 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1770 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1771 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1772 | int open_get_desired_capabilities(OPEN_HANDLE open, AMQP_VALUE* desired_capabilities_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 1773 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1774 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1775 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1776 | if (open == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1777 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1778 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1779 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1780 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1781 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1782 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 1783 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open; |
AzureIoTClient | 23:1111ee8bcba4 | 1784 | if (amqpvalue_get_composite_item_count(open_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 1785 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1786 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1787 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1788 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1789 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1790 | if (item_count <= 8) |
AzureIoTClient | 23:1111ee8bcba4 | 1791 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1792 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1793 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1794 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1795 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1796 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(open_instance->composite_value, 8); |
AzureIoTClient | 23:1111ee8bcba4 | 1797 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 1798 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 1799 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1800 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1801 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1802 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1803 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1804 | if (amqpvalue_get_array(item_value, desired_capabilities_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 1805 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1806 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1807 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1808 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1809 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1810 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 1811 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1812 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1813 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1814 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1815 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1816 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1817 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1818 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1819 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1820 | int open_set_desired_capabilities(OPEN_HANDLE open, AMQP_VALUE desired_capabilities_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 1821 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1822 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1823 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1824 | if (open == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1825 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1826 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1827 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1828 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1829 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1830 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open; |
AzureIoTClient | 23:1111ee8bcba4 | 1831 | AMQP_VALUE desired_capabilities_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 1832 | if (desired_capabilities_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 1833 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1834 | desired_capabilities_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 1835 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1836 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1837 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1838 | desired_capabilities_amqp_value = amqpvalue_clone(desired_capabilities_value); |
AzureIoTClient | 23:1111ee8bcba4 | 1839 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1840 | if (desired_capabilities_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1841 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1842 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1843 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1844 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1845 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1846 | if (amqpvalue_set_composite_item(open_instance->composite_value, 8, desired_capabilities_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 1847 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1848 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1849 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1850 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1851 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1852 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 1853 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1854 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1855 | amqpvalue_destroy(desired_capabilities_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 1856 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1857 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1858 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1859 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1860 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1861 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1862 | int open_get_properties(OPEN_HANDLE open, fields* properties_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 1863 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1864 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1865 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1866 | if (open == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1867 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1868 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1869 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1870 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1871 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1872 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 1873 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open; |
AzureIoTClient | 23:1111ee8bcba4 | 1874 | if (amqpvalue_get_composite_item_count(open_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 1875 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1876 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1877 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1878 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1879 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1880 | if (item_count <= 9) |
AzureIoTClient | 23:1111ee8bcba4 | 1881 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1882 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1883 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1884 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1885 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1886 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(open_instance->composite_value, 9); |
AzureIoTClient | 23:1111ee8bcba4 | 1887 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 1888 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 1889 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1890 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1891 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1892 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1893 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1894 | if (amqpvalue_get_fields(item_value, properties_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 1895 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1896 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 1897 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1898 | else |
AzureIoTClient | 23:1111ee8bcba4 | 1899 | { |
AzureIoTClient | 23:1111ee8bcba4 | 1900 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 1901 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1902 | } |
AzureIoTClient | 23:1111ee8bcba4 | 1903 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1904 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1905 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1906 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1907 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1908 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1909 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1910 | int open_set_properties(OPEN_HANDLE open, fields properties_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 1911 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1912 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1913 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1914 | if (open == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1915 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1916 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1917 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1918 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1919 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1920 | OPEN_INSTANCE* open_instance = (OPEN_INSTANCE*)open; |
Azure.IoT Build | 0:6ae2f7bca550 | 1921 | AMQP_VALUE properties_amqp_value = amqpvalue_create_fields(properties_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 1922 | if (properties_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1923 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1924 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1925 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1926 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1927 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1928 | if (amqpvalue_set_composite_item(open_instance->composite_value, 9, properties_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 1929 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1930 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1931 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1932 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1933 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1934 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 1935 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1936 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1937 | amqpvalue_destroy(properties_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 1938 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1939 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1940 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1941 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 1942 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1943 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1944 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1945 | /* begin */ |
Azure.IoT Build | 0:6ae2f7bca550 | 1946 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1947 | typedef struct BEGIN_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 1948 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1949 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 1950 | } BEGIN_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 1951 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1952 | static BEGIN_HANDLE begin_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 1953 | { |
AzureIoTClient | 21:f9c433d8e6ca | 1954 | BEGIN_INSTANCE* begin_instance = (BEGIN_INSTANCE*)malloc(sizeof(BEGIN_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 1955 | if (begin_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1956 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1957 | begin_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 1958 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1959 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1960 | return begin_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 1961 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1962 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1963 | BEGIN_HANDLE begin_create(transfer_number next_outgoing_id_value, uint32_t incoming_window_value, uint32_t outgoing_window_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 1964 | { |
AzureIoTClient | 21:f9c433d8e6ca | 1965 | BEGIN_INSTANCE* begin_instance = (BEGIN_INSTANCE*)malloc(sizeof(BEGIN_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 1966 | if (begin_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1967 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1968 | begin_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(17); |
Azure.IoT Build | 0:6ae2f7bca550 | 1969 | if (begin_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 1970 | { |
AzureIoTClient | 21:f9c433d8e6ca | 1971 | free(begin_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 1972 | begin_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 1973 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1974 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 1975 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 1976 | AMQP_VALUE next_outgoing_id_amqp_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 1977 | AMQP_VALUE incoming_window_amqp_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 1978 | AMQP_VALUE outgoing_window_amqp_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 1979 | int result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 1980 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1981 | next_outgoing_id_amqp_value = amqpvalue_create_transfer_number(next_outgoing_id_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 1982 | if ((result == 0) && (amqpvalue_set_composite_item(begin_instance->composite_value, 1, next_outgoing_id_amqp_value) != 0)) |
Azure.IoT Build | 0:6ae2f7bca550 | 1983 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1984 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1985 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1986 | incoming_window_amqp_value = amqpvalue_create_uint(incoming_window_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 1987 | if ((result == 0) && (amqpvalue_set_composite_item(begin_instance->composite_value, 2, incoming_window_amqp_value) != 0)) |
Azure.IoT Build | 0:6ae2f7bca550 | 1988 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1989 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1990 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1991 | outgoing_window_amqp_value = amqpvalue_create_uint(outgoing_window_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 1992 | if ((result == 0) && (amqpvalue_set_composite_item(begin_instance->composite_value, 3, outgoing_window_amqp_value) != 0)) |
Azure.IoT Build | 0:6ae2f7bca550 | 1993 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 1994 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 1995 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 1996 | |
Azure.IoT Build | 0:6ae2f7bca550 | 1997 | amqpvalue_destroy(next_outgoing_id_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 1998 | amqpvalue_destroy(incoming_window_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 1999 | amqpvalue_destroy(outgoing_window_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 2000 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2001 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2002 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2003 | return begin_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 2004 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2005 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2006 | BEGIN_HANDLE begin_clone(BEGIN_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 2007 | { |
AzureIoTClient | 21:f9c433d8e6ca | 2008 | BEGIN_INSTANCE* begin_instance = (BEGIN_INSTANCE*)malloc(sizeof(BEGIN_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 2009 | if (begin_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2010 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2011 | begin_instance->composite_value = amqpvalue_clone(((BEGIN_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 2012 | if (begin_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2013 | { |
AzureIoTClient | 21:f9c433d8e6ca | 2014 | free(begin_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 2015 | begin_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 2016 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2017 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2018 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2019 | return begin_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 2020 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2021 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2022 | void begin_destroy(BEGIN_HANDLE begin) |
Azure.IoT Build | 0:6ae2f7bca550 | 2023 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2024 | if (begin != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2025 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2026 | BEGIN_INSTANCE* begin_instance = (BEGIN_INSTANCE*)begin; |
Azure.IoT Build | 0:6ae2f7bca550 | 2027 | amqpvalue_destroy(begin_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 2028 | free(begin_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 2029 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2030 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2031 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2032 | AMQP_VALUE amqpvalue_create_begin(BEGIN_HANDLE begin) |
Azure.IoT Build | 0:6ae2f7bca550 | 2033 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2034 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2035 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2036 | if (begin == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2037 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2038 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 2039 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2040 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2041 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2042 | BEGIN_INSTANCE* begin_instance = (BEGIN_INSTANCE*)begin; |
Azure.IoT Build | 0:6ae2f7bca550 | 2043 | result = amqpvalue_clone(begin_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 2044 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2045 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2046 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2047 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2048 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2049 | bool is_begin_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 2050 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2051 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2052 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2053 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 2054 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 2055 | (descriptor_ulong == 17)) |
Azure.IoT Build | 0:6ae2f7bca550 | 2056 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2057 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 2058 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2059 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2060 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2061 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 2062 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2063 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2064 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2065 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2066 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2067 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2068 | int amqpvalue_get_begin(AMQP_VALUE value, BEGIN_HANDLE* begin_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 2069 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2070 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2071 | BEGIN_INSTANCE* begin_instance = (BEGIN_INSTANCE*)begin_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 2072 | *begin_handle = begin_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 2073 | if (*begin_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2074 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2075 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2076 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2077 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2078 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2079 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 2080 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2081 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2082 | begin_destroy(*begin_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 2083 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2084 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2085 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2086 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2087 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 2088 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2089 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2090 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2091 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2092 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2093 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2094 | do |
AzureIoTClient | 23:1111ee8bcba4 | 2095 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2096 | AMQP_VALUE item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 2097 | /* remote-channel */ |
AzureIoTClient | 23:1111ee8bcba4 | 2098 | if (list_item_count > 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2099 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2100 | item_value = amqpvalue_get_list_item(list_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 2101 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 2102 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2103 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 2104 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2105 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2106 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2107 | uint16_t remote_channel; |
AzureIoTClient | 23:1111ee8bcba4 | 2108 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 2109 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2110 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 2111 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2112 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2113 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2114 | if (amqpvalue_get_ushort(item_value, &remote_channel) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2115 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2116 | begin_destroy(*begin_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 2117 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2118 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 2119 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2120 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2121 | |
AzureIoTClient | 23:1111ee8bcba4 | 2122 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 2123 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2124 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2125 | /* next-outgoing-id */ |
AzureIoTClient | 23:1111ee8bcba4 | 2126 | if (list_item_count > 1) |
AzureIoTClient | 23:1111ee8bcba4 | 2127 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2128 | item_value = amqpvalue_get_list_item(list_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 2129 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 2130 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2131 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2132 | begin_destroy(*begin_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 2133 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2134 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 2135 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2136 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2137 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2138 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2139 | transfer_number next_outgoing_id; |
AzureIoTClient | 23:1111ee8bcba4 | 2140 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 2141 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2142 | begin_destroy(*begin_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 2143 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2144 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 2145 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2146 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2147 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2148 | if (amqpvalue_get_transfer_number(item_value, &next_outgoing_id) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2149 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2150 | begin_destroy(*begin_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 2151 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2152 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 2153 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2154 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2155 | |
AzureIoTClient | 23:1111ee8bcba4 | 2156 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 2157 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2158 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2159 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2160 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2161 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2162 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2163 | /* incoming-window */ |
AzureIoTClient | 23:1111ee8bcba4 | 2164 | if (list_item_count > 2) |
AzureIoTClient | 23:1111ee8bcba4 | 2165 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2166 | item_value = amqpvalue_get_list_item(list_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 2167 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 2168 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2169 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2170 | begin_destroy(*begin_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 2171 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2172 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 2173 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2174 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2175 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2176 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2177 | uint32_t incoming_window; |
AzureIoTClient | 23:1111ee8bcba4 | 2178 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 2179 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2180 | begin_destroy(*begin_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 2181 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2182 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 2183 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2184 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2185 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2186 | if (amqpvalue_get_uint(item_value, &incoming_window) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2187 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2188 | begin_destroy(*begin_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 2189 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2190 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 2191 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2192 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2193 | |
AzureIoTClient | 23:1111ee8bcba4 | 2194 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 2195 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2196 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2197 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2198 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2199 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2200 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2201 | /* outgoing-window */ |
AzureIoTClient | 23:1111ee8bcba4 | 2202 | if (list_item_count > 3) |
AzureIoTClient | 23:1111ee8bcba4 | 2203 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2204 | item_value = amqpvalue_get_list_item(list_value, 3); |
AzureIoTClient | 23:1111ee8bcba4 | 2205 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 2206 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2207 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2208 | begin_destroy(*begin_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 2209 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2210 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 2211 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2212 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2213 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2214 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2215 | uint32_t outgoing_window; |
AzureIoTClient | 23:1111ee8bcba4 | 2216 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 2217 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2218 | begin_destroy(*begin_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 2219 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2220 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 2221 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2222 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2223 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2224 | if (amqpvalue_get_uint(item_value, &outgoing_window) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2225 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2226 | begin_destroy(*begin_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 2227 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2228 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 2229 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2230 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2231 | |
AzureIoTClient | 23:1111ee8bcba4 | 2232 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 2233 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2234 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2235 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2236 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2237 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2238 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2239 | /* handle-max */ |
AzureIoTClient | 23:1111ee8bcba4 | 2240 | if (list_item_count > 4) |
AzureIoTClient | 23:1111ee8bcba4 | 2241 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2242 | item_value = amqpvalue_get_list_item(list_value, 4); |
AzureIoTClient | 23:1111ee8bcba4 | 2243 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 2244 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2245 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 2246 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2247 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2248 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2249 | handle handle_max; |
AzureIoTClient | 23:1111ee8bcba4 | 2250 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 2251 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2252 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 2253 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2254 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2255 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2256 | if (amqpvalue_get_handle(item_value, &handle_max) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2257 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2258 | begin_destroy(*begin_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 2259 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2260 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 2261 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2262 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2263 | |
AzureIoTClient | 23:1111ee8bcba4 | 2264 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 2265 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2266 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2267 | /* offered-capabilities */ |
AzureIoTClient | 23:1111ee8bcba4 | 2268 | if (list_item_count > 5) |
AzureIoTClient | 23:1111ee8bcba4 | 2269 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2270 | item_value = amqpvalue_get_list_item(list_value, 5); |
AzureIoTClient | 23:1111ee8bcba4 | 2271 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 2272 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2273 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 2274 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2275 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2276 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2277 | const char* offered_capabilities; |
AzureIoTClient | 23:1111ee8bcba4 | 2278 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 2279 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2280 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 2281 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2282 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2283 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2284 | AMQP_VALUE offered_capabilities_array; |
AzureIoTClient | 23:1111ee8bcba4 | 2285 | if ((amqpvalue_get_array(item_value, &offered_capabilities_array) != 0) && |
AzureIoTClient | 23:1111ee8bcba4 | 2286 | (amqpvalue_get_symbol(item_value, &offered_capabilities) != 0)) |
AzureIoTClient | 23:1111ee8bcba4 | 2287 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2288 | begin_destroy(*begin_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 2289 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2290 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 2291 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2292 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2293 | |
AzureIoTClient | 23:1111ee8bcba4 | 2294 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 2295 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2296 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2297 | /* desired-capabilities */ |
AzureIoTClient | 23:1111ee8bcba4 | 2298 | if (list_item_count > 6) |
AzureIoTClient | 23:1111ee8bcba4 | 2299 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2300 | item_value = amqpvalue_get_list_item(list_value, 6); |
AzureIoTClient | 23:1111ee8bcba4 | 2301 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 2302 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2303 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 2304 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2305 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2306 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2307 | const char* desired_capabilities; |
AzureIoTClient | 23:1111ee8bcba4 | 2308 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 2309 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2310 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 2311 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2312 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2313 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2314 | AMQP_VALUE desired_capabilities_array; |
AzureIoTClient | 23:1111ee8bcba4 | 2315 | if ((amqpvalue_get_array(item_value, &desired_capabilities_array) != 0) && |
AzureIoTClient | 23:1111ee8bcba4 | 2316 | (amqpvalue_get_symbol(item_value, &desired_capabilities) != 0)) |
AzureIoTClient | 23:1111ee8bcba4 | 2317 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2318 | begin_destroy(*begin_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 2319 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2320 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 2321 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2322 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2323 | |
AzureIoTClient | 23:1111ee8bcba4 | 2324 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 2325 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2326 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2327 | /* properties */ |
AzureIoTClient | 23:1111ee8bcba4 | 2328 | if (list_item_count > 7) |
AzureIoTClient | 23:1111ee8bcba4 | 2329 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2330 | item_value = amqpvalue_get_list_item(list_value, 7); |
AzureIoTClient | 23:1111ee8bcba4 | 2331 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 2332 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2333 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 2334 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2335 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2336 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2337 | fields properties; |
AzureIoTClient | 23:1111ee8bcba4 | 2338 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 2339 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2340 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 2341 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2342 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2343 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2344 | if (amqpvalue_get_fields(item_value, &properties) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2345 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2346 | begin_destroy(*begin_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 2347 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2348 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 2349 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2350 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2351 | |
AzureIoTClient | 23:1111ee8bcba4 | 2352 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 2353 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2354 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2355 | |
AzureIoTClient | 23:1111ee8bcba4 | 2356 | begin_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 2357 | |
AzureIoTClient | 23:1111ee8bcba4 | 2358 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 2359 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 2360 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2361 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2362 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2363 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2364 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2365 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2366 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2367 | int begin_get_remote_channel(BEGIN_HANDLE begin, uint16_t* remote_channel_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 2368 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2369 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2370 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2371 | if (begin == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2372 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2373 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2374 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2375 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2376 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2377 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 2378 | BEGIN_INSTANCE* begin_instance = (BEGIN_INSTANCE*)begin; |
AzureIoTClient | 23:1111ee8bcba4 | 2379 | if (amqpvalue_get_composite_item_count(begin_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2380 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2381 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2382 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2383 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2384 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2385 | if (item_count <= 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2386 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2387 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2388 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2389 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2390 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2391 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(begin_instance->composite_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 2392 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 2393 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 2394 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2395 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2396 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2397 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2398 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2399 | if (amqpvalue_get_ushort(item_value, remote_channel_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2400 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2401 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2402 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2403 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2404 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2405 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 2406 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2407 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2408 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2409 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2410 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2411 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2412 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2413 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2414 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2415 | int begin_set_remote_channel(BEGIN_HANDLE begin, uint16_t remote_channel_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 2416 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2417 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2418 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2419 | if (begin == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2420 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2421 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2422 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2423 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2424 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2425 | BEGIN_INSTANCE* begin_instance = (BEGIN_INSTANCE*)begin; |
Azure.IoT Build | 0:6ae2f7bca550 | 2426 | AMQP_VALUE remote_channel_amqp_value = amqpvalue_create_ushort(remote_channel_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 2427 | if (remote_channel_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2428 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2429 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2430 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2431 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2432 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2433 | if (amqpvalue_set_composite_item(begin_instance->composite_value, 0, remote_channel_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 2434 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2435 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2436 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2437 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2438 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2439 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 2440 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2441 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2442 | amqpvalue_destroy(remote_channel_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 2443 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2444 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2445 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2446 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2447 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2448 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2449 | int begin_get_next_outgoing_id(BEGIN_HANDLE begin, transfer_number* next_outgoing_id_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 2450 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2451 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2452 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2453 | if (begin == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2454 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2455 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2456 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2457 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2458 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2459 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 2460 | BEGIN_INSTANCE* begin_instance = (BEGIN_INSTANCE*)begin; |
AzureIoTClient | 23:1111ee8bcba4 | 2461 | if (amqpvalue_get_composite_item_count(begin_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2462 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2463 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2464 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2465 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2466 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2467 | if (item_count <= 1) |
AzureIoTClient | 23:1111ee8bcba4 | 2468 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2469 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2470 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2471 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2472 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2473 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(begin_instance->composite_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 2474 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 2475 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 2476 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2477 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2478 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2479 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2480 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2481 | if (amqpvalue_get_transfer_number(item_value, next_outgoing_id_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2482 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2483 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2484 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2485 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2486 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2487 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 2488 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2489 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2490 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2491 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2492 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2493 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2494 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2495 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2496 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2497 | int begin_set_next_outgoing_id(BEGIN_HANDLE begin, transfer_number next_outgoing_id_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 2498 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2499 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2500 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2501 | if (begin == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2502 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2503 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2504 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2505 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2506 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2507 | BEGIN_INSTANCE* begin_instance = (BEGIN_INSTANCE*)begin; |
Azure.IoT Build | 0:6ae2f7bca550 | 2508 | AMQP_VALUE next_outgoing_id_amqp_value = amqpvalue_create_transfer_number(next_outgoing_id_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 2509 | if (next_outgoing_id_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2510 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2511 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2512 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2513 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2514 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2515 | if (amqpvalue_set_composite_item(begin_instance->composite_value, 1, next_outgoing_id_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 2516 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2517 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2518 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2519 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2520 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2521 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 2522 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2523 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2524 | amqpvalue_destroy(next_outgoing_id_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 2525 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2526 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2527 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2528 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2529 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2530 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2531 | int begin_get_incoming_window(BEGIN_HANDLE begin, uint32_t* incoming_window_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 2532 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2533 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2534 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2535 | if (begin == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2536 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2537 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2538 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2539 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2540 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2541 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 2542 | BEGIN_INSTANCE* begin_instance = (BEGIN_INSTANCE*)begin; |
AzureIoTClient | 23:1111ee8bcba4 | 2543 | if (amqpvalue_get_composite_item_count(begin_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2544 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2545 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2546 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2547 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2548 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2549 | if (item_count <= 2) |
AzureIoTClient | 23:1111ee8bcba4 | 2550 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2551 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2552 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2553 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2554 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2555 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(begin_instance->composite_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 2556 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 2557 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 2558 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2559 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2560 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2561 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2562 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2563 | if (amqpvalue_get_uint(item_value, incoming_window_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2564 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2565 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2566 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2567 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2568 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2569 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 2570 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2571 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2572 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2573 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2574 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2575 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2576 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2577 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2578 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2579 | int begin_set_incoming_window(BEGIN_HANDLE begin, uint32_t incoming_window_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 2580 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2581 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2582 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2583 | if (begin == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2584 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2585 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2586 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2587 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2588 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2589 | BEGIN_INSTANCE* begin_instance = (BEGIN_INSTANCE*)begin; |
Azure.IoT Build | 0:6ae2f7bca550 | 2590 | AMQP_VALUE incoming_window_amqp_value = amqpvalue_create_uint(incoming_window_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 2591 | if (incoming_window_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2592 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2593 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2594 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2595 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2596 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2597 | if (amqpvalue_set_composite_item(begin_instance->composite_value, 2, incoming_window_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 2598 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2599 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2600 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2601 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2602 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2603 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 2604 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2605 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2606 | amqpvalue_destroy(incoming_window_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 2607 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2608 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2609 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2610 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2611 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2612 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2613 | int begin_get_outgoing_window(BEGIN_HANDLE begin, uint32_t* outgoing_window_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 2614 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2615 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2616 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2617 | if (begin == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2618 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2619 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2620 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2621 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2622 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2623 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 2624 | BEGIN_INSTANCE* begin_instance = (BEGIN_INSTANCE*)begin; |
AzureIoTClient | 23:1111ee8bcba4 | 2625 | if (amqpvalue_get_composite_item_count(begin_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2626 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2627 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2628 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2629 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2630 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2631 | if (item_count <= 3) |
AzureIoTClient | 23:1111ee8bcba4 | 2632 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2633 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2634 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2635 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2636 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2637 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(begin_instance->composite_value, 3); |
AzureIoTClient | 23:1111ee8bcba4 | 2638 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 2639 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 2640 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2641 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2642 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2643 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2644 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2645 | if (amqpvalue_get_uint(item_value, outgoing_window_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2646 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2647 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2648 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2649 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2650 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2651 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 2652 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2653 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2654 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2655 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2656 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2657 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2658 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2659 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2660 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2661 | int begin_set_outgoing_window(BEGIN_HANDLE begin, uint32_t outgoing_window_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 2662 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2663 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2664 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2665 | if (begin == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2666 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2667 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2668 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2669 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2670 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2671 | BEGIN_INSTANCE* begin_instance = (BEGIN_INSTANCE*)begin; |
Azure.IoT Build | 0:6ae2f7bca550 | 2672 | AMQP_VALUE outgoing_window_amqp_value = amqpvalue_create_uint(outgoing_window_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 2673 | if (outgoing_window_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2674 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2675 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2676 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2677 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2678 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2679 | if (amqpvalue_set_composite_item(begin_instance->composite_value, 3, outgoing_window_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 2680 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2681 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2682 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2683 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2684 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2685 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 2686 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2687 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2688 | amqpvalue_destroy(outgoing_window_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 2689 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2690 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2691 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2692 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2693 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2694 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2695 | int begin_get_handle_max(BEGIN_HANDLE begin, handle* handle_max_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 2696 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2697 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2698 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2699 | if (begin == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2700 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2701 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2702 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2703 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2704 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2705 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 2706 | BEGIN_INSTANCE* begin_instance = (BEGIN_INSTANCE*)begin; |
AzureIoTClient | 23:1111ee8bcba4 | 2707 | if (amqpvalue_get_composite_item_count(begin_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2708 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2709 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2710 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2711 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2712 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2713 | if (item_count <= 4) |
AzureIoTClient | 23:1111ee8bcba4 | 2714 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2715 | *handle_max_value = 4294967295u; |
AzureIoTClient | 23:1111ee8bcba4 | 2716 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 2717 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2718 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2719 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2720 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(begin_instance->composite_value, 4); |
AzureIoTClient | 23:1111ee8bcba4 | 2721 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 2722 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 2723 | { |
AzureIoTClient | 16:22a72cf8e416 | 2724 | *handle_max_value = 4294967295u; |
AzureIoTClient | 16:22a72cf8e416 | 2725 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 2726 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2727 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2728 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2729 | if (amqpvalue_get_handle(item_value, handle_max_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2730 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2731 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 2732 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2733 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2734 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2735 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2736 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2737 | *handle_max_value = 4294967295u; |
AzureIoTClient | 23:1111ee8bcba4 | 2738 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 2739 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2740 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2741 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2742 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2743 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 2744 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2745 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2746 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2747 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2748 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2749 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2750 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2751 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2752 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2753 | int begin_set_handle_max(BEGIN_HANDLE begin, handle handle_max_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 2754 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2755 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2756 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2757 | if (begin == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2758 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2759 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2760 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2761 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2762 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2763 | BEGIN_INSTANCE* begin_instance = (BEGIN_INSTANCE*)begin; |
Azure.IoT Build | 0:6ae2f7bca550 | 2764 | AMQP_VALUE handle_max_amqp_value = amqpvalue_create_handle(handle_max_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 2765 | if (handle_max_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2766 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2767 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2768 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2769 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2770 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2771 | if (amqpvalue_set_composite_item(begin_instance->composite_value, 4, handle_max_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 2772 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2773 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2774 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2775 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2776 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2777 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 2778 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2779 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2780 | amqpvalue_destroy(handle_max_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 2781 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2782 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2783 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2784 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2785 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2786 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2787 | int begin_get_offered_capabilities(BEGIN_HANDLE begin, AMQP_VALUE* offered_capabilities_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 2788 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2789 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2790 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2791 | if (begin == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2792 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2793 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2794 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2795 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2796 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2797 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 2798 | BEGIN_INSTANCE* begin_instance = (BEGIN_INSTANCE*)begin; |
AzureIoTClient | 23:1111ee8bcba4 | 2799 | if (amqpvalue_get_composite_item_count(begin_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2800 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2801 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2802 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2803 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2804 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2805 | if (item_count <= 5) |
AzureIoTClient | 23:1111ee8bcba4 | 2806 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2807 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2808 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2809 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2810 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2811 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(begin_instance->composite_value, 5); |
AzureIoTClient | 23:1111ee8bcba4 | 2812 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 2813 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 2814 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2815 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2816 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2817 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2818 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2819 | if (amqpvalue_get_array(item_value, offered_capabilities_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2820 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2821 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2822 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2823 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2824 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2825 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 2826 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2827 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2828 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2829 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2830 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2831 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2832 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2833 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2834 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2835 | int begin_set_offered_capabilities(BEGIN_HANDLE begin, AMQP_VALUE offered_capabilities_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 2836 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2837 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2838 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2839 | if (begin == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2840 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2841 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2842 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2843 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2844 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2845 | BEGIN_INSTANCE* begin_instance = (BEGIN_INSTANCE*)begin; |
AzureIoTClient | 23:1111ee8bcba4 | 2846 | AMQP_VALUE offered_capabilities_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 2847 | if (offered_capabilities_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 2848 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2849 | offered_capabilities_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 2850 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2851 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2852 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2853 | offered_capabilities_amqp_value = amqpvalue_clone(offered_capabilities_value); |
AzureIoTClient | 23:1111ee8bcba4 | 2854 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2855 | if (offered_capabilities_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2856 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2857 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2858 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2859 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2860 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2861 | if (amqpvalue_set_composite_item(begin_instance->composite_value, 5, offered_capabilities_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 2862 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2863 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2864 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2865 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2866 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2867 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 2868 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2869 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2870 | amqpvalue_destroy(offered_capabilities_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 2871 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2872 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2873 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2874 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2875 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2876 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2877 | int begin_get_desired_capabilities(BEGIN_HANDLE begin, AMQP_VALUE* desired_capabilities_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 2878 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2879 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2880 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2881 | if (begin == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2882 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2883 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2884 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2885 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2886 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2887 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 2888 | BEGIN_INSTANCE* begin_instance = (BEGIN_INSTANCE*)begin; |
AzureIoTClient | 23:1111ee8bcba4 | 2889 | if (amqpvalue_get_composite_item_count(begin_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2890 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2891 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2892 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2893 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2894 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2895 | if (item_count <= 6) |
AzureIoTClient | 23:1111ee8bcba4 | 2896 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2897 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2898 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2899 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2900 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2901 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(begin_instance->composite_value, 6); |
AzureIoTClient | 23:1111ee8bcba4 | 2902 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 2903 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 2904 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2905 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2906 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2907 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2908 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2909 | if (amqpvalue_get_array(item_value, desired_capabilities_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2910 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2911 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2912 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2913 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2914 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2915 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 2916 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2917 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2918 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2919 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2920 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2921 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2922 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2923 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2924 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2925 | int begin_set_desired_capabilities(BEGIN_HANDLE begin, AMQP_VALUE desired_capabilities_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 2926 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2927 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2928 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2929 | if (begin == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2930 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2931 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2932 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2933 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2934 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2935 | BEGIN_INSTANCE* begin_instance = (BEGIN_INSTANCE*)begin; |
AzureIoTClient | 23:1111ee8bcba4 | 2936 | AMQP_VALUE desired_capabilities_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 2937 | if (desired_capabilities_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 2938 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2939 | desired_capabilities_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 2940 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2941 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2942 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2943 | desired_capabilities_amqp_value = amqpvalue_clone(desired_capabilities_value); |
AzureIoTClient | 23:1111ee8bcba4 | 2944 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2945 | if (desired_capabilities_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2946 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2947 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2948 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2949 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2950 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2951 | if (amqpvalue_set_composite_item(begin_instance->composite_value, 6, desired_capabilities_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 2952 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2953 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2954 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2955 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2956 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2957 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 2958 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2959 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2960 | amqpvalue_destroy(desired_capabilities_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 2961 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2962 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2963 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2964 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2965 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2966 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2967 | int begin_get_properties(BEGIN_HANDLE begin, fields* properties_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 2968 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 2969 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 2970 | |
Azure.IoT Build | 0:6ae2f7bca550 | 2971 | if (begin == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 2972 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 2973 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 2974 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 2975 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 2976 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2977 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 2978 | BEGIN_INSTANCE* begin_instance = (BEGIN_INSTANCE*)begin; |
AzureIoTClient | 23:1111ee8bcba4 | 2979 | if (amqpvalue_get_composite_item_count(begin_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 2980 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2981 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2982 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2983 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2984 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2985 | if (item_count <= 7) |
AzureIoTClient | 23:1111ee8bcba4 | 2986 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2987 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2988 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2989 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2990 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2991 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(begin_instance->composite_value, 7); |
AzureIoTClient | 23:1111ee8bcba4 | 2992 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 2993 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 2994 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2995 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 2996 | } |
AzureIoTClient | 23:1111ee8bcba4 | 2997 | else |
AzureIoTClient | 23:1111ee8bcba4 | 2998 | { |
AzureIoTClient | 23:1111ee8bcba4 | 2999 | if (amqpvalue_get_fields(item_value, properties_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3000 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3001 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3002 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3003 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3004 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3005 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 3006 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3007 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3008 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3009 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3010 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3011 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3012 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3013 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3014 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3015 | int begin_set_properties(BEGIN_HANDLE begin, fields properties_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 3016 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3017 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3018 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3019 | if (begin == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3020 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3021 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3022 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3023 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3024 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3025 | BEGIN_INSTANCE* begin_instance = (BEGIN_INSTANCE*)begin; |
Azure.IoT Build | 0:6ae2f7bca550 | 3026 | AMQP_VALUE properties_amqp_value = amqpvalue_create_fields(properties_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 3027 | if (properties_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3028 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3029 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3030 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3031 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3032 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3033 | if (amqpvalue_set_composite_item(begin_instance->composite_value, 7, properties_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 3034 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3035 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3036 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3037 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3038 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3039 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 3040 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3041 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3042 | amqpvalue_destroy(properties_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 3043 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3044 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3045 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3046 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3047 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3048 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3049 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3050 | /* attach */ |
Azure.IoT Build | 0:6ae2f7bca550 | 3051 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3052 | typedef struct ATTACH_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 3053 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3054 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 3055 | } ATTACH_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 3056 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3057 | static ATTACH_HANDLE attach_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 3058 | { |
AzureIoTClient | 21:f9c433d8e6ca | 3059 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)malloc(sizeof(ATTACH_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 3060 | if (attach_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3061 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3062 | attach_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 3063 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3064 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3065 | return attach_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 3066 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3067 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3068 | ATTACH_HANDLE attach_create(const char* name_value, handle handle_value, role role_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 3069 | { |
AzureIoTClient | 21:f9c433d8e6ca | 3070 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)malloc(sizeof(ATTACH_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 3071 | if (attach_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3072 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3073 | attach_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(18); |
Azure.IoT Build | 0:6ae2f7bca550 | 3074 | if (attach_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3075 | { |
AzureIoTClient | 21:f9c433d8e6ca | 3076 | free(attach_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 3077 | attach_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 3078 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3079 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3080 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3081 | AMQP_VALUE name_amqp_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 3082 | AMQP_VALUE handle_amqp_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 3083 | AMQP_VALUE role_amqp_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 3084 | int result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 3085 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3086 | name_amqp_value = amqpvalue_create_string(name_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 3087 | if ((result == 0) && (amqpvalue_set_composite_item(attach_instance->composite_value, 0, name_amqp_value) != 0)) |
Azure.IoT Build | 0:6ae2f7bca550 | 3088 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3089 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3090 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3091 | handle_amqp_value = amqpvalue_create_handle(handle_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 3092 | if ((result == 0) && (amqpvalue_set_composite_item(attach_instance->composite_value, 1, handle_amqp_value) != 0)) |
Azure.IoT Build | 0:6ae2f7bca550 | 3093 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3094 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3095 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3096 | role_amqp_value = amqpvalue_create_role(role_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 3097 | if ((result == 0) && (amqpvalue_set_composite_item(attach_instance->composite_value, 2, role_amqp_value) != 0)) |
Azure.IoT Build | 0:6ae2f7bca550 | 3098 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3099 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3100 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3101 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3102 | amqpvalue_destroy(name_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 3103 | amqpvalue_destroy(handle_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 3104 | amqpvalue_destroy(role_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 3105 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3106 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3107 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3108 | return attach_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 3109 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3110 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3111 | ATTACH_HANDLE attach_clone(ATTACH_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 3112 | { |
AzureIoTClient | 21:f9c433d8e6ca | 3113 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)malloc(sizeof(ATTACH_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 3114 | if (attach_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3115 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3116 | attach_instance->composite_value = amqpvalue_clone(((ATTACH_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 3117 | if (attach_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3118 | { |
AzureIoTClient | 21:f9c433d8e6ca | 3119 | free(attach_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 3120 | attach_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 3121 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3122 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3123 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3124 | return attach_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 3125 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3126 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3127 | void attach_destroy(ATTACH_HANDLE attach) |
Azure.IoT Build | 0:6ae2f7bca550 | 3128 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3129 | if (attach != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3130 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3131 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
Azure.IoT Build | 0:6ae2f7bca550 | 3132 | amqpvalue_destroy(attach_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 3133 | free(attach_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 3134 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3135 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3136 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3137 | AMQP_VALUE amqpvalue_create_attach(ATTACH_HANDLE attach) |
Azure.IoT Build | 0:6ae2f7bca550 | 3138 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3139 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3140 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3141 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3142 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3143 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 3144 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3145 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3146 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3147 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
Azure.IoT Build | 0:6ae2f7bca550 | 3148 | result = amqpvalue_clone(attach_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 3149 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3150 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3151 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3152 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3153 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3154 | bool is_attach_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 3155 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3156 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3157 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3158 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 3159 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 3160 | (descriptor_ulong == 18)) |
Azure.IoT Build | 0:6ae2f7bca550 | 3161 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3162 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 3163 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3164 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3165 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3166 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 3167 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3168 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3169 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3170 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3171 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3172 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3173 | int amqpvalue_get_attach(AMQP_VALUE value, ATTACH_HANDLE* attach_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 3174 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3175 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3176 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 3177 | *attach_handle = attach_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 3178 | if (*attach_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3179 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3180 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3181 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3182 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3183 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3184 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 3185 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3186 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3187 | attach_destroy(*attach_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 3188 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3189 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3190 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3191 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3192 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 3193 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3194 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3195 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3196 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3197 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3198 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3199 | do |
AzureIoTClient | 23:1111ee8bcba4 | 3200 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3201 | AMQP_VALUE item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 3202 | /* name */ |
AzureIoTClient | 23:1111ee8bcba4 | 3203 | if (list_item_count > 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3204 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3205 | item_value = amqpvalue_get_list_item(list_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 3206 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3207 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3208 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3209 | attach_destroy(*attach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 3210 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3211 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 3212 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3213 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3214 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3215 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3216 | const char* name; |
AzureIoTClient | 23:1111ee8bcba4 | 3217 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3218 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3219 | attach_destroy(*attach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 3220 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3221 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 3222 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3223 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3224 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3225 | if (amqpvalue_get_string(item_value, &name) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3226 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3227 | attach_destroy(*attach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 3228 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3229 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 3230 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3231 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3232 | |
AzureIoTClient | 23:1111ee8bcba4 | 3233 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 3234 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3235 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3236 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3237 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3238 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3239 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3240 | /* handle */ |
AzureIoTClient | 23:1111ee8bcba4 | 3241 | if (list_item_count > 1) |
AzureIoTClient | 23:1111ee8bcba4 | 3242 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3243 | item_value = amqpvalue_get_list_item(list_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 3244 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3245 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3246 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3247 | attach_destroy(*attach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 3248 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3249 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 3250 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3251 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3252 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3253 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3254 | handle handle; |
AzureIoTClient | 23:1111ee8bcba4 | 3255 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3256 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3257 | attach_destroy(*attach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 3258 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3259 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 3260 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3261 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3262 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3263 | if (amqpvalue_get_handle(item_value, &handle) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3264 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3265 | attach_destroy(*attach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 3266 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3267 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 3268 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3269 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3270 | |
AzureIoTClient | 23:1111ee8bcba4 | 3271 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 3272 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3273 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3274 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3275 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3276 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3277 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3278 | /* role */ |
AzureIoTClient | 23:1111ee8bcba4 | 3279 | if (list_item_count > 2) |
AzureIoTClient | 23:1111ee8bcba4 | 3280 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3281 | item_value = amqpvalue_get_list_item(list_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 3282 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3283 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3284 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3285 | attach_destroy(*attach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 3286 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3287 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 3288 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3289 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3290 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3291 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3292 | role role; |
AzureIoTClient | 23:1111ee8bcba4 | 3293 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3294 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3295 | attach_destroy(*attach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 3296 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3297 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 3298 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3299 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3300 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3301 | if (amqpvalue_get_role(item_value, &role) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3302 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3303 | attach_destroy(*attach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 3304 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3305 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 3306 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3307 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3308 | |
AzureIoTClient | 23:1111ee8bcba4 | 3309 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 3310 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3311 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3312 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3313 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3314 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3315 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3316 | /* snd-settle-mode */ |
AzureIoTClient | 23:1111ee8bcba4 | 3317 | if (list_item_count > 3) |
AzureIoTClient | 23:1111ee8bcba4 | 3318 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3319 | item_value = amqpvalue_get_list_item(list_value, 3); |
AzureIoTClient | 23:1111ee8bcba4 | 3320 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3321 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3322 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 3323 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3324 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3325 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3326 | sender_settle_mode snd_settle_mode; |
AzureIoTClient | 23:1111ee8bcba4 | 3327 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3328 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3329 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 3330 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3331 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3332 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3333 | if (amqpvalue_get_sender_settle_mode(item_value, &snd_settle_mode) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3334 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3335 | attach_destroy(*attach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 3336 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3337 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 3338 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3339 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3340 | |
AzureIoTClient | 23:1111ee8bcba4 | 3341 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 3342 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3343 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3344 | /* rcv-settle-mode */ |
AzureIoTClient | 23:1111ee8bcba4 | 3345 | if (list_item_count > 4) |
AzureIoTClient | 23:1111ee8bcba4 | 3346 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3347 | item_value = amqpvalue_get_list_item(list_value, 4); |
AzureIoTClient | 23:1111ee8bcba4 | 3348 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3349 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3350 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 3351 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3352 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3353 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3354 | receiver_settle_mode rcv_settle_mode; |
AzureIoTClient | 23:1111ee8bcba4 | 3355 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3356 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3357 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 3358 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3359 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3360 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3361 | if (amqpvalue_get_receiver_settle_mode(item_value, &rcv_settle_mode) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3362 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3363 | attach_destroy(*attach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 3364 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3365 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 3366 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3367 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3368 | |
AzureIoTClient | 23:1111ee8bcba4 | 3369 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 3370 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3371 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3372 | /* source */ |
AzureIoTClient | 23:1111ee8bcba4 | 3373 | if (list_item_count > 5) |
AzureIoTClient | 23:1111ee8bcba4 | 3374 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3375 | item_value = amqpvalue_get_list_item(list_value, 5); |
AzureIoTClient | 23:1111ee8bcba4 | 3376 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3377 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3378 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 3379 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3380 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3381 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3382 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 3383 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3384 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3385 | /* target */ |
AzureIoTClient | 23:1111ee8bcba4 | 3386 | if (list_item_count > 6) |
AzureIoTClient | 23:1111ee8bcba4 | 3387 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3388 | item_value = amqpvalue_get_list_item(list_value, 6); |
AzureIoTClient | 23:1111ee8bcba4 | 3389 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3390 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3391 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 3392 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3393 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3394 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3395 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 3396 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3397 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3398 | /* unsettled */ |
AzureIoTClient | 23:1111ee8bcba4 | 3399 | if (list_item_count > 7) |
AzureIoTClient | 23:1111ee8bcba4 | 3400 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3401 | item_value = amqpvalue_get_list_item(list_value, 7); |
AzureIoTClient | 23:1111ee8bcba4 | 3402 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3403 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3404 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 3405 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3406 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3407 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3408 | AMQP_VALUE unsettled; |
AzureIoTClient | 23:1111ee8bcba4 | 3409 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3410 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3411 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 3412 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3413 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3414 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3415 | if (amqpvalue_get_map(item_value, &unsettled) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3416 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3417 | attach_destroy(*attach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 3418 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3419 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 3420 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3421 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3422 | |
AzureIoTClient | 23:1111ee8bcba4 | 3423 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 3424 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3425 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3426 | /* incomplete-unsettled */ |
AzureIoTClient | 23:1111ee8bcba4 | 3427 | if (list_item_count > 8) |
AzureIoTClient | 23:1111ee8bcba4 | 3428 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3429 | item_value = amqpvalue_get_list_item(list_value, 8); |
AzureIoTClient | 23:1111ee8bcba4 | 3430 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3431 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3432 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 3433 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3434 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3435 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3436 | bool incomplete_unsettled; |
AzureIoTClient | 23:1111ee8bcba4 | 3437 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3438 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3439 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 3440 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3441 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3442 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3443 | if (amqpvalue_get_boolean(item_value, &incomplete_unsettled) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3444 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3445 | attach_destroy(*attach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 3446 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3447 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 3448 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3449 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3450 | |
AzureIoTClient | 23:1111ee8bcba4 | 3451 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 3452 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3453 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3454 | /* initial-delivery-count */ |
AzureIoTClient | 23:1111ee8bcba4 | 3455 | if (list_item_count > 9) |
AzureIoTClient | 23:1111ee8bcba4 | 3456 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3457 | item_value = amqpvalue_get_list_item(list_value, 9); |
AzureIoTClient | 23:1111ee8bcba4 | 3458 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3459 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3460 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 3461 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3462 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3463 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3464 | sequence_no initial_delivery_count; |
AzureIoTClient | 23:1111ee8bcba4 | 3465 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3466 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3467 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 3468 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3469 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3470 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3471 | if (amqpvalue_get_sequence_no(item_value, &initial_delivery_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3472 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3473 | attach_destroy(*attach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 3474 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3475 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 3476 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3477 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3478 | |
AzureIoTClient | 23:1111ee8bcba4 | 3479 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 3480 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3481 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3482 | /* max-message-size */ |
AzureIoTClient | 23:1111ee8bcba4 | 3483 | if (list_item_count > 10) |
AzureIoTClient | 23:1111ee8bcba4 | 3484 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3485 | item_value = amqpvalue_get_list_item(list_value, 10); |
AzureIoTClient | 23:1111ee8bcba4 | 3486 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3487 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3488 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 3489 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3490 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3491 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3492 | uint64_t max_message_size; |
AzureIoTClient | 23:1111ee8bcba4 | 3493 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3494 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3495 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 3496 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3497 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3498 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3499 | if (amqpvalue_get_ulong(item_value, &max_message_size) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3500 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3501 | attach_destroy(*attach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 3502 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3503 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 3504 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3505 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3506 | |
AzureIoTClient | 23:1111ee8bcba4 | 3507 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 3508 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3509 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3510 | /* offered-capabilities */ |
AzureIoTClient | 23:1111ee8bcba4 | 3511 | if (list_item_count > 11) |
AzureIoTClient | 23:1111ee8bcba4 | 3512 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3513 | item_value = amqpvalue_get_list_item(list_value, 11); |
AzureIoTClient | 23:1111ee8bcba4 | 3514 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3515 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3516 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 3517 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3518 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3519 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3520 | const char* offered_capabilities; |
AzureIoTClient | 23:1111ee8bcba4 | 3521 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3522 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3523 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 3524 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3525 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3526 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3527 | AMQP_VALUE offered_capabilities_array; |
AzureIoTClient | 23:1111ee8bcba4 | 3528 | if ((amqpvalue_get_array(item_value, &offered_capabilities_array) != 0) && |
AzureIoTClient | 23:1111ee8bcba4 | 3529 | (amqpvalue_get_symbol(item_value, &offered_capabilities) != 0)) |
AzureIoTClient | 23:1111ee8bcba4 | 3530 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3531 | attach_destroy(*attach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 3532 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3533 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 3534 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3535 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3536 | |
AzureIoTClient | 23:1111ee8bcba4 | 3537 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 3538 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3539 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3540 | /* desired-capabilities */ |
AzureIoTClient | 23:1111ee8bcba4 | 3541 | if (list_item_count > 12) |
AzureIoTClient | 23:1111ee8bcba4 | 3542 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3543 | item_value = amqpvalue_get_list_item(list_value, 12); |
AzureIoTClient | 23:1111ee8bcba4 | 3544 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3545 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3546 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 3547 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3548 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3549 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3550 | const char* desired_capabilities; |
AzureIoTClient | 23:1111ee8bcba4 | 3551 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3552 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3553 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 3554 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3555 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3556 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3557 | AMQP_VALUE desired_capabilities_array; |
AzureIoTClient | 23:1111ee8bcba4 | 3558 | if ((amqpvalue_get_array(item_value, &desired_capabilities_array) != 0) && |
AzureIoTClient | 23:1111ee8bcba4 | 3559 | (amqpvalue_get_symbol(item_value, &desired_capabilities) != 0)) |
AzureIoTClient | 23:1111ee8bcba4 | 3560 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3561 | attach_destroy(*attach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 3562 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3563 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 3564 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3565 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3566 | |
AzureIoTClient | 23:1111ee8bcba4 | 3567 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 3568 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3569 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3570 | /* properties */ |
AzureIoTClient | 23:1111ee8bcba4 | 3571 | if (list_item_count > 13) |
AzureIoTClient | 23:1111ee8bcba4 | 3572 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3573 | item_value = amqpvalue_get_list_item(list_value, 13); |
AzureIoTClient | 23:1111ee8bcba4 | 3574 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3575 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3576 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 3577 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3578 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3579 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3580 | fields properties; |
AzureIoTClient | 23:1111ee8bcba4 | 3581 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3582 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3583 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 3584 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3585 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3586 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3587 | if (amqpvalue_get_fields(item_value, &properties) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3588 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3589 | attach_destroy(*attach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 3590 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3591 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 3592 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3593 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3594 | |
AzureIoTClient | 23:1111ee8bcba4 | 3595 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 3596 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3597 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3598 | |
AzureIoTClient | 23:1111ee8bcba4 | 3599 | attach_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 3600 | |
AzureIoTClient | 23:1111ee8bcba4 | 3601 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 3602 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 3603 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3604 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3605 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3606 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3607 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3608 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3609 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3610 | int attach_get_name(ATTACH_HANDLE attach, const char** name_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 3611 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3612 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3613 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3614 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3615 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3616 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3617 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3618 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3619 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3620 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 3621 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
AzureIoTClient | 23:1111ee8bcba4 | 3622 | if (amqpvalue_get_composite_item_count(attach_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3623 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3624 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3625 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3626 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3627 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3628 | if (item_count <= 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3629 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3630 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3631 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3632 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3633 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3634 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(attach_instance->composite_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 3635 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 3636 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 3637 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3638 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3639 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3640 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3641 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3642 | if (amqpvalue_get_string(item_value, name_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3643 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3644 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3645 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3646 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3647 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3648 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 3649 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3650 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3651 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3652 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3653 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3654 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3655 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3656 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3657 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3658 | int attach_set_name(ATTACH_HANDLE attach, const char* name_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 3659 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3660 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3661 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3662 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3663 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3664 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3665 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3666 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3667 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3668 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
Azure.IoT Build | 0:6ae2f7bca550 | 3669 | AMQP_VALUE name_amqp_value = amqpvalue_create_string(name_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 3670 | if (name_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3671 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3672 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3673 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3674 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3675 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3676 | if (amqpvalue_set_composite_item(attach_instance->composite_value, 0, name_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 3677 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3678 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3679 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3680 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3681 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3682 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 3683 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3684 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3685 | amqpvalue_destroy(name_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 3686 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3687 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3688 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3689 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3690 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3691 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3692 | int attach_get_handle(ATTACH_HANDLE attach, handle* handle_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 3693 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3694 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3695 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3696 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3697 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3698 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3699 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3700 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3701 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3702 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 3703 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
AzureIoTClient | 23:1111ee8bcba4 | 3704 | if (amqpvalue_get_composite_item_count(attach_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3705 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3706 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3707 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3708 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3709 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3710 | if (item_count <= 1) |
AzureIoTClient | 23:1111ee8bcba4 | 3711 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3712 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3713 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3714 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3715 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3716 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(attach_instance->composite_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 3717 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 3718 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 3719 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3720 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3721 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3722 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3723 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3724 | if (amqpvalue_get_handle(item_value, handle_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3725 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3726 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3727 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3728 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3729 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3730 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 3731 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3732 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3733 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3734 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3735 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3736 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3737 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3738 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3739 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3740 | int attach_set_handle(ATTACH_HANDLE attach, handle handle_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 3741 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3742 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3743 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3744 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3745 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3746 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3747 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3748 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3749 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3750 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
Azure.IoT Build | 0:6ae2f7bca550 | 3751 | AMQP_VALUE handle_amqp_value = amqpvalue_create_handle(handle_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 3752 | if (handle_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3753 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3754 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3755 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3756 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3757 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3758 | if (amqpvalue_set_composite_item(attach_instance->composite_value, 1, handle_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 3759 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3760 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3761 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3762 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3763 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3764 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 3765 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3766 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3767 | amqpvalue_destroy(handle_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 3768 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3769 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3770 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3771 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3772 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3773 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3774 | int attach_get_role(ATTACH_HANDLE attach, role* role_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 3775 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3776 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3777 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3778 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3779 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3780 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3781 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3782 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3783 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3784 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 3785 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
AzureIoTClient | 23:1111ee8bcba4 | 3786 | if (amqpvalue_get_composite_item_count(attach_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3787 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3788 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3789 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3790 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3791 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3792 | if (item_count <= 2) |
AzureIoTClient | 23:1111ee8bcba4 | 3793 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3794 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3795 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3796 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3797 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3798 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(attach_instance->composite_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 3799 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 3800 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 3801 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3802 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3803 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3804 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3805 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3806 | if (amqpvalue_get_role(item_value, role_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3807 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3808 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3809 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3810 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3811 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3812 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 3813 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3814 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3815 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3816 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3817 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3818 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3819 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3820 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3821 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3822 | int attach_set_role(ATTACH_HANDLE attach, role role_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 3823 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3824 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3825 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3826 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3827 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3828 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3829 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3830 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3831 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3832 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
Azure.IoT Build | 0:6ae2f7bca550 | 3833 | AMQP_VALUE role_amqp_value = amqpvalue_create_role(role_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 3834 | if (role_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3835 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3836 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3837 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3838 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3839 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3840 | if (amqpvalue_set_composite_item(attach_instance->composite_value, 2, role_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 3841 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3842 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3843 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3844 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3845 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3846 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 3847 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3848 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3849 | amqpvalue_destroy(role_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 3850 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3851 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3852 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3853 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3854 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3855 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3856 | int attach_get_snd_settle_mode(ATTACH_HANDLE attach, sender_settle_mode* snd_settle_mode_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 3857 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3858 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3859 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3860 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3861 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3862 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3863 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3864 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3865 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3866 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 3867 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
AzureIoTClient | 23:1111ee8bcba4 | 3868 | if (amqpvalue_get_composite_item_count(attach_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3869 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3870 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3871 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3872 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3873 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3874 | if (item_count <= 3) |
AzureIoTClient | 23:1111ee8bcba4 | 3875 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3876 | *snd_settle_mode_value = sender_settle_mode_mixed; |
AzureIoTClient | 23:1111ee8bcba4 | 3877 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 3878 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3879 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3880 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3881 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(attach_instance->composite_value, 3); |
AzureIoTClient | 23:1111ee8bcba4 | 3882 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 3883 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 3884 | { |
AzureIoTClient | 16:22a72cf8e416 | 3885 | *snd_settle_mode_value = sender_settle_mode_mixed; |
AzureIoTClient | 16:22a72cf8e416 | 3886 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 3887 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3888 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3889 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3890 | if (amqpvalue_get_sender_settle_mode(item_value, snd_settle_mode_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3891 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3892 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3893 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3894 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3895 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3896 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3897 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3898 | *snd_settle_mode_value = sender_settle_mode_mixed; |
AzureIoTClient | 23:1111ee8bcba4 | 3899 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 3900 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3901 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3902 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3903 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3904 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 3905 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3906 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3907 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3908 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3909 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3910 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3911 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3912 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3913 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3914 | int attach_set_snd_settle_mode(ATTACH_HANDLE attach, sender_settle_mode snd_settle_mode_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 3915 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3916 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3917 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3918 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3919 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3920 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3921 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3922 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3923 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3924 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
Azure.IoT Build | 0:6ae2f7bca550 | 3925 | AMQP_VALUE snd_settle_mode_amqp_value = amqpvalue_create_sender_settle_mode(snd_settle_mode_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 3926 | if (snd_settle_mode_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3927 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3928 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3929 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3930 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3931 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3932 | if (amqpvalue_set_composite_item(attach_instance->composite_value, 3, snd_settle_mode_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 3933 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3934 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3935 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3936 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3937 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3938 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 3939 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3940 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3941 | amqpvalue_destroy(snd_settle_mode_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 3942 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3943 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3944 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3945 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3946 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3947 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3948 | int attach_get_rcv_settle_mode(ATTACH_HANDLE attach, receiver_settle_mode* rcv_settle_mode_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 3949 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 3950 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 3951 | |
Azure.IoT Build | 0:6ae2f7bca550 | 3952 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 3953 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 3954 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 3955 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 3956 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 3957 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3958 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 3959 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
AzureIoTClient | 23:1111ee8bcba4 | 3960 | if (amqpvalue_get_composite_item_count(attach_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3961 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3962 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3963 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3964 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3965 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3966 | if (item_count <= 4) |
AzureIoTClient | 23:1111ee8bcba4 | 3967 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3968 | *rcv_settle_mode_value = receiver_settle_mode_first; |
AzureIoTClient | 23:1111ee8bcba4 | 3969 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 3970 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3971 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3972 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3973 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(attach_instance->composite_value, 4); |
AzureIoTClient | 23:1111ee8bcba4 | 3974 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 3975 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 3976 | { |
AzureIoTClient | 16:22a72cf8e416 | 3977 | *rcv_settle_mode_value = receiver_settle_mode_first; |
AzureIoTClient | 16:22a72cf8e416 | 3978 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 3979 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3980 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3981 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3982 | if (amqpvalue_get_receiver_settle_mode(item_value, rcv_settle_mode_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 3983 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3984 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 3985 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3986 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 3987 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3988 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3989 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3990 | *rcv_settle_mode_value = receiver_settle_mode_first; |
AzureIoTClient | 23:1111ee8bcba4 | 3991 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 3992 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3993 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3994 | else |
AzureIoTClient | 23:1111ee8bcba4 | 3995 | { |
AzureIoTClient | 23:1111ee8bcba4 | 3996 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 3997 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3998 | } |
AzureIoTClient | 23:1111ee8bcba4 | 3999 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4000 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4001 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4002 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4003 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4004 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4005 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4006 | int attach_set_rcv_settle_mode(ATTACH_HANDLE attach, receiver_settle_mode rcv_settle_mode_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 4007 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4008 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4009 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4010 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4011 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4012 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4013 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4014 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4015 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4016 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
Azure.IoT Build | 0:6ae2f7bca550 | 4017 | AMQP_VALUE rcv_settle_mode_amqp_value = amqpvalue_create_receiver_settle_mode(rcv_settle_mode_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4018 | if (rcv_settle_mode_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4019 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4020 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4021 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4022 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4023 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4024 | if (amqpvalue_set_composite_item(attach_instance->composite_value, 4, rcv_settle_mode_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 4025 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4026 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4027 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4028 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4029 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4030 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 4031 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4032 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4033 | amqpvalue_destroy(rcv_settle_mode_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4034 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4035 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4036 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4037 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4038 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4039 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4040 | int attach_get_source(ATTACH_HANDLE attach, AMQP_VALUE* source_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 4041 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4042 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4043 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4044 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4045 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4046 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4047 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4048 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4049 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4050 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 4051 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
AzureIoTClient | 23:1111ee8bcba4 | 4052 | if (amqpvalue_get_composite_item_count(attach_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 4053 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4054 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4055 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4056 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4057 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4058 | if (item_count <= 5) |
AzureIoTClient | 23:1111ee8bcba4 | 4059 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4060 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4061 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4062 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4063 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4064 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(attach_instance->composite_value, 5); |
AzureIoTClient | 23:1111ee8bcba4 | 4065 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 4066 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 4067 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4068 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4069 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4070 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4071 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4072 | *source_value = item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 4073 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 4074 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4075 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4076 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4077 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4078 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4079 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4080 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4081 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4082 | int attach_set_source(ATTACH_HANDLE attach, AMQP_VALUE source_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 4083 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4084 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4085 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4086 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4087 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4088 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4089 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4090 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4091 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4092 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
AzureIoTClient | 23:1111ee8bcba4 | 4093 | AMQP_VALUE source_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 4094 | if (source_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 4095 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4096 | source_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 4097 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4098 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4099 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4100 | source_amqp_value = amqpvalue_clone(source_value); |
AzureIoTClient | 23:1111ee8bcba4 | 4101 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4102 | if (source_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4103 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4104 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4105 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4106 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4107 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4108 | if (amqpvalue_set_composite_item(attach_instance->composite_value, 5, source_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 4109 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4110 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4111 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4112 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4113 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4114 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 4115 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4116 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4117 | amqpvalue_destroy(source_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4118 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4119 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4120 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4121 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4122 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4123 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4124 | int attach_get_target(ATTACH_HANDLE attach, AMQP_VALUE* target_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 4125 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4126 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4127 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4128 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4129 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4130 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4131 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4132 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4133 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4134 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 4135 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
AzureIoTClient | 23:1111ee8bcba4 | 4136 | if (amqpvalue_get_composite_item_count(attach_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 4137 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4138 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4139 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4140 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4141 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4142 | if (item_count <= 6) |
AzureIoTClient | 23:1111ee8bcba4 | 4143 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4144 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4145 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4146 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4147 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4148 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(attach_instance->composite_value, 6); |
AzureIoTClient | 23:1111ee8bcba4 | 4149 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 4150 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 4151 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4152 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4153 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4154 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4155 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4156 | *target_value = item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 4157 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 4158 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4159 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4160 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4161 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4162 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4163 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4164 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4165 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4166 | int attach_set_target(ATTACH_HANDLE attach, AMQP_VALUE target_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 4167 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4168 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4169 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4170 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4171 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4172 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4173 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4174 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4175 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4176 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
AzureIoTClient | 23:1111ee8bcba4 | 4177 | AMQP_VALUE target_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 4178 | if (target_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 4179 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4180 | target_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 4181 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4182 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4183 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4184 | target_amqp_value = amqpvalue_clone(target_value); |
AzureIoTClient | 23:1111ee8bcba4 | 4185 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4186 | if (target_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4187 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4188 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4189 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4190 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4191 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4192 | if (amqpvalue_set_composite_item(attach_instance->composite_value, 6, target_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 4193 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4194 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4195 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4196 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4197 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4198 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 4199 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4200 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4201 | amqpvalue_destroy(target_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4202 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4203 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4204 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4205 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4206 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4207 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4208 | int attach_get_unsettled(ATTACH_HANDLE attach, AMQP_VALUE* unsettled_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 4209 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4210 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4211 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4212 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4213 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4214 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4215 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4216 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4217 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4218 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 4219 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
AzureIoTClient | 23:1111ee8bcba4 | 4220 | if (amqpvalue_get_composite_item_count(attach_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 4221 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4222 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4223 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4224 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4225 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4226 | if (item_count <= 7) |
AzureIoTClient | 23:1111ee8bcba4 | 4227 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4228 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4229 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4230 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4231 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4232 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(attach_instance->composite_value, 7); |
AzureIoTClient | 23:1111ee8bcba4 | 4233 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 4234 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 4235 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4236 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4237 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4238 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4239 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4240 | if (amqpvalue_get_map(item_value, unsettled_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 4241 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4242 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4243 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4244 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4245 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4246 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 4247 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4248 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4249 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4250 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4251 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4252 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4253 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4254 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4255 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4256 | int attach_set_unsettled(ATTACH_HANDLE attach, AMQP_VALUE unsettled_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 4257 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4258 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4259 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4260 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4261 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4262 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4263 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4264 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4265 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4266 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
AzureIoTClient | 23:1111ee8bcba4 | 4267 | AMQP_VALUE unsettled_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 4268 | if (unsettled_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 4269 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4270 | unsettled_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 4271 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4272 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4273 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4274 | unsettled_amqp_value = amqpvalue_clone(unsettled_value); |
AzureIoTClient | 23:1111ee8bcba4 | 4275 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4276 | if (unsettled_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4277 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4278 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4279 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4280 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4281 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4282 | if (amqpvalue_set_composite_item(attach_instance->composite_value, 7, unsettled_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 4283 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4284 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4285 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4286 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4287 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4288 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 4289 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4290 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4291 | amqpvalue_destroy(unsettled_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4292 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4293 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4294 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4295 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4296 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4297 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4298 | int attach_get_incomplete_unsettled(ATTACH_HANDLE attach, bool* incomplete_unsettled_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 4299 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4300 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4301 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4302 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4303 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4304 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4305 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4306 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4307 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4308 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 4309 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
AzureIoTClient | 23:1111ee8bcba4 | 4310 | if (amqpvalue_get_composite_item_count(attach_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 4311 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4312 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4313 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4314 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4315 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4316 | if (item_count <= 8) |
AzureIoTClient | 23:1111ee8bcba4 | 4317 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4318 | *incomplete_unsettled_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 4319 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 4320 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4321 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4322 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4323 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(attach_instance->composite_value, 8); |
AzureIoTClient | 23:1111ee8bcba4 | 4324 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 4325 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 4326 | { |
AzureIoTClient | 16:22a72cf8e416 | 4327 | *incomplete_unsettled_value = false; |
AzureIoTClient | 16:22a72cf8e416 | 4328 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 4329 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4330 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4331 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4332 | if (amqpvalue_get_boolean(item_value, incomplete_unsettled_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 4333 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4334 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 4335 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4336 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4337 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4338 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4339 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4340 | *incomplete_unsettled_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 4341 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 4342 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4343 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4344 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4345 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4346 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 4347 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4348 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4349 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4350 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4351 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4352 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4353 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4354 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4355 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4356 | int attach_set_incomplete_unsettled(ATTACH_HANDLE attach, bool incomplete_unsettled_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 4357 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4358 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4359 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4360 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4361 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4362 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4363 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4364 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4365 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4366 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
Azure.IoT Build | 0:6ae2f7bca550 | 4367 | AMQP_VALUE incomplete_unsettled_amqp_value = amqpvalue_create_boolean(incomplete_unsettled_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4368 | if (incomplete_unsettled_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4369 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4370 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4371 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4372 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4373 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4374 | if (amqpvalue_set_composite_item(attach_instance->composite_value, 8, incomplete_unsettled_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 4375 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4376 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4377 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4378 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4379 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4380 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 4381 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4382 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4383 | amqpvalue_destroy(incomplete_unsettled_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4384 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4385 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4386 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4387 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4388 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4389 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4390 | int attach_get_initial_delivery_count(ATTACH_HANDLE attach, sequence_no* initial_delivery_count_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 4391 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4392 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4393 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4394 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4395 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4396 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4397 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4398 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4399 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4400 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 4401 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
AzureIoTClient | 23:1111ee8bcba4 | 4402 | if (amqpvalue_get_composite_item_count(attach_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 4403 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4404 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4405 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4406 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4407 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4408 | if (item_count <= 9) |
AzureIoTClient | 23:1111ee8bcba4 | 4409 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4410 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4411 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4412 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4413 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4414 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(attach_instance->composite_value, 9); |
AzureIoTClient | 23:1111ee8bcba4 | 4415 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 4416 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 4417 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4418 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4419 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4420 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4421 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4422 | if (amqpvalue_get_sequence_no(item_value, initial_delivery_count_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 4423 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4424 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4425 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4426 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4427 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4428 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 4429 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4430 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4431 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4432 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4433 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4434 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4435 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4436 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4437 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4438 | int attach_set_initial_delivery_count(ATTACH_HANDLE attach, sequence_no initial_delivery_count_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 4439 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4440 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4441 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4442 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4443 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4444 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4445 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4446 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4447 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4448 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
Azure.IoT Build | 0:6ae2f7bca550 | 4449 | AMQP_VALUE initial_delivery_count_amqp_value = amqpvalue_create_sequence_no(initial_delivery_count_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4450 | if (initial_delivery_count_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4451 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4452 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4453 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4454 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4455 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4456 | if (amqpvalue_set_composite_item(attach_instance->composite_value, 9, initial_delivery_count_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 4457 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4458 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4459 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4460 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4461 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4462 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 4463 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4464 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4465 | amqpvalue_destroy(initial_delivery_count_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4466 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4467 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4468 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4469 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4470 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4471 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4472 | int attach_get_max_message_size(ATTACH_HANDLE attach, uint64_t* max_message_size_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 4473 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4474 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4475 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4476 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4477 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4478 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4479 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4480 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4481 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4482 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 4483 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
AzureIoTClient | 23:1111ee8bcba4 | 4484 | if (amqpvalue_get_composite_item_count(attach_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 4485 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4486 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4487 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4488 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4489 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4490 | if (item_count <= 10) |
AzureIoTClient | 23:1111ee8bcba4 | 4491 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4492 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4493 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4494 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4495 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4496 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(attach_instance->composite_value, 10); |
AzureIoTClient | 23:1111ee8bcba4 | 4497 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 4498 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 4499 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4500 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4501 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4502 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4503 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4504 | if (amqpvalue_get_ulong(item_value, max_message_size_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 4505 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4506 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4507 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4508 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4509 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4510 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 4511 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4512 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4513 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4514 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4515 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4516 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4517 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4518 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4519 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4520 | int attach_set_max_message_size(ATTACH_HANDLE attach, uint64_t max_message_size_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 4521 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4522 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4523 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4524 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4525 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4526 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4527 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4528 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4529 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4530 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
Azure.IoT Build | 0:6ae2f7bca550 | 4531 | AMQP_VALUE max_message_size_amqp_value = amqpvalue_create_ulong(max_message_size_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4532 | if (max_message_size_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4533 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4534 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4535 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4536 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4537 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4538 | if (amqpvalue_set_composite_item(attach_instance->composite_value, 10, max_message_size_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 4539 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4540 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4541 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4542 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4543 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4544 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 4545 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4546 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4547 | amqpvalue_destroy(max_message_size_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4548 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4549 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4550 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4551 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4552 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4553 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4554 | int attach_get_offered_capabilities(ATTACH_HANDLE attach, AMQP_VALUE* offered_capabilities_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 4555 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4556 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4557 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4558 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4559 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4560 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4561 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4562 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4563 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4564 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 4565 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
AzureIoTClient | 23:1111ee8bcba4 | 4566 | if (amqpvalue_get_composite_item_count(attach_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 4567 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4568 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4569 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4570 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4571 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4572 | if (item_count <= 11) |
AzureIoTClient | 23:1111ee8bcba4 | 4573 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4574 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4575 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4576 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4577 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4578 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(attach_instance->composite_value, 11); |
AzureIoTClient | 23:1111ee8bcba4 | 4579 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 4580 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 4581 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4582 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4583 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4584 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4585 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4586 | if (amqpvalue_get_array(item_value, offered_capabilities_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 4587 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4588 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4589 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4590 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4591 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4592 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 4593 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4594 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4595 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4596 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4597 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4598 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4599 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4600 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4601 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4602 | int attach_set_offered_capabilities(ATTACH_HANDLE attach, AMQP_VALUE offered_capabilities_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 4603 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4604 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4605 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4606 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4607 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4608 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4609 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4610 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4611 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4612 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
AzureIoTClient | 23:1111ee8bcba4 | 4613 | AMQP_VALUE offered_capabilities_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 4614 | if (offered_capabilities_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 4615 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4616 | offered_capabilities_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 4617 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4618 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4619 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4620 | offered_capabilities_amqp_value = amqpvalue_clone(offered_capabilities_value); |
AzureIoTClient | 23:1111ee8bcba4 | 4621 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4622 | if (offered_capabilities_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4623 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4624 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4625 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4626 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4627 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4628 | if (amqpvalue_set_composite_item(attach_instance->composite_value, 11, offered_capabilities_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 4629 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4630 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4631 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4632 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4633 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4634 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 4635 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4636 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4637 | amqpvalue_destroy(offered_capabilities_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4638 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4639 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4640 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4641 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4642 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4643 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4644 | int attach_get_desired_capabilities(ATTACH_HANDLE attach, AMQP_VALUE* desired_capabilities_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 4645 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4646 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4647 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4648 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4649 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4650 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4651 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4652 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4653 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4654 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 4655 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
AzureIoTClient | 23:1111ee8bcba4 | 4656 | if (amqpvalue_get_composite_item_count(attach_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 4657 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4658 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4659 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4660 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4661 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4662 | if (item_count <= 12) |
AzureIoTClient | 23:1111ee8bcba4 | 4663 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4664 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4665 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4666 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4667 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4668 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(attach_instance->composite_value, 12); |
AzureIoTClient | 23:1111ee8bcba4 | 4669 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 4670 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 4671 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4672 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4673 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4674 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4675 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4676 | if (amqpvalue_get_array(item_value, desired_capabilities_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 4677 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4678 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4679 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4680 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4681 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4682 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 4683 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4684 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4685 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4686 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4687 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4688 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4689 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4690 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4691 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4692 | int attach_set_desired_capabilities(ATTACH_HANDLE attach, AMQP_VALUE desired_capabilities_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 4693 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4694 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4695 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4696 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4697 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4698 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4699 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4700 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4701 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4702 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
AzureIoTClient | 23:1111ee8bcba4 | 4703 | AMQP_VALUE desired_capabilities_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 4704 | if (desired_capabilities_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 4705 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4706 | desired_capabilities_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 4707 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4708 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4709 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4710 | desired_capabilities_amqp_value = amqpvalue_clone(desired_capabilities_value); |
AzureIoTClient | 23:1111ee8bcba4 | 4711 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4712 | if (desired_capabilities_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4713 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4714 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4715 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4716 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4717 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4718 | if (amqpvalue_set_composite_item(attach_instance->composite_value, 12, desired_capabilities_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 4719 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4720 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4721 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4722 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4723 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4724 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 4725 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4726 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4727 | amqpvalue_destroy(desired_capabilities_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4728 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4729 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4730 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4731 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4732 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4733 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4734 | int attach_get_properties(ATTACH_HANDLE attach, fields* properties_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 4735 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4736 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4737 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4738 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4739 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4740 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4741 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4742 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4743 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4744 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 4745 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
AzureIoTClient | 23:1111ee8bcba4 | 4746 | if (amqpvalue_get_composite_item_count(attach_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 4747 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4748 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4749 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4750 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4751 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4752 | if (item_count <= 13) |
AzureIoTClient | 23:1111ee8bcba4 | 4753 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4754 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4755 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4756 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4757 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4758 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(attach_instance->composite_value, 13); |
AzureIoTClient | 23:1111ee8bcba4 | 4759 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 4760 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 4761 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4762 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4763 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4764 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4765 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4766 | if (amqpvalue_get_fields(item_value, properties_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 4767 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4768 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4769 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4770 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4771 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4772 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 4773 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4774 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4775 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4776 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4777 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4778 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4779 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4780 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4781 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4782 | int attach_set_properties(ATTACH_HANDLE attach, fields properties_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 4783 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4784 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4785 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4786 | if (attach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4787 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4788 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4789 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4790 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4791 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4792 | ATTACH_INSTANCE* attach_instance = (ATTACH_INSTANCE*)attach; |
Azure.IoT Build | 0:6ae2f7bca550 | 4793 | AMQP_VALUE properties_amqp_value = amqpvalue_create_fields(properties_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4794 | if (properties_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4795 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4796 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4797 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4798 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4799 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4800 | if (amqpvalue_set_composite_item(attach_instance->composite_value, 13, properties_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 4801 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4802 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4803 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4804 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4805 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4806 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 4807 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4808 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4809 | amqpvalue_destroy(properties_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4810 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4811 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4812 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4813 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4814 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4815 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4816 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4817 | /* flow */ |
Azure.IoT Build | 0:6ae2f7bca550 | 4818 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4819 | typedef struct FLOW_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 4820 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4821 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 4822 | } FLOW_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 4823 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4824 | static FLOW_HANDLE flow_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 4825 | { |
AzureIoTClient | 21:f9c433d8e6ca | 4826 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)malloc(sizeof(FLOW_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 4827 | if (flow_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4828 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4829 | flow_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 4830 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4831 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4832 | return flow_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 4833 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4834 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4835 | FLOW_HANDLE flow_create(uint32_t incoming_window_value, transfer_number next_outgoing_id_value, uint32_t outgoing_window_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 4836 | { |
AzureIoTClient | 21:f9c433d8e6ca | 4837 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)malloc(sizeof(FLOW_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 4838 | if (flow_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4839 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4840 | flow_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(19); |
Azure.IoT Build | 0:6ae2f7bca550 | 4841 | if (flow_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4842 | { |
AzureIoTClient | 21:f9c433d8e6ca | 4843 | free(flow_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 4844 | flow_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 4845 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4846 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4847 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4848 | AMQP_VALUE incoming_window_amqp_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 4849 | AMQP_VALUE next_outgoing_id_amqp_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 4850 | AMQP_VALUE outgoing_window_amqp_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 4851 | int result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 4852 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4853 | incoming_window_amqp_value = amqpvalue_create_uint(incoming_window_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4854 | if ((result == 0) && (amqpvalue_set_composite_item(flow_instance->composite_value, 1, incoming_window_amqp_value) != 0)) |
Azure.IoT Build | 0:6ae2f7bca550 | 4855 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4856 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4857 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4858 | next_outgoing_id_amqp_value = amqpvalue_create_transfer_number(next_outgoing_id_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4859 | if ((result == 0) && (amqpvalue_set_composite_item(flow_instance->composite_value, 2, next_outgoing_id_amqp_value) != 0)) |
Azure.IoT Build | 0:6ae2f7bca550 | 4860 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4861 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4862 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4863 | outgoing_window_amqp_value = amqpvalue_create_uint(outgoing_window_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4864 | if ((result == 0) && (amqpvalue_set_composite_item(flow_instance->composite_value, 3, outgoing_window_amqp_value) != 0)) |
Azure.IoT Build | 0:6ae2f7bca550 | 4865 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4866 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4867 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4868 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4869 | amqpvalue_destroy(incoming_window_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4870 | amqpvalue_destroy(next_outgoing_id_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4871 | amqpvalue_destroy(outgoing_window_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4872 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4873 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4874 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4875 | return flow_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 4876 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4877 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4878 | FLOW_HANDLE flow_clone(FLOW_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 4879 | { |
AzureIoTClient | 21:f9c433d8e6ca | 4880 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)malloc(sizeof(FLOW_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 4881 | if (flow_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4882 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4883 | flow_instance->composite_value = amqpvalue_clone(((FLOW_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4884 | if (flow_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4885 | { |
AzureIoTClient | 21:f9c433d8e6ca | 4886 | free(flow_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 4887 | flow_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 4888 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4889 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4890 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4891 | return flow_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 4892 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4893 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4894 | void flow_destroy(FLOW_HANDLE flow) |
Azure.IoT Build | 0:6ae2f7bca550 | 4895 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4896 | if (flow != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4897 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4898 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
Azure.IoT Build | 0:6ae2f7bca550 | 4899 | amqpvalue_destroy(flow_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 4900 | free(flow_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 4901 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4902 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4903 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4904 | AMQP_VALUE amqpvalue_create_flow(FLOW_HANDLE flow) |
Azure.IoT Build | 0:6ae2f7bca550 | 4905 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4906 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4907 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4908 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4909 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4910 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 4911 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4912 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4913 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4914 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
Azure.IoT Build | 0:6ae2f7bca550 | 4915 | result = amqpvalue_clone(flow_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4916 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4917 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4918 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4919 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4920 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4921 | bool is_flow_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 4922 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4923 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4924 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4925 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 4926 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 4927 | (descriptor_ulong == 19)) |
Azure.IoT Build | 0:6ae2f7bca550 | 4928 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4929 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 4930 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4931 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4932 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4933 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 4934 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4935 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4936 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4937 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4938 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4939 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4940 | int amqpvalue_get_flow(AMQP_VALUE value, FLOW_HANDLE* flow_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 4941 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4942 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 4943 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 4944 | *flow_handle = flow_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 4945 | if (*flow_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4946 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 4947 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4948 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4949 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4950 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4951 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 4952 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 4953 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 4954 | flow_destroy(*flow_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 4955 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 4956 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 4957 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 4958 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4959 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 4960 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 4961 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4962 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4963 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4964 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4965 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4966 | do |
AzureIoTClient | 23:1111ee8bcba4 | 4967 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4968 | AMQP_VALUE item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 4969 | /* next-incoming-id */ |
AzureIoTClient | 23:1111ee8bcba4 | 4970 | if (list_item_count > 0) |
AzureIoTClient | 23:1111ee8bcba4 | 4971 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4972 | item_value = amqpvalue_get_list_item(list_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 4973 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 4974 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4975 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 4976 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4977 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4978 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4979 | transfer_number next_incoming_id; |
AzureIoTClient | 23:1111ee8bcba4 | 4980 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 4981 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4982 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 4983 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4984 | else |
AzureIoTClient | 23:1111ee8bcba4 | 4985 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4986 | if (amqpvalue_get_transfer_number(item_value, &next_incoming_id) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 4987 | { |
AzureIoTClient | 23:1111ee8bcba4 | 4988 | flow_destroy(*flow_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 4989 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 4990 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 4991 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4992 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4993 | |
AzureIoTClient | 23:1111ee8bcba4 | 4994 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 4995 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4996 | } |
AzureIoTClient | 23:1111ee8bcba4 | 4997 | /* incoming-window */ |
AzureIoTClient | 23:1111ee8bcba4 | 4998 | if (list_item_count > 1) |
AzureIoTClient | 23:1111ee8bcba4 | 4999 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5000 | item_value = amqpvalue_get_list_item(list_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 5001 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 5002 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5003 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5004 | flow_destroy(*flow_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 5005 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5006 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 5007 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5008 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5009 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5010 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5011 | uint32_t incoming_window; |
AzureIoTClient | 23:1111ee8bcba4 | 5012 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 5013 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5014 | flow_destroy(*flow_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 5015 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5016 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 5017 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5018 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5019 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5020 | if (amqpvalue_get_uint(item_value, &incoming_window) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5021 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5022 | flow_destroy(*flow_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 5023 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5024 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 5025 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5026 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5027 | |
AzureIoTClient | 23:1111ee8bcba4 | 5028 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 5029 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5030 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5031 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5032 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5033 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5034 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5035 | /* next-outgoing-id */ |
AzureIoTClient | 23:1111ee8bcba4 | 5036 | if (list_item_count > 2) |
AzureIoTClient | 23:1111ee8bcba4 | 5037 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5038 | item_value = amqpvalue_get_list_item(list_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 5039 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 5040 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5041 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5042 | flow_destroy(*flow_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 5043 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5044 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 5045 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5046 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5047 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5048 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5049 | transfer_number next_outgoing_id; |
AzureIoTClient | 23:1111ee8bcba4 | 5050 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 5051 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5052 | flow_destroy(*flow_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 5053 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5054 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 5055 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5056 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5057 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5058 | if (amqpvalue_get_transfer_number(item_value, &next_outgoing_id) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5059 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5060 | flow_destroy(*flow_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 5061 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5062 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 5063 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5064 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5065 | |
AzureIoTClient | 23:1111ee8bcba4 | 5066 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 5067 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5068 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5069 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5070 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5071 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5072 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5073 | /* outgoing-window */ |
AzureIoTClient | 23:1111ee8bcba4 | 5074 | if (list_item_count > 3) |
AzureIoTClient | 23:1111ee8bcba4 | 5075 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5076 | item_value = amqpvalue_get_list_item(list_value, 3); |
AzureIoTClient | 23:1111ee8bcba4 | 5077 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 5078 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5079 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5080 | flow_destroy(*flow_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 5081 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5082 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 5083 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5084 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5085 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5086 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5087 | uint32_t outgoing_window; |
AzureIoTClient | 23:1111ee8bcba4 | 5088 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 5089 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5090 | flow_destroy(*flow_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 5091 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5092 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 5093 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5094 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5095 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5096 | if (amqpvalue_get_uint(item_value, &outgoing_window) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5097 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5098 | flow_destroy(*flow_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 5099 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5100 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 5101 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5102 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5103 | |
AzureIoTClient | 23:1111ee8bcba4 | 5104 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 5105 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5106 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5107 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5108 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5109 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5110 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5111 | /* handle */ |
AzureIoTClient | 23:1111ee8bcba4 | 5112 | if (list_item_count > 4) |
AzureIoTClient | 23:1111ee8bcba4 | 5113 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5114 | item_value = amqpvalue_get_list_item(list_value, 4); |
AzureIoTClient | 23:1111ee8bcba4 | 5115 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 5116 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5117 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 5118 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5119 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5120 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5121 | handle handle; |
AzureIoTClient | 23:1111ee8bcba4 | 5122 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 5123 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5124 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 5125 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5126 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5127 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5128 | if (amqpvalue_get_handle(item_value, &handle) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5129 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5130 | flow_destroy(*flow_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 5131 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5132 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 5133 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5134 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5135 | |
AzureIoTClient | 23:1111ee8bcba4 | 5136 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 5137 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5138 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5139 | /* delivery-count */ |
AzureIoTClient | 23:1111ee8bcba4 | 5140 | if (list_item_count > 5) |
AzureIoTClient | 23:1111ee8bcba4 | 5141 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5142 | item_value = amqpvalue_get_list_item(list_value, 5); |
AzureIoTClient | 23:1111ee8bcba4 | 5143 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 5144 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5145 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 5146 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5147 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5148 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5149 | sequence_no delivery_count; |
AzureIoTClient | 23:1111ee8bcba4 | 5150 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 5151 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5152 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 5153 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5154 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5155 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5156 | if (amqpvalue_get_sequence_no(item_value, &delivery_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5157 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5158 | flow_destroy(*flow_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 5159 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5160 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 5161 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5162 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5163 | |
AzureIoTClient | 23:1111ee8bcba4 | 5164 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 5165 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5166 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5167 | /* link-credit */ |
AzureIoTClient | 23:1111ee8bcba4 | 5168 | if (list_item_count > 6) |
AzureIoTClient | 23:1111ee8bcba4 | 5169 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5170 | item_value = amqpvalue_get_list_item(list_value, 6); |
AzureIoTClient | 23:1111ee8bcba4 | 5171 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 5172 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5173 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 5174 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5175 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5176 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5177 | uint32_t link_credit; |
AzureIoTClient | 23:1111ee8bcba4 | 5178 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 5179 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5180 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 5181 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5182 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5183 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5184 | if (amqpvalue_get_uint(item_value, &link_credit) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5185 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5186 | flow_destroy(*flow_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 5187 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5188 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 5189 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5190 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5191 | |
AzureIoTClient | 23:1111ee8bcba4 | 5192 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 5193 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5194 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5195 | /* available */ |
AzureIoTClient | 23:1111ee8bcba4 | 5196 | if (list_item_count > 7) |
AzureIoTClient | 23:1111ee8bcba4 | 5197 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5198 | item_value = amqpvalue_get_list_item(list_value, 7); |
AzureIoTClient | 23:1111ee8bcba4 | 5199 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 5200 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5201 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 5202 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5203 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5204 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5205 | uint32_t available; |
AzureIoTClient | 23:1111ee8bcba4 | 5206 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 5207 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5208 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 5209 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5210 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5211 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5212 | if (amqpvalue_get_uint(item_value, &available) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5213 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5214 | flow_destroy(*flow_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 5215 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5216 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 5217 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5218 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5219 | |
AzureIoTClient | 23:1111ee8bcba4 | 5220 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 5221 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5222 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5223 | /* drain */ |
AzureIoTClient | 23:1111ee8bcba4 | 5224 | if (list_item_count > 8) |
AzureIoTClient | 23:1111ee8bcba4 | 5225 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5226 | item_value = amqpvalue_get_list_item(list_value, 8); |
AzureIoTClient | 23:1111ee8bcba4 | 5227 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 5228 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5229 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 5230 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5231 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5232 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5233 | bool drain; |
AzureIoTClient | 23:1111ee8bcba4 | 5234 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 5235 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5236 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 5237 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5238 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5239 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5240 | if (amqpvalue_get_boolean(item_value, &drain) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5241 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5242 | flow_destroy(*flow_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 5243 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5244 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 5245 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5246 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5247 | |
AzureIoTClient | 23:1111ee8bcba4 | 5248 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 5249 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5250 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5251 | /* echo */ |
AzureIoTClient | 23:1111ee8bcba4 | 5252 | if (list_item_count > 9) |
AzureIoTClient | 23:1111ee8bcba4 | 5253 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5254 | item_value = amqpvalue_get_list_item(list_value, 9); |
AzureIoTClient | 23:1111ee8bcba4 | 5255 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 5256 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5257 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 5258 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5259 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5260 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5261 | bool echo; |
AzureIoTClient | 23:1111ee8bcba4 | 5262 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 5263 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5264 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 5265 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5266 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5267 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5268 | if (amqpvalue_get_boolean(item_value, &echo) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5269 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5270 | flow_destroy(*flow_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 5271 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5272 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 5273 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5274 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5275 | |
AzureIoTClient | 23:1111ee8bcba4 | 5276 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 5277 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5278 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5279 | /* properties */ |
AzureIoTClient | 23:1111ee8bcba4 | 5280 | if (list_item_count > 10) |
AzureIoTClient | 23:1111ee8bcba4 | 5281 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5282 | item_value = amqpvalue_get_list_item(list_value, 10); |
AzureIoTClient | 23:1111ee8bcba4 | 5283 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 5284 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5285 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 5286 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5287 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5288 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5289 | fields properties; |
AzureIoTClient | 23:1111ee8bcba4 | 5290 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 5291 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5292 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 5293 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5294 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5295 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5296 | if (amqpvalue_get_fields(item_value, &properties) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5297 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5298 | flow_destroy(*flow_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 5299 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5300 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 5301 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5302 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5303 | |
AzureIoTClient | 23:1111ee8bcba4 | 5304 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 5305 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5306 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5307 | |
AzureIoTClient | 23:1111ee8bcba4 | 5308 | flow_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 5309 | |
AzureIoTClient | 23:1111ee8bcba4 | 5310 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 5311 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 5312 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5313 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5314 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5315 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5316 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5317 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5318 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5319 | int flow_get_next_incoming_id(FLOW_HANDLE flow, transfer_number* next_incoming_id_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 5320 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5321 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5322 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5323 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5324 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5325 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5326 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5327 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5328 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5329 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 5330 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
AzureIoTClient | 23:1111ee8bcba4 | 5331 | if (amqpvalue_get_composite_item_count(flow_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5332 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5333 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5334 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5335 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5336 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5337 | if (item_count <= 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5338 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5339 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5340 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5341 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5342 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5343 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(flow_instance->composite_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 5344 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 5345 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 5346 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5347 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5348 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5349 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5350 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5351 | if (amqpvalue_get_transfer_number(item_value, next_incoming_id_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5352 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5353 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5354 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5355 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5356 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5357 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 5358 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5359 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5360 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5361 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5362 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5363 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5364 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5365 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5366 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5367 | int flow_set_next_incoming_id(FLOW_HANDLE flow, transfer_number next_incoming_id_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 5368 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5369 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5370 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5371 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5372 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5373 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5374 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5375 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5376 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5377 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
Azure.IoT Build | 0:6ae2f7bca550 | 5378 | AMQP_VALUE next_incoming_id_amqp_value = amqpvalue_create_transfer_number(next_incoming_id_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 5379 | if (next_incoming_id_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5380 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5381 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5382 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5383 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5384 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5385 | if (amqpvalue_set_composite_item(flow_instance->composite_value, 0, next_incoming_id_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 5386 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5387 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5388 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5389 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5390 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5391 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 5392 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5393 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5394 | amqpvalue_destroy(next_incoming_id_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 5395 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5396 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5397 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5398 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5399 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5400 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5401 | int flow_get_incoming_window(FLOW_HANDLE flow, uint32_t* incoming_window_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 5402 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5403 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5404 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5405 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5406 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5407 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5408 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5409 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5410 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5411 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 5412 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
AzureIoTClient | 23:1111ee8bcba4 | 5413 | if (amqpvalue_get_composite_item_count(flow_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5414 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5415 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5416 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5417 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5418 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5419 | if (item_count <= 1) |
AzureIoTClient | 23:1111ee8bcba4 | 5420 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5421 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5422 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5423 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5424 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5425 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(flow_instance->composite_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 5426 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 5427 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 5428 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5429 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5430 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5431 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5432 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5433 | if (amqpvalue_get_uint(item_value, incoming_window_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5434 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5435 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5436 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5437 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5438 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5439 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 5440 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5441 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5442 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5443 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5444 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5445 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5446 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5447 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5448 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5449 | int flow_set_incoming_window(FLOW_HANDLE flow, uint32_t incoming_window_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 5450 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5451 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5452 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5453 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5454 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5455 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5456 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5457 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5458 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5459 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
Azure.IoT Build | 0:6ae2f7bca550 | 5460 | AMQP_VALUE incoming_window_amqp_value = amqpvalue_create_uint(incoming_window_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 5461 | if (incoming_window_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5462 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5463 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5464 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5465 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5466 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5467 | if (amqpvalue_set_composite_item(flow_instance->composite_value, 1, incoming_window_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 5468 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5469 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5470 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5471 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5472 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5473 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 5474 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5475 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5476 | amqpvalue_destroy(incoming_window_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 5477 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5478 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5479 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5480 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5481 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5482 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5483 | int flow_get_next_outgoing_id(FLOW_HANDLE flow, transfer_number* next_outgoing_id_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 5484 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5485 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5486 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5487 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5488 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5489 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5490 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5491 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5492 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5493 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 5494 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
AzureIoTClient | 23:1111ee8bcba4 | 5495 | if (amqpvalue_get_composite_item_count(flow_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5496 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5497 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5498 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5499 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5500 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5501 | if (item_count <= 2) |
AzureIoTClient | 23:1111ee8bcba4 | 5502 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5503 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5504 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5505 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5506 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5507 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(flow_instance->composite_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 5508 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 5509 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 5510 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5511 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5512 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5513 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5514 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5515 | if (amqpvalue_get_transfer_number(item_value, next_outgoing_id_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5516 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5517 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5518 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5519 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5520 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5521 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 5522 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5523 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5524 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5525 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5526 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5527 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5528 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5529 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5530 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5531 | int flow_set_next_outgoing_id(FLOW_HANDLE flow, transfer_number next_outgoing_id_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 5532 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5533 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5534 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5535 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5536 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5537 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5538 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5539 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5540 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5541 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
Azure.IoT Build | 0:6ae2f7bca550 | 5542 | AMQP_VALUE next_outgoing_id_amqp_value = amqpvalue_create_transfer_number(next_outgoing_id_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 5543 | if (next_outgoing_id_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5544 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5545 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5546 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5547 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5548 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5549 | if (amqpvalue_set_composite_item(flow_instance->composite_value, 2, next_outgoing_id_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 5550 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5551 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5552 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5553 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5554 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5555 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 5556 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5557 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5558 | amqpvalue_destroy(next_outgoing_id_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 5559 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5560 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5561 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5562 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5563 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5564 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5565 | int flow_get_outgoing_window(FLOW_HANDLE flow, uint32_t* outgoing_window_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 5566 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5567 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5568 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5569 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5570 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5571 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5572 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5573 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5574 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5575 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 5576 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
AzureIoTClient | 23:1111ee8bcba4 | 5577 | if (amqpvalue_get_composite_item_count(flow_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5578 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5579 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5580 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5581 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5582 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5583 | if (item_count <= 3) |
AzureIoTClient | 23:1111ee8bcba4 | 5584 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5585 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5586 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5587 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5588 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5589 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(flow_instance->composite_value, 3); |
AzureIoTClient | 23:1111ee8bcba4 | 5590 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 5591 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 5592 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5593 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5594 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5595 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5596 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5597 | if (amqpvalue_get_uint(item_value, outgoing_window_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5598 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5599 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5600 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5601 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5602 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5603 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 5604 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5605 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5606 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5607 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5608 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5609 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5610 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5611 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5612 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5613 | int flow_set_outgoing_window(FLOW_HANDLE flow, uint32_t outgoing_window_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 5614 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5615 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5616 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5617 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5618 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5619 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5620 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5621 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5622 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5623 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
Azure.IoT Build | 0:6ae2f7bca550 | 5624 | AMQP_VALUE outgoing_window_amqp_value = amqpvalue_create_uint(outgoing_window_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 5625 | if (outgoing_window_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5626 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5627 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5628 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5629 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5630 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5631 | if (amqpvalue_set_composite_item(flow_instance->composite_value, 3, outgoing_window_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 5632 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5633 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5634 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5635 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5636 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5637 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 5638 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5639 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5640 | amqpvalue_destroy(outgoing_window_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 5641 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5642 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5643 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5644 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5645 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5646 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5647 | int flow_get_handle(FLOW_HANDLE flow, handle* handle_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 5648 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5649 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5650 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5651 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5652 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5653 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5654 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5655 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5656 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5657 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 5658 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
AzureIoTClient | 23:1111ee8bcba4 | 5659 | if (amqpvalue_get_composite_item_count(flow_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5660 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5661 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5662 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5663 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5664 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5665 | if (item_count <= 4) |
AzureIoTClient | 23:1111ee8bcba4 | 5666 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5667 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5668 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5669 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5670 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5671 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(flow_instance->composite_value, 4); |
AzureIoTClient | 23:1111ee8bcba4 | 5672 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 5673 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 5674 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5675 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5676 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5677 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5678 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5679 | if (amqpvalue_get_handle(item_value, handle_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5680 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5681 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5682 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5683 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5684 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5685 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 5686 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5687 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5688 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5689 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5690 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5691 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5692 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5693 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5694 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5695 | int flow_set_handle(FLOW_HANDLE flow, handle handle_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 5696 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5697 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5698 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5699 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5700 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5701 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5702 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5703 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5704 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5705 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
Azure.IoT Build | 0:6ae2f7bca550 | 5706 | AMQP_VALUE handle_amqp_value = amqpvalue_create_handle(handle_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 5707 | if (handle_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5708 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5709 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5710 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5711 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5712 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5713 | if (amqpvalue_set_composite_item(flow_instance->composite_value, 4, handle_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 5714 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5715 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5716 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5717 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5718 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5719 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 5720 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5721 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5722 | amqpvalue_destroy(handle_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 5723 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5724 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5725 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5726 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5727 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5728 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5729 | int flow_get_delivery_count(FLOW_HANDLE flow, sequence_no* delivery_count_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 5730 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5731 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5732 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5733 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5734 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5735 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5736 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5737 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5738 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5739 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 5740 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
AzureIoTClient | 23:1111ee8bcba4 | 5741 | if (amqpvalue_get_composite_item_count(flow_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5742 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5743 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5744 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5745 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5746 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5747 | if (item_count <= 5) |
AzureIoTClient | 23:1111ee8bcba4 | 5748 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5749 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5750 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5751 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5752 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5753 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(flow_instance->composite_value, 5); |
AzureIoTClient | 23:1111ee8bcba4 | 5754 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 5755 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 5756 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5757 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5758 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5759 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5760 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5761 | if (amqpvalue_get_sequence_no(item_value, delivery_count_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5762 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5763 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5764 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5765 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5766 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5767 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 5768 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5769 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5770 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5771 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5772 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5773 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5774 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5775 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5776 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5777 | int flow_set_delivery_count(FLOW_HANDLE flow, sequence_no delivery_count_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 5778 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5779 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5780 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5781 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5782 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5783 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5784 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5785 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5786 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5787 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
Azure.IoT Build | 0:6ae2f7bca550 | 5788 | AMQP_VALUE delivery_count_amqp_value = amqpvalue_create_sequence_no(delivery_count_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 5789 | if (delivery_count_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5790 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5791 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5792 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5793 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5794 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5795 | if (amqpvalue_set_composite_item(flow_instance->composite_value, 5, delivery_count_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 5796 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5797 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5798 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5799 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5800 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5801 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 5802 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5803 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5804 | amqpvalue_destroy(delivery_count_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 5805 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5806 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5807 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5808 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5809 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5810 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5811 | int flow_get_link_credit(FLOW_HANDLE flow, uint32_t* link_credit_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 5812 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5813 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5814 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5815 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5816 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5817 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5818 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5819 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5820 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5821 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 5822 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
AzureIoTClient | 23:1111ee8bcba4 | 5823 | if (amqpvalue_get_composite_item_count(flow_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5824 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5825 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5826 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5827 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5828 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5829 | if (item_count <= 6) |
AzureIoTClient | 23:1111ee8bcba4 | 5830 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5831 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5832 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5833 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5834 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5835 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(flow_instance->composite_value, 6); |
AzureIoTClient | 23:1111ee8bcba4 | 5836 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 5837 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 5838 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5839 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5840 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5841 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5842 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5843 | if (amqpvalue_get_uint(item_value, link_credit_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5844 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5845 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5846 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5847 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5848 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5849 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 5850 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5851 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5852 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5853 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5854 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5855 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5856 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5857 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5858 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5859 | int flow_set_link_credit(FLOW_HANDLE flow, uint32_t link_credit_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 5860 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5861 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5862 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5863 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5864 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5865 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5866 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5867 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5868 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5869 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
Azure.IoT Build | 0:6ae2f7bca550 | 5870 | AMQP_VALUE link_credit_amqp_value = amqpvalue_create_uint(link_credit_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 5871 | if (link_credit_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5872 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5873 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5874 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5875 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5876 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5877 | if (amqpvalue_set_composite_item(flow_instance->composite_value, 6, link_credit_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 5878 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5879 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5880 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5881 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5882 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5883 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 5884 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5885 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5886 | amqpvalue_destroy(link_credit_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 5887 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5888 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5889 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5890 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5891 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5892 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5893 | int flow_get_available(FLOW_HANDLE flow, uint32_t* available_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 5894 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5895 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5896 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5897 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5898 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5899 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5900 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5901 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5902 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5903 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 5904 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
AzureIoTClient | 23:1111ee8bcba4 | 5905 | if (amqpvalue_get_composite_item_count(flow_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5906 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5907 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5908 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5909 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5910 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5911 | if (item_count <= 7) |
AzureIoTClient | 23:1111ee8bcba4 | 5912 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5913 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5914 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5915 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5916 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5917 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(flow_instance->composite_value, 7); |
AzureIoTClient | 23:1111ee8bcba4 | 5918 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 5919 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 5920 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5921 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5922 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5923 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5924 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5925 | if (amqpvalue_get_uint(item_value, available_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5926 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5927 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5928 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5929 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5930 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5931 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 5932 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5933 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5934 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5935 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5936 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5937 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5938 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5939 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5940 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5941 | int flow_set_available(FLOW_HANDLE flow, uint32_t available_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 5942 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5943 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5944 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5945 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5946 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5947 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5948 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5949 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5950 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5951 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
Azure.IoT Build | 0:6ae2f7bca550 | 5952 | AMQP_VALUE available_amqp_value = amqpvalue_create_uint(available_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 5953 | if (available_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5954 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5955 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5956 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5957 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5958 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5959 | if (amqpvalue_set_composite_item(flow_instance->composite_value, 7, available_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 5960 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5961 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5962 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5963 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5964 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5965 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 5966 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5967 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5968 | amqpvalue_destroy(available_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 5969 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5970 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5971 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5972 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5973 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5974 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5975 | int flow_get_drain(FLOW_HANDLE flow, bool* drain_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 5976 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 5977 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 5978 | |
Azure.IoT Build | 0:6ae2f7bca550 | 5979 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 5980 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 5981 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 5982 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 5983 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 5984 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5985 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 5986 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
AzureIoTClient | 23:1111ee8bcba4 | 5987 | if (amqpvalue_get_composite_item_count(flow_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 5988 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5989 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 5990 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5991 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5992 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5993 | if (item_count <= 8) |
AzureIoTClient | 23:1111ee8bcba4 | 5994 | { |
AzureIoTClient | 23:1111ee8bcba4 | 5995 | *drain_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 5996 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 5997 | } |
AzureIoTClient | 23:1111ee8bcba4 | 5998 | else |
AzureIoTClient | 23:1111ee8bcba4 | 5999 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6000 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(flow_instance->composite_value, 8); |
AzureIoTClient | 23:1111ee8bcba4 | 6001 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 6002 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 6003 | { |
AzureIoTClient | 16:22a72cf8e416 | 6004 | *drain_value = false; |
AzureIoTClient | 16:22a72cf8e416 | 6005 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 6006 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6007 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6008 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6009 | if (amqpvalue_get_boolean(item_value, drain_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6010 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6011 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6012 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6013 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6014 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6015 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6016 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6017 | *drain_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 6018 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 6019 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6020 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6021 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6022 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6023 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 6024 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6025 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6026 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6027 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6028 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6029 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6030 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6031 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6032 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6033 | int flow_set_drain(FLOW_HANDLE flow, bool drain_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 6034 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6035 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6036 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6037 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6038 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6039 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6040 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6041 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6042 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6043 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
Azure.IoT Build | 0:6ae2f7bca550 | 6044 | AMQP_VALUE drain_amqp_value = amqpvalue_create_boolean(drain_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 6045 | if (drain_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6046 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6047 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6048 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6049 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6050 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6051 | if (amqpvalue_set_composite_item(flow_instance->composite_value, 8, drain_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 6052 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6053 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6054 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6055 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6056 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6057 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 6058 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6059 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6060 | amqpvalue_destroy(drain_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 6061 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6062 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6063 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6064 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6065 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6066 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6067 | int flow_get_echo(FLOW_HANDLE flow, bool* echo_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 6068 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6069 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6070 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6071 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6072 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6073 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6074 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6075 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6076 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6077 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 6078 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
AzureIoTClient | 23:1111ee8bcba4 | 6079 | if (amqpvalue_get_composite_item_count(flow_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6080 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6081 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6082 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6083 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6084 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6085 | if (item_count <= 9) |
AzureIoTClient | 23:1111ee8bcba4 | 6086 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6087 | *echo_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 6088 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 6089 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6090 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6091 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6092 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(flow_instance->composite_value, 9); |
AzureIoTClient | 23:1111ee8bcba4 | 6093 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 6094 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 6095 | { |
AzureIoTClient | 16:22a72cf8e416 | 6096 | *echo_value = false; |
AzureIoTClient | 16:22a72cf8e416 | 6097 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 6098 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6099 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6100 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6101 | if (amqpvalue_get_boolean(item_value, echo_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6102 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6103 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6104 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6105 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6106 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6107 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6108 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6109 | *echo_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 6110 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 6111 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6112 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6113 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6114 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6115 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 6116 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6117 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6118 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6119 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6120 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6121 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6122 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6123 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6124 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6125 | int flow_set_echo(FLOW_HANDLE flow, bool echo_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 6126 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6127 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6128 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6129 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6130 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6131 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6132 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6133 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6134 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6135 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
Azure.IoT Build | 0:6ae2f7bca550 | 6136 | AMQP_VALUE echo_amqp_value = amqpvalue_create_boolean(echo_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 6137 | if (echo_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6138 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6139 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6140 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6141 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6142 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6143 | if (amqpvalue_set_composite_item(flow_instance->composite_value, 9, echo_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 6144 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6145 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6146 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6147 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6148 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6149 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 6150 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6151 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6152 | amqpvalue_destroy(echo_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 6153 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6154 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6155 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6156 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6157 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6158 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6159 | int flow_get_properties(FLOW_HANDLE flow, fields* properties_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 6160 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6161 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6162 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6163 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6164 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6165 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6166 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6167 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6168 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6169 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 6170 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
AzureIoTClient | 23:1111ee8bcba4 | 6171 | if (amqpvalue_get_composite_item_count(flow_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6172 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6173 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6174 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6175 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6176 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6177 | if (item_count <= 10) |
AzureIoTClient | 23:1111ee8bcba4 | 6178 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6179 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6180 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6181 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6182 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6183 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(flow_instance->composite_value, 10); |
AzureIoTClient | 23:1111ee8bcba4 | 6184 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 6185 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 6186 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6187 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6188 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6189 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6190 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6191 | if (amqpvalue_get_fields(item_value, properties_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6192 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6193 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6194 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6195 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6196 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6197 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 6198 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6199 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6200 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6201 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6202 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6203 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6204 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6205 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6206 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6207 | int flow_set_properties(FLOW_HANDLE flow, fields properties_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 6208 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6209 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6210 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6211 | if (flow == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6212 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6213 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6214 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6215 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6216 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6217 | FLOW_INSTANCE* flow_instance = (FLOW_INSTANCE*)flow; |
Azure.IoT Build | 0:6ae2f7bca550 | 6218 | AMQP_VALUE properties_amqp_value = amqpvalue_create_fields(properties_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 6219 | if (properties_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6220 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6221 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6222 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6223 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6224 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6225 | if (amqpvalue_set_composite_item(flow_instance->composite_value, 10, properties_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 6226 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6227 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6228 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6229 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6230 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6231 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 6232 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6233 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6234 | amqpvalue_destroy(properties_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 6235 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6236 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6237 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6238 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6239 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6240 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6241 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6242 | /* transfer */ |
Azure.IoT Build | 0:6ae2f7bca550 | 6243 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6244 | typedef struct TRANSFER_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 6245 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6246 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 6247 | } TRANSFER_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 6248 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6249 | static TRANSFER_HANDLE transfer_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 6250 | { |
AzureIoTClient | 21:f9c433d8e6ca | 6251 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)malloc(sizeof(TRANSFER_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 6252 | if (transfer_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6253 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6254 | transfer_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 6255 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6256 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6257 | return transfer_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 6258 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6259 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6260 | TRANSFER_HANDLE transfer_create(handle handle_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 6261 | { |
AzureIoTClient | 21:f9c433d8e6ca | 6262 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)malloc(sizeof(TRANSFER_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 6263 | if (transfer_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6264 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6265 | transfer_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(20); |
Azure.IoT Build | 0:6ae2f7bca550 | 6266 | if (transfer_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6267 | { |
AzureIoTClient | 21:f9c433d8e6ca | 6268 | free(transfer_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 6269 | transfer_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 6270 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6271 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6272 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6273 | AMQP_VALUE handle_amqp_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 6274 | int result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 6275 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6276 | handle_amqp_value = amqpvalue_create_handle(handle_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 6277 | if ((result == 0) && (amqpvalue_set_composite_item(transfer_instance->composite_value, 0, handle_amqp_value) != 0)) |
Azure.IoT Build | 0:6ae2f7bca550 | 6278 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6279 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6280 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6281 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6282 | amqpvalue_destroy(handle_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 6283 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6284 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6285 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6286 | return transfer_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 6287 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6288 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6289 | TRANSFER_HANDLE transfer_clone(TRANSFER_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 6290 | { |
AzureIoTClient | 21:f9c433d8e6ca | 6291 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)malloc(sizeof(TRANSFER_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 6292 | if (transfer_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6293 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6294 | transfer_instance->composite_value = amqpvalue_clone(((TRANSFER_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 6295 | if (transfer_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6296 | { |
AzureIoTClient | 21:f9c433d8e6ca | 6297 | free(transfer_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 6298 | transfer_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 6299 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6300 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6301 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6302 | return transfer_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 6303 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6304 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6305 | void transfer_destroy(TRANSFER_HANDLE transfer) |
Azure.IoT Build | 0:6ae2f7bca550 | 6306 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6307 | if (transfer != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6308 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6309 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
Azure.IoT Build | 0:6ae2f7bca550 | 6310 | amqpvalue_destroy(transfer_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 6311 | free(transfer_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 6312 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6313 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6314 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6315 | AMQP_VALUE amqpvalue_create_transfer(TRANSFER_HANDLE transfer) |
Azure.IoT Build | 0:6ae2f7bca550 | 6316 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6317 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6318 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6319 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6320 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6321 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 6322 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6323 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6324 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6325 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
Azure.IoT Build | 0:6ae2f7bca550 | 6326 | result = amqpvalue_clone(transfer_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 6327 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6328 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6329 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6330 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6331 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6332 | bool is_transfer_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 6333 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6334 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6335 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6336 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 6337 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 6338 | (descriptor_ulong == 20)) |
Azure.IoT Build | 0:6ae2f7bca550 | 6339 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6340 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 6341 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6342 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6343 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6344 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 6345 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6346 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6347 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6348 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6349 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6350 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6351 | int amqpvalue_get_transfer(AMQP_VALUE value, TRANSFER_HANDLE* transfer_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 6352 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6353 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6354 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 6355 | *transfer_handle = transfer_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 6356 | if (*transfer_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6357 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6358 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6359 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6360 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6361 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6362 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 6363 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6364 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6365 | transfer_destroy(*transfer_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 6366 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6367 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6368 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6369 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6370 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 6371 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6372 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6373 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6374 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6375 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6376 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6377 | do |
AzureIoTClient | 23:1111ee8bcba4 | 6378 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6379 | AMQP_VALUE item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 6380 | /* handle */ |
AzureIoTClient | 23:1111ee8bcba4 | 6381 | if (list_item_count > 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6382 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6383 | item_value = amqpvalue_get_list_item(list_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 6384 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6385 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6386 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6387 | transfer_destroy(*transfer_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 6388 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6389 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 6390 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6391 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6392 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6393 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6394 | handle handle; |
AzureIoTClient | 23:1111ee8bcba4 | 6395 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6396 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6397 | transfer_destroy(*transfer_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 6398 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6399 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 6400 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6401 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6402 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6403 | if (amqpvalue_get_handle(item_value, &handle) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6404 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6405 | transfer_destroy(*transfer_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 6406 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6407 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 6408 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6409 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6410 | |
AzureIoTClient | 23:1111ee8bcba4 | 6411 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 6412 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6413 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6414 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6415 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6416 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6417 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6418 | /* delivery-id */ |
AzureIoTClient | 23:1111ee8bcba4 | 6419 | if (list_item_count > 1) |
AzureIoTClient | 23:1111ee8bcba4 | 6420 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6421 | item_value = amqpvalue_get_list_item(list_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 6422 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6423 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6424 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 6425 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6426 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6427 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6428 | delivery_number delivery_id; |
AzureIoTClient | 23:1111ee8bcba4 | 6429 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6430 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6431 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 6432 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6433 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6434 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6435 | if (amqpvalue_get_delivery_number(item_value, &delivery_id) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6436 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6437 | transfer_destroy(*transfer_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 6438 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6439 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 6440 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6441 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6442 | |
AzureIoTClient | 23:1111ee8bcba4 | 6443 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 6444 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6445 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6446 | /* delivery-tag */ |
AzureIoTClient | 23:1111ee8bcba4 | 6447 | if (list_item_count > 2) |
AzureIoTClient | 23:1111ee8bcba4 | 6448 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6449 | item_value = amqpvalue_get_list_item(list_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 6450 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6451 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6452 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 6453 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6454 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6455 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6456 | delivery_tag delivery_tag; |
AzureIoTClient | 23:1111ee8bcba4 | 6457 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6458 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6459 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 6460 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6461 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6462 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6463 | if (amqpvalue_get_delivery_tag(item_value, &delivery_tag) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6464 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6465 | transfer_destroy(*transfer_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 6466 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6467 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 6468 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6469 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6470 | |
AzureIoTClient | 23:1111ee8bcba4 | 6471 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 6472 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6473 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6474 | /* message-format */ |
AzureIoTClient | 23:1111ee8bcba4 | 6475 | if (list_item_count > 3) |
AzureIoTClient | 23:1111ee8bcba4 | 6476 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6477 | item_value = amqpvalue_get_list_item(list_value, 3); |
AzureIoTClient | 23:1111ee8bcba4 | 6478 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6479 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6480 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 6481 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6482 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6483 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6484 | message_format message_format; |
AzureIoTClient | 23:1111ee8bcba4 | 6485 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6486 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6487 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 6488 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6489 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6490 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6491 | if (amqpvalue_get_message_format(item_value, &message_format) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6492 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6493 | transfer_destroy(*transfer_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 6494 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6495 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 6496 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6497 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6498 | |
AzureIoTClient | 23:1111ee8bcba4 | 6499 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 6500 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6501 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6502 | /* settled */ |
AzureIoTClient | 23:1111ee8bcba4 | 6503 | if (list_item_count > 4) |
AzureIoTClient | 23:1111ee8bcba4 | 6504 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6505 | item_value = amqpvalue_get_list_item(list_value, 4); |
AzureIoTClient | 23:1111ee8bcba4 | 6506 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6507 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6508 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 6509 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6510 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6511 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6512 | bool settled; |
AzureIoTClient | 23:1111ee8bcba4 | 6513 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6514 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6515 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 6516 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6517 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6518 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6519 | if (amqpvalue_get_boolean(item_value, &settled) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6520 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6521 | transfer_destroy(*transfer_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 6522 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6523 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 6524 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6525 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6526 | |
AzureIoTClient | 23:1111ee8bcba4 | 6527 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 6528 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6529 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6530 | /* more */ |
AzureIoTClient | 23:1111ee8bcba4 | 6531 | if (list_item_count > 5) |
AzureIoTClient | 23:1111ee8bcba4 | 6532 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6533 | item_value = amqpvalue_get_list_item(list_value, 5); |
AzureIoTClient | 23:1111ee8bcba4 | 6534 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6535 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6536 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 6537 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6538 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6539 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6540 | bool more; |
AzureIoTClient | 23:1111ee8bcba4 | 6541 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6542 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6543 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 6544 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6545 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6546 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6547 | if (amqpvalue_get_boolean(item_value, &more) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6548 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6549 | transfer_destroy(*transfer_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 6550 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6551 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 6552 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6553 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6554 | |
AzureIoTClient | 23:1111ee8bcba4 | 6555 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 6556 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6557 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6558 | /* rcv-settle-mode */ |
AzureIoTClient | 23:1111ee8bcba4 | 6559 | if (list_item_count > 6) |
AzureIoTClient | 23:1111ee8bcba4 | 6560 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6561 | item_value = amqpvalue_get_list_item(list_value, 6); |
AzureIoTClient | 23:1111ee8bcba4 | 6562 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6563 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6564 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 6565 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6566 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6567 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6568 | receiver_settle_mode rcv_settle_mode; |
AzureIoTClient | 23:1111ee8bcba4 | 6569 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6570 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6571 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 6572 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6573 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6574 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6575 | if (amqpvalue_get_receiver_settle_mode(item_value, &rcv_settle_mode) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6576 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6577 | transfer_destroy(*transfer_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 6578 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6579 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 6580 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6581 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6582 | |
AzureIoTClient | 23:1111ee8bcba4 | 6583 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 6584 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6585 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6586 | /* state */ |
AzureIoTClient | 23:1111ee8bcba4 | 6587 | if (list_item_count > 7) |
AzureIoTClient | 23:1111ee8bcba4 | 6588 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6589 | item_value = amqpvalue_get_list_item(list_value, 7); |
AzureIoTClient | 23:1111ee8bcba4 | 6590 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6591 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6592 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 6593 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6594 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6595 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6596 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 6597 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6598 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6599 | /* resume */ |
AzureIoTClient | 23:1111ee8bcba4 | 6600 | if (list_item_count > 8) |
AzureIoTClient | 23:1111ee8bcba4 | 6601 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6602 | item_value = amqpvalue_get_list_item(list_value, 8); |
AzureIoTClient | 23:1111ee8bcba4 | 6603 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6604 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6605 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 6606 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6607 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6608 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6609 | bool resume; |
AzureIoTClient | 23:1111ee8bcba4 | 6610 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6611 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6612 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 6613 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6614 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6615 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6616 | if (amqpvalue_get_boolean(item_value, &resume) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6617 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6618 | transfer_destroy(*transfer_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 6619 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6620 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 6621 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6622 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6623 | |
AzureIoTClient | 23:1111ee8bcba4 | 6624 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 6625 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6626 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6627 | /* aborted */ |
AzureIoTClient | 23:1111ee8bcba4 | 6628 | if (list_item_count > 9) |
AzureIoTClient | 23:1111ee8bcba4 | 6629 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6630 | item_value = amqpvalue_get_list_item(list_value, 9); |
AzureIoTClient | 23:1111ee8bcba4 | 6631 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6632 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6633 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 6634 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6635 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6636 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6637 | bool aborted; |
AzureIoTClient | 23:1111ee8bcba4 | 6638 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6639 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6640 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 6641 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6642 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6643 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6644 | if (amqpvalue_get_boolean(item_value, &aborted) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6645 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6646 | transfer_destroy(*transfer_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 6647 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6648 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 6649 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6650 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6651 | |
AzureIoTClient | 23:1111ee8bcba4 | 6652 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 6653 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6654 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6655 | /* batchable */ |
AzureIoTClient | 23:1111ee8bcba4 | 6656 | if (list_item_count > 10) |
AzureIoTClient | 23:1111ee8bcba4 | 6657 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6658 | item_value = amqpvalue_get_list_item(list_value, 10); |
AzureIoTClient | 23:1111ee8bcba4 | 6659 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6660 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6661 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 6662 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6663 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6664 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6665 | bool batchable; |
AzureIoTClient | 23:1111ee8bcba4 | 6666 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 6667 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6668 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 6669 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6670 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6671 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6672 | if (amqpvalue_get_boolean(item_value, &batchable) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6673 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6674 | transfer_destroy(*transfer_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 6675 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6676 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 6677 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6678 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6679 | |
AzureIoTClient | 23:1111ee8bcba4 | 6680 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 6681 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6682 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6683 | |
AzureIoTClient | 23:1111ee8bcba4 | 6684 | transfer_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 6685 | |
AzureIoTClient | 23:1111ee8bcba4 | 6686 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 6687 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 6688 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6689 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6690 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6691 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6692 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6693 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6694 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6695 | int transfer_get_handle(TRANSFER_HANDLE transfer, handle* handle_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 6696 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6697 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6698 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6699 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6700 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6701 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6702 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6703 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6704 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6705 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 6706 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
AzureIoTClient | 23:1111ee8bcba4 | 6707 | if (amqpvalue_get_composite_item_count(transfer_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6708 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6709 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6710 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6711 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6712 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6713 | if (item_count <= 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6714 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6715 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6716 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6717 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6718 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6719 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(transfer_instance->composite_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 6720 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 6721 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 6722 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6723 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6724 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6725 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6726 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6727 | if (amqpvalue_get_handle(item_value, handle_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6728 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6729 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6730 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6731 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6732 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6733 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 6734 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6735 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6736 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6737 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6738 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6739 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6740 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6741 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6742 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6743 | int transfer_set_handle(TRANSFER_HANDLE transfer, handle handle_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 6744 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6745 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6746 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6747 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6748 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6749 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6750 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6751 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6752 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6753 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
Azure.IoT Build | 0:6ae2f7bca550 | 6754 | AMQP_VALUE handle_amqp_value = amqpvalue_create_handle(handle_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 6755 | if (handle_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6756 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6757 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6758 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6759 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6760 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6761 | if (amqpvalue_set_composite_item(transfer_instance->composite_value, 0, handle_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 6762 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6763 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6764 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6765 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6766 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6767 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 6768 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6769 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6770 | amqpvalue_destroy(handle_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 6771 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6772 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6773 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6774 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6775 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6776 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6777 | int transfer_get_delivery_id(TRANSFER_HANDLE transfer, delivery_number* delivery_id_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 6778 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6779 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6780 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6781 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6782 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6783 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6784 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6785 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6786 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6787 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 6788 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
AzureIoTClient | 23:1111ee8bcba4 | 6789 | if (amqpvalue_get_composite_item_count(transfer_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6790 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6791 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6792 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6793 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6794 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6795 | if (item_count <= 1) |
AzureIoTClient | 23:1111ee8bcba4 | 6796 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6797 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6798 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6799 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6800 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6801 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(transfer_instance->composite_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 6802 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 6803 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 6804 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6805 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6806 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6807 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6808 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6809 | if (amqpvalue_get_delivery_number(item_value, delivery_id_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6810 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6811 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6812 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6813 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6814 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6815 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 6816 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6817 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6818 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6819 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6820 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6821 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6822 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6823 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6824 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6825 | int transfer_set_delivery_id(TRANSFER_HANDLE transfer, delivery_number delivery_id_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 6826 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6827 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6828 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6829 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6830 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6831 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6832 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6833 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6834 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6835 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
Azure.IoT Build | 0:6ae2f7bca550 | 6836 | AMQP_VALUE delivery_id_amqp_value = amqpvalue_create_delivery_number(delivery_id_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 6837 | if (delivery_id_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6838 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6839 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6840 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6841 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6842 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6843 | if (amqpvalue_set_composite_item(transfer_instance->composite_value, 1, delivery_id_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 6844 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6845 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6846 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6847 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6848 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6849 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 6850 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6851 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6852 | amqpvalue_destroy(delivery_id_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 6853 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6854 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6855 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6856 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6857 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6858 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6859 | int transfer_get_delivery_tag(TRANSFER_HANDLE transfer, delivery_tag* delivery_tag_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 6860 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6861 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6862 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6863 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6864 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6865 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6866 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6867 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6868 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6869 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 6870 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
AzureIoTClient | 23:1111ee8bcba4 | 6871 | if (amqpvalue_get_composite_item_count(transfer_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6872 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6873 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6874 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6875 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6876 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6877 | if (item_count <= 2) |
AzureIoTClient | 23:1111ee8bcba4 | 6878 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6879 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6880 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6881 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6882 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6883 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(transfer_instance->composite_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 6884 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 6885 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 6886 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6887 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6888 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6889 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6890 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6891 | if (amqpvalue_get_delivery_tag(item_value, delivery_tag_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6892 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6893 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6894 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6895 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6896 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6897 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 6898 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6899 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6900 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6901 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6902 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6903 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6904 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6905 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6906 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6907 | int transfer_set_delivery_tag(TRANSFER_HANDLE transfer, delivery_tag delivery_tag_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 6908 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6909 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6910 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6911 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6912 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6913 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6914 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6915 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6916 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6917 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
Azure.IoT Build | 0:6ae2f7bca550 | 6918 | AMQP_VALUE delivery_tag_amqp_value = amqpvalue_create_delivery_tag(delivery_tag_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 6919 | if (delivery_tag_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6920 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6921 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6922 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6923 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6924 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6925 | if (amqpvalue_set_composite_item(transfer_instance->composite_value, 2, delivery_tag_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 6926 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6927 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6928 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6929 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6930 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6931 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 6932 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6933 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6934 | amqpvalue_destroy(delivery_tag_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 6935 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6936 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6937 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6938 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6939 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6940 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6941 | int transfer_get_message_format(TRANSFER_HANDLE transfer, message_format* message_format_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 6942 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6943 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6944 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6945 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6946 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6947 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6948 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6949 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6950 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6951 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 6952 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
AzureIoTClient | 23:1111ee8bcba4 | 6953 | if (amqpvalue_get_composite_item_count(transfer_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6954 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6955 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6956 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6957 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6958 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6959 | if (item_count <= 3) |
AzureIoTClient | 23:1111ee8bcba4 | 6960 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6961 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6962 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6963 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6964 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6965 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(transfer_instance->composite_value, 3); |
AzureIoTClient | 23:1111ee8bcba4 | 6966 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 6967 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 6968 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6969 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6970 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6971 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6972 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6973 | if (amqpvalue_get_message_format(item_value, message_format_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 6974 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6975 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 6976 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6977 | else |
AzureIoTClient | 23:1111ee8bcba4 | 6978 | { |
AzureIoTClient | 23:1111ee8bcba4 | 6979 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 6980 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6981 | } |
AzureIoTClient | 23:1111ee8bcba4 | 6982 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6983 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6984 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6985 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6986 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6987 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6988 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6989 | int transfer_set_message_format(TRANSFER_HANDLE transfer, message_format message_format_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 6990 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6991 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 6992 | |
Azure.IoT Build | 0:6ae2f7bca550 | 6993 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 6994 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 6995 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 6996 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 6997 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 6998 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 6999 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
Azure.IoT Build | 0:6ae2f7bca550 | 7000 | AMQP_VALUE message_format_amqp_value = amqpvalue_create_message_format(message_format_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 7001 | if (message_format_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7002 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7003 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7004 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7005 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7006 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7007 | if (amqpvalue_set_composite_item(transfer_instance->composite_value, 3, message_format_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 7008 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7009 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7010 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7011 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7012 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7013 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 7014 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7015 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7016 | amqpvalue_destroy(message_format_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 7017 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7018 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7019 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7020 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7021 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7022 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7023 | int transfer_get_settled(TRANSFER_HANDLE transfer, bool* settled_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 7024 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7025 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7026 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7027 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7028 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7029 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7030 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7031 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7032 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7033 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 7034 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
AzureIoTClient | 23:1111ee8bcba4 | 7035 | if (amqpvalue_get_composite_item_count(transfer_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 7036 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7037 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7038 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7039 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7040 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7041 | if (item_count <= 4) |
AzureIoTClient | 23:1111ee8bcba4 | 7042 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7043 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7044 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7045 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7046 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7047 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(transfer_instance->composite_value, 4); |
AzureIoTClient | 23:1111ee8bcba4 | 7048 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 7049 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 7050 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7051 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7052 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7053 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7054 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7055 | if (amqpvalue_get_boolean(item_value, settled_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 7056 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7057 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7058 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7059 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7060 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7061 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 7062 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7063 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7064 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7065 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7066 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7067 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7068 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7069 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7070 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7071 | int transfer_set_settled(TRANSFER_HANDLE transfer, bool settled_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 7072 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7073 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7074 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7075 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7076 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7077 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7078 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7079 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7080 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7081 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
Azure.IoT Build | 0:6ae2f7bca550 | 7082 | AMQP_VALUE settled_amqp_value = amqpvalue_create_boolean(settled_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 7083 | if (settled_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7084 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7085 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7086 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7087 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7088 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7089 | if (amqpvalue_set_composite_item(transfer_instance->composite_value, 4, settled_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 7090 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7091 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7092 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7093 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7094 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7095 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 7096 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7097 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7098 | amqpvalue_destroy(settled_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 7099 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7100 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7101 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7102 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7103 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7104 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7105 | int transfer_get_more(TRANSFER_HANDLE transfer, bool* more_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 7106 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7107 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7108 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7109 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7110 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7111 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7112 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7113 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7114 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7115 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 7116 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
AzureIoTClient | 23:1111ee8bcba4 | 7117 | if (amqpvalue_get_composite_item_count(transfer_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 7118 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7119 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7120 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7121 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7122 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7123 | if (item_count <= 5) |
AzureIoTClient | 23:1111ee8bcba4 | 7124 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7125 | *more_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 7126 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 7127 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7128 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7129 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7130 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(transfer_instance->composite_value, 5); |
AzureIoTClient | 23:1111ee8bcba4 | 7131 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 7132 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 7133 | { |
AzureIoTClient | 16:22a72cf8e416 | 7134 | *more_value = false; |
AzureIoTClient | 16:22a72cf8e416 | 7135 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 7136 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7137 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7138 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7139 | if (amqpvalue_get_boolean(item_value, more_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 7140 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7141 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 7142 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7143 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7144 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7145 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7146 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7147 | *more_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 7148 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 7149 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7150 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7151 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7152 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7153 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 7154 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7155 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7156 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7157 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7158 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7159 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7160 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7161 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7162 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7163 | int transfer_set_more(TRANSFER_HANDLE transfer, bool more_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 7164 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7165 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7166 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7167 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7168 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7169 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7170 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7171 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7172 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7173 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
Azure.IoT Build | 0:6ae2f7bca550 | 7174 | AMQP_VALUE more_amqp_value = amqpvalue_create_boolean(more_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 7175 | if (more_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7176 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7177 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7178 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7179 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7180 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7181 | if (amqpvalue_set_composite_item(transfer_instance->composite_value, 5, more_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 7182 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7183 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7184 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7185 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7186 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7187 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 7188 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7189 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7190 | amqpvalue_destroy(more_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 7191 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7192 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7193 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7194 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7195 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7196 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7197 | int transfer_get_rcv_settle_mode(TRANSFER_HANDLE transfer, receiver_settle_mode* rcv_settle_mode_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 7198 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7199 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7200 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7201 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7202 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7203 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7204 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7205 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7206 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7207 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 7208 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
AzureIoTClient | 23:1111ee8bcba4 | 7209 | if (amqpvalue_get_composite_item_count(transfer_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 7210 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7211 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7212 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7213 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7214 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7215 | if (item_count <= 6) |
AzureIoTClient | 23:1111ee8bcba4 | 7216 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7217 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7218 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7219 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7220 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7221 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(transfer_instance->composite_value, 6); |
AzureIoTClient | 23:1111ee8bcba4 | 7222 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 7223 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 7224 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7225 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7226 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7227 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7228 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7229 | if (amqpvalue_get_receiver_settle_mode(item_value, rcv_settle_mode_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 7230 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7231 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7232 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7233 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7234 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7235 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 7236 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7237 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7238 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7239 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7240 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7241 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7242 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7243 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7244 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7245 | int transfer_set_rcv_settle_mode(TRANSFER_HANDLE transfer, receiver_settle_mode rcv_settle_mode_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 7246 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7247 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7248 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7249 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7250 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7251 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7252 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7253 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7254 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7255 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
Azure.IoT Build | 0:6ae2f7bca550 | 7256 | AMQP_VALUE rcv_settle_mode_amqp_value = amqpvalue_create_receiver_settle_mode(rcv_settle_mode_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 7257 | if (rcv_settle_mode_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7258 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7259 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7260 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7261 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7262 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7263 | if (amqpvalue_set_composite_item(transfer_instance->composite_value, 6, rcv_settle_mode_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 7264 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7265 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7266 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7267 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7268 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7269 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 7270 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7271 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7272 | amqpvalue_destroy(rcv_settle_mode_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 7273 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7274 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7275 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7276 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7277 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7278 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7279 | int transfer_get_state(TRANSFER_HANDLE transfer, AMQP_VALUE* state_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 7280 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7281 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7282 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7283 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7284 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7285 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7286 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7287 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7288 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7289 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 7290 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
AzureIoTClient | 23:1111ee8bcba4 | 7291 | if (amqpvalue_get_composite_item_count(transfer_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 7292 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7293 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7294 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7295 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7296 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7297 | if (item_count <= 7) |
AzureIoTClient | 23:1111ee8bcba4 | 7298 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7299 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7300 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7301 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7302 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7303 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(transfer_instance->composite_value, 7); |
AzureIoTClient | 23:1111ee8bcba4 | 7304 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 7305 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 7306 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7307 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7308 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7309 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7310 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7311 | *state_value = item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 7312 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 7313 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7314 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7315 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7316 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7317 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7318 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7319 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7320 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7321 | int transfer_set_state(TRANSFER_HANDLE transfer, AMQP_VALUE state_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 7322 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7323 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7324 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7325 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7326 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7327 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7328 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7329 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7330 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7331 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
AzureIoTClient | 23:1111ee8bcba4 | 7332 | AMQP_VALUE state_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 7333 | if (state_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 7334 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7335 | state_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 7336 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7337 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7338 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7339 | state_amqp_value = amqpvalue_clone(state_value); |
AzureIoTClient | 23:1111ee8bcba4 | 7340 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7341 | if (state_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7342 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7343 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7344 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7345 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7346 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7347 | if (amqpvalue_set_composite_item(transfer_instance->composite_value, 7, state_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 7348 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7349 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7350 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7351 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7352 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7353 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 7354 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7355 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7356 | amqpvalue_destroy(state_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 7357 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7358 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7359 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7360 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7361 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7362 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7363 | int transfer_get_resume(TRANSFER_HANDLE transfer, bool* resume_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 7364 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7365 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7366 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7367 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7368 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7369 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7370 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7371 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7372 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7373 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 7374 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
AzureIoTClient | 23:1111ee8bcba4 | 7375 | if (amqpvalue_get_composite_item_count(transfer_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 7376 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7377 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7378 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7379 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7380 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7381 | if (item_count <= 8) |
AzureIoTClient | 23:1111ee8bcba4 | 7382 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7383 | *resume_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 7384 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 7385 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7386 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7387 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7388 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(transfer_instance->composite_value, 8); |
AzureIoTClient | 23:1111ee8bcba4 | 7389 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 7390 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 7391 | { |
AzureIoTClient | 16:22a72cf8e416 | 7392 | *resume_value = false; |
AzureIoTClient | 16:22a72cf8e416 | 7393 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 7394 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7395 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7396 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7397 | if (amqpvalue_get_boolean(item_value, resume_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 7398 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7399 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 7400 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7401 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7402 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7403 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7404 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7405 | *resume_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 7406 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 7407 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7408 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7409 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7410 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7411 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 7412 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7413 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7414 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7415 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7416 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7417 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7418 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7419 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7420 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7421 | int transfer_set_resume(TRANSFER_HANDLE transfer, bool resume_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 7422 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7423 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7424 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7425 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7426 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7427 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7428 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7429 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7430 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7431 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
Azure.IoT Build | 0:6ae2f7bca550 | 7432 | AMQP_VALUE resume_amqp_value = amqpvalue_create_boolean(resume_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 7433 | if (resume_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7434 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7435 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7436 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7437 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7438 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7439 | if (amqpvalue_set_composite_item(transfer_instance->composite_value, 8, resume_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 7440 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7441 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7442 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7443 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7444 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7445 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 7446 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7447 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7448 | amqpvalue_destroy(resume_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 7449 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7450 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7451 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7452 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7453 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7454 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7455 | int transfer_get_aborted(TRANSFER_HANDLE transfer, bool* aborted_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 7456 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7457 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7458 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7459 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7460 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7461 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7462 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7463 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7464 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7465 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 7466 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
AzureIoTClient | 23:1111ee8bcba4 | 7467 | if (amqpvalue_get_composite_item_count(transfer_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 7468 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7469 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7470 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7471 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7472 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7473 | if (item_count <= 9) |
AzureIoTClient | 23:1111ee8bcba4 | 7474 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7475 | *aborted_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 7476 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 7477 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7478 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7479 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7480 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(transfer_instance->composite_value, 9); |
AzureIoTClient | 23:1111ee8bcba4 | 7481 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 7482 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 7483 | { |
AzureIoTClient | 16:22a72cf8e416 | 7484 | *aborted_value = false; |
AzureIoTClient | 16:22a72cf8e416 | 7485 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 7486 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7487 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7488 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7489 | if (amqpvalue_get_boolean(item_value, aborted_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 7490 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7491 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 7492 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7493 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7494 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7495 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7496 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7497 | *aborted_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 7498 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 7499 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7500 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7501 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7502 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7503 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 7504 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7505 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7506 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7507 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7508 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7509 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7510 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7511 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7512 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7513 | int transfer_set_aborted(TRANSFER_HANDLE transfer, bool aborted_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 7514 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7515 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7516 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7517 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7518 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7519 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7520 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7521 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7522 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7523 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
Azure.IoT Build | 0:6ae2f7bca550 | 7524 | AMQP_VALUE aborted_amqp_value = amqpvalue_create_boolean(aborted_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 7525 | if (aborted_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7526 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7527 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7528 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7529 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7530 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7531 | if (amqpvalue_set_composite_item(transfer_instance->composite_value, 9, aborted_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 7532 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7533 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7534 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7535 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7536 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7537 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 7538 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7539 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7540 | amqpvalue_destroy(aborted_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 7541 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7542 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7543 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7544 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7545 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7546 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7547 | int transfer_get_batchable(TRANSFER_HANDLE transfer, bool* batchable_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 7548 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7549 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7550 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7551 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7552 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7553 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7554 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7555 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7556 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7557 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 7558 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
AzureIoTClient | 23:1111ee8bcba4 | 7559 | if (amqpvalue_get_composite_item_count(transfer_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 7560 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7561 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7562 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7563 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7564 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7565 | if (item_count <= 10) |
AzureIoTClient | 23:1111ee8bcba4 | 7566 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7567 | *batchable_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 7568 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 7569 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7570 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7571 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7572 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(transfer_instance->composite_value, 10); |
AzureIoTClient | 23:1111ee8bcba4 | 7573 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 7574 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 7575 | { |
AzureIoTClient | 16:22a72cf8e416 | 7576 | *batchable_value = false; |
AzureIoTClient | 16:22a72cf8e416 | 7577 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 7578 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7579 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7580 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7581 | if (amqpvalue_get_boolean(item_value, batchable_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 7582 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7583 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 7584 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7585 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7586 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7587 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7588 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7589 | *batchable_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 7590 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 7591 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7592 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7593 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7594 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7595 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 7596 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7597 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7598 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7599 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7600 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7601 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7602 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7603 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7604 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7605 | int transfer_set_batchable(TRANSFER_HANDLE transfer, bool batchable_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 7606 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7607 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7608 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7609 | if (transfer == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7610 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7611 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7612 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7613 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7614 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7615 | TRANSFER_INSTANCE* transfer_instance = (TRANSFER_INSTANCE*)transfer; |
Azure.IoT Build | 0:6ae2f7bca550 | 7616 | AMQP_VALUE batchable_amqp_value = amqpvalue_create_boolean(batchable_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 7617 | if (batchable_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7618 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7619 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7620 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7621 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7622 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7623 | if (amqpvalue_set_composite_item(transfer_instance->composite_value, 10, batchable_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 7624 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7625 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7626 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7627 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7628 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7629 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 7630 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7631 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7632 | amqpvalue_destroy(batchable_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 7633 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7634 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7635 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7636 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7637 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7638 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7639 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7640 | /* disposition */ |
Azure.IoT Build | 0:6ae2f7bca550 | 7641 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7642 | typedef struct DISPOSITION_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 7643 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7644 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 7645 | } DISPOSITION_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 7646 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7647 | static DISPOSITION_HANDLE disposition_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 7648 | { |
AzureIoTClient | 21:f9c433d8e6ca | 7649 | DISPOSITION_INSTANCE* disposition_instance = (DISPOSITION_INSTANCE*)malloc(sizeof(DISPOSITION_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 7650 | if (disposition_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7651 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7652 | disposition_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 7653 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7654 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7655 | return disposition_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 7656 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7657 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7658 | DISPOSITION_HANDLE disposition_create(role role_value, delivery_number first_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 7659 | { |
AzureIoTClient | 21:f9c433d8e6ca | 7660 | DISPOSITION_INSTANCE* disposition_instance = (DISPOSITION_INSTANCE*)malloc(sizeof(DISPOSITION_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 7661 | if (disposition_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7662 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7663 | disposition_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(21); |
Azure.IoT Build | 0:6ae2f7bca550 | 7664 | if (disposition_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7665 | { |
AzureIoTClient | 21:f9c433d8e6ca | 7666 | free(disposition_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 7667 | disposition_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 7668 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7669 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7670 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7671 | AMQP_VALUE role_amqp_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 7672 | AMQP_VALUE first_amqp_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 7673 | int result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 7674 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7675 | role_amqp_value = amqpvalue_create_role(role_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 7676 | if ((result == 0) && (amqpvalue_set_composite_item(disposition_instance->composite_value, 0, role_amqp_value) != 0)) |
Azure.IoT Build | 0:6ae2f7bca550 | 7677 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7678 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7679 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7680 | first_amqp_value = amqpvalue_create_delivery_number(first_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 7681 | if ((result == 0) && (amqpvalue_set_composite_item(disposition_instance->composite_value, 1, first_amqp_value) != 0)) |
Azure.IoT Build | 0:6ae2f7bca550 | 7682 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7683 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7684 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7685 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7686 | amqpvalue_destroy(role_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 7687 | amqpvalue_destroy(first_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 7688 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7689 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7690 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7691 | return disposition_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 7692 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7693 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7694 | DISPOSITION_HANDLE disposition_clone(DISPOSITION_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 7695 | { |
AzureIoTClient | 21:f9c433d8e6ca | 7696 | DISPOSITION_INSTANCE* disposition_instance = (DISPOSITION_INSTANCE*)malloc(sizeof(DISPOSITION_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 7697 | if (disposition_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7698 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7699 | disposition_instance->composite_value = amqpvalue_clone(((DISPOSITION_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 7700 | if (disposition_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7701 | { |
AzureIoTClient | 21:f9c433d8e6ca | 7702 | free(disposition_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 7703 | disposition_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 7704 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7705 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7706 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7707 | return disposition_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 7708 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7709 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7710 | void disposition_destroy(DISPOSITION_HANDLE disposition) |
Azure.IoT Build | 0:6ae2f7bca550 | 7711 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7712 | if (disposition != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7713 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7714 | DISPOSITION_INSTANCE* disposition_instance = (DISPOSITION_INSTANCE*)disposition; |
Azure.IoT Build | 0:6ae2f7bca550 | 7715 | amqpvalue_destroy(disposition_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 7716 | free(disposition_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 7717 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7718 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7719 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7720 | AMQP_VALUE amqpvalue_create_disposition(DISPOSITION_HANDLE disposition) |
Azure.IoT Build | 0:6ae2f7bca550 | 7721 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7722 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7723 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7724 | if (disposition == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7725 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7726 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 7727 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7728 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7729 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7730 | DISPOSITION_INSTANCE* disposition_instance = (DISPOSITION_INSTANCE*)disposition; |
Azure.IoT Build | 0:6ae2f7bca550 | 7731 | result = amqpvalue_clone(disposition_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 7732 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7733 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7734 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7735 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7736 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7737 | bool is_disposition_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 7738 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7739 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7740 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7741 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 7742 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 7743 | (descriptor_ulong == 21)) |
Azure.IoT Build | 0:6ae2f7bca550 | 7744 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7745 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 7746 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7747 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7748 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7749 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 7750 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7751 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7752 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7753 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7754 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7755 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7756 | int amqpvalue_get_disposition(AMQP_VALUE value, DISPOSITION_HANDLE* disposition_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 7757 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7758 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7759 | DISPOSITION_INSTANCE* disposition_instance = (DISPOSITION_INSTANCE*)disposition_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 7760 | *disposition_handle = disposition_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 7761 | if (*disposition_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7762 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7763 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7764 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7765 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7766 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7767 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 7768 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7769 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7770 | disposition_destroy(*disposition_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 7771 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7772 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7773 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7774 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7775 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 7776 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 7777 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7778 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7779 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7780 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7781 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7782 | do |
AzureIoTClient | 23:1111ee8bcba4 | 7783 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7784 | AMQP_VALUE item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 7785 | /* role */ |
AzureIoTClient | 23:1111ee8bcba4 | 7786 | if (list_item_count > 0) |
AzureIoTClient | 23:1111ee8bcba4 | 7787 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7788 | item_value = amqpvalue_get_list_item(list_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 7789 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 7790 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7791 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7792 | disposition_destroy(*disposition_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 7793 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7794 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 7795 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7796 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7797 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7798 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7799 | role role; |
AzureIoTClient | 23:1111ee8bcba4 | 7800 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 7801 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7802 | disposition_destroy(*disposition_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 7803 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7804 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 7805 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7806 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7807 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7808 | if (amqpvalue_get_role(item_value, &role) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 7809 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7810 | disposition_destroy(*disposition_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 7811 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7812 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 7813 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7814 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7815 | |
AzureIoTClient | 23:1111ee8bcba4 | 7816 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 7817 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7818 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7819 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7820 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7821 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7822 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7823 | /* first */ |
AzureIoTClient | 23:1111ee8bcba4 | 7824 | if (list_item_count > 1) |
AzureIoTClient | 23:1111ee8bcba4 | 7825 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7826 | item_value = amqpvalue_get_list_item(list_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 7827 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 7828 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7829 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7830 | disposition_destroy(*disposition_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 7831 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7832 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 7833 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7834 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7835 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7836 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7837 | delivery_number first; |
AzureIoTClient | 23:1111ee8bcba4 | 7838 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 7839 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7840 | disposition_destroy(*disposition_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 7841 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7842 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 7843 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7844 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7845 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7846 | if (amqpvalue_get_delivery_number(item_value, &first) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 7847 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7848 | disposition_destroy(*disposition_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 7849 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7850 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 7851 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7852 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7853 | |
AzureIoTClient | 23:1111ee8bcba4 | 7854 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 7855 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7856 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7857 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7858 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7859 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7860 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7861 | /* last */ |
AzureIoTClient | 23:1111ee8bcba4 | 7862 | if (list_item_count > 2) |
AzureIoTClient | 23:1111ee8bcba4 | 7863 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7864 | item_value = amqpvalue_get_list_item(list_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 7865 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 7866 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7867 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 7868 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7869 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7870 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7871 | delivery_number last; |
AzureIoTClient | 23:1111ee8bcba4 | 7872 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 7873 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7874 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 7875 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7876 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7877 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7878 | if (amqpvalue_get_delivery_number(item_value, &last) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 7879 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7880 | disposition_destroy(*disposition_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 7881 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7882 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 7883 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7884 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7885 | |
AzureIoTClient | 23:1111ee8bcba4 | 7886 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 7887 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7888 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7889 | /* settled */ |
AzureIoTClient | 23:1111ee8bcba4 | 7890 | if (list_item_count > 3) |
AzureIoTClient | 23:1111ee8bcba4 | 7891 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7892 | item_value = amqpvalue_get_list_item(list_value, 3); |
AzureIoTClient | 23:1111ee8bcba4 | 7893 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 7894 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7895 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 7896 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7897 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7898 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7899 | bool settled; |
AzureIoTClient | 23:1111ee8bcba4 | 7900 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 7901 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7902 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 7903 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7904 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7905 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7906 | if (amqpvalue_get_boolean(item_value, &settled) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 7907 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7908 | disposition_destroy(*disposition_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 7909 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7910 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 7911 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7912 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7913 | |
AzureIoTClient | 23:1111ee8bcba4 | 7914 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 7915 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7916 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7917 | /* state */ |
AzureIoTClient | 23:1111ee8bcba4 | 7918 | if (list_item_count > 4) |
AzureIoTClient | 23:1111ee8bcba4 | 7919 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7920 | item_value = amqpvalue_get_list_item(list_value, 4); |
AzureIoTClient | 23:1111ee8bcba4 | 7921 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 7922 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7923 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 7924 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7925 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7926 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7927 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 7928 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7929 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7930 | /* batchable */ |
AzureIoTClient | 23:1111ee8bcba4 | 7931 | if (list_item_count > 5) |
AzureIoTClient | 23:1111ee8bcba4 | 7932 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7933 | item_value = amqpvalue_get_list_item(list_value, 5); |
AzureIoTClient | 23:1111ee8bcba4 | 7934 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 7935 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7936 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 7937 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7938 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7939 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7940 | bool batchable; |
AzureIoTClient | 23:1111ee8bcba4 | 7941 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 7942 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7943 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 7944 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7945 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7946 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7947 | if (amqpvalue_get_boolean(item_value, &batchable) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 7948 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7949 | disposition_destroy(*disposition_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 7950 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7951 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 7952 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7953 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7954 | |
AzureIoTClient | 23:1111ee8bcba4 | 7955 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 7956 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7957 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7958 | |
AzureIoTClient | 23:1111ee8bcba4 | 7959 | disposition_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 7960 | |
AzureIoTClient | 23:1111ee8bcba4 | 7961 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 7962 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 7963 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7964 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7965 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7966 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7967 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7968 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7969 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7970 | int disposition_get_role(DISPOSITION_HANDLE disposition, role* role_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 7971 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 7972 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 7973 | |
Azure.IoT Build | 0:6ae2f7bca550 | 7974 | if (disposition == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 7975 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 7976 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 7977 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 7978 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 7979 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7980 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 7981 | DISPOSITION_INSTANCE* disposition_instance = (DISPOSITION_INSTANCE*)disposition; |
AzureIoTClient | 23:1111ee8bcba4 | 7982 | if (amqpvalue_get_composite_item_count(disposition_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 7983 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7984 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7985 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7986 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7987 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7988 | if (item_count <= 0) |
AzureIoTClient | 23:1111ee8bcba4 | 7989 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7990 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7991 | } |
AzureIoTClient | 23:1111ee8bcba4 | 7992 | else |
AzureIoTClient | 23:1111ee8bcba4 | 7993 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7994 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(disposition_instance->composite_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 7995 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 7996 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 7997 | { |
AzureIoTClient | 23:1111ee8bcba4 | 7998 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 7999 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8000 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8001 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8002 | if (amqpvalue_get_role(item_value, role_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 8003 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8004 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8005 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8006 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8007 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8008 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 8009 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8010 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8011 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8012 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8013 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8014 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8015 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8016 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8017 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8018 | int disposition_set_role(DISPOSITION_HANDLE disposition, role role_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 8019 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8020 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8021 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8022 | if (disposition == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8023 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8024 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8025 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8026 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8027 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8028 | DISPOSITION_INSTANCE* disposition_instance = (DISPOSITION_INSTANCE*)disposition; |
Azure.IoT Build | 0:6ae2f7bca550 | 8029 | AMQP_VALUE role_amqp_value = amqpvalue_create_role(role_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 8030 | if (role_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8031 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8032 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8033 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8034 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8035 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8036 | if (amqpvalue_set_composite_item(disposition_instance->composite_value, 0, role_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 8037 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8038 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8039 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8040 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8041 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8042 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 8043 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8044 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8045 | amqpvalue_destroy(role_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 8046 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8047 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8048 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8049 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8050 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8051 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8052 | int disposition_get_first(DISPOSITION_HANDLE disposition, delivery_number* first_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 8053 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8054 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8055 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8056 | if (disposition == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8057 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8058 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8059 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8060 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8061 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8062 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 8063 | DISPOSITION_INSTANCE* disposition_instance = (DISPOSITION_INSTANCE*)disposition; |
AzureIoTClient | 23:1111ee8bcba4 | 8064 | if (amqpvalue_get_composite_item_count(disposition_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 8065 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8066 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8067 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8068 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8069 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8070 | if (item_count <= 1) |
AzureIoTClient | 23:1111ee8bcba4 | 8071 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8072 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8073 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8074 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8075 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8076 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(disposition_instance->composite_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 8077 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 8078 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 8079 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8080 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8081 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8082 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8083 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8084 | if (amqpvalue_get_delivery_number(item_value, first_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 8085 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8086 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8087 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8088 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8089 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8090 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 8091 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8092 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8093 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8094 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8095 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8096 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8097 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8098 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8099 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8100 | int disposition_set_first(DISPOSITION_HANDLE disposition, delivery_number first_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 8101 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8102 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8103 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8104 | if (disposition == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8105 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8106 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8107 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8108 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8109 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8110 | DISPOSITION_INSTANCE* disposition_instance = (DISPOSITION_INSTANCE*)disposition; |
Azure.IoT Build | 0:6ae2f7bca550 | 8111 | AMQP_VALUE first_amqp_value = amqpvalue_create_delivery_number(first_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 8112 | if (first_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8113 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8114 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8115 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8116 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8117 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8118 | if (amqpvalue_set_composite_item(disposition_instance->composite_value, 1, first_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 8119 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8120 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8121 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8122 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8123 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8124 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 8125 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8126 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8127 | amqpvalue_destroy(first_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 8128 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8129 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8130 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8131 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8132 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8133 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8134 | int disposition_get_last(DISPOSITION_HANDLE disposition, delivery_number* last_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 8135 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8136 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8137 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8138 | if (disposition == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8139 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8140 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8141 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8142 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8143 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8144 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 8145 | DISPOSITION_INSTANCE* disposition_instance = (DISPOSITION_INSTANCE*)disposition; |
AzureIoTClient | 23:1111ee8bcba4 | 8146 | if (amqpvalue_get_composite_item_count(disposition_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 8147 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8148 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8149 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8150 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8151 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8152 | if (item_count <= 2) |
AzureIoTClient | 23:1111ee8bcba4 | 8153 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8154 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8155 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8156 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8157 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8158 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(disposition_instance->composite_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 8159 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 8160 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 8161 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8162 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8163 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8164 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8165 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8166 | if (amqpvalue_get_delivery_number(item_value, last_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 8167 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8168 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8169 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8170 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8171 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8172 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 8173 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8174 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8175 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8176 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8177 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8178 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8179 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8180 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8181 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8182 | int disposition_set_last(DISPOSITION_HANDLE disposition, delivery_number last_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 8183 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8184 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8185 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8186 | if (disposition == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8187 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8188 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8189 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8190 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8191 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8192 | DISPOSITION_INSTANCE* disposition_instance = (DISPOSITION_INSTANCE*)disposition; |
Azure.IoT Build | 0:6ae2f7bca550 | 8193 | AMQP_VALUE last_amqp_value = amqpvalue_create_delivery_number(last_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 8194 | if (last_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8195 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8196 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8197 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8198 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8199 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8200 | if (amqpvalue_set_composite_item(disposition_instance->composite_value, 2, last_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 8201 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8202 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8203 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8204 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8205 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8206 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 8207 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8208 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8209 | amqpvalue_destroy(last_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 8210 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8211 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8212 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8213 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8214 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8215 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8216 | int disposition_get_settled(DISPOSITION_HANDLE disposition, bool* settled_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 8217 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8218 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8219 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8220 | if (disposition == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8221 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8222 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8223 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8224 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8225 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8226 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 8227 | DISPOSITION_INSTANCE* disposition_instance = (DISPOSITION_INSTANCE*)disposition; |
AzureIoTClient | 23:1111ee8bcba4 | 8228 | if (amqpvalue_get_composite_item_count(disposition_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 8229 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8230 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8231 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8232 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8233 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8234 | if (item_count <= 3) |
AzureIoTClient | 23:1111ee8bcba4 | 8235 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8236 | *settled_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 8237 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 8238 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8239 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8240 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8241 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(disposition_instance->composite_value, 3); |
AzureIoTClient | 23:1111ee8bcba4 | 8242 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 8243 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 8244 | { |
AzureIoTClient | 16:22a72cf8e416 | 8245 | *settled_value = false; |
AzureIoTClient | 16:22a72cf8e416 | 8246 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 8247 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8248 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8249 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8250 | if (amqpvalue_get_boolean(item_value, settled_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 8251 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8252 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 8253 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8254 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8255 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8256 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8257 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8258 | *settled_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 8259 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 8260 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8261 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8262 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8263 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8264 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 8265 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8266 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8267 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8268 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8269 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8270 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8271 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8272 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8273 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8274 | int disposition_set_settled(DISPOSITION_HANDLE disposition, bool settled_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 8275 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8276 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8277 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8278 | if (disposition == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8279 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8280 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8281 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8282 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8283 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8284 | DISPOSITION_INSTANCE* disposition_instance = (DISPOSITION_INSTANCE*)disposition; |
Azure.IoT Build | 0:6ae2f7bca550 | 8285 | AMQP_VALUE settled_amqp_value = amqpvalue_create_boolean(settled_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 8286 | if (settled_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8287 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8288 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8289 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8290 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8291 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8292 | if (amqpvalue_set_composite_item(disposition_instance->composite_value, 3, settled_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 8293 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8294 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8295 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8296 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8297 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8298 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 8299 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8300 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8301 | amqpvalue_destroy(settled_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 8302 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8303 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8304 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8305 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8306 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8307 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8308 | int disposition_get_state(DISPOSITION_HANDLE disposition, AMQP_VALUE* state_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 8309 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8310 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8311 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8312 | if (disposition == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8313 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8314 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8315 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8316 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8317 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8318 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 8319 | DISPOSITION_INSTANCE* disposition_instance = (DISPOSITION_INSTANCE*)disposition; |
AzureIoTClient | 23:1111ee8bcba4 | 8320 | if (amqpvalue_get_composite_item_count(disposition_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 8321 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8322 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8323 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8324 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8325 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8326 | if (item_count <= 4) |
AzureIoTClient | 23:1111ee8bcba4 | 8327 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8328 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8329 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8330 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8331 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8332 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(disposition_instance->composite_value, 4); |
AzureIoTClient | 23:1111ee8bcba4 | 8333 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 8334 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 8335 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8336 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8337 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8338 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8339 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8340 | *state_value = item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 8341 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 8342 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8343 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8344 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8345 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8346 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8347 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8348 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8349 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8350 | int disposition_set_state(DISPOSITION_HANDLE disposition, AMQP_VALUE state_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 8351 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8352 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8353 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8354 | if (disposition == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8355 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8356 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8357 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8358 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8359 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8360 | DISPOSITION_INSTANCE* disposition_instance = (DISPOSITION_INSTANCE*)disposition; |
AzureIoTClient | 23:1111ee8bcba4 | 8361 | AMQP_VALUE state_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 8362 | if (state_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 8363 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8364 | state_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 8365 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8366 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8367 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8368 | state_amqp_value = amqpvalue_clone(state_value); |
AzureIoTClient | 23:1111ee8bcba4 | 8369 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8370 | if (state_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8371 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8372 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8373 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8374 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8375 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8376 | if (amqpvalue_set_composite_item(disposition_instance->composite_value, 4, state_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 8377 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8378 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8379 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8380 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8381 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8382 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 8383 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8384 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8385 | amqpvalue_destroy(state_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 8386 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8387 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8388 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8389 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8390 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8391 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8392 | int disposition_get_batchable(DISPOSITION_HANDLE disposition, bool* batchable_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 8393 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8394 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8395 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8396 | if (disposition == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8397 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8398 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8399 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8400 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8401 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8402 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 8403 | DISPOSITION_INSTANCE* disposition_instance = (DISPOSITION_INSTANCE*)disposition; |
AzureIoTClient | 23:1111ee8bcba4 | 8404 | if (amqpvalue_get_composite_item_count(disposition_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 8405 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8406 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8407 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8408 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8409 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8410 | if (item_count <= 5) |
AzureIoTClient | 23:1111ee8bcba4 | 8411 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8412 | *batchable_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 8413 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 8414 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8415 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8416 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8417 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(disposition_instance->composite_value, 5); |
AzureIoTClient | 23:1111ee8bcba4 | 8418 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 8419 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 8420 | { |
AzureIoTClient | 16:22a72cf8e416 | 8421 | *batchable_value = false; |
AzureIoTClient | 16:22a72cf8e416 | 8422 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 8423 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8424 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8425 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8426 | if (amqpvalue_get_boolean(item_value, batchable_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 8427 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8428 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 8429 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8430 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8431 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8432 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8433 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8434 | *batchable_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 8435 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 8436 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8437 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8438 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8439 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8440 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 8441 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8442 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8443 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8444 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8445 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8446 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8447 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8448 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8449 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8450 | int disposition_set_batchable(DISPOSITION_HANDLE disposition, bool batchable_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 8451 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8452 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8453 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8454 | if (disposition == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8455 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8456 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8457 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8458 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8459 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8460 | DISPOSITION_INSTANCE* disposition_instance = (DISPOSITION_INSTANCE*)disposition; |
Azure.IoT Build | 0:6ae2f7bca550 | 8461 | AMQP_VALUE batchable_amqp_value = amqpvalue_create_boolean(batchable_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 8462 | if (batchable_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8463 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8464 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8465 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8466 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8467 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8468 | if (amqpvalue_set_composite_item(disposition_instance->composite_value, 5, batchable_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 8469 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8470 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8471 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8472 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8473 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8474 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 8475 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8476 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8477 | amqpvalue_destroy(batchable_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 8478 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8479 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8480 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8481 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8482 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8483 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8484 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8485 | /* detach */ |
Azure.IoT Build | 0:6ae2f7bca550 | 8486 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8487 | typedef struct DETACH_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 8488 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8489 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 8490 | } DETACH_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 8491 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8492 | static DETACH_HANDLE detach_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 8493 | { |
AzureIoTClient | 21:f9c433d8e6ca | 8494 | DETACH_INSTANCE* detach_instance = (DETACH_INSTANCE*)malloc(sizeof(DETACH_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 8495 | if (detach_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8496 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8497 | detach_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 8498 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8499 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8500 | return detach_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 8501 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8502 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8503 | DETACH_HANDLE detach_create(handle handle_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 8504 | { |
AzureIoTClient | 21:f9c433d8e6ca | 8505 | DETACH_INSTANCE* detach_instance = (DETACH_INSTANCE*)malloc(sizeof(DETACH_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 8506 | if (detach_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8507 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8508 | detach_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(22); |
Azure.IoT Build | 0:6ae2f7bca550 | 8509 | if (detach_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8510 | { |
AzureIoTClient | 21:f9c433d8e6ca | 8511 | free(detach_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 8512 | detach_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 8513 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8514 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8515 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8516 | AMQP_VALUE handle_amqp_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 8517 | int result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 8518 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8519 | handle_amqp_value = amqpvalue_create_handle(handle_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 8520 | if ((result == 0) && (amqpvalue_set_composite_item(detach_instance->composite_value, 0, handle_amqp_value) != 0)) |
Azure.IoT Build | 0:6ae2f7bca550 | 8521 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8522 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8523 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8524 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8525 | amqpvalue_destroy(handle_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 8526 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8527 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8528 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8529 | return detach_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 8530 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8531 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8532 | DETACH_HANDLE detach_clone(DETACH_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 8533 | { |
AzureIoTClient | 21:f9c433d8e6ca | 8534 | DETACH_INSTANCE* detach_instance = (DETACH_INSTANCE*)malloc(sizeof(DETACH_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 8535 | if (detach_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8536 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8537 | detach_instance->composite_value = amqpvalue_clone(((DETACH_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 8538 | if (detach_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8539 | { |
AzureIoTClient | 21:f9c433d8e6ca | 8540 | free(detach_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 8541 | detach_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 8542 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8543 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8544 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8545 | return detach_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 8546 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8547 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8548 | void detach_destroy(DETACH_HANDLE detach) |
Azure.IoT Build | 0:6ae2f7bca550 | 8549 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8550 | if (detach != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8551 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8552 | DETACH_INSTANCE* detach_instance = (DETACH_INSTANCE*)detach; |
Azure.IoT Build | 0:6ae2f7bca550 | 8553 | amqpvalue_destroy(detach_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 8554 | free(detach_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 8555 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8556 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8557 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8558 | AMQP_VALUE amqpvalue_create_detach(DETACH_HANDLE detach) |
Azure.IoT Build | 0:6ae2f7bca550 | 8559 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8560 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8561 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8562 | if (detach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8563 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8564 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 8565 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8566 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8567 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8568 | DETACH_INSTANCE* detach_instance = (DETACH_INSTANCE*)detach; |
Azure.IoT Build | 0:6ae2f7bca550 | 8569 | result = amqpvalue_clone(detach_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 8570 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8571 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8572 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8573 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8574 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8575 | bool is_detach_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 8576 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8577 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8578 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8579 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 8580 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 8581 | (descriptor_ulong == 22)) |
Azure.IoT Build | 0:6ae2f7bca550 | 8582 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8583 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 8584 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8585 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8586 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8587 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 8588 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8589 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8590 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8591 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8592 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8593 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8594 | int amqpvalue_get_detach(AMQP_VALUE value, DETACH_HANDLE* detach_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 8595 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8596 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8597 | DETACH_INSTANCE* detach_instance = (DETACH_INSTANCE*)detach_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 8598 | *detach_handle = detach_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 8599 | if (*detach_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8600 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8601 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8602 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8603 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8604 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8605 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 8606 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8607 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8608 | detach_destroy(*detach_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 8609 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8610 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8611 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8612 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8613 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 8614 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 8615 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8616 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8617 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8618 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8619 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8620 | do |
AzureIoTClient | 23:1111ee8bcba4 | 8621 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8622 | AMQP_VALUE item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 8623 | /* handle */ |
AzureIoTClient | 23:1111ee8bcba4 | 8624 | if (list_item_count > 0) |
AzureIoTClient | 23:1111ee8bcba4 | 8625 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8626 | item_value = amqpvalue_get_list_item(list_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 8627 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 8628 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8629 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8630 | detach_destroy(*detach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 8631 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8632 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 8633 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8634 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8635 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8636 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8637 | handle handle; |
AzureIoTClient | 23:1111ee8bcba4 | 8638 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 8639 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8640 | detach_destroy(*detach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 8641 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8642 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 8643 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8644 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8645 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8646 | if (amqpvalue_get_handle(item_value, &handle) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 8647 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8648 | detach_destroy(*detach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 8649 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8650 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 8651 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8652 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8653 | |
AzureIoTClient | 23:1111ee8bcba4 | 8654 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 8655 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8656 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8657 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8658 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8659 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8660 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8661 | /* closed */ |
AzureIoTClient | 23:1111ee8bcba4 | 8662 | if (list_item_count > 1) |
AzureIoTClient | 23:1111ee8bcba4 | 8663 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8664 | item_value = amqpvalue_get_list_item(list_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 8665 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 8666 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8667 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 8668 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8669 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8670 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8671 | bool closed; |
AzureIoTClient | 23:1111ee8bcba4 | 8672 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 8673 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8674 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 8675 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8676 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8677 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8678 | if (amqpvalue_get_boolean(item_value, &closed) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 8679 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8680 | detach_destroy(*detach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 8681 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8682 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 8683 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8684 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8685 | |
AzureIoTClient | 23:1111ee8bcba4 | 8686 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 8687 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8688 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8689 | /* error */ |
AzureIoTClient | 23:1111ee8bcba4 | 8690 | if (list_item_count > 2) |
AzureIoTClient | 23:1111ee8bcba4 | 8691 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8692 | item_value = amqpvalue_get_list_item(list_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 8693 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 8694 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8695 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 8696 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8697 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8698 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8699 | ERROR_HANDLE error; |
AzureIoTClient | 23:1111ee8bcba4 | 8700 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 8701 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8702 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 8703 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8704 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8705 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8706 | if (amqpvalue_get_error(item_value, &error) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 8707 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8708 | detach_destroy(*detach_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 8709 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8710 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 8711 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8712 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8713 | |
AzureIoTClient | 23:1111ee8bcba4 | 8714 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 8715 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8716 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8717 | |
AzureIoTClient | 23:1111ee8bcba4 | 8718 | detach_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 8719 | |
AzureIoTClient | 23:1111ee8bcba4 | 8720 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 8721 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 8722 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8723 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8724 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8725 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8726 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8727 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8728 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8729 | int detach_get_handle(DETACH_HANDLE detach, handle* handle_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 8730 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8731 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8732 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8733 | if (detach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8734 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8735 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8736 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8737 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8738 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8739 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 8740 | DETACH_INSTANCE* detach_instance = (DETACH_INSTANCE*)detach; |
AzureIoTClient | 23:1111ee8bcba4 | 8741 | if (amqpvalue_get_composite_item_count(detach_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 8742 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8743 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8744 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8745 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8746 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8747 | if (item_count <= 0) |
AzureIoTClient | 23:1111ee8bcba4 | 8748 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8749 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8750 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8751 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8752 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8753 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(detach_instance->composite_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 8754 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 8755 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 8756 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8757 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8758 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8759 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8760 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8761 | if (amqpvalue_get_handle(item_value, handle_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 8762 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8763 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8764 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8765 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8766 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8767 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 8768 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8769 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8770 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8771 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8772 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8773 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8774 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8775 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8776 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8777 | int detach_set_handle(DETACH_HANDLE detach, handle handle_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 8778 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8779 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8780 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8781 | if (detach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8782 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8783 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8784 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8785 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8786 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8787 | DETACH_INSTANCE* detach_instance = (DETACH_INSTANCE*)detach; |
Azure.IoT Build | 0:6ae2f7bca550 | 8788 | AMQP_VALUE handle_amqp_value = amqpvalue_create_handle(handle_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 8789 | if (handle_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8790 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8791 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8792 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8793 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8794 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8795 | if (amqpvalue_set_composite_item(detach_instance->composite_value, 0, handle_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 8796 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8797 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8798 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8799 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8800 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8801 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 8802 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8803 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8804 | amqpvalue_destroy(handle_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 8805 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8806 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8807 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8808 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8809 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8810 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8811 | int detach_get_closed(DETACH_HANDLE detach, bool* closed_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 8812 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8813 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8814 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8815 | if (detach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8816 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8817 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8818 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8819 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8820 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8821 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 8822 | DETACH_INSTANCE* detach_instance = (DETACH_INSTANCE*)detach; |
AzureIoTClient | 23:1111ee8bcba4 | 8823 | if (amqpvalue_get_composite_item_count(detach_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 8824 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8825 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8826 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8827 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8828 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8829 | if (item_count <= 1) |
AzureIoTClient | 23:1111ee8bcba4 | 8830 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8831 | *closed_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 8832 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 8833 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8834 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8835 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8836 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(detach_instance->composite_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 8837 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 8838 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 8839 | { |
AzureIoTClient | 16:22a72cf8e416 | 8840 | *closed_value = false; |
AzureIoTClient | 16:22a72cf8e416 | 8841 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 8842 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8843 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8844 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8845 | if (amqpvalue_get_boolean(item_value, closed_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 8846 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8847 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 8848 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8849 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8850 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8851 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8852 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8853 | *closed_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 8854 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 8855 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8856 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8857 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8858 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8859 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 8860 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8861 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8862 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8863 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8864 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8865 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8866 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8867 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8868 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8869 | int detach_set_closed(DETACH_HANDLE detach, bool closed_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 8870 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8871 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8872 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8873 | if (detach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8874 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8875 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8876 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8877 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8878 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8879 | DETACH_INSTANCE* detach_instance = (DETACH_INSTANCE*)detach; |
Azure.IoT Build | 0:6ae2f7bca550 | 8880 | AMQP_VALUE closed_amqp_value = amqpvalue_create_boolean(closed_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 8881 | if (closed_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8882 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8883 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8884 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8885 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8886 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8887 | if (amqpvalue_set_composite_item(detach_instance->composite_value, 1, closed_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 8888 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8889 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8890 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8891 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8892 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8893 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 8894 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8895 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8896 | amqpvalue_destroy(closed_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 8897 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8898 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8899 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8900 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8901 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8902 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8903 | int detach_get_error(DETACH_HANDLE detach, ERROR_HANDLE* error_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 8904 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8905 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8906 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8907 | if (detach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8908 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8909 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8910 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8911 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8912 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8913 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 8914 | DETACH_INSTANCE* detach_instance = (DETACH_INSTANCE*)detach; |
AzureIoTClient | 23:1111ee8bcba4 | 8915 | if (amqpvalue_get_composite_item_count(detach_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 8916 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8917 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8918 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8919 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8920 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8921 | if (item_count <= 2) |
AzureIoTClient | 23:1111ee8bcba4 | 8922 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8923 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8924 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8925 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8926 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8927 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(detach_instance->composite_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 8928 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 8929 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 8930 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8931 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8932 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8933 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8934 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8935 | if (amqpvalue_get_error(item_value, error_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 8936 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8937 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 8938 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8939 | else |
AzureIoTClient | 23:1111ee8bcba4 | 8940 | { |
AzureIoTClient | 23:1111ee8bcba4 | 8941 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 8942 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8943 | } |
AzureIoTClient | 23:1111ee8bcba4 | 8944 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8945 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8946 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8947 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8948 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8949 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8950 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8951 | int detach_set_error(DETACH_HANDLE detach, ERROR_HANDLE error_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 8952 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8953 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8954 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8955 | if (detach == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8956 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8957 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8958 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8959 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8960 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8961 | DETACH_INSTANCE* detach_instance = (DETACH_INSTANCE*)detach; |
Azure.IoT Build | 0:6ae2f7bca550 | 8962 | AMQP_VALUE error_amqp_value = amqpvalue_create_error(error_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 8963 | if (error_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8964 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8965 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8966 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8967 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8968 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8969 | if (amqpvalue_set_composite_item(detach_instance->composite_value, 2, error_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 8970 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 8971 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 8972 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8973 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 8974 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8975 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 8976 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8977 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8978 | amqpvalue_destroy(error_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 8979 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8980 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8981 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8982 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 8983 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 8984 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8985 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8986 | /* end */ |
Azure.IoT Build | 0:6ae2f7bca550 | 8987 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8988 | typedef struct END_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 8989 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8990 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 8991 | } END_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 8992 | |
Azure.IoT Build | 0:6ae2f7bca550 | 8993 | static END_HANDLE end_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 8994 | { |
AzureIoTClient | 21:f9c433d8e6ca | 8995 | END_INSTANCE* end_instance = (END_INSTANCE*)malloc(sizeof(END_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 8996 | if (end_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 8997 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 8998 | end_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 8999 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9000 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9001 | return end_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 9002 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9003 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9004 | END_HANDLE end_create(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 9005 | { |
AzureIoTClient | 21:f9c433d8e6ca | 9006 | END_INSTANCE* end_instance = (END_INSTANCE*)malloc(sizeof(END_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 9007 | if (end_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9008 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9009 | end_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(23); |
Azure.IoT Build | 0:6ae2f7bca550 | 9010 | if (end_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9011 | { |
AzureIoTClient | 21:f9c433d8e6ca | 9012 | free(end_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 9013 | end_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 9014 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9015 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9016 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9017 | return end_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 9018 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9019 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9020 | END_HANDLE end_clone(END_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 9021 | { |
AzureIoTClient | 21:f9c433d8e6ca | 9022 | END_INSTANCE* end_instance = (END_INSTANCE*)malloc(sizeof(END_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 9023 | if (end_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9024 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9025 | end_instance->composite_value = amqpvalue_clone(((END_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 9026 | if (end_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9027 | { |
AzureIoTClient | 21:f9c433d8e6ca | 9028 | free(end_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 9029 | end_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 9030 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9031 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9032 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9033 | return end_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 9034 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9035 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9036 | void end_destroy(END_HANDLE end) |
Azure.IoT Build | 0:6ae2f7bca550 | 9037 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9038 | if (end != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9039 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9040 | END_INSTANCE* end_instance = (END_INSTANCE*)end; |
Azure.IoT Build | 0:6ae2f7bca550 | 9041 | amqpvalue_destroy(end_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 9042 | free(end_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 9043 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9044 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9045 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9046 | AMQP_VALUE amqpvalue_create_end(END_HANDLE end) |
Azure.IoT Build | 0:6ae2f7bca550 | 9047 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9048 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9049 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9050 | if (end == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9051 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9052 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 9053 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9054 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9055 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9056 | END_INSTANCE* end_instance = (END_INSTANCE*)end; |
Azure.IoT Build | 0:6ae2f7bca550 | 9057 | result = amqpvalue_clone(end_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 9058 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9059 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9060 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9061 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9062 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9063 | bool is_end_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 9064 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9065 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9066 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9067 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 9068 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 9069 | (descriptor_ulong == 23)) |
Azure.IoT Build | 0:6ae2f7bca550 | 9070 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9071 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 9072 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9073 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9074 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9075 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 9076 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9077 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9078 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9079 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9080 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9081 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9082 | int amqpvalue_get_end(AMQP_VALUE value, END_HANDLE* end_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 9083 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9084 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9085 | END_INSTANCE* end_instance = (END_INSTANCE*)end_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 9086 | *end_handle = end_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 9087 | if (*end_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9088 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 9089 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 9090 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9091 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9092 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9093 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 9094 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9095 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9096 | end_destroy(*end_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 9097 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 9098 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9099 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9100 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9101 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 9102 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 9103 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9104 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9105 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9106 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9107 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9108 | do |
AzureIoTClient | 23:1111ee8bcba4 | 9109 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9110 | AMQP_VALUE item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 9111 | /* error */ |
AzureIoTClient | 23:1111ee8bcba4 | 9112 | if (list_item_count > 0) |
AzureIoTClient | 23:1111ee8bcba4 | 9113 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9114 | item_value = amqpvalue_get_list_item(list_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 9115 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 9116 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9117 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 9118 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9119 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9120 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9121 | ERROR_HANDLE error; |
AzureIoTClient | 23:1111ee8bcba4 | 9122 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 9123 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9124 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 9125 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9126 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9127 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9128 | if (amqpvalue_get_error(item_value, &error) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 9129 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9130 | end_destroy(*end_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 9131 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9132 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 9133 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9134 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9135 | |
AzureIoTClient | 23:1111ee8bcba4 | 9136 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 9137 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9138 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9139 | |
AzureIoTClient | 23:1111ee8bcba4 | 9140 | end_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 9141 | |
AzureIoTClient | 23:1111ee8bcba4 | 9142 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 9143 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 9144 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9145 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9146 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9147 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9148 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9149 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9150 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9151 | int end_get_error(END_HANDLE end, ERROR_HANDLE* error_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 9152 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9153 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9154 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9155 | if (end == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9156 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 9157 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 9158 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9159 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9160 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9161 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 9162 | END_INSTANCE* end_instance = (END_INSTANCE*)end; |
AzureIoTClient | 23:1111ee8bcba4 | 9163 | if (amqpvalue_get_composite_item_count(end_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 9164 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9165 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9166 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9167 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9168 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9169 | if (item_count <= 0) |
AzureIoTClient | 23:1111ee8bcba4 | 9170 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9171 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9172 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9173 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9174 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9175 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(end_instance->composite_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 9176 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 9177 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 9178 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9179 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9180 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9181 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9182 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9183 | if (amqpvalue_get_error(item_value, error_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 9184 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9185 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9186 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9187 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9188 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9189 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 9190 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9191 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9192 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9193 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9194 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9195 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9196 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9197 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9198 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9199 | int end_set_error(END_HANDLE end, ERROR_HANDLE error_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 9200 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9201 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9202 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9203 | if (end == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9204 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 9205 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 9206 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9207 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9208 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9209 | END_INSTANCE* end_instance = (END_INSTANCE*)end; |
Azure.IoT Build | 0:6ae2f7bca550 | 9210 | AMQP_VALUE error_amqp_value = amqpvalue_create_error(error_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 9211 | if (error_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9212 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 9213 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 9214 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9215 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9216 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9217 | if (amqpvalue_set_composite_item(end_instance->composite_value, 0, error_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 9218 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 9219 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 9220 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9221 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9222 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9223 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 9224 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9225 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9226 | amqpvalue_destroy(error_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 9227 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9228 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9229 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9230 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9231 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9232 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9233 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9234 | /* close */ |
Azure.IoT Build | 0:6ae2f7bca550 | 9235 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9236 | typedef struct CLOSE_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 9237 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9238 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 9239 | } CLOSE_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 9240 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9241 | static CLOSE_HANDLE close_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 9242 | { |
AzureIoTClient | 21:f9c433d8e6ca | 9243 | CLOSE_INSTANCE* close_instance = (CLOSE_INSTANCE*)malloc(sizeof(CLOSE_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 9244 | if (close_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9245 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9246 | close_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 9247 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9248 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9249 | return close_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 9250 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9251 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9252 | CLOSE_HANDLE close_create(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 9253 | { |
AzureIoTClient | 21:f9c433d8e6ca | 9254 | CLOSE_INSTANCE* close_instance = (CLOSE_INSTANCE*)malloc(sizeof(CLOSE_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 9255 | if (close_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9256 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9257 | close_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(24); |
Azure.IoT Build | 0:6ae2f7bca550 | 9258 | if (close_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9259 | { |
AzureIoTClient | 21:f9c433d8e6ca | 9260 | free(close_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 9261 | close_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 9262 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9263 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9264 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9265 | return close_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 9266 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9267 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9268 | CLOSE_HANDLE close_clone(CLOSE_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 9269 | { |
AzureIoTClient | 21:f9c433d8e6ca | 9270 | CLOSE_INSTANCE* close_instance = (CLOSE_INSTANCE*)malloc(sizeof(CLOSE_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 9271 | if (close_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9272 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9273 | close_instance->composite_value = amqpvalue_clone(((CLOSE_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 9274 | if (close_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9275 | { |
AzureIoTClient | 21:f9c433d8e6ca | 9276 | free(close_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 9277 | close_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 9278 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9279 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9280 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9281 | return close_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 9282 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9283 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9284 | void close_destroy(CLOSE_HANDLE close) |
Azure.IoT Build | 0:6ae2f7bca550 | 9285 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9286 | if (close != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9287 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9288 | CLOSE_INSTANCE* close_instance = (CLOSE_INSTANCE*)close; |
Azure.IoT Build | 0:6ae2f7bca550 | 9289 | amqpvalue_destroy(close_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 9290 | free(close_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 9291 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9292 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9293 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9294 | AMQP_VALUE amqpvalue_create_close(CLOSE_HANDLE close) |
Azure.IoT Build | 0:6ae2f7bca550 | 9295 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9296 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9297 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9298 | if (close == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9299 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9300 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 9301 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9302 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9303 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9304 | CLOSE_INSTANCE* close_instance = (CLOSE_INSTANCE*)close; |
Azure.IoT Build | 0:6ae2f7bca550 | 9305 | result = amqpvalue_clone(close_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 9306 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9307 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9308 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9309 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9310 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9311 | bool is_close_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 9312 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9313 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9314 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9315 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 9316 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 9317 | (descriptor_ulong == 24)) |
Azure.IoT Build | 0:6ae2f7bca550 | 9318 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9319 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 9320 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9321 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9322 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9323 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 9324 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9325 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9326 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9327 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9328 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9329 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9330 | int amqpvalue_get_close(AMQP_VALUE value, CLOSE_HANDLE* close_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 9331 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9332 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9333 | CLOSE_INSTANCE* close_instance = (CLOSE_INSTANCE*)close_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 9334 | *close_handle = close_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 9335 | if (*close_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9336 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 9337 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 9338 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9339 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9340 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9341 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 9342 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9343 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9344 | close_destroy(*close_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 9345 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 9346 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9347 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9348 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9349 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 9350 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 9351 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9352 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9353 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9354 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9355 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9356 | do |
AzureIoTClient | 23:1111ee8bcba4 | 9357 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9358 | AMQP_VALUE item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 9359 | /* error */ |
AzureIoTClient | 23:1111ee8bcba4 | 9360 | if (list_item_count > 0) |
AzureIoTClient | 23:1111ee8bcba4 | 9361 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9362 | item_value = amqpvalue_get_list_item(list_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 9363 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 9364 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9365 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 9366 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9367 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9368 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9369 | ERROR_HANDLE error; |
AzureIoTClient | 23:1111ee8bcba4 | 9370 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 9371 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9372 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 9373 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9374 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9375 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9376 | if (amqpvalue_get_error(item_value, &error) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 9377 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9378 | close_destroy(*close_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 9379 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9380 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 9381 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9382 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9383 | |
AzureIoTClient | 23:1111ee8bcba4 | 9384 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 9385 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9386 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9387 | |
AzureIoTClient | 23:1111ee8bcba4 | 9388 | close_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 9389 | |
AzureIoTClient | 23:1111ee8bcba4 | 9390 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 9391 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 9392 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9393 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9394 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9395 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9396 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9397 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9398 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9399 | int close_get_error(CLOSE_HANDLE close, ERROR_HANDLE* error_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 9400 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9401 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9402 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9403 | if (close == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9404 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 9405 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 9406 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9407 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9408 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9409 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 9410 | CLOSE_INSTANCE* close_instance = (CLOSE_INSTANCE*)close; |
AzureIoTClient | 23:1111ee8bcba4 | 9411 | if (amqpvalue_get_composite_item_count(close_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 9412 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9413 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9414 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9415 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9416 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9417 | if (item_count <= 0) |
AzureIoTClient | 23:1111ee8bcba4 | 9418 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9419 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9420 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9421 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9422 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9423 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(close_instance->composite_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 9424 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 9425 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 9426 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9427 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9428 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9429 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9430 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9431 | if (amqpvalue_get_error(item_value, error_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 9432 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9433 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9434 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9435 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9436 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9437 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 9438 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9439 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9440 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9441 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9442 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9443 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9444 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9445 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9446 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9447 | int close_set_error(CLOSE_HANDLE close, ERROR_HANDLE error_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 9448 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9449 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9450 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9451 | if (close == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9452 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 9453 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 9454 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9455 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9456 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9457 | CLOSE_INSTANCE* close_instance = (CLOSE_INSTANCE*)close; |
Azure.IoT Build | 0:6ae2f7bca550 | 9458 | AMQP_VALUE error_amqp_value = amqpvalue_create_error(error_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 9459 | if (error_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9460 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 9461 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 9462 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9463 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9464 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9465 | if (amqpvalue_set_composite_item(close_instance->composite_value, 0, error_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 9466 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 9467 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 9468 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9469 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9470 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9471 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 9472 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9473 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9474 | amqpvalue_destroy(error_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 9475 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9476 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9477 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9478 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9479 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9480 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9481 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9482 | /* sasl-code */ |
Azure.IoT Build | 0:6ae2f7bca550 | 9483 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9484 | AMQP_VALUE amqpvalue_create_sasl_code(sasl_code value) |
Azure.IoT Build | 0:6ae2f7bca550 | 9485 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9486 | return amqpvalue_create_ubyte(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 9487 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9488 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9489 | /* sasl-mechanisms */ |
Azure.IoT Build | 0:6ae2f7bca550 | 9490 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9491 | typedef struct SASL_MECHANISMS_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 9492 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9493 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 9494 | } SASL_MECHANISMS_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 9495 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9496 | static SASL_MECHANISMS_HANDLE sasl_mechanisms_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 9497 | { |
AzureIoTClient | 21:f9c433d8e6ca | 9498 | SASL_MECHANISMS_INSTANCE* sasl_mechanisms_instance = (SASL_MECHANISMS_INSTANCE*)malloc(sizeof(SASL_MECHANISMS_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 9499 | if (sasl_mechanisms_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9500 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9501 | sasl_mechanisms_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 9502 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9503 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9504 | return sasl_mechanisms_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 9505 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9506 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9507 | SASL_MECHANISMS_HANDLE sasl_mechanisms_create(AMQP_VALUE sasl_server_mechanisms_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 9508 | { |
AzureIoTClient | 21:f9c433d8e6ca | 9509 | SASL_MECHANISMS_INSTANCE* sasl_mechanisms_instance = (SASL_MECHANISMS_INSTANCE*)malloc(sizeof(SASL_MECHANISMS_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 9510 | if (sasl_mechanisms_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9511 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9512 | sasl_mechanisms_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(64); |
Azure.IoT Build | 0:6ae2f7bca550 | 9513 | if (sasl_mechanisms_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9514 | { |
AzureIoTClient | 21:f9c433d8e6ca | 9515 | free(sasl_mechanisms_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 9516 | sasl_mechanisms_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 9517 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9518 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9519 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9520 | AMQP_VALUE sasl_server_mechanisms_amqp_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 9521 | int result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 9522 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9523 | sasl_server_mechanisms_amqp_value = sasl_server_mechanisms_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 9524 | if ((result == 0) && (amqpvalue_set_composite_item(sasl_mechanisms_instance->composite_value, 0, sasl_server_mechanisms_amqp_value) != 0)) |
Azure.IoT Build | 0:6ae2f7bca550 | 9525 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 9526 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 9527 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9528 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9529 | amqpvalue_destroy(sasl_server_mechanisms_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 9530 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9531 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9532 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9533 | return sasl_mechanisms_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 9534 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9535 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9536 | SASL_MECHANISMS_HANDLE sasl_mechanisms_clone(SASL_MECHANISMS_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 9537 | { |
AzureIoTClient | 21:f9c433d8e6ca | 9538 | SASL_MECHANISMS_INSTANCE* sasl_mechanisms_instance = (SASL_MECHANISMS_INSTANCE*)malloc(sizeof(SASL_MECHANISMS_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 9539 | if (sasl_mechanisms_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9540 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9541 | sasl_mechanisms_instance->composite_value = amqpvalue_clone(((SASL_MECHANISMS_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 9542 | if (sasl_mechanisms_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9543 | { |
AzureIoTClient | 21:f9c433d8e6ca | 9544 | free(sasl_mechanisms_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 9545 | sasl_mechanisms_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 9546 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9547 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9548 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9549 | return sasl_mechanisms_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 9550 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9551 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9552 | void sasl_mechanisms_destroy(SASL_MECHANISMS_HANDLE sasl_mechanisms) |
Azure.IoT Build | 0:6ae2f7bca550 | 9553 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9554 | if (sasl_mechanisms != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9555 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9556 | SASL_MECHANISMS_INSTANCE* sasl_mechanisms_instance = (SASL_MECHANISMS_INSTANCE*)sasl_mechanisms; |
Azure.IoT Build | 0:6ae2f7bca550 | 9557 | amqpvalue_destroy(sasl_mechanisms_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 9558 | free(sasl_mechanisms_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 9559 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9560 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9561 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9562 | AMQP_VALUE amqpvalue_create_sasl_mechanisms(SASL_MECHANISMS_HANDLE sasl_mechanisms) |
Azure.IoT Build | 0:6ae2f7bca550 | 9563 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9564 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9565 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9566 | if (sasl_mechanisms == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9567 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9568 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 9569 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9570 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9571 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9572 | SASL_MECHANISMS_INSTANCE* sasl_mechanisms_instance = (SASL_MECHANISMS_INSTANCE*)sasl_mechanisms; |
Azure.IoT Build | 0:6ae2f7bca550 | 9573 | result = amqpvalue_clone(sasl_mechanisms_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 9574 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9575 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9576 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9577 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9578 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9579 | bool is_sasl_mechanisms_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 9580 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9581 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9582 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9583 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 9584 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 9585 | (descriptor_ulong == 64)) |
Azure.IoT Build | 0:6ae2f7bca550 | 9586 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9587 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 9588 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9589 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9590 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9591 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 9592 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9593 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9594 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9595 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9596 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9597 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9598 | int amqpvalue_get_sasl_mechanisms(AMQP_VALUE value, SASL_MECHANISMS_HANDLE* sasl_mechanisms_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 9599 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9600 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9601 | SASL_MECHANISMS_INSTANCE* sasl_mechanisms_instance = (SASL_MECHANISMS_INSTANCE*)sasl_mechanisms_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 9602 | *sasl_mechanisms_handle = sasl_mechanisms_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 9603 | if (*sasl_mechanisms_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9604 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 9605 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 9606 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9607 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9608 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9609 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 9610 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9611 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9612 | sasl_mechanisms_destroy(*sasl_mechanisms_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 9613 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 9614 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9615 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9616 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9617 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 9618 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 9619 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9620 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9621 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9622 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9623 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9624 | do |
AzureIoTClient | 23:1111ee8bcba4 | 9625 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9626 | AMQP_VALUE item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 9627 | /* sasl-server-mechanisms */ |
AzureIoTClient | 23:1111ee8bcba4 | 9628 | if (list_item_count > 0) |
AzureIoTClient | 23:1111ee8bcba4 | 9629 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9630 | item_value = amqpvalue_get_list_item(list_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 9631 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 9632 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9633 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9634 | sasl_mechanisms_destroy(*sasl_mechanisms_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 9635 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9636 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 9637 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9638 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9639 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9640 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9641 | const char* sasl_server_mechanisms; |
AzureIoTClient | 23:1111ee8bcba4 | 9642 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 9643 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9644 | sasl_mechanisms_destroy(*sasl_mechanisms_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 9645 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9646 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 9647 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9648 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9649 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9650 | AMQP_VALUE sasl_server_mechanisms_array; |
AzureIoTClient | 23:1111ee8bcba4 | 9651 | if ((amqpvalue_get_array(item_value, &sasl_server_mechanisms_array) != 0) && |
AzureIoTClient | 23:1111ee8bcba4 | 9652 | (amqpvalue_get_symbol(item_value, &sasl_server_mechanisms) != 0)) |
AzureIoTClient | 23:1111ee8bcba4 | 9653 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9654 | sasl_mechanisms_destroy(*sasl_mechanisms_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 9655 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9656 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 9657 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9658 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9659 | |
AzureIoTClient | 23:1111ee8bcba4 | 9660 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 9661 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9662 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9663 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9664 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9665 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9666 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9667 | |
AzureIoTClient | 23:1111ee8bcba4 | 9668 | sasl_mechanisms_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 9669 | |
AzureIoTClient | 23:1111ee8bcba4 | 9670 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 9671 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 9672 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9673 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9674 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9675 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9676 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9677 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9678 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9679 | int sasl_mechanisms_get_sasl_server_mechanisms(SASL_MECHANISMS_HANDLE sasl_mechanisms, AMQP_VALUE* sasl_server_mechanisms_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 9680 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9681 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9682 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9683 | if (sasl_mechanisms == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9684 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 9685 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 9686 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9687 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9688 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9689 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 9690 | SASL_MECHANISMS_INSTANCE* sasl_mechanisms_instance = (SASL_MECHANISMS_INSTANCE*)sasl_mechanisms; |
AzureIoTClient | 23:1111ee8bcba4 | 9691 | if (amqpvalue_get_composite_item_count(sasl_mechanisms_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 9692 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9693 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9694 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9695 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9696 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9697 | if (item_count <= 0) |
AzureIoTClient | 23:1111ee8bcba4 | 9698 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9699 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9700 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9701 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9702 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9703 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(sasl_mechanisms_instance->composite_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 9704 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 9705 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 9706 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9707 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9708 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9709 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9710 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9711 | if (amqpvalue_get_array(item_value, sasl_server_mechanisms_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 9712 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9713 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9714 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9715 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9716 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9717 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 9718 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9719 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9720 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9721 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9722 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9723 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9724 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9725 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9726 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9727 | int sasl_mechanisms_set_sasl_server_mechanisms(SASL_MECHANISMS_HANDLE sasl_mechanisms, AMQP_VALUE sasl_server_mechanisms_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 9728 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9729 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9730 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9731 | if (sasl_mechanisms == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9732 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 9733 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 9734 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9735 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9736 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9737 | SASL_MECHANISMS_INSTANCE* sasl_mechanisms_instance = (SASL_MECHANISMS_INSTANCE*)sasl_mechanisms; |
AzureIoTClient | 23:1111ee8bcba4 | 9738 | AMQP_VALUE sasl_server_mechanisms_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 9739 | if (sasl_server_mechanisms_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 9740 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9741 | sasl_server_mechanisms_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 9742 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9743 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9744 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9745 | sasl_server_mechanisms_amqp_value = amqpvalue_clone(sasl_server_mechanisms_value); |
AzureIoTClient | 23:1111ee8bcba4 | 9746 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9747 | if (sasl_server_mechanisms_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9748 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 9749 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 9750 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9751 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9752 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9753 | if (amqpvalue_set_composite_item(sasl_mechanisms_instance->composite_value, 0, sasl_server_mechanisms_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 9754 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 9755 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 9756 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9757 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9758 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9759 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 9760 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9761 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9762 | amqpvalue_destroy(sasl_server_mechanisms_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 9763 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9764 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9765 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9766 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9767 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9768 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9769 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9770 | /* sasl-init */ |
Azure.IoT Build | 0:6ae2f7bca550 | 9771 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9772 | typedef struct SASL_INIT_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 9773 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9774 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 9775 | } SASL_INIT_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 9776 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9777 | static SASL_INIT_HANDLE sasl_init_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 9778 | { |
AzureIoTClient | 21:f9c433d8e6ca | 9779 | SASL_INIT_INSTANCE* sasl_init_instance = (SASL_INIT_INSTANCE*)malloc(sizeof(SASL_INIT_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 9780 | if (sasl_init_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9781 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9782 | sasl_init_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 9783 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9784 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9785 | return sasl_init_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 9786 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9787 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9788 | SASL_INIT_HANDLE sasl_init_create(const char* mechanism_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 9789 | { |
AzureIoTClient | 21:f9c433d8e6ca | 9790 | SASL_INIT_INSTANCE* sasl_init_instance = (SASL_INIT_INSTANCE*)malloc(sizeof(SASL_INIT_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 9791 | if (sasl_init_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9792 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9793 | sasl_init_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(65); |
Azure.IoT Build | 0:6ae2f7bca550 | 9794 | if (sasl_init_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9795 | { |
AzureIoTClient | 21:f9c433d8e6ca | 9796 | free(sasl_init_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 9797 | sasl_init_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 9798 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9799 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9800 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9801 | AMQP_VALUE mechanism_amqp_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 9802 | int result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 9803 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9804 | mechanism_amqp_value = amqpvalue_create_symbol(mechanism_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 9805 | if ((result == 0) && (amqpvalue_set_composite_item(sasl_init_instance->composite_value, 0, mechanism_amqp_value) != 0)) |
Azure.IoT Build | 0:6ae2f7bca550 | 9806 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 9807 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 9808 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9809 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9810 | amqpvalue_destroy(mechanism_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 9811 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9812 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9813 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9814 | return sasl_init_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 9815 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9816 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9817 | SASL_INIT_HANDLE sasl_init_clone(SASL_INIT_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 9818 | { |
AzureIoTClient | 21:f9c433d8e6ca | 9819 | SASL_INIT_INSTANCE* sasl_init_instance = (SASL_INIT_INSTANCE*)malloc(sizeof(SASL_INIT_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 9820 | if (sasl_init_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9821 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9822 | sasl_init_instance->composite_value = amqpvalue_clone(((SASL_INIT_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 9823 | if (sasl_init_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9824 | { |
AzureIoTClient | 21:f9c433d8e6ca | 9825 | free(sasl_init_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 9826 | sasl_init_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 9827 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9828 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9829 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9830 | return sasl_init_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 9831 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9832 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9833 | void sasl_init_destroy(SASL_INIT_HANDLE sasl_init) |
Azure.IoT Build | 0:6ae2f7bca550 | 9834 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9835 | if (sasl_init != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9836 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9837 | SASL_INIT_INSTANCE* sasl_init_instance = (SASL_INIT_INSTANCE*)sasl_init; |
Azure.IoT Build | 0:6ae2f7bca550 | 9838 | amqpvalue_destroy(sasl_init_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 9839 | free(sasl_init_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 9840 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9841 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9842 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9843 | AMQP_VALUE amqpvalue_create_sasl_init(SASL_INIT_HANDLE sasl_init) |
Azure.IoT Build | 0:6ae2f7bca550 | 9844 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9845 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9846 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9847 | if (sasl_init == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9848 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9849 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 9850 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9851 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9852 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9853 | SASL_INIT_INSTANCE* sasl_init_instance = (SASL_INIT_INSTANCE*)sasl_init; |
Azure.IoT Build | 0:6ae2f7bca550 | 9854 | result = amqpvalue_clone(sasl_init_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 9855 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9856 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9857 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9858 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9859 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9860 | bool is_sasl_init_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 9861 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9862 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9863 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9864 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 9865 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 9866 | (descriptor_ulong == 65)) |
Azure.IoT Build | 0:6ae2f7bca550 | 9867 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9868 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 9869 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9870 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9871 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9872 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 9873 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9874 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9875 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9876 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9877 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9878 | |
Azure.IoT Build | 0:6ae2f7bca550 | 9879 | int amqpvalue_get_sasl_init(AMQP_VALUE value, SASL_INIT_HANDLE* sasl_init_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 9880 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9881 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 9882 | SASL_INIT_INSTANCE* sasl_init_instance = (SASL_INIT_INSTANCE*)sasl_init_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 9883 | *sasl_init_handle = sasl_init_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 9884 | if (*sasl_init_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9885 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 9886 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 9887 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9888 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9889 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9890 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 9891 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 9892 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 9893 | sasl_init_destroy(*sasl_init_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 9894 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 9895 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 9896 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 9897 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9898 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 9899 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 9900 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9901 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9902 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9903 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9904 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9905 | do |
AzureIoTClient | 23:1111ee8bcba4 | 9906 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9907 | AMQP_VALUE item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 9908 | /* mechanism */ |
AzureIoTClient | 23:1111ee8bcba4 | 9909 | if (list_item_count > 0) |
AzureIoTClient | 23:1111ee8bcba4 | 9910 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9911 | item_value = amqpvalue_get_list_item(list_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 9912 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 9913 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9914 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9915 | sasl_init_destroy(*sasl_init_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 9916 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9917 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 9918 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9919 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9920 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9921 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9922 | const char* mechanism; |
AzureIoTClient | 23:1111ee8bcba4 | 9923 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 9924 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9925 | sasl_init_destroy(*sasl_init_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 9926 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9927 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 9928 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9929 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9930 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9931 | if (amqpvalue_get_symbol(item_value, &mechanism) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 9932 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9933 | sasl_init_destroy(*sasl_init_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 9934 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9935 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 9936 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9937 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9938 | |
AzureIoTClient | 23:1111ee8bcba4 | 9939 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 9940 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9941 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9942 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9943 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9944 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9945 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9946 | /* initial-response */ |
AzureIoTClient | 23:1111ee8bcba4 | 9947 | if (list_item_count > 1) |
AzureIoTClient | 23:1111ee8bcba4 | 9948 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9949 | item_value = amqpvalue_get_list_item(list_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 9950 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 9951 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9952 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 9953 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9954 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9955 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9956 | amqp_binary initial_response; |
AzureIoTClient | 23:1111ee8bcba4 | 9957 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 9958 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9959 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 9960 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9961 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9962 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9963 | if (amqpvalue_get_binary(item_value, &initial_response) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 9964 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9965 | sasl_init_destroy(*sasl_init_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 9966 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9967 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 9968 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9969 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9970 | |
AzureIoTClient | 23:1111ee8bcba4 | 9971 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 9972 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9973 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9974 | /* hostname */ |
AzureIoTClient | 23:1111ee8bcba4 | 9975 | if (list_item_count > 2) |
AzureIoTClient | 23:1111ee8bcba4 | 9976 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9977 | item_value = amqpvalue_get_list_item(list_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 9978 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 9979 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9980 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 9981 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9982 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9983 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9984 | const char* hostname; |
AzureIoTClient | 23:1111ee8bcba4 | 9985 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 9986 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9987 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 9988 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9989 | else |
AzureIoTClient | 23:1111ee8bcba4 | 9990 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9991 | if (amqpvalue_get_string(item_value, &hostname) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 9992 | { |
AzureIoTClient | 23:1111ee8bcba4 | 9993 | sasl_init_destroy(*sasl_init_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 9994 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 9995 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 9996 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9997 | } |
AzureIoTClient | 23:1111ee8bcba4 | 9998 | |
AzureIoTClient | 23:1111ee8bcba4 | 9999 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 10000 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10001 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10002 | |
AzureIoTClient | 23:1111ee8bcba4 | 10003 | sasl_init_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 10004 | |
AzureIoTClient | 23:1111ee8bcba4 | 10005 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 10006 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 10007 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10008 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10009 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10010 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10011 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10012 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10013 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10014 | int sasl_init_get_mechanism(SASL_INIT_HANDLE sasl_init, const char** mechanism_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 10015 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10016 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10017 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10018 | if (sasl_init == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10019 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10020 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10021 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10022 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10023 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10024 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 10025 | SASL_INIT_INSTANCE* sasl_init_instance = (SASL_INIT_INSTANCE*)sasl_init; |
AzureIoTClient | 23:1111ee8bcba4 | 10026 | if (amqpvalue_get_composite_item_count(sasl_init_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10027 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10028 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10029 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10030 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10031 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10032 | if (item_count <= 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10033 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10034 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10035 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10036 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10037 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10038 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(sasl_init_instance->composite_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 10039 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 10040 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 10041 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10042 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10043 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10044 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10045 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10046 | if (amqpvalue_get_symbol(item_value, mechanism_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10047 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10048 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10049 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10050 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10051 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10052 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 10053 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10054 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10055 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10056 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10057 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10058 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10059 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10060 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10061 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10062 | int sasl_init_set_mechanism(SASL_INIT_HANDLE sasl_init, const char* mechanism_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 10063 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10064 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10065 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10066 | if (sasl_init == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10067 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10068 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10069 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10070 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10071 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10072 | SASL_INIT_INSTANCE* sasl_init_instance = (SASL_INIT_INSTANCE*)sasl_init; |
Azure.IoT Build | 0:6ae2f7bca550 | 10073 | AMQP_VALUE mechanism_amqp_value = amqpvalue_create_symbol(mechanism_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10074 | if (mechanism_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10075 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10076 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10077 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10078 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10079 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10080 | if (amqpvalue_set_composite_item(sasl_init_instance->composite_value, 0, mechanism_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 10081 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10082 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10083 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10084 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10085 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10086 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 10087 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10088 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10089 | amqpvalue_destroy(mechanism_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10090 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10091 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10092 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10093 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10094 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10095 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10096 | int sasl_init_get_initial_response(SASL_INIT_HANDLE sasl_init, amqp_binary* initial_response_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 10097 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10098 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10099 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10100 | if (sasl_init == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10101 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10102 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10103 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10104 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10105 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10106 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 10107 | SASL_INIT_INSTANCE* sasl_init_instance = (SASL_INIT_INSTANCE*)sasl_init; |
AzureIoTClient | 23:1111ee8bcba4 | 10108 | if (amqpvalue_get_composite_item_count(sasl_init_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10109 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10110 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10111 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10112 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10113 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10114 | if (item_count <= 1) |
AzureIoTClient | 23:1111ee8bcba4 | 10115 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10116 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10117 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10118 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10119 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10120 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(sasl_init_instance->composite_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 10121 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 10122 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 10123 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10124 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10125 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10126 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10127 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10128 | if (amqpvalue_get_binary(item_value, initial_response_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10129 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10130 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10131 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10132 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10133 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10134 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 10135 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10136 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10137 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10138 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10139 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10140 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10141 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10142 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10143 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10144 | int sasl_init_set_initial_response(SASL_INIT_HANDLE sasl_init, amqp_binary initial_response_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 10145 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10146 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10147 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10148 | if (sasl_init == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10149 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10150 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10151 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10152 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10153 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10154 | SASL_INIT_INSTANCE* sasl_init_instance = (SASL_INIT_INSTANCE*)sasl_init; |
Azure.IoT Build | 0:6ae2f7bca550 | 10155 | AMQP_VALUE initial_response_amqp_value = amqpvalue_create_binary(initial_response_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10156 | if (initial_response_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10157 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10158 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10159 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10160 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10161 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10162 | if (amqpvalue_set_composite_item(sasl_init_instance->composite_value, 1, initial_response_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 10163 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10164 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10165 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10166 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10167 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10168 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 10169 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10170 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10171 | amqpvalue_destroy(initial_response_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10172 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10173 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10174 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10175 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10176 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10177 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10178 | int sasl_init_get_hostname(SASL_INIT_HANDLE sasl_init, const char** hostname_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 10179 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10180 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10181 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10182 | if (sasl_init == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10183 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10184 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10185 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10186 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10187 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10188 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 10189 | SASL_INIT_INSTANCE* sasl_init_instance = (SASL_INIT_INSTANCE*)sasl_init; |
AzureIoTClient | 23:1111ee8bcba4 | 10190 | if (amqpvalue_get_composite_item_count(sasl_init_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10191 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10192 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10193 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10194 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10195 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10196 | if (item_count <= 2) |
AzureIoTClient | 23:1111ee8bcba4 | 10197 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10198 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10199 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10200 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10201 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10202 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(sasl_init_instance->composite_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 10203 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 10204 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 10205 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10206 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10207 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10208 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10209 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10210 | if (amqpvalue_get_string(item_value, hostname_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10211 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10212 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10213 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10214 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10215 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10216 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 10217 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10218 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10219 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10220 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10221 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10222 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10223 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10224 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10225 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10226 | int sasl_init_set_hostname(SASL_INIT_HANDLE sasl_init, const char* hostname_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 10227 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10228 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10229 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10230 | if (sasl_init == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10231 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10232 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10233 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10234 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10235 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10236 | SASL_INIT_INSTANCE* sasl_init_instance = (SASL_INIT_INSTANCE*)sasl_init; |
Azure.IoT Build | 0:6ae2f7bca550 | 10237 | AMQP_VALUE hostname_amqp_value = amqpvalue_create_string(hostname_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10238 | if (hostname_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10239 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10240 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10241 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10242 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10243 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10244 | if (amqpvalue_set_composite_item(sasl_init_instance->composite_value, 2, hostname_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 10245 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10246 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10247 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10248 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10249 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10250 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 10251 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10252 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10253 | amqpvalue_destroy(hostname_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10254 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10255 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10256 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10257 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10258 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10259 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10260 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10261 | /* sasl-challenge */ |
Azure.IoT Build | 0:6ae2f7bca550 | 10262 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10263 | typedef struct SASL_CHALLENGE_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 10264 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10265 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 10266 | } SASL_CHALLENGE_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 10267 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10268 | static SASL_CHALLENGE_HANDLE sasl_challenge_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 10269 | { |
AzureIoTClient | 21:f9c433d8e6ca | 10270 | SASL_CHALLENGE_INSTANCE* sasl_challenge_instance = (SASL_CHALLENGE_INSTANCE*)malloc(sizeof(SASL_CHALLENGE_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 10271 | if (sasl_challenge_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10272 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10273 | sasl_challenge_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 10274 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10275 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10276 | return sasl_challenge_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 10277 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10278 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10279 | SASL_CHALLENGE_HANDLE sasl_challenge_create(amqp_binary challenge_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 10280 | { |
AzureIoTClient | 21:f9c433d8e6ca | 10281 | SASL_CHALLENGE_INSTANCE* sasl_challenge_instance = (SASL_CHALLENGE_INSTANCE*)malloc(sizeof(SASL_CHALLENGE_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 10282 | if (sasl_challenge_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10283 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10284 | sasl_challenge_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(66); |
Azure.IoT Build | 0:6ae2f7bca550 | 10285 | if (sasl_challenge_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10286 | { |
AzureIoTClient | 21:f9c433d8e6ca | 10287 | free(sasl_challenge_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 10288 | sasl_challenge_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 10289 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10290 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10291 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10292 | AMQP_VALUE challenge_amqp_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 10293 | int result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 10294 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10295 | challenge_amqp_value = amqpvalue_create_binary(challenge_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10296 | if ((result == 0) && (amqpvalue_set_composite_item(sasl_challenge_instance->composite_value, 0, challenge_amqp_value) != 0)) |
Azure.IoT Build | 0:6ae2f7bca550 | 10297 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10298 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10299 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10300 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10301 | amqpvalue_destroy(challenge_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10302 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10303 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10304 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10305 | return sasl_challenge_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 10306 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10307 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10308 | SASL_CHALLENGE_HANDLE sasl_challenge_clone(SASL_CHALLENGE_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 10309 | { |
AzureIoTClient | 21:f9c433d8e6ca | 10310 | SASL_CHALLENGE_INSTANCE* sasl_challenge_instance = (SASL_CHALLENGE_INSTANCE*)malloc(sizeof(SASL_CHALLENGE_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 10311 | if (sasl_challenge_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10312 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10313 | sasl_challenge_instance->composite_value = amqpvalue_clone(((SASL_CHALLENGE_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10314 | if (sasl_challenge_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10315 | { |
AzureIoTClient | 21:f9c433d8e6ca | 10316 | free(sasl_challenge_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 10317 | sasl_challenge_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 10318 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10319 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10320 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10321 | return sasl_challenge_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 10322 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10323 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10324 | void sasl_challenge_destroy(SASL_CHALLENGE_HANDLE sasl_challenge) |
Azure.IoT Build | 0:6ae2f7bca550 | 10325 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10326 | if (sasl_challenge != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10327 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10328 | SASL_CHALLENGE_INSTANCE* sasl_challenge_instance = (SASL_CHALLENGE_INSTANCE*)sasl_challenge; |
Azure.IoT Build | 0:6ae2f7bca550 | 10329 | amqpvalue_destroy(sasl_challenge_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 10330 | free(sasl_challenge_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 10331 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10332 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10333 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10334 | AMQP_VALUE amqpvalue_create_sasl_challenge(SASL_CHALLENGE_HANDLE sasl_challenge) |
Azure.IoT Build | 0:6ae2f7bca550 | 10335 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10336 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10337 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10338 | if (sasl_challenge == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10339 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10340 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 10341 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10342 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10343 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10344 | SASL_CHALLENGE_INSTANCE* sasl_challenge_instance = (SASL_CHALLENGE_INSTANCE*)sasl_challenge; |
Azure.IoT Build | 0:6ae2f7bca550 | 10345 | result = amqpvalue_clone(sasl_challenge_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10346 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10347 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10348 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10349 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10350 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10351 | bool is_sasl_challenge_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 10352 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10353 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10354 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10355 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 10356 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 10357 | (descriptor_ulong == 66)) |
Azure.IoT Build | 0:6ae2f7bca550 | 10358 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10359 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 10360 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10361 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10362 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10363 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 10364 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10365 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10366 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10367 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10368 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10369 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10370 | int amqpvalue_get_sasl_challenge(AMQP_VALUE value, SASL_CHALLENGE_HANDLE* sasl_challenge_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 10371 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10372 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10373 | SASL_CHALLENGE_INSTANCE* sasl_challenge_instance = (SASL_CHALLENGE_INSTANCE*)sasl_challenge_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 10374 | *sasl_challenge_handle = sasl_challenge_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 10375 | if (*sasl_challenge_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10376 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10377 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10378 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10379 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10380 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10381 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10382 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10383 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10384 | sasl_challenge_destroy(*sasl_challenge_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 10385 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10386 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10387 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10388 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10389 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 10390 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10391 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10392 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10393 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10394 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10395 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10396 | do |
AzureIoTClient | 23:1111ee8bcba4 | 10397 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10398 | AMQP_VALUE item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 10399 | /* challenge */ |
AzureIoTClient | 23:1111ee8bcba4 | 10400 | if (list_item_count > 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10401 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10402 | item_value = amqpvalue_get_list_item(list_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 10403 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 10404 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10405 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10406 | sasl_challenge_destroy(*sasl_challenge_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 10407 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10408 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 10409 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10410 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10411 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10412 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10413 | amqp_binary challenge; |
AzureIoTClient | 23:1111ee8bcba4 | 10414 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 10415 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10416 | sasl_challenge_destroy(*sasl_challenge_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 10417 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10418 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 10419 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10420 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10421 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10422 | if (amqpvalue_get_binary(item_value, &challenge) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10423 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10424 | sasl_challenge_destroy(*sasl_challenge_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 10425 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10426 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 10427 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10428 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10429 | |
AzureIoTClient | 23:1111ee8bcba4 | 10430 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 10431 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10432 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10433 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10434 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10435 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10436 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10437 | |
AzureIoTClient | 23:1111ee8bcba4 | 10438 | sasl_challenge_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 10439 | |
AzureIoTClient | 23:1111ee8bcba4 | 10440 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 10441 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 10442 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10443 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10444 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10445 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10446 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10447 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10448 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10449 | int sasl_challenge_get_challenge(SASL_CHALLENGE_HANDLE sasl_challenge, amqp_binary* challenge_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 10450 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10451 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10452 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10453 | if (sasl_challenge == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10454 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10455 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10456 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10457 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10458 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10459 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 10460 | SASL_CHALLENGE_INSTANCE* sasl_challenge_instance = (SASL_CHALLENGE_INSTANCE*)sasl_challenge; |
AzureIoTClient | 23:1111ee8bcba4 | 10461 | if (amqpvalue_get_composite_item_count(sasl_challenge_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10462 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10463 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10464 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10465 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10466 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10467 | if (item_count <= 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10468 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10469 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10470 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10471 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10472 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10473 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(sasl_challenge_instance->composite_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 10474 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 10475 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 10476 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10477 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10478 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10479 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10480 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10481 | if (amqpvalue_get_binary(item_value, challenge_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10482 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10483 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10484 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10485 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10486 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10487 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 10488 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10489 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10490 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10491 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10492 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10493 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10494 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10495 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10496 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10497 | int sasl_challenge_set_challenge(SASL_CHALLENGE_HANDLE sasl_challenge, amqp_binary challenge_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 10498 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10499 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10500 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10501 | if (sasl_challenge == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10502 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10503 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10504 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10505 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10506 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10507 | SASL_CHALLENGE_INSTANCE* sasl_challenge_instance = (SASL_CHALLENGE_INSTANCE*)sasl_challenge; |
Azure.IoT Build | 0:6ae2f7bca550 | 10508 | AMQP_VALUE challenge_amqp_value = amqpvalue_create_binary(challenge_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10509 | if (challenge_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10510 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10511 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10512 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10513 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10514 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10515 | if (amqpvalue_set_composite_item(sasl_challenge_instance->composite_value, 0, challenge_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 10516 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10517 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10518 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10519 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10520 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10521 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 10522 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10523 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10524 | amqpvalue_destroy(challenge_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10525 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10526 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10527 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10528 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10529 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10530 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10531 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10532 | /* sasl-response */ |
Azure.IoT Build | 0:6ae2f7bca550 | 10533 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10534 | typedef struct SASL_RESPONSE_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 10535 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10536 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 10537 | } SASL_RESPONSE_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 10538 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10539 | static SASL_RESPONSE_HANDLE sasl_response_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 10540 | { |
AzureIoTClient | 21:f9c433d8e6ca | 10541 | SASL_RESPONSE_INSTANCE* sasl_response_instance = (SASL_RESPONSE_INSTANCE*)malloc(sizeof(SASL_RESPONSE_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 10542 | if (sasl_response_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10543 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10544 | sasl_response_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 10545 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10546 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10547 | return sasl_response_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 10548 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10549 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10550 | SASL_RESPONSE_HANDLE sasl_response_create(amqp_binary response_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 10551 | { |
AzureIoTClient | 21:f9c433d8e6ca | 10552 | SASL_RESPONSE_INSTANCE* sasl_response_instance = (SASL_RESPONSE_INSTANCE*)malloc(sizeof(SASL_RESPONSE_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 10553 | if (sasl_response_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10554 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10555 | sasl_response_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(67); |
Azure.IoT Build | 0:6ae2f7bca550 | 10556 | if (sasl_response_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10557 | { |
AzureIoTClient | 21:f9c433d8e6ca | 10558 | free(sasl_response_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 10559 | sasl_response_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 10560 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10561 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10562 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10563 | AMQP_VALUE response_amqp_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 10564 | int result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 10565 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10566 | response_amqp_value = amqpvalue_create_binary(response_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10567 | if ((result == 0) && (amqpvalue_set_composite_item(sasl_response_instance->composite_value, 0, response_amqp_value) != 0)) |
Azure.IoT Build | 0:6ae2f7bca550 | 10568 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10569 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10570 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10571 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10572 | amqpvalue_destroy(response_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10573 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10574 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10575 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10576 | return sasl_response_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 10577 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10578 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10579 | SASL_RESPONSE_HANDLE sasl_response_clone(SASL_RESPONSE_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 10580 | { |
AzureIoTClient | 21:f9c433d8e6ca | 10581 | SASL_RESPONSE_INSTANCE* sasl_response_instance = (SASL_RESPONSE_INSTANCE*)malloc(sizeof(SASL_RESPONSE_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 10582 | if (sasl_response_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10583 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10584 | sasl_response_instance->composite_value = amqpvalue_clone(((SASL_RESPONSE_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10585 | if (sasl_response_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10586 | { |
AzureIoTClient | 21:f9c433d8e6ca | 10587 | free(sasl_response_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 10588 | sasl_response_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 10589 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10590 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10591 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10592 | return sasl_response_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 10593 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10594 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10595 | void sasl_response_destroy(SASL_RESPONSE_HANDLE sasl_response) |
Azure.IoT Build | 0:6ae2f7bca550 | 10596 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10597 | if (sasl_response != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10598 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10599 | SASL_RESPONSE_INSTANCE* sasl_response_instance = (SASL_RESPONSE_INSTANCE*)sasl_response; |
Azure.IoT Build | 0:6ae2f7bca550 | 10600 | amqpvalue_destroy(sasl_response_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 10601 | free(sasl_response_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 10602 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10603 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10604 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10605 | AMQP_VALUE amqpvalue_create_sasl_response(SASL_RESPONSE_HANDLE sasl_response) |
Azure.IoT Build | 0:6ae2f7bca550 | 10606 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10607 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10608 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10609 | if (sasl_response == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10610 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10611 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 10612 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10613 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10614 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10615 | SASL_RESPONSE_INSTANCE* sasl_response_instance = (SASL_RESPONSE_INSTANCE*)sasl_response; |
Azure.IoT Build | 0:6ae2f7bca550 | 10616 | result = amqpvalue_clone(sasl_response_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10617 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10618 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10619 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10620 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10621 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10622 | bool is_sasl_response_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 10623 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10624 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10625 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10626 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 10627 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 10628 | (descriptor_ulong == 67)) |
Azure.IoT Build | 0:6ae2f7bca550 | 10629 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10630 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 10631 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10632 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10633 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10634 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 10635 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10636 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10637 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10638 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10639 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10640 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10641 | int amqpvalue_get_sasl_response(AMQP_VALUE value, SASL_RESPONSE_HANDLE* sasl_response_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 10642 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10643 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10644 | SASL_RESPONSE_INSTANCE* sasl_response_instance = (SASL_RESPONSE_INSTANCE*)sasl_response_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 10645 | *sasl_response_handle = sasl_response_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 10646 | if (*sasl_response_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10647 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10648 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10649 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10650 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10651 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10652 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10653 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10654 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10655 | sasl_response_destroy(*sasl_response_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 10656 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10657 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10658 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10659 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10660 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 10661 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10662 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10663 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10664 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10665 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10666 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10667 | do |
AzureIoTClient | 23:1111ee8bcba4 | 10668 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10669 | AMQP_VALUE item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 10670 | /* response */ |
AzureIoTClient | 23:1111ee8bcba4 | 10671 | if (list_item_count > 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10672 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10673 | item_value = amqpvalue_get_list_item(list_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 10674 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 10675 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10676 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10677 | sasl_response_destroy(*sasl_response_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 10678 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10679 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 10680 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10681 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10682 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10683 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10684 | amqp_binary response; |
AzureIoTClient | 23:1111ee8bcba4 | 10685 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 10686 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10687 | sasl_response_destroy(*sasl_response_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 10688 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10689 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 10690 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10691 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10692 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10693 | if (amqpvalue_get_binary(item_value, &response) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10694 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10695 | sasl_response_destroy(*sasl_response_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 10696 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10697 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 10698 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10699 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10700 | |
AzureIoTClient | 23:1111ee8bcba4 | 10701 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 10702 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10703 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10704 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10705 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10706 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10707 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10708 | |
AzureIoTClient | 23:1111ee8bcba4 | 10709 | sasl_response_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 10710 | |
AzureIoTClient | 23:1111ee8bcba4 | 10711 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 10712 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 10713 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10714 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10715 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10716 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10717 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10718 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10719 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10720 | int sasl_response_get_response(SASL_RESPONSE_HANDLE sasl_response, amqp_binary* response_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 10721 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10722 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10723 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10724 | if (sasl_response == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10725 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10726 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10727 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10728 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10729 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10730 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 10731 | SASL_RESPONSE_INSTANCE* sasl_response_instance = (SASL_RESPONSE_INSTANCE*)sasl_response; |
AzureIoTClient | 23:1111ee8bcba4 | 10732 | if (amqpvalue_get_composite_item_count(sasl_response_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10733 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10734 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10735 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10736 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10737 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10738 | if (item_count <= 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10739 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10740 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10741 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10742 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10743 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10744 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(sasl_response_instance->composite_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 10745 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 10746 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 10747 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10748 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10749 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10750 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10751 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10752 | if (amqpvalue_get_binary(item_value, response_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10753 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10754 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10755 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10756 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10757 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10758 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 10759 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10760 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10761 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10762 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10763 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10764 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10765 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10766 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10767 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10768 | int sasl_response_set_response(SASL_RESPONSE_HANDLE sasl_response, amqp_binary response_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 10769 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10770 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10771 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10772 | if (sasl_response == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10773 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10774 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10775 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10776 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10777 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10778 | SASL_RESPONSE_INSTANCE* sasl_response_instance = (SASL_RESPONSE_INSTANCE*)sasl_response; |
Azure.IoT Build | 0:6ae2f7bca550 | 10779 | AMQP_VALUE response_amqp_value = amqpvalue_create_binary(response_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10780 | if (response_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10781 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10782 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10783 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10784 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10785 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10786 | if (amqpvalue_set_composite_item(sasl_response_instance->composite_value, 0, response_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 10787 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10788 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10789 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10790 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10791 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10792 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 10793 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10794 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10795 | amqpvalue_destroy(response_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10796 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10797 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10798 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10799 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10800 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10801 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10802 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10803 | /* sasl-outcome */ |
Azure.IoT Build | 0:6ae2f7bca550 | 10804 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10805 | typedef struct SASL_OUTCOME_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 10806 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10807 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 10808 | } SASL_OUTCOME_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 10809 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10810 | static SASL_OUTCOME_HANDLE sasl_outcome_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 10811 | { |
AzureIoTClient | 21:f9c433d8e6ca | 10812 | SASL_OUTCOME_INSTANCE* sasl_outcome_instance = (SASL_OUTCOME_INSTANCE*)malloc(sizeof(SASL_OUTCOME_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 10813 | if (sasl_outcome_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10814 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10815 | sasl_outcome_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 10816 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10817 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10818 | return sasl_outcome_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 10819 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10820 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10821 | SASL_OUTCOME_HANDLE sasl_outcome_create(sasl_code code_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 10822 | { |
AzureIoTClient | 21:f9c433d8e6ca | 10823 | SASL_OUTCOME_INSTANCE* sasl_outcome_instance = (SASL_OUTCOME_INSTANCE*)malloc(sizeof(SASL_OUTCOME_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 10824 | if (sasl_outcome_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10825 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10826 | sasl_outcome_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(68); |
Azure.IoT Build | 0:6ae2f7bca550 | 10827 | if (sasl_outcome_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10828 | { |
AzureIoTClient | 21:f9c433d8e6ca | 10829 | free(sasl_outcome_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 10830 | sasl_outcome_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 10831 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10832 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10833 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10834 | AMQP_VALUE code_amqp_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 10835 | int result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 10836 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10837 | code_amqp_value = amqpvalue_create_sasl_code(code_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10838 | if ((result == 0) && (amqpvalue_set_composite_item(sasl_outcome_instance->composite_value, 0, code_amqp_value) != 0)) |
Azure.IoT Build | 0:6ae2f7bca550 | 10839 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10840 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10841 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10842 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10843 | amqpvalue_destroy(code_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10844 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10845 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10846 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10847 | return sasl_outcome_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 10848 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10849 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10850 | SASL_OUTCOME_HANDLE sasl_outcome_clone(SASL_OUTCOME_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 10851 | { |
AzureIoTClient | 21:f9c433d8e6ca | 10852 | SASL_OUTCOME_INSTANCE* sasl_outcome_instance = (SASL_OUTCOME_INSTANCE*)malloc(sizeof(SASL_OUTCOME_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 10853 | if (sasl_outcome_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10854 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10855 | sasl_outcome_instance->composite_value = amqpvalue_clone(((SASL_OUTCOME_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10856 | if (sasl_outcome_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10857 | { |
AzureIoTClient | 21:f9c433d8e6ca | 10858 | free(sasl_outcome_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 10859 | sasl_outcome_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 10860 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10861 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10862 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10863 | return sasl_outcome_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 10864 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10865 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10866 | void sasl_outcome_destroy(SASL_OUTCOME_HANDLE sasl_outcome) |
Azure.IoT Build | 0:6ae2f7bca550 | 10867 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10868 | if (sasl_outcome != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10869 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10870 | SASL_OUTCOME_INSTANCE* sasl_outcome_instance = (SASL_OUTCOME_INSTANCE*)sasl_outcome; |
Azure.IoT Build | 0:6ae2f7bca550 | 10871 | amqpvalue_destroy(sasl_outcome_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 10872 | free(sasl_outcome_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 10873 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10874 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10875 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10876 | AMQP_VALUE amqpvalue_create_sasl_outcome(SASL_OUTCOME_HANDLE sasl_outcome) |
Azure.IoT Build | 0:6ae2f7bca550 | 10877 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10878 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10879 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10880 | if (sasl_outcome == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10881 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10882 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 10883 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10884 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10885 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10886 | SASL_OUTCOME_INSTANCE* sasl_outcome_instance = (SASL_OUTCOME_INSTANCE*)sasl_outcome; |
Azure.IoT Build | 0:6ae2f7bca550 | 10887 | result = amqpvalue_clone(sasl_outcome_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10888 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10889 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10890 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10891 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10892 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10893 | bool is_sasl_outcome_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 10894 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10895 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10896 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10897 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 10898 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 10899 | (descriptor_ulong == 68)) |
Azure.IoT Build | 0:6ae2f7bca550 | 10900 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10901 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 10902 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10903 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10904 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10905 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 10906 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10907 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10908 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10909 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10910 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10911 | |
Azure.IoT Build | 0:6ae2f7bca550 | 10912 | int amqpvalue_get_sasl_outcome(AMQP_VALUE value, SASL_OUTCOME_HANDLE* sasl_outcome_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 10913 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10914 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 10915 | SASL_OUTCOME_INSTANCE* sasl_outcome_instance = (SASL_OUTCOME_INSTANCE*)sasl_outcome_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 10916 | *sasl_outcome_handle = sasl_outcome_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 10917 | if (*sasl_outcome_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10918 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 10919 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10920 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10921 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10922 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10923 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 10924 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 10925 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 10926 | sasl_outcome_destroy(*sasl_outcome_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 10927 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 10928 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 10929 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 10930 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10931 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 10932 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10933 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10934 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10935 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10936 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10937 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10938 | do |
AzureIoTClient | 23:1111ee8bcba4 | 10939 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10940 | AMQP_VALUE item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 10941 | /* code */ |
AzureIoTClient | 23:1111ee8bcba4 | 10942 | if (list_item_count > 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10943 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10944 | item_value = amqpvalue_get_list_item(list_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 10945 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 10946 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10947 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10948 | sasl_outcome_destroy(*sasl_outcome_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 10949 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10950 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 10951 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10952 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10953 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10954 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10955 | sasl_code code; |
AzureIoTClient | 23:1111ee8bcba4 | 10956 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 10957 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10958 | sasl_outcome_destroy(*sasl_outcome_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 10959 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10960 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 10961 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10962 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10963 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10964 | if (amqpvalue_get_sasl_code(item_value, &code) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10965 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10966 | sasl_outcome_destroy(*sasl_outcome_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 10967 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10968 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 10969 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10970 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10971 | |
AzureIoTClient | 23:1111ee8bcba4 | 10972 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 10973 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10974 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10975 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10976 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10977 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 10978 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10979 | /* additional-data */ |
AzureIoTClient | 23:1111ee8bcba4 | 10980 | if (list_item_count > 1) |
AzureIoTClient | 23:1111ee8bcba4 | 10981 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10982 | item_value = amqpvalue_get_list_item(list_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 10983 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 10984 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10985 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 10986 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10987 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10988 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10989 | amqp_binary additional_data; |
AzureIoTClient | 23:1111ee8bcba4 | 10990 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 10991 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10992 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 10993 | } |
AzureIoTClient | 23:1111ee8bcba4 | 10994 | else |
AzureIoTClient | 23:1111ee8bcba4 | 10995 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10996 | if (amqpvalue_get_binary(item_value, &additional_data) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 10997 | { |
AzureIoTClient | 23:1111ee8bcba4 | 10998 | sasl_outcome_destroy(*sasl_outcome_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 10999 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11000 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 11001 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11002 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11003 | |
AzureIoTClient | 23:1111ee8bcba4 | 11004 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 11005 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11006 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11007 | |
AzureIoTClient | 23:1111ee8bcba4 | 11008 | sasl_outcome_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 11009 | |
AzureIoTClient | 23:1111ee8bcba4 | 11010 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 11011 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 11012 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11013 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11014 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11015 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11016 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11017 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11018 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11019 | int sasl_outcome_get_code(SASL_OUTCOME_HANDLE sasl_outcome, sasl_code* code_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 11020 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11021 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11022 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11023 | if (sasl_outcome == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11024 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11025 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11026 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11027 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11028 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11029 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 11030 | SASL_OUTCOME_INSTANCE* sasl_outcome_instance = (SASL_OUTCOME_INSTANCE*)sasl_outcome; |
AzureIoTClient | 23:1111ee8bcba4 | 11031 | if (amqpvalue_get_composite_item_count(sasl_outcome_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 11032 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11033 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11034 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11035 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11036 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11037 | if (item_count <= 0) |
AzureIoTClient | 23:1111ee8bcba4 | 11038 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11039 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11040 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11041 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11042 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11043 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(sasl_outcome_instance->composite_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 11044 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 11045 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 11046 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11047 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11048 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11049 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11050 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11051 | if (amqpvalue_get_sasl_code(item_value, code_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 11052 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11053 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11054 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11055 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11056 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11057 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 11058 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11059 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11060 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11061 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11062 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11063 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11064 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11065 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11066 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11067 | int sasl_outcome_set_code(SASL_OUTCOME_HANDLE sasl_outcome, sasl_code code_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 11068 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11069 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11070 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11071 | if (sasl_outcome == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11072 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11073 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11074 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11075 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11076 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11077 | SASL_OUTCOME_INSTANCE* sasl_outcome_instance = (SASL_OUTCOME_INSTANCE*)sasl_outcome; |
Azure.IoT Build | 0:6ae2f7bca550 | 11078 | AMQP_VALUE code_amqp_value = amqpvalue_create_sasl_code(code_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 11079 | if (code_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11080 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11081 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11082 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11083 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11084 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11085 | if (amqpvalue_set_composite_item(sasl_outcome_instance->composite_value, 0, code_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 11086 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11087 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11088 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11089 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11090 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11091 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 11092 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11093 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11094 | amqpvalue_destroy(code_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 11095 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11096 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11097 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11098 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11099 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11100 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11101 | int sasl_outcome_get_additional_data(SASL_OUTCOME_HANDLE sasl_outcome, amqp_binary* additional_data_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 11102 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11103 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11104 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11105 | if (sasl_outcome == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11106 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11107 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11108 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11109 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11110 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11111 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 11112 | SASL_OUTCOME_INSTANCE* sasl_outcome_instance = (SASL_OUTCOME_INSTANCE*)sasl_outcome; |
AzureIoTClient | 23:1111ee8bcba4 | 11113 | if (amqpvalue_get_composite_item_count(sasl_outcome_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 11114 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11115 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11116 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11117 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11118 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11119 | if (item_count <= 1) |
AzureIoTClient | 23:1111ee8bcba4 | 11120 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11121 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11122 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11123 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11124 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11125 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(sasl_outcome_instance->composite_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 11126 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 11127 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 11128 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11129 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11130 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11131 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11132 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11133 | if (amqpvalue_get_binary(item_value, additional_data_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 11134 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11135 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11136 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11137 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11138 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11139 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 11140 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11141 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11142 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11143 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11144 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11145 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11146 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11147 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11148 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11149 | int sasl_outcome_set_additional_data(SASL_OUTCOME_HANDLE sasl_outcome, amqp_binary additional_data_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 11150 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11151 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11152 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11153 | if (sasl_outcome == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11154 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11155 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11156 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11157 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11158 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11159 | SASL_OUTCOME_INSTANCE* sasl_outcome_instance = (SASL_OUTCOME_INSTANCE*)sasl_outcome; |
Azure.IoT Build | 0:6ae2f7bca550 | 11160 | AMQP_VALUE additional_data_amqp_value = amqpvalue_create_binary(additional_data_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 11161 | if (additional_data_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11162 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11163 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11164 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11165 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11166 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11167 | if (amqpvalue_set_composite_item(sasl_outcome_instance->composite_value, 1, additional_data_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 11168 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11169 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11170 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11171 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11172 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11173 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 11174 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11175 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11176 | amqpvalue_destroy(additional_data_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 11177 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11178 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11179 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11180 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11181 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11182 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11183 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11184 | /* terminus-durability */ |
Azure.IoT Build | 0:6ae2f7bca550 | 11185 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11186 | AMQP_VALUE amqpvalue_create_terminus_durability(terminus_durability value) |
Azure.IoT Build | 0:6ae2f7bca550 | 11187 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11188 | return amqpvalue_create_uint(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 11189 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11190 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11191 | /* terminus-expiry-policy */ |
Azure.IoT Build | 0:6ae2f7bca550 | 11192 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11193 | AMQP_VALUE amqpvalue_create_terminus_expiry_policy(terminus_expiry_policy value) |
Azure.IoT Build | 0:6ae2f7bca550 | 11194 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11195 | return amqpvalue_create_symbol(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 11196 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11197 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11198 | /* node-properties */ |
Azure.IoT Build | 0:6ae2f7bca550 | 11199 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11200 | AMQP_VALUE amqpvalue_create_node_properties(node_properties value) |
Azure.IoT Build | 0:6ae2f7bca550 | 11201 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11202 | return amqpvalue_create_fields(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 11203 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11204 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11205 | /* filter-set */ |
Azure.IoT Build | 0:6ae2f7bca550 | 11206 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11207 | AMQP_VALUE amqpvalue_create_filter_set(AMQP_VALUE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 11208 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11209 | return amqpvalue_clone(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 11210 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11211 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11212 | /* source */ |
Azure.IoT Build | 0:6ae2f7bca550 | 11213 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11214 | typedef struct SOURCE_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 11215 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11216 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 11217 | } SOURCE_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 11218 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11219 | static SOURCE_HANDLE source_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 11220 | { |
AzureIoTClient | 21:f9c433d8e6ca | 11221 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)malloc(sizeof(SOURCE_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 11222 | if (source_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11223 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11224 | source_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 11225 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11226 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11227 | return source_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 11228 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11229 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11230 | SOURCE_HANDLE source_create(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 11231 | { |
AzureIoTClient | 21:f9c433d8e6ca | 11232 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)malloc(sizeof(SOURCE_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 11233 | if (source_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11234 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11235 | source_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(40); |
Azure.IoT Build | 0:6ae2f7bca550 | 11236 | if (source_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11237 | { |
AzureIoTClient | 21:f9c433d8e6ca | 11238 | free(source_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 11239 | source_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 11240 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11241 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11242 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11243 | return source_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 11244 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11245 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11246 | SOURCE_HANDLE source_clone(SOURCE_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 11247 | { |
AzureIoTClient | 21:f9c433d8e6ca | 11248 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)malloc(sizeof(SOURCE_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 11249 | if (source_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11250 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11251 | source_instance->composite_value = amqpvalue_clone(((SOURCE_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 11252 | if (source_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11253 | { |
AzureIoTClient | 21:f9c433d8e6ca | 11254 | free(source_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 11255 | source_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 11256 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11257 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11258 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11259 | return source_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 11260 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11261 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11262 | void source_destroy(SOURCE_HANDLE source) |
Azure.IoT Build | 0:6ae2f7bca550 | 11263 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11264 | if (source != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11265 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11266 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
Azure.IoT Build | 0:6ae2f7bca550 | 11267 | amqpvalue_destroy(source_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 11268 | free(source_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 11269 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11270 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11271 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11272 | AMQP_VALUE amqpvalue_create_source(SOURCE_HANDLE source) |
Azure.IoT Build | 0:6ae2f7bca550 | 11273 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11274 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11275 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11276 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11277 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11278 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 11279 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11280 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11281 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11282 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
Azure.IoT Build | 0:6ae2f7bca550 | 11283 | result = amqpvalue_clone(source_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 11284 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11285 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11286 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11287 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11288 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11289 | bool is_source_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 11290 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11291 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11292 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11293 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 11294 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 11295 | (descriptor_ulong == 40)) |
Azure.IoT Build | 0:6ae2f7bca550 | 11296 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11297 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 11298 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11299 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11300 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11301 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 11302 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11303 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11304 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11305 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11306 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11307 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11308 | int amqpvalue_get_source(AMQP_VALUE value, SOURCE_HANDLE* source_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 11309 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11310 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11311 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 11312 | *source_handle = source_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 11313 | if (*source_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11314 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11315 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11316 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11317 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11318 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11319 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 11320 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11321 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11322 | source_destroy(*source_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 11323 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11324 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11325 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11326 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11327 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 11328 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 11329 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11330 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11331 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11332 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11333 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11334 | do |
AzureIoTClient | 23:1111ee8bcba4 | 11335 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11336 | AMQP_VALUE item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 11337 | /* address */ |
AzureIoTClient | 23:1111ee8bcba4 | 11338 | if (list_item_count > 0) |
AzureIoTClient | 23:1111ee8bcba4 | 11339 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11340 | item_value = amqpvalue_get_list_item(list_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 11341 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11342 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11343 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 11344 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11345 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11346 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11347 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 11348 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11349 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11350 | /* durable */ |
AzureIoTClient | 23:1111ee8bcba4 | 11351 | if (list_item_count > 1) |
AzureIoTClient | 23:1111ee8bcba4 | 11352 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11353 | item_value = amqpvalue_get_list_item(list_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 11354 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11355 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11356 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 11357 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11358 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11359 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11360 | terminus_durability durable; |
AzureIoTClient | 23:1111ee8bcba4 | 11361 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11362 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11363 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 11364 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11365 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11366 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11367 | if (amqpvalue_get_terminus_durability(item_value, &durable) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 11368 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11369 | source_destroy(*source_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 11370 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11371 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 11372 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11373 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11374 | |
AzureIoTClient | 23:1111ee8bcba4 | 11375 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 11376 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11377 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11378 | /* expiry-policy */ |
AzureIoTClient | 23:1111ee8bcba4 | 11379 | if (list_item_count > 2) |
AzureIoTClient | 23:1111ee8bcba4 | 11380 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11381 | item_value = amqpvalue_get_list_item(list_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 11382 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11383 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11384 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 11385 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11386 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11387 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11388 | terminus_expiry_policy expiry_policy; |
AzureIoTClient | 23:1111ee8bcba4 | 11389 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11390 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11391 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 11392 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11393 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11394 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11395 | if (amqpvalue_get_terminus_expiry_policy(item_value, &expiry_policy) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 11396 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11397 | source_destroy(*source_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 11398 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11399 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 11400 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11401 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11402 | |
AzureIoTClient | 23:1111ee8bcba4 | 11403 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 11404 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11405 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11406 | /* timeout */ |
AzureIoTClient | 23:1111ee8bcba4 | 11407 | if (list_item_count > 3) |
AzureIoTClient | 23:1111ee8bcba4 | 11408 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11409 | item_value = amqpvalue_get_list_item(list_value, 3); |
AzureIoTClient | 23:1111ee8bcba4 | 11410 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11411 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11412 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 11413 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11414 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11415 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11416 | seconds timeout; |
AzureIoTClient | 23:1111ee8bcba4 | 11417 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11418 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11419 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 11420 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11421 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11422 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11423 | if (amqpvalue_get_seconds(item_value, &timeout) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 11424 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11425 | source_destroy(*source_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 11426 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11427 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 11428 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11429 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11430 | |
AzureIoTClient | 23:1111ee8bcba4 | 11431 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 11432 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11433 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11434 | /* dynamic */ |
AzureIoTClient | 23:1111ee8bcba4 | 11435 | if (list_item_count > 4) |
AzureIoTClient | 23:1111ee8bcba4 | 11436 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11437 | item_value = amqpvalue_get_list_item(list_value, 4); |
AzureIoTClient | 23:1111ee8bcba4 | 11438 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11439 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11440 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 11441 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11442 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11443 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11444 | bool dynamic; |
AzureIoTClient | 23:1111ee8bcba4 | 11445 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11446 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11447 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 11448 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11449 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11450 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11451 | if (amqpvalue_get_boolean(item_value, &dynamic) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 11452 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11453 | source_destroy(*source_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 11454 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11455 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 11456 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11457 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11458 | |
AzureIoTClient | 23:1111ee8bcba4 | 11459 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 11460 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11461 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11462 | /* dynamic-node-properties */ |
AzureIoTClient | 23:1111ee8bcba4 | 11463 | if (list_item_count > 5) |
AzureIoTClient | 23:1111ee8bcba4 | 11464 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11465 | item_value = amqpvalue_get_list_item(list_value, 5); |
AzureIoTClient | 23:1111ee8bcba4 | 11466 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11467 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11468 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 11469 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11470 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11471 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11472 | node_properties dynamic_node_properties; |
AzureIoTClient | 23:1111ee8bcba4 | 11473 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11474 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11475 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 11476 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11477 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11478 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11479 | if (amqpvalue_get_node_properties(item_value, &dynamic_node_properties) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 11480 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11481 | source_destroy(*source_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 11482 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11483 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 11484 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11485 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11486 | |
AzureIoTClient | 23:1111ee8bcba4 | 11487 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 11488 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11489 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11490 | /* distribution-mode */ |
AzureIoTClient | 23:1111ee8bcba4 | 11491 | if (list_item_count > 6) |
AzureIoTClient | 23:1111ee8bcba4 | 11492 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11493 | item_value = amqpvalue_get_list_item(list_value, 6); |
AzureIoTClient | 23:1111ee8bcba4 | 11494 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11495 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11496 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 11497 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11498 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11499 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11500 | const char* distribution_mode; |
AzureIoTClient | 23:1111ee8bcba4 | 11501 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11502 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11503 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 11504 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11505 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11506 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11507 | if (amqpvalue_get_symbol(item_value, &distribution_mode) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 11508 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11509 | source_destroy(*source_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 11510 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11511 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 11512 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11513 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11514 | |
AzureIoTClient | 23:1111ee8bcba4 | 11515 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 11516 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11517 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11518 | /* filter */ |
AzureIoTClient | 23:1111ee8bcba4 | 11519 | if (list_item_count > 7) |
AzureIoTClient | 23:1111ee8bcba4 | 11520 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11521 | item_value = amqpvalue_get_list_item(list_value, 7); |
AzureIoTClient | 23:1111ee8bcba4 | 11522 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11523 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11524 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 11525 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11526 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11527 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11528 | filter_set filter; |
AzureIoTClient | 23:1111ee8bcba4 | 11529 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11530 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11531 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 11532 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11533 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11534 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11535 | if (amqpvalue_get_filter_set(item_value, &filter) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 11536 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11537 | source_destroy(*source_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 11538 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11539 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 11540 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11541 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11542 | |
AzureIoTClient | 23:1111ee8bcba4 | 11543 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 11544 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11545 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11546 | /* default-outcome */ |
AzureIoTClient | 23:1111ee8bcba4 | 11547 | if (list_item_count > 8) |
AzureIoTClient | 23:1111ee8bcba4 | 11548 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11549 | item_value = amqpvalue_get_list_item(list_value, 8); |
AzureIoTClient | 23:1111ee8bcba4 | 11550 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11551 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11552 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 11553 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11554 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11555 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11556 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 11557 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11558 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11559 | /* outcomes */ |
AzureIoTClient | 23:1111ee8bcba4 | 11560 | if (list_item_count > 9) |
AzureIoTClient | 23:1111ee8bcba4 | 11561 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11562 | item_value = amqpvalue_get_list_item(list_value, 9); |
AzureIoTClient | 23:1111ee8bcba4 | 11563 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11564 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11565 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 11566 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11567 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11568 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11569 | const char* outcomes; |
AzureIoTClient | 23:1111ee8bcba4 | 11570 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11571 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11572 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 11573 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11574 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11575 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11576 | AMQP_VALUE outcomes_array; |
AzureIoTClient | 23:1111ee8bcba4 | 11577 | if ((amqpvalue_get_array(item_value, &outcomes_array) != 0) && |
AzureIoTClient | 23:1111ee8bcba4 | 11578 | (amqpvalue_get_symbol(item_value, &outcomes) != 0)) |
AzureIoTClient | 23:1111ee8bcba4 | 11579 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11580 | source_destroy(*source_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 11581 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11582 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 11583 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11584 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11585 | |
AzureIoTClient | 23:1111ee8bcba4 | 11586 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 11587 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11588 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11589 | /* capabilities */ |
AzureIoTClient | 23:1111ee8bcba4 | 11590 | if (list_item_count > 10) |
AzureIoTClient | 23:1111ee8bcba4 | 11591 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11592 | item_value = amqpvalue_get_list_item(list_value, 10); |
AzureIoTClient | 23:1111ee8bcba4 | 11593 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11594 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11595 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 11596 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11597 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11598 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11599 | const char* capabilities; |
AzureIoTClient | 23:1111ee8bcba4 | 11600 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11601 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11602 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 11603 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11604 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11605 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11606 | AMQP_VALUE capabilities_array; |
AzureIoTClient | 23:1111ee8bcba4 | 11607 | if ((amqpvalue_get_array(item_value, &capabilities_array) != 0) && |
AzureIoTClient | 23:1111ee8bcba4 | 11608 | (amqpvalue_get_symbol(item_value, &capabilities) != 0)) |
AzureIoTClient | 23:1111ee8bcba4 | 11609 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11610 | source_destroy(*source_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 11611 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11612 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 11613 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11614 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11615 | |
AzureIoTClient | 23:1111ee8bcba4 | 11616 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 11617 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11618 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11619 | |
AzureIoTClient | 23:1111ee8bcba4 | 11620 | source_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 11621 | |
AzureIoTClient | 23:1111ee8bcba4 | 11622 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 11623 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 11624 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11625 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11626 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11627 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11628 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11629 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11630 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11631 | int source_get_address(SOURCE_HANDLE source, AMQP_VALUE* address_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 11632 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11633 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11634 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11635 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11636 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11637 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11638 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11639 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11640 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11641 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 11642 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
AzureIoTClient | 23:1111ee8bcba4 | 11643 | if (amqpvalue_get_composite_item_count(source_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 11644 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11645 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11646 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11647 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11648 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11649 | if (item_count <= 0) |
AzureIoTClient | 23:1111ee8bcba4 | 11650 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11651 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11652 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11653 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11654 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11655 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(source_instance->composite_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 11656 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 11657 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 11658 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11659 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11660 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11661 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11662 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11663 | *address_value = item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 11664 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 11665 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11666 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11667 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11668 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11669 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11670 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11671 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11672 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11673 | int source_set_address(SOURCE_HANDLE source, AMQP_VALUE address_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 11674 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11675 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11676 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11677 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11678 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11679 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11680 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11681 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11682 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11683 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
AzureIoTClient | 23:1111ee8bcba4 | 11684 | AMQP_VALUE address_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 11685 | if (address_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11686 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11687 | address_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 11688 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11689 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11690 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11691 | address_amqp_value = amqpvalue_clone(address_value); |
AzureIoTClient | 23:1111ee8bcba4 | 11692 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11693 | if (address_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11694 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11695 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11696 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11697 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11698 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11699 | if (amqpvalue_set_composite_item(source_instance->composite_value, 0, address_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 11700 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11701 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11702 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11703 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11704 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11705 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 11706 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11707 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11708 | amqpvalue_destroy(address_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 11709 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11710 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11711 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11712 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11713 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11714 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11715 | int source_get_durable(SOURCE_HANDLE source, terminus_durability* durable_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 11716 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11717 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11718 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11719 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11720 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11721 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11722 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11723 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11724 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11725 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 11726 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
AzureIoTClient | 23:1111ee8bcba4 | 11727 | if (amqpvalue_get_composite_item_count(source_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 11728 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11729 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11730 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11731 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11732 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11733 | if (item_count <= 1) |
AzureIoTClient | 23:1111ee8bcba4 | 11734 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11735 | *durable_value = terminus_durability_none; |
AzureIoTClient | 23:1111ee8bcba4 | 11736 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 11737 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11738 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11739 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11740 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(source_instance->composite_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 11741 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 11742 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 11743 | { |
AzureIoTClient | 16:22a72cf8e416 | 11744 | *durable_value = terminus_durability_none; |
AzureIoTClient | 16:22a72cf8e416 | 11745 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 11746 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11747 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11748 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11749 | if (amqpvalue_get_terminus_durability(item_value, durable_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 11750 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11751 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11752 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11753 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11754 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11755 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11756 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11757 | *durable_value = terminus_durability_none; |
AzureIoTClient | 23:1111ee8bcba4 | 11758 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 11759 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11760 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11761 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11762 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11763 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 11764 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11765 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11766 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11767 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11768 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11769 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11770 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11771 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11772 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11773 | int source_set_durable(SOURCE_HANDLE source, terminus_durability durable_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 11774 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11775 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11776 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11777 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11778 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11779 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11780 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11781 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11782 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11783 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
Azure.IoT Build | 0:6ae2f7bca550 | 11784 | AMQP_VALUE durable_amqp_value = amqpvalue_create_terminus_durability(durable_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 11785 | if (durable_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11786 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11787 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11788 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11789 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11790 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11791 | if (amqpvalue_set_composite_item(source_instance->composite_value, 1, durable_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 11792 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11793 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11794 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11795 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11796 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11797 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 11798 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11799 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11800 | amqpvalue_destroy(durable_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 11801 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11802 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11803 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11804 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11805 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11806 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11807 | int source_get_expiry_policy(SOURCE_HANDLE source, terminus_expiry_policy* expiry_policy_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 11808 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11809 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11810 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11811 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11812 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11813 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11814 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11815 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11816 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11817 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 11818 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
AzureIoTClient | 23:1111ee8bcba4 | 11819 | if (amqpvalue_get_composite_item_count(source_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 11820 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11821 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11822 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11823 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11824 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11825 | if (item_count <= 2) |
AzureIoTClient | 23:1111ee8bcba4 | 11826 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11827 | *expiry_policy_value = terminus_expiry_policy_session_end; |
AzureIoTClient | 23:1111ee8bcba4 | 11828 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 11829 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11830 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11831 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11832 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(source_instance->composite_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 11833 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 11834 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 11835 | { |
AzureIoTClient | 16:22a72cf8e416 | 11836 | *expiry_policy_value = terminus_expiry_policy_session_end; |
AzureIoTClient | 16:22a72cf8e416 | 11837 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 11838 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11839 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11840 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11841 | if (amqpvalue_get_terminus_expiry_policy(item_value, expiry_policy_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 11842 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11843 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11844 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11845 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11846 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11847 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11848 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11849 | *expiry_policy_value = terminus_expiry_policy_session_end; |
AzureIoTClient | 23:1111ee8bcba4 | 11850 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 11851 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11852 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11853 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11854 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11855 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 11856 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11857 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11858 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11859 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11860 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11861 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11862 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11863 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11864 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11865 | int source_set_expiry_policy(SOURCE_HANDLE source, terminus_expiry_policy expiry_policy_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 11866 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11867 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11868 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11869 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11870 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11871 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11872 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11873 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11874 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11875 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
Azure.IoT Build | 0:6ae2f7bca550 | 11876 | AMQP_VALUE expiry_policy_amqp_value = amqpvalue_create_terminus_expiry_policy(expiry_policy_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 11877 | if (expiry_policy_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11878 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11879 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11880 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11881 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11882 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11883 | if (amqpvalue_set_composite_item(source_instance->composite_value, 2, expiry_policy_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 11884 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11885 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11886 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11887 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11888 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11889 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 11890 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11891 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11892 | amqpvalue_destroy(expiry_policy_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 11893 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11894 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11895 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11896 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11897 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11898 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11899 | int source_get_timeout(SOURCE_HANDLE source, seconds* timeout_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 11900 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11901 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11902 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11903 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11904 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11905 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11906 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11907 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11908 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11909 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 11910 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
AzureIoTClient | 23:1111ee8bcba4 | 11911 | if (amqpvalue_get_composite_item_count(source_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 11912 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11913 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11914 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11915 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11916 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11917 | if (item_count <= 3) |
AzureIoTClient | 23:1111ee8bcba4 | 11918 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11919 | *timeout_value = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 11920 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 11921 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11922 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11923 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11924 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(source_instance->composite_value, 3); |
AzureIoTClient | 23:1111ee8bcba4 | 11925 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 11926 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 11927 | { |
AzureIoTClient | 16:22a72cf8e416 | 11928 | *timeout_value = 0; |
AzureIoTClient | 16:22a72cf8e416 | 11929 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 11930 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11931 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11932 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11933 | if (amqpvalue_get_seconds(item_value, timeout_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 11934 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11935 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 11936 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11937 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 11938 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11939 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11940 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11941 | *timeout_value = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 11942 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 11943 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11944 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11945 | else |
AzureIoTClient | 23:1111ee8bcba4 | 11946 | { |
AzureIoTClient | 23:1111ee8bcba4 | 11947 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 11948 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11949 | } |
AzureIoTClient | 23:1111ee8bcba4 | 11950 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11951 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11952 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11953 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11954 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11955 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11956 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11957 | int source_set_timeout(SOURCE_HANDLE source, seconds timeout_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 11958 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11959 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11960 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11961 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11962 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11963 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11964 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11965 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11966 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11967 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
Azure.IoT Build | 0:6ae2f7bca550 | 11968 | AMQP_VALUE timeout_amqp_value = amqpvalue_create_seconds(timeout_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 11969 | if (timeout_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11970 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11971 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11972 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11973 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11974 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11975 | if (amqpvalue_set_composite_item(source_instance->composite_value, 3, timeout_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 11976 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11977 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11978 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11979 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 11980 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11981 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 11982 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11983 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11984 | amqpvalue_destroy(timeout_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 11985 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11986 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11987 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11988 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11989 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11990 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11991 | int source_get_dynamic(SOURCE_HANDLE source, bool* dynamic_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 11992 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 11993 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 11994 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11995 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 11996 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 11997 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 11998 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 11999 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12000 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12001 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 12002 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
AzureIoTClient | 23:1111ee8bcba4 | 12003 | if (amqpvalue_get_composite_item_count(source_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 12004 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12005 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12006 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12007 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12008 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12009 | if (item_count <= 4) |
AzureIoTClient | 23:1111ee8bcba4 | 12010 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12011 | *dynamic_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 12012 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 12013 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12014 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12015 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12016 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(source_instance->composite_value, 4); |
AzureIoTClient | 23:1111ee8bcba4 | 12017 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 12018 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 12019 | { |
AzureIoTClient | 16:22a72cf8e416 | 12020 | *dynamic_value = false; |
AzureIoTClient | 16:22a72cf8e416 | 12021 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 12022 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12023 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12024 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12025 | if (amqpvalue_get_boolean(item_value, dynamic_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 12026 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12027 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 12028 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12029 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12030 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12031 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12032 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12033 | *dynamic_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 12034 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 12035 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12036 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12037 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12038 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12039 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 12040 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12041 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12042 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12043 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12044 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12045 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12046 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12047 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12048 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12049 | int source_set_dynamic(SOURCE_HANDLE source, bool dynamic_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 12050 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12051 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12052 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12053 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12054 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12055 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12056 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12057 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12058 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12059 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
Azure.IoT Build | 0:6ae2f7bca550 | 12060 | AMQP_VALUE dynamic_amqp_value = amqpvalue_create_boolean(dynamic_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 12061 | if (dynamic_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12062 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12063 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12064 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12065 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12066 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12067 | if (amqpvalue_set_composite_item(source_instance->composite_value, 4, dynamic_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 12068 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12069 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12070 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12071 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12072 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12073 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 12074 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12075 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12076 | amqpvalue_destroy(dynamic_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 12077 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12078 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12079 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12080 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12081 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12082 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12083 | int source_get_dynamic_node_properties(SOURCE_HANDLE source, node_properties* dynamic_node_properties_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 12084 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12085 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12086 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12087 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12088 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12089 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12090 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12091 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12092 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12093 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 12094 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
AzureIoTClient | 23:1111ee8bcba4 | 12095 | if (amqpvalue_get_composite_item_count(source_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 12096 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12097 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12098 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12099 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12100 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12101 | if (item_count <= 5) |
AzureIoTClient | 23:1111ee8bcba4 | 12102 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12103 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12104 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12105 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12106 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12107 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(source_instance->composite_value, 5); |
AzureIoTClient | 23:1111ee8bcba4 | 12108 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 12109 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 12110 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12111 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12112 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12113 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12114 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12115 | if (amqpvalue_get_node_properties(item_value, dynamic_node_properties_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 12116 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12117 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12118 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12119 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12120 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12121 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 12122 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12123 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12124 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12125 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12126 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12127 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12128 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12129 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12130 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12131 | int source_set_dynamic_node_properties(SOURCE_HANDLE source, node_properties dynamic_node_properties_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 12132 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12133 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12134 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12135 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12136 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12137 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12138 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12139 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12140 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12141 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
Azure.IoT Build | 0:6ae2f7bca550 | 12142 | AMQP_VALUE dynamic_node_properties_amqp_value = amqpvalue_create_node_properties(dynamic_node_properties_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 12143 | if (dynamic_node_properties_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12144 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12145 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12146 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12147 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12148 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12149 | if (amqpvalue_set_composite_item(source_instance->composite_value, 5, dynamic_node_properties_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 12150 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12151 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12152 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12153 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12154 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12155 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 12156 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12157 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12158 | amqpvalue_destroy(dynamic_node_properties_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 12159 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12160 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12161 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12162 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12163 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12164 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12165 | int source_get_distribution_mode(SOURCE_HANDLE source, const char** distribution_mode_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 12166 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12167 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12168 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12169 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12170 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12171 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12172 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12173 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12174 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12175 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 12176 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
AzureIoTClient | 23:1111ee8bcba4 | 12177 | if (amqpvalue_get_composite_item_count(source_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 12178 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12179 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12180 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12181 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12182 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12183 | if (item_count <= 6) |
AzureIoTClient | 23:1111ee8bcba4 | 12184 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12185 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12186 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12187 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12188 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12189 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(source_instance->composite_value, 6); |
AzureIoTClient | 23:1111ee8bcba4 | 12190 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 12191 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 12192 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12193 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12194 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12195 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12196 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12197 | if (amqpvalue_get_symbol(item_value, distribution_mode_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 12198 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12199 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12200 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12201 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12202 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12203 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 12204 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12205 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12206 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12207 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12208 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12209 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12210 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12211 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12212 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12213 | int source_set_distribution_mode(SOURCE_HANDLE source, const char* distribution_mode_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 12214 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12215 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12216 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12217 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12218 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12219 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12220 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12221 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12222 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12223 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
Azure.IoT Build | 0:6ae2f7bca550 | 12224 | AMQP_VALUE distribution_mode_amqp_value = amqpvalue_create_symbol(distribution_mode_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 12225 | if (distribution_mode_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12226 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12227 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12228 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12229 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12230 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12231 | if (amqpvalue_set_composite_item(source_instance->composite_value, 6, distribution_mode_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 12232 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12233 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12234 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12235 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12236 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12237 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 12238 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12239 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12240 | amqpvalue_destroy(distribution_mode_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 12241 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12242 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12243 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12244 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12245 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12246 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12247 | int source_get_filter(SOURCE_HANDLE source, filter_set* filter_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 12248 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12249 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12250 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12251 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12252 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12253 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12254 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12255 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12256 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12257 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 12258 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
AzureIoTClient | 23:1111ee8bcba4 | 12259 | if (amqpvalue_get_composite_item_count(source_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 12260 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12261 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12262 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12263 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12264 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12265 | if (item_count <= 7) |
AzureIoTClient | 23:1111ee8bcba4 | 12266 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12267 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12268 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12269 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12270 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12271 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(source_instance->composite_value, 7); |
AzureIoTClient | 23:1111ee8bcba4 | 12272 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 12273 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 12274 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12275 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12276 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12277 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12278 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12279 | if (amqpvalue_get_filter_set(item_value, filter_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 12280 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12281 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12282 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12283 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12284 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12285 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 12286 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12287 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12288 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12289 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12290 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12291 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12292 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12293 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12294 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12295 | int source_set_filter(SOURCE_HANDLE source, filter_set filter_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 12296 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12297 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12298 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12299 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12300 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12301 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12302 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12303 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12304 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12305 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
Azure.IoT Build | 0:6ae2f7bca550 | 12306 | AMQP_VALUE filter_amqp_value = amqpvalue_create_filter_set(filter_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 12307 | if (filter_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12308 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12309 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12310 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12311 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12312 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12313 | if (amqpvalue_set_composite_item(source_instance->composite_value, 7, filter_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 12314 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12315 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12316 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12317 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12318 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12319 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 12320 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12321 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12322 | amqpvalue_destroy(filter_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 12323 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12324 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12325 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12326 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12327 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12328 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12329 | int source_get_default_outcome(SOURCE_HANDLE source, AMQP_VALUE* default_outcome_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 12330 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12331 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12332 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12333 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12334 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12335 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12336 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12337 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12338 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12339 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 12340 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
AzureIoTClient | 23:1111ee8bcba4 | 12341 | if (amqpvalue_get_composite_item_count(source_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 12342 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12343 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12344 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12345 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12346 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12347 | if (item_count <= 8) |
AzureIoTClient | 23:1111ee8bcba4 | 12348 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12349 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12350 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12351 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12352 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12353 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(source_instance->composite_value, 8); |
AzureIoTClient | 23:1111ee8bcba4 | 12354 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 12355 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 12356 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12357 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12358 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12359 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12360 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12361 | *default_outcome_value = item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 12362 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 12363 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12364 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12365 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12366 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12367 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12368 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12369 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12370 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12371 | int source_set_default_outcome(SOURCE_HANDLE source, AMQP_VALUE default_outcome_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 12372 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12373 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12374 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12375 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12376 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12377 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12378 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12379 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12380 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12381 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
AzureIoTClient | 23:1111ee8bcba4 | 12382 | AMQP_VALUE default_outcome_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 12383 | if (default_outcome_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 12384 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12385 | default_outcome_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 12386 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12387 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12388 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12389 | default_outcome_amqp_value = amqpvalue_clone(default_outcome_value); |
AzureIoTClient | 23:1111ee8bcba4 | 12390 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12391 | if (default_outcome_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12392 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12393 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12394 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12395 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12396 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12397 | if (amqpvalue_set_composite_item(source_instance->composite_value, 8, default_outcome_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 12398 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12399 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12400 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12401 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12402 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12403 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 12404 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12405 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12406 | amqpvalue_destroy(default_outcome_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 12407 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12408 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12409 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12410 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12411 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12412 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12413 | int source_get_outcomes(SOURCE_HANDLE source, AMQP_VALUE* outcomes_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 12414 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12415 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12416 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12417 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12418 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12419 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12420 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12421 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12422 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12423 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 12424 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
AzureIoTClient | 23:1111ee8bcba4 | 12425 | if (amqpvalue_get_composite_item_count(source_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 12426 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12427 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12428 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12429 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12430 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12431 | if (item_count <= 9) |
AzureIoTClient | 23:1111ee8bcba4 | 12432 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12433 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12434 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12435 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12436 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12437 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(source_instance->composite_value, 9); |
AzureIoTClient | 23:1111ee8bcba4 | 12438 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 12439 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 12440 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12441 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12442 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12443 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12444 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12445 | if (amqpvalue_get_array(item_value, outcomes_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 12446 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12447 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12448 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12449 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12450 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12451 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 12452 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12453 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12454 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12455 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12456 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12457 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12458 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12459 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12460 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12461 | int source_set_outcomes(SOURCE_HANDLE source, AMQP_VALUE outcomes_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 12462 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12463 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12464 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12465 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12466 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12467 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12468 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12469 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12470 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12471 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
AzureIoTClient | 23:1111ee8bcba4 | 12472 | AMQP_VALUE outcomes_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 12473 | if (outcomes_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 12474 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12475 | outcomes_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 12476 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12477 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12478 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12479 | outcomes_amqp_value = amqpvalue_clone(outcomes_value); |
AzureIoTClient | 23:1111ee8bcba4 | 12480 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12481 | if (outcomes_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12482 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12483 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12484 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12485 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12486 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12487 | if (amqpvalue_set_composite_item(source_instance->composite_value, 9, outcomes_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 12488 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12489 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12490 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12491 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12492 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12493 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 12494 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12495 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12496 | amqpvalue_destroy(outcomes_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 12497 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12498 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12499 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12500 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12501 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12502 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12503 | int source_get_capabilities(SOURCE_HANDLE source, AMQP_VALUE* capabilities_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 12504 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12505 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12506 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12507 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12508 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12509 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12510 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12511 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12512 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12513 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 12514 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
AzureIoTClient | 23:1111ee8bcba4 | 12515 | if (amqpvalue_get_composite_item_count(source_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 12516 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12517 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12518 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12519 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12520 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12521 | if (item_count <= 10) |
AzureIoTClient | 23:1111ee8bcba4 | 12522 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12523 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12524 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12525 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12526 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12527 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(source_instance->composite_value, 10); |
AzureIoTClient | 23:1111ee8bcba4 | 12528 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 12529 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 12530 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12531 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12532 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12533 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12534 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12535 | if (amqpvalue_get_array(item_value, capabilities_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 12536 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12537 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12538 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12539 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12540 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12541 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 12542 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12543 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12544 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12545 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12546 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12547 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12548 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12549 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12550 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12551 | int source_set_capabilities(SOURCE_HANDLE source, AMQP_VALUE capabilities_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 12552 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12553 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12554 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12555 | if (source == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12556 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12557 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12558 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12559 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12560 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12561 | SOURCE_INSTANCE* source_instance = (SOURCE_INSTANCE*)source; |
AzureIoTClient | 23:1111ee8bcba4 | 12562 | AMQP_VALUE capabilities_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 12563 | if (capabilities_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 12564 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12565 | capabilities_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 12566 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12567 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12568 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12569 | capabilities_amqp_value = amqpvalue_clone(capabilities_value); |
AzureIoTClient | 23:1111ee8bcba4 | 12570 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12571 | if (capabilities_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12572 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12573 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12574 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12575 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12576 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12577 | if (amqpvalue_set_composite_item(source_instance->composite_value, 10, capabilities_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 12578 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12579 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12580 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12581 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12582 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12583 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 12584 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12585 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12586 | amqpvalue_destroy(capabilities_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 12587 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12588 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12589 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12590 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12591 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12592 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12593 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12594 | /* target */ |
Azure.IoT Build | 0:6ae2f7bca550 | 12595 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12596 | typedef struct TARGET_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 12597 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12598 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 12599 | } TARGET_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 12600 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12601 | static TARGET_HANDLE target_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 12602 | { |
AzureIoTClient | 21:f9c433d8e6ca | 12603 | TARGET_INSTANCE* target_instance = (TARGET_INSTANCE*)malloc(sizeof(TARGET_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 12604 | if (target_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12605 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12606 | target_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 12607 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12608 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12609 | return target_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 12610 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12611 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12612 | TARGET_HANDLE target_create(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 12613 | { |
AzureIoTClient | 21:f9c433d8e6ca | 12614 | TARGET_INSTANCE* target_instance = (TARGET_INSTANCE*)malloc(sizeof(TARGET_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 12615 | if (target_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12616 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12617 | target_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(41); |
Azure.IoT Build | 0:6ae2f7bca550 | 12618 | if (target_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12619 | { |
AzureIoTClient | 21:f9c433d8e6ca | 12620 | free(target_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 12621 | target_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 12622 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12623 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12624 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12625 | return target_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 12626 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12627 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12628 | TARGET_HANDLE target_clone(TARGET_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 12629 | { |
AzureIoTClient | 21:f9c433d8e6ca | 12630 | TARGET_INSTANCE* target_instance = (TARGET_INSTANCE*)malloc(sizeof(TARGET_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 12631 | if (target_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12632 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12633 | target_instance->composite_value = amqpvalue_clone(((TARGET_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 12634 | if (target_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12635 | { |
AzureIoTClient | 21:f9c433d8e6ca | 12636 | free(target_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 12637 | target_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 12638 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12639 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12640 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12641 | return target_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 12642 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12643 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12644 | void target_destroy(TARGET_HANDLE target) |
Azure.IoT Build | 0:6ae2f7bca550 | 12645 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12646 | if (target != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12647 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12648 | TARGET_INSTANCE* target_instance = (TARGET_INSTANCE*)target; |
Azure.IoT Build | 0:6ae2f7bca550 | 12649 | amqpvalue_destroy(target_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 12650 | free(target_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 12651 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12652 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12653 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12654 | AMQP_VALUE amqpvalue_create_target(TARGET_HANDLE target) |
Azure.IoT Build | 0:6ae2f7bca550 | 12655 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12656 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12657 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12658 | if (target == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12659 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12660 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 12661 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12662 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12663 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12664 | TARGET_INSTANCE* target_instance = (TARGET_INSTANCE*)target; |
Azure.IoT Build | 0:6ae2f7bca550 | 12665 | result = amqpvalue_clone(target_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 12666 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12667 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12668 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12669 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12670 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12671 | bool is_target_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 12672 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12673 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12674 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12675 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 12676 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 12677 | (descriptor_ulong == 41)) |
Azure.IoT Build | 0:6ae2f7bca550 | 12678 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12679 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 12680 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12681 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12682 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12683 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 12684 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12685 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12686 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12687 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12688 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12689 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12690 | int amqpvalue_get_target(AMQP_VALUE value, TARGET_HANDLE* target_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 12691 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12692 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12693 | TARGET_INSTANCE* target_instance = (TARGET_INSTANCE*)target_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 12694 | *target_handle = target_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 12695 | if (*target_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12696 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12697 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12698 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12699 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12700 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12701 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 12702 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12703 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12704 | target_destroy(*target_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 12705 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12706 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12707 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12708 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12709 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 12710 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 12711 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12712 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12713 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12714 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12715 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12716 | do |
AzureIoTClient | 23:1111ee8bcba4 | 12717 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12718 | AMQP_VALUE item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 12719 | /* address */ |
AzureIoTClient | 23:1111ee8bcba4 | 12720 | if (list_item_count > 0) |
AzureIoTClient | 23:1111ee8bcba4 | 12721 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12722 | item_value = amqpvalue_get_list_item(list_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 12723 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 12724 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12725 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 12726 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12727 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12728 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12729 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 12730 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12731 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12732 | /* durable */ |
AzureIoTClient | 23:1111ee8bcba4 | 12733 | if (list_item_count > 1) |
AzureIoTClient | 23:1111ee8bcba4 | 12734 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12735 | item_value = amqpvalue_get_list_item(list_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 12736 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 12737 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12738 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 12739 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12740 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12741 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12742 | terminus_durability durable; |
AzureIoTClient | 23:1111ee8bcba4 | 12743 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 12744 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12745 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 12746 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12747 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12748 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12749 | if (amqpvalue_get_terminus_durability(item_value, &durable) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 12750 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12751 | target_destroy(*target_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 12752 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12753 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 12754 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12755 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12756 | |
AzureIoTClient | 23:1111ee8bcba4 | 12757 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 12758 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12759 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12760 | /* expiry-policy */ |
AzureIoTClient | 23:1111ee8bcba4 | 12761 | if (list_item_count > 2) |
AzureIoTClient | 23:1111ee8bcba4 | 12762 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12763 | item_value = amqpvalue_get_list_item(list_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 12764 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 12765 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12766 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 12767 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12768 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12769 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12770 | terminus_expiry_policy expiry_policy; |
AzureIoTClient | 23:1111ee8bcba4 | 12771 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 12772 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12773 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 12774 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12775 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12776 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12777 | if (amqpvalue_get_terminus_expiry_policy(item_value, &expiry_policy) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 12778 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12779 | target_destroy(*target_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 12780 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12781 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 12782 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12783 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12784 | |
AzureIoTClient | 23:1111ee8bcba4 | 12785 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 12786 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12787 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12788 | /* timeout */ |
AzureIoTClient | 23:1111ee8bcba4 | 12789 | if (list_item_count > 3) |
AzureIoTClient | 23:1111ee8bcba4 | 12790 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12791 | item_value = amqpvalue_get_list_item(list_value, 3); |
AzureIoTClient | 23:1111ee8bcba4 | 12792 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 12793 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12794 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 12795 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12796 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12797 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12798 | seconds timeout; |
AzureIoTClient | 23:1111ee8bcba4 | 12799 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 12800 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12801 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 12802 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12803 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12804 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12805 | if (amqpvalue_get_seconds(item_value, &timeout) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 12806 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12807 | target_destroy(*target_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 12808 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12809 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 12810 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12811 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12812 | |
AzureIoTClient | 23:1111ee8bcba4 | 12813 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 12814 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12815 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12816 | /* dynamic */ |
AzureIoTClient | 23:1111ee8bcba4 | 12817 | if (list_item_count > 4) |
AzureIoTClient | 23:1111ee8bcba4 | 12818 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12819 | item_value = amqpvalue_get_list_item(list_value, 4); |
AzureIoTClient | 23:1111ee8bcba4 | 12820 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 12821 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12822 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 12823 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12824 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12825 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12826 | bool dynamic; |
AzureIoTClient | 23:1111ee8bcba4 | 12827 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 12828 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12829 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 12830 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12831 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12832 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12833 | if (amqpvalue_get_boolean(item_value, &dynamic) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 12834 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12835 | target_destroy(*target_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 12836 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12837 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 12838 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12839 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12840 | |
AzureIoTClient | 23:1111ee8bcba4 | 12841 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 12842 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12843 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12844 | /* dynamic-node-properties */ |
AzureIoTClient | 23:1111ee8bcba4 | 12845 | if (list_item_count > 5) |
AzureIoTClient | 23:1111ee8bcba4 | 12846 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12847 | item_value = amqpvalue_get_list_item(list_value, 5); |
AzureIoTClient | 23:1111ee8bcba4 | 12848 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 12849 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12850 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 12851 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12852 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12853 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12854 | node_properties dynamic_node_properties; |
AzureIoTClient | 23:1111ee8bcba4 | 12855 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 12856 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12857 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 12858 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12859 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12860 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12861 | if (amqpvalue_get_node_properties(item_value, &dynamic_node_properties) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 12862 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12863 | target_destroy(*target_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 12864 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12865 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 12866 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12867 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12868 | |
AzureIoTClient | 23:1111ee8bcba4 | 12869 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 12870 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12871 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12872 | /* capabilities */ |
AzureIoTClient | 23:1111ee8bcba4 | 12873 | if (list_item_count > 6) |
AzureIoTClient | 23:1111ee8bcba4 | 12874 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12875 | item_value = amqpvalue_get_list_item(list_value, 6); |
AzureIoTClient | 23:1111ee8bcba4 | 12876 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 12877 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12878 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 12879 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12880 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12881 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12882 | const char* capabilities; |
AzureIoTClient | 23:1111ee8bcba4 | 12883 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 12884 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12885 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 12886 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12887 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12888 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12889 | AMQP_VALUE capabilities_array; |
AzureIoTClient | 23:1111ee8bcba4 | 12890 | if ((amqpvalue_get_array(item_value, &capabilities_array) != 0) && |
AzureIoTClient | 23:1111ee8bcba4 | 12891 | (amqpvalue_get_symbol(item_value, &capabilities) != 0)) |
AzureIoTClient | 23:1111ee8bcba4 | 12892 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12893 | target_destroy(*target_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 12894 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12895 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 12896 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12897 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12898 | |
AzureIoTClient | 23:1111ee8bcba4 | 12899 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 12900 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12901 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12902 | |
AzureIoTClient | 23:1111ee8bcba4 | 12903 | target_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 12904 | |
AzureIoTClient | 23:1111ee8bcba4 | 12905 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 12906 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 12907 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12908 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12909 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12910 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12911 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12912 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12913 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12914 | int target_get_address(TARGET_HANDLE target, AMQP_VALUE* address_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 12915 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12916 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12917 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12918 | if (target == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12919 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12920 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12921 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12922 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12923 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12924 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 12925 | TARGET_INSTANCE* target_instance = (TARGET_INSTANCE*)target; |
AzureIoTClient | 23:1111ee8bcba4 | 12926 | if (amqpvalue_get_composite_item_count(target_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 12927 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12928 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12929 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12930 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12931 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12932 | if (item_count <= 0) |
AzureIoTClient | 23:1111ee8bcba4 | 12933 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12934 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12935 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12936 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12937 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12938 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(target_instance->composite_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 12939 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 12940 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 12941 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12942 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 12943 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12944 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12945 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12946 | *address_value = item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 12947 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 12948 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12949 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12950 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12951 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12952 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12953 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12954 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12955 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12956 | int target_set_address(TARGET_HANDLE target, AMQP_VALUE address_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 12957 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12958 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12959 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12960 | if (target == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12961 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12962 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12963 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12964 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12965 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12966 | TARGET_INSTANCE* target_instance = (TARGET_INSTANCE*)target; |
AzureIoTClient | 23:1111ee8bcba4 | 12967 | AMQP_VALUE address_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 12968 | if (address_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 12969 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12970 | address_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 12971 | } |
AzureIoTClient | 23:1111ee8bcba4 | 12972 | else |
AzureIoTClient | 23:1111ee8bcba4 | 12973 | { |
AzureIoTClient | 23:1111ee8bcba4 | 12974 | address_amqp_value = amqpvalue_clone(address_value); |
AzureIoTClient | 23:1111ee8bcba4 | 12975 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12976 | if (address_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 12977 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12978 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12979 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12980 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12981 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12982 | if (amqpvalue_set_composite_item(target_instance->composite_value, 0, address_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 12983 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 12984 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 12985 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12986 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 12987 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 12988 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 12989 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12990 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12991 | amqpvalue_destroy(address_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 12992 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12993 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12994 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12995 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 12996 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 12997 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12998 | int target_get_durable(TARGET_HANDLE target, terminus_durability* durable_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 12999 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13000 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13001 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13002 | if (target == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13003 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13004 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13005 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13006 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13007 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13008 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 13009 | TARGET_INSTANCE* target_instance = (TARGET_INSTANCE*)target; |
AzureIoTClient | 23:1111ee8bcba4 | 13010 | if (amqpvalue_get_composite_item_count(target_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13011 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13012 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13013 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13014 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13015 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13016 | if (item_count <= 1) |
AzureIoTClient | 23:1111ee8bcba4 | 13017 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13018 | *durable_value = terminus_durability_none; |
AzureIoTClient | 23:1111ee8bcba4 | 13019 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13020 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13021 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13022 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13023 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(target_instance->composite_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 13024 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 13025 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 13026 | { |
AzureIoTClient | 16:22a72cf8e416 | 13027 | *durable_value = terminus_durability_none; |
AzureIoTClient | 16:22a72cf8e416 | 13028 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13029 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13030 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13031 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13032 | if (amqpvalue_get_terminus_durability(item_value, durable_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13033 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13034 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 13035 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13036 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13037 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13038 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13039 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13040 | *durable_value = terminus_durability_none; |
AzureIoTClient | 23:1111ee8bcba4 | 13041 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13042 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13043 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13044 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13045 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13046 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13047 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13048 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13049 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13050 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13051 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13052 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13053 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13054 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13055 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13056 | int target_set_durable(TARGET_HANDLE target, terminus_durability durable_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 13057 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13058 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13059 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13060 | if (target == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13061 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13062 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13063 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13064 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13065 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13066 | TARGET_INSTANCE* target_instance = (TARGET_INSTANCE*)target; |
Azure.IoT Build | 0:6ae2f7bca550 | 13067 | AMQP_VALUE durable_amqp_value = amqpvalue_create_terminus_durability(durable_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 13068 | if (durable_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13069 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13070 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13071 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13072 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13073 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13074 | if (amqpvalue_set_composite_item(target_instance->composite_value, 1, durable_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 13075 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13076 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13077 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13078 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13079 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13080 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 13081 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13082 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13083 | amqpvalue_destroy(durable_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 13084 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13085 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13086 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13087 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13088 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13089 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13090 | int target_get_expiry_policy(TARGET_HANDLE target, terminus_expiry_policy* expiry_policy_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 13091 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13092 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13093 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13094 | if (target == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13095 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13096 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13097 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13098 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13099 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13100 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 13101 | TARGET_INSTANCE* target_instance = (TARGET_INSTANCE*)target; |
AzureIoTClient | 23:1111ee8bcba4 | 13102 | if (amqpvalue_get_composite_item_count(target_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13103 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13104 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13105 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13106 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13107 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13108 | if (item_count <= 2) |
AzureIoTClient | 23:1111ee8bcba4 | 13109 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13110 | *expiry_policy_value = terminus_expiry_policy_session_end; |
AzureIoTClient | 23:1111ee8bcba4 | 13111 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13112 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13113 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13114 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13115 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(target_instance->composite_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 13116 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 13117 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 13118 | { |
AzureIoTClient | 16:22a72cf8e416 | 13119 | *expiry_policy_value = terminus_expiry_policy_session_end; |
AzureIoTClient | 16:22a72cf8e416 | 13120 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13121 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13122 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13123 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13124 | if (amqpvalue_get_terminus_expiry_policy(item_value, expiry_policy_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13125 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13126 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 13127 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13128 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13129 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13130 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13131 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13132 | *expiry_policy_value = terminus_expiry_policy_session_end; |
AzureIoTClient | 23:1111ee8bcba4 | 13133 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13134 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13135 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13136 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13137 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13138 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13139 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13140 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13141 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13142 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13143 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13144 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13145 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13146 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13147 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13148 | int target_set_expiry_policy(TARGET_HANDLE target, terminus_expiry_policy expiry_policy_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 13149 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13150 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13151 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13152 | if (target == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13153 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13154 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13155 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13156 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13157 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13158 | TARGET_INSTANCE* target_instance = (TARGET_INSTANCE*)target; |
Azure.IoT Build | 0:6ae2f7bca550 | 13159 | AMQP_VALUE expiry_policy_amqp_value = amqpvalue_create_terminus_expiry_policy(expiry_policy_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 13160 | if (expiry_policy_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13161 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13162 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13163 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13164 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13165 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13166 | if (amqpvalue_set_composite_item(target_instance->composite_value, 2, expiry_policy_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 13167 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13168 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13169 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13170 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13171 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13172 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 13173 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13174 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13175 | amqpvalue_destroy(expiry_policy_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 13176 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13177 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13178 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13179 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13180 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13181 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13182 | int target_get_timeout(TARGET_HANDLE target, seconds* timeout_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 13183 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13184 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13185 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13186 | if (target == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13187 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13188 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13189 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13190 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13191 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13192 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 13193 | TARGET_INSTANCE* target_instance = (TARGET_INSTANCE*)target; |
AzureIoTClient | 23:1111ee8bcba4 | 13194 | if (amqpvalue_get_composite_item_count(target_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13195 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13196 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13197 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13198 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13199 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13200 | if (item_count <= 3) |
AzureIoTClient | 23:1111ee8bcba4 | 13201 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13202 | *timeout_value = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13203 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13204 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13205 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13206 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13207 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(target_instance->composite_value, 3); |
AzureIoTClient | 23:1111ee8bcba4 | 13208 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 13209 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 13210 | { |
AzureIoTClient | 16:22a72cf8e416 | 13211 | *timeout_value = 0; |
AzureIoTClient | 16:22a72cf8e416 | 13212 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13213 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13214 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13215 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13216 | if (amqpvalue_get_seconds(item_value, timeout_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13217 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13218 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 13219 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13220 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13221 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13222 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13223 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13224 | *timeout_value = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13225 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13226 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13227 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13228 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13229 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13230 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13231 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13232 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13233 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13234 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13235 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13236 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13237 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13238 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13239 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13240 | int target_set_timeout(TARGET_HANDLE target, seconds timeout_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 13241 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13242 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13243 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13244 | if (target == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13245 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13246 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13247 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13248 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13249 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13250 | TARGET_INSTANCE* target_instance = (TARGET_INSTANCE*)target; |
Azure.IoT Build | 0:6ae2f7bca550 | 13251 | AMQP_VALUE timeout_amqp_value = amqpvalue_create_seconds(timeout_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 13252 | if (timeout_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13253 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13254 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13255 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13256 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13257 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13258 | if (amqpvalue_set_composite_item(target_instance->composite_value, 3, timeout_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 13259 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13260 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13261 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13262 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13263 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13264 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 13265 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13266 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13267 | amqpvalue_destroy(timeout_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 13268 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13269 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13270 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13271 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13272 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13273 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13274 | int target_get_dynamic(TARGET_HANDLE target, bool* dynamic_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 13275 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13276 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13277 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13278 | if (target == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13279 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13280 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13281 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13282 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13283 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13284 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 13285 | TARGET_INSTANCE* target_instance = (TARGET_INSTANCE*)target; |
AzureIoTClient | 23:1111ee8bcba4 | 13286 | if (amqpvalue_get_composite_item_count(target_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13287 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13288 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13289 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13290 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13291 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13292 | if (item_count <= 4) |
AzureIoTClient | 23:1111ee8bcba4 | 13293 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13294 | *dynamic_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 13295 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13296 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13297 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13298 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13299 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(target_instance->composite_value, 4); |
AzureIoTClient | 23:1111ee8bcba4 | 13300 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 13301 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 13302 | { |
AzureIoTClient | 16:22a72cf8e416 | 13303 | *dynamic_value = false; |
AzureIoTClient | 16:22a72cf8e416 | 13304 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13305 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13306 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13307 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13308 | if (amqpvalue_get_boolean(item_value, dynamic_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13309 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13310 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 13311 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13312 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13313 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13314 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13315 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13316 | *dynamic_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 13317 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13318 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13319 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13320 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13321 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13322 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13323 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13324 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13325 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13326 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13327 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13328 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13329 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13330 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13331 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13332 | int target_set_dynamic(TARGET_HANDLE target, bool dynamic_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 13333 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13334 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13335 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13336 | if (target == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13337 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13338 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13339 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13340 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13341 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13342 | TARGET_INSTANCE* target_instance = (TARGET_INSTANCE*)target; |
Azure.IoT Build | 0:6ae2f7bca550 | 13343 | AMQP_VALUE dynamic_amqp_value = amqpvalue_create_boolean(dynamic_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 13344 | if (dynamic_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13345 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13346 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13347 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13348 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13349 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13350 | if (amqpvalue_set_composite_item(target_instance->composite_value, 4, dynamic_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 13351 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13352 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13353 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13354 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13355 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13356 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 13357 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13358 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13359 | amqpvalue_destroy(dynamic_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 13360 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13361 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13362 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13363 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13364 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13365 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13366 | int target_get_dynamic_node_properties(TARGET_HANDLE target, node_properties* dynamic_node_properties_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 13367 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13368 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13369 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13370 | if (target == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13371 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13372 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13373 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13374 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13375 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13376 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 13377 | TARGET_INSTANCE* target_instance = (TARGET_INSTANCE*)target; |
AzureIoTClient | 23:1111ee8bcba4 | 13378 | if (amqpvalue_get_composite_item_count(target_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13379 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13380 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13381 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13382 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13383 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13384 | if (item_count <= 5) |
AzureIoTClient | 23:1111ee8bcba4 | 13385 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13386 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13387 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13388 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13389 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13390 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(target_instance->composite_value, 5); |
AzureIoTClient | 23:1111ee8bcba4 | 13391 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 13392 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 13393 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13394 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13395 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13396 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13397 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13398 | if (amqpvalue_get_node_properties(item_value, dynamic_node_properties_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13399 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13400 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13401 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13402 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13403 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13404 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13405 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13406 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13407 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13408 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13409 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13410 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13411 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13412 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13413 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13414 | int target_set_dynamic_node_properties(TARGET_HANDLE target, node_properties dynamic_node_properties_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 13415 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13416 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13417 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13418 | if (target == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13419 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13420 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13421 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13422 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13423 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13424 | TARGET_INSTANCE* target_instance = (TARGET_INSTANCE*)target; |
Azure.IoT Build | 0:6ae2f7bca550 | 13425 | AMQP_VALUE dynamic_node_properties_amqp_value = amqpvalue_create_node_properties(dynamic_node_properties_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 13426 | if (dynamic_node_properties_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13427 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13428 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13429 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13430 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13431 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13432 | if (amqpvalue_set_composite_item(target_instance->composite_value, 5, dynamic_node_properties_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 13433 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13434 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13435 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13436 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13437 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13438 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 13439 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13440 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13441 | amqpvalue_destroy(dynamic_node_properties_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 13442 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13443 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13444 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13445 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13446 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13447 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13448 | int target_get_capabilities(TARGET_HANDLE target, AMQP_VALUE* capabilities_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 13449 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13450 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13451 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13452 | if (target == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13453 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13454 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13455 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13456 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13457 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13458 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 13459 | TARGET_INSTANCE* target_instance = (TARGET_INSTANCE*)target; |
AzureIoTClient | 23:1111ee8bcba4 | 13460 | if (amqpvalue_get_composite_item_count(target_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13461 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13462 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13463 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13464 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13465 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13466 | if (item_count <= 6) |
AzureIoTClient | 23:1111ee8bcba4 | 13467 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13468 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13469 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13470 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13471 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13472 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(target_instance->composite_value, 6); |
AzureIoTClient | 23:1111ee8bcba4 | 13473 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 13474 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 13475 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13476 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13477 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13478 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13479 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13480 | if (amqpvalue_get_array(item_value, capabilities_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13481 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13482 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13483 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13484 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13485 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13486 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13487 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13488 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13489 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13490 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13491 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13492 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13493 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13494 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13495 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13496 | int target_set_capabilities(TARGET_HANDLE target, AMQP_VALUE capabilities_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 13497 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13498 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13499 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13500 | if (target == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13501 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13502 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13503 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13504 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13505 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13506 | TARGET_INSTANCE* target_instance = (TARGET_INSTANCE*)target; |
AzureIoTClient | 23:1111ee8bcba4 | 13507 | AMQP_VALUE capabilities_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 13508 | if (capabilities_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 13509 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13510 | capabilities_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 13511 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13512 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13513 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13514 | capabilities_amqp_value = amqpvalue_clone(capabilities_value); |
AzureIoTClient | 23:1111ee8bcba4 | 13515 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13516 | if (capabilities_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13517 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13518 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13519 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13520 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13521 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13522 | if (amqpvalue_set_composite_item(target_instance->composite_value, 6, capabilities_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 13523 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13524 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13525 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13526 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13527 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13528 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 13529 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13530 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13531 | amqpvalue_destroy(capabilities_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 13532 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13533 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13534 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13535 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13536 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13537 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13538 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13539 | /* annotations */ |
Azure.IoT Build | 0:6ae2f7bca550 | 13540 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13541 | AMQP_VALUE amqpvalue_create_annotations(AMQP_VALUE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 13542 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13543 | return amqpvalue_clone(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 13544 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13545 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13546 | /* message-id-ulong */ |
Azure.IoT Build | 0:6ae2f7bca550 | 13547 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13548 | AMQP_VALUE amqpvalue_create_message_id_ulong(message_id_ulong value) |
Azure.IoT Build | 0:6ae2f7bca550 | 13549 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13550 | return amqpvalue_create_ulong(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 13551 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13552 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13553 | /* message-id-uuid */ |
Azure.IoT Build | 0:6ae2f7bca550 | 13554 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13555 | AMQP_VALUE amqpvalue_create_message_id_uuid(message_id_uuid value) |
Azure.IoT Build | 0:6ae2f7bca550 | 13556 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13557 | return amqpvalue_create_uuid(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 13558 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13559 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13560 | /* message-id-binary */ |
Azure.IoT Build | 0:6ae2f7bca550 | 13561 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13562 | AMQP_VALUE amqpvalue_create_message_id_binary(message_id_binary value) |
Azure.IoT Build | 0:6ae2f7bca550 | 13563 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13564 | return amqpvalue_create_binary(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 13565 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13566 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13567 | /* message-id-string */ |
Azure.IoT Build | 0:6ae2f7bca550 | 13568 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13569 | AMQP_VALUE amqpvalue_create_message_id_string(message_id_string value) |
Azure.IoT Build | 0:6ae2f7bca550 | 13570 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13571 | return amqpvalue_create_string(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 13572 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13573 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13574 | /* address-string */ |
Azure.IoT Build | 0:6ae2f7bca550 | 13575 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13576 | AMQP_VALUE amqpvalue_create_address_string(address_string value) |
Azure.IoT Build | 0:6ae2f7bca550 | 13577 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13578 | return amqpvalue_create_string(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 13579 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13580 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13581 | /* header */ |
Azure.IoT Build | 0:6ae2f7bca550 | 13582 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13583 | typedef struct HEADER_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 13584 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13585 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 13586 | } HEADER_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 13587 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13588 | static HEADER_HANDLE header_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 13589 | { |
AzureIoTClient | 21:f9c433d8e6ca | 13590 | HEADER_INSTANCE* header_instance = (HEADER_INSTANCE*)malloc(sizeof(HEADER_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 13591 | if (header_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13592 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13593 | header_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 13594 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13595 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13596 | return header_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 13597 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13598 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13599 | HEADER_HANDLE header_create(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 13600 | { |
AzureIoTClient | 21:f9c433d8e6ca | 13601 | HEADER_INSTANCE* header_instance = (HEADER_INSTANCE*)malloc(sizeof(HEADER_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 13602 | if (header_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13603 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13604 | header_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(112); |
Azure.IoT Build | 0:6ae2f7bca550 | 13605 | if (header_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13606 | { |
AzureIoTClient | 21:f9c433d8e6ca | 13607 | free(header_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 13608 | header_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 13609 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13610 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13611 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13612 | return header_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 13613 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13614 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13615 | HEADER_HANDLE header_clone(HEADER_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 13616 | { |
AzureIoTClient | 21:f9c433d8e6ca | 13617 | HEADER_INSTANCE* header_instance = (HEADER_INSTANCE*)malloc(sizeof(HEADER_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 13618 | if (header_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13619 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13620 | header_instance->composite_value = amqpvalue_clone(((HEADER_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 13621 | if (header_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13622 | { |
AzureIoTClient | 21:f9c433d8e6ca | 13623 | free(header_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 13624 | header_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 13625 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13626 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13627 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13628 | return header_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 13629 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13630 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13631 | void header_destroy(HEADER_HANDLE header) |
Azure.IoT Build | 0:6ae2f7bca550 | 13632 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13633 | if (header != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13634 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13635 | HEADER_INSTANCE* header_instance = (HEADER_INSTANCE*)header; |
Azure.IoT Build | 0:6ae2f7bca550 | 13636 | amqpvalue_destroy(header_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 13637 | free(header_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 13638 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13639 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13640 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13641 | AMQP_VALUE amqpvalue_create_header(HEADER_HANDLE header) |
Azure.IoT Build | 0:6ae2f7bca550 | 13642 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13643 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13644 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13645 | if (header == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13646 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13647 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 13648 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13649 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13650 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13651 | HEADER_INSTANCE* header_instance = (HEADER_INSTANCE*)header; |
Azure.IoT Build | 0:6ae2f7bca550 | 13652 | result = amqpvalue_clone(header_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 13653 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13654 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13655 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13656 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13657 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13658 | bool is_header_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 13659 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13660 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13661 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13662 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 13663 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 13664 | (descriptor_ulong == 112)) |
Azure.IoT Build | 0:6ae2f7bca550 | 13665 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13666 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 13667 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13668 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13669 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13670 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 13671 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13672 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13673 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13674 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13675 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13676 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13677 | int amqpvalue_get_header(AMQP_VALUE value, HEADER_HANDLE* header_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 13678 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13679 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13680 | HEADER_INSTANCE* header_instance = (HEADER_INSTANCE*)header_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 13681 | *header_handle = header_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 13682 | if (*header_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13683 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13684 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13685 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13686 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13687 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13688 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 13689 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13690 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13691 | header_destroy(*header_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 13692 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13693 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13694 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13695 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13696 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 13697 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13698 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13699 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13700 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13701 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13702 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13703 | do |
AzureIoTClient | 23:1111ee8bcba4 | 13704 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13705 | AMQP_VALUE item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 13706 | /* durable */ |
AzureIoTClient | 23:1111ee8bcba4 | 13707 | if (list_item_count > 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13708 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13709 | item_value = amqpvalue_get_list_item(list_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 13710 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 13711 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13712 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 13713 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13714 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13715 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13716 | bool durable; |
AzureIoTClient | 23:1111ee8bcba4 | 13717 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 13718 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13719 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 13720 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13721 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13722 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13723 | if (amqpvalue_get_boolean(item_value, &durable) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13724 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13725 | header_destroy(*header_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 13726 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13727 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 13728 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13729 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13730 | |
AzureIoTClient | 23:1111ee8bcba4 | 13731 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 13732 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13733 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13734 | /* priority */ |
AzureIoTClient | 23:1111ee8bcba4 | 13735 | if (list_item_count > 1) |
AzureIoTClient | 23:1111ee8bcba4 | 13736 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13737 | item_value = amqpvalue_get_list_item(list_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 13738 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 13739 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13740 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 13741 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13742 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13743 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13744 | uint8_t priority; |
AzureIoTClient | 23:1111ee8bcba4 | 13745 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 13746 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13747 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 13748 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13749 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13750 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13751 | if (amqpvalue_get_ubyte(item_value, &priority) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13752 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13753 | header_destroy(*header_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 13754 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13755 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 13756 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13757 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13758 | |
AzureIoTClient | 23:1111ee8bcba4 | 13759 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 13760 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13761 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13762 | /* ttl */ |
AzureIoTClient | 23:1111ee8bcba4 | 13763 | if (list_item_count > 2) |
AzureIoTClient | 23:1111ee8bcba4 | 13764 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13765 | item_value = amqpvalue_get_list_item(list_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 13766 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 13767 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13768 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 13769 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13770 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13771 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13772 | milliseconds ttl; |
AzureIoTClient | 23:1111ee8bcba4 | 13773 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 13774 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13775 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 13776 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13777 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13778 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13779 | if (amqpvalue_get_milliseconds(item_value, &ttl) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13780 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13781 | header_destroy(*header_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 13782 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13783 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 13784 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13785 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13786 | |
AzureIoTClient | 23:1111ee8bcba4 | 13787 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 13788 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13789 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13790 | /* first-acquirer */ |
AzureIoTClient | 23:1111ee8bcba4 | 13791 | if (list_item_count > 3) |
AzureIoTClient | 23:1111ee8bcba4 | 13792 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13793 | item_value = amqpvalue_get_list_item(list_value, 3); |
AzureIoTClient | 23:1111ee8bcba4 | 13794 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 13795 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13796 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 13797 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13798 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13799 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13800 | bool first_acquirer; |
AzureIoTClient | 23:1111ee8bcba4 | 13801 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 13802 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13803 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 13804 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13805 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13806 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13807 | if (amqpvalue_get_boolean(item_value, &first_acquirer) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13808 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13809 | header_destroy(*header_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 13810 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13811 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 13812 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13813 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13814 | |
AzureIoTClient | 23:1111ee8bcba4 | 13815 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 13816 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13817 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13818 | /* delivery-count */ |
AzureIoTClient | 23:1111ee8bcba4 | 13819 | if (list_item_count > 4) |
AzureIoTClient | 23:1111ee8bcba4 | 13820 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13821 | item_value = amqpvalue_get_list_item(list_value, 4); |
AzureIoTClient | 23:1111ee8bcba4 | 13822 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 13823 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13824 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 13825 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13826 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13827 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13828 | uint32_t delivery_count; |
AzureIoTClient | 23:1111ee8bcba4 | 13829 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 13830 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13831 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 13832 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13833 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13834 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13835 | if (amqpvalue_get_uint(item_value, &delivery_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13836 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13837 | header_destroy(*header_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 13838 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13839 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 13840 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13841 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13842 | |
AzureIoTClient | 23:1111ee8bcba4 | 13843 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 13844 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13845 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13846 | |
AzureIoTClient | 23:1111ee8bcba4 | 13847 | header_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 13848 | |
AzureIoTClient | 23:1111ee8bcba4 | 13849 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13850 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 13851 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13852 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13853 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13854 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13855 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13856 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13857 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13858 | int header_get_durable(HEADER_HANDLE header, bool* durable_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 13859 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13860 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13861 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13862 | if (header == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13863 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13864 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13865 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13866 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13867 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13868 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 13869 | HEADER_INSTANCE* header_instance = (HEADER_INSTANCE*)header; |
AzureIoTClient | 23:1111ee8bcba4 | 13870 | if (amqpvalue_get_composite_item_count(header_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13871 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13872 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13873 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13874 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13875 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13876 | if (item_count <= 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13877 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13878 | *durable_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 13879 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13880 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13881 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13882 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13883 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(header_instance->composite_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 13884 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 13885 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 13886 | { |
AzureIoTClient | 16:22a72cf8e416 | 13887 | *durable_value = false; |
AzureIoTClient | 16:22a72cf8e416 | 13888 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13889 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13890 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13891 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13892 | if (amqpvalue_get_boolean(item_value, durable_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13893 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13894 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 13895 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13896 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13897 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13898 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13899 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13900 | *durable_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 13901 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13902 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13903 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13904 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13905 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13906 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13907 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13908 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13909 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13910 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13911 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13912 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13913 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13914 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13915 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13916 | int header_set_durable(HEADER_HANDLE header, bool durable_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 13917 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13918 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13919 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13920 | if (header == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13921 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13922 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13923 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13924 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13925 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13926 | HEADER_INSTANCE* header_instance = (HEADER_INSTANCE*)header; |
Azure.IoT Build | 0:6ae2f7bca550 | 13927 | AMQP_VALUE durable_amqp_value = amqpvalue_create_boolean(durable_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 13928 | if (durable_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13929 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13930 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13931 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13932 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13933 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13934 | if (amqpvalue_set_composite_item(header_instance->composite_value, 0, durable_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 13935 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13936 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13937 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13938 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13939 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13940 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 13941 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13942 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13943 | amqpvalue_destroy(durable_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 13944 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13945 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13946 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13947 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13948 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13949 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13950 | int header_get_priority(HEADER_HANDLE header, uint8_t* priority_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 13951 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 13952 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 13953 | |
Azure.IoT Build | 0:6ae2f7bca550 | 13954 | if (header == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 13955 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 13956 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 13957 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 13958 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 13959 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13960 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 13961 | HEADER_INSTANCE* header_instance = (HEADER_INSTANCE*)header; |
AzureIoTClient | 23:1111ee8bcba4 | 13962 | if (amqpvalue_get_composite_item_count(header_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13963 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13964 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13965 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13966 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13967 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13968 | if (item_count <= 1) |
AzureIoTClient | 23:1111ee8bcba4 | 13969 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13970 | *priority_value = 4; |
AzureIoTClient | 23:1111ee8bcba4 | 13971 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13972 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13973 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13974 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13975 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(header_instance->composite_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 13976 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 13977 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 13978 | { |
AzureIoTClient | 16:22a72cf8e416 | 13979 | *priority_value = 4; |
AzureIoTClient | 16:22a72cf8e416 | 13980 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13981 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13982 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13983 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13984 | if (amqpvalue_get_ubyte(item_value, priority_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 13985 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13986 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 13987 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13988 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 13989 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13990 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13991 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13992 | *priority_value = 4; |
AzureIoTClient | 23:1111ee8bcba4 | 13993 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13994 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13995 | } |
AzureIoTClient | 23:1111ee8bcba4 | 13996 | else |
AzureIoTClient | 23:1111ee8bcba4 | 13997 | { |
AzureIoTClient | 23:1111ee8bcba4 | 13998 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 13999 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14000 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14001 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14002 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14003 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14004 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14005 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14006 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14007 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14008 | int header_set_priority(HEADER_HANDLE header, uint8_t priority_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 14009 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14010 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14011 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14012 | if (header == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14013 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 14014 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 14015 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14016 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14017 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14018 | HEADER_INSTANCE* header_instance = (HEADER_INSTANCE*)header; |
Azure.IoT Build | 0:6ae2f7bca550 | 14019 | AMQP_VALUE priority_amqp_value = amqpvalue_create_ubyte(priority_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14020 | if (priority_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14021 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 14022 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 14023 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14024 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14025 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14026 | if (amqpvalue_set_composite_item(header_instance->composite_value, 1, priority_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 14027 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 14028 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 14029 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14030 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14031 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14032 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 14033 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14034 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14035 | amqpvalue_destroy(priority_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14036 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14037 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14038 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14039 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14040 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14041 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14042 | int header_get_ttl(HEADER_HANDLE header, milliseconds* ttl_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 14043 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14044 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14045 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14046 | if (header == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14047 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 14048 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 14049 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14050 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14051 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14052 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 14053 | HEADER_INSTANCE* header_instance = (HEADER_INSTANCE*)header; |
AzureIoTClient | 23:1111ee8bcba4 | 14054 | if (amqpvalue_get_composite_item_count(header_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 14055 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14056 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 14057 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14058 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14059 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14060 | if (item_count <= 2) |
AzureIoTClient | 23:1111ee8bcba4 | 14061 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14062 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 14063 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14064 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14065 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14066 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(header_instance->composite_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 14067 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 14068 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 14069 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14070 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 14071 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14072 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14073 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14074 | if (amqpvalue_get_milliseconds(item_value, ttl_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 14075 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14076 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 14077 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14078 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14079 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14080 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 14081 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14082 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14083 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14084 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14085 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14086 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14087 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14088 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14089 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14090 | int header_set_ttl(HEADER_HANDLE header, milliseconds ttl_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 14091 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14092 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14093 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14094 | if (header == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14095 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 14096 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 14097 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14098 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14099 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14100 | HEADER_INSTANCE* header_instance = (HEADER_INSTANCE*)header; |
Azure.IoT Build | 0:6ae2f7bca550 | 14101 | AMQP_VALUE ttl_amqp_value = amqpvalue_create_milliseconds(ttl_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14102 | if (ttl_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14103 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 14104 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 14105 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14106 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14107 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14108 | if (amqpvalue_set_composite_item(header_instance->composite_value, 2, ttl_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 14109 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 14110 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 14111 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14112 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14113 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14114 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 14115 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14116 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14117 | amqpvalue_destroy(ttl_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14118 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14119 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14120 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14121 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14122 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14123 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14124 | int header_get_first_acquirer(HEADER_HANDLE header, bool* first_acquirer_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 14125 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14126 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14127 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14128 | if (header == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14129 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 14130 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 14131 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14132 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14133 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14134 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 14135 | HEADER_INSTANCE* header_instance = (HEADER_INSTANCE*)header; |
AzureIoTClient | 23:1111ee8bcba4 | 14136 | if (amqpvalue_get_composite_item_count(header_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 14137 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14138 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 14139 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14140 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14141 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14142 | if (item_count <= 3) |
AzureIoTClient | 23:1111ee8bcba4 | 14143 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14144 | *first_acquirer_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 14145 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 14146 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14147 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14148 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14149 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(header_instance->composite_value, 3); |
AzureIoTClient | 23:1111ee8bcba4 | 14150 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 14151 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 14152 | { |
AzureIoTClient | 16:22a72cf8e416 | 14153 | *first_acquirer_value = false; |
AzureIoTClient | 16:22a72cf8e416 | 14154 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 14155 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14156 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14157 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14158 | if (amqpvalue_get_boolean(item_value, first_acquirer_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 14159 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14160 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 14161 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14162 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 14163 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14164 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14165 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14166 | *first_acquirer_value = false; |
AzureIoTClient | 23:1111ee8bcba4 | 14167 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 14168 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14169 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14170 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14171 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14172 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 14173 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14174 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14175 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14176 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14177 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14178 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14179 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14180 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14181 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14182 | int header_set_first_acquirer(HEADER_HANDLE header, bool first_acquirer_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 14183 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14184 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14185 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14186 | if (header == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14187 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 14188 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 14189 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14190 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14191 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14192 | HEADER_INSTANCE* header_instance = (HEADER_INSTANCE*)header; |
Azure.IoT Build | 0:6ae2f7bca550 | 14193 | AMQP_VALUE first_acquirer_amqp_value = amqpvalue_create_boolean(first_acquirer_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14194 | if (first_acquirer_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14195 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 14196 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 14197 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14198 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14199 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14200 | if (amqpvalue_set_composite_item(header_instance->composite_value, 3, first_acquirer_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 14201 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 14202 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 14203 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14204 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14205 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14206 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 14207 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14208 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14209 | amqpvalue_destroy(first_acquirer_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14210 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14211 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14212 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14213 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14214 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14215 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14216 | int header_get_delivery_count(HEADER_HANDLE header, uint32_t* delivery_count_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 14217 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14218 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14219 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14220 | if (header == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14221 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 14222 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 14223 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14224 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14225 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14226 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 14227 | HEADER_INSTANCE* header_instance = (HEADER_INSTANCE*)header; |
AzureIoTClient | 23:1111ee8bcba4 | 14228 | if (amqpvalue_get_composite_item_count(header_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 14229 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14230 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 14231 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14232 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14233 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14234 | if (item_count <= 4) |
AzureIoTClient | 23:1111ee8bcba4 | 14235 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14236 | *delivery_count_value = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 14237 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 14238 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14239 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14240 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14241 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(header_instance->composite_value, 4); |
AzureIoTClient | 23:1111ee8bcba4 | 14242 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 14243 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 14244 | { |
AzureIoTClient | 16:22a72cf8e416 | 14245 | *delivery_count_value = 0; |
AzureIoTClient | 16:22a72cf8e416 | 14246 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 14247 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14248 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14249 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14250 | if (amqpvalue_get_uint(item_value, delivery_count_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 14251 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14252 | if (amqpvalue_get_type(item_value) != AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 14253 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14254 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 14255 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14256 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14257 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14258 | *delivery_count_value = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 14259 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 14260 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14261 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14262 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14263 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14264 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 14265 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14266 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14267 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14268 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14269 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14270 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14271 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14272 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14273 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14274 | int header_set_delivery_count(HEADER_HANDLE header, uint32_t delivery_count_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 14275 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14276 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14277 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14278 | if (header == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14279 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 14280 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 14281 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14282 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14283 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14284 | HEADER_INSTANCE* header_instance = (HEADER_INSTANCE*)header; |
Azure.IoT Build | 0:6ae2f7bca550 | 14285 | AMQP_VALUE delivery_count_amqp_value = amqpvalue_create_uint(delivery_count_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14286 | if (delivery_count_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14287 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 14288 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 14289 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14290 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14291 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14292 | if (amqpvalue_set_composite_item(header_instance->composite_value, 4, delivery_count_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 14293 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 14294 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 14295 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14296 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14297 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14298 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 14299 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14300 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14301 | amqpvalue_destroy(delivery_count_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14302 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14303 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14304 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14305 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14306 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14307 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14308 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14309 | /* delivery-annotations */ |
Azure.IoT Build | 0:6ae2f7bca550 | 14310 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14311 | AMQP_VALUE amqpvalue_create_delivery_annotations(delivery_annotations value) |
Azure.IoT Build | 0:6ae2f7bca550 | 14312 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14313 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14314 | AMQP_VALUE described_value = amqpvalue_create_annotations(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14315 | if (described_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14316 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14317 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 14318 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14319 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14320 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14321 | AMQP_VALUE descriptor = amqpvalue_create_ulong(113); |
Azure.IoT Build | 0:6ae2f7bca550 | 14322 | if (descriptor == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14323 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14324 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 14325 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14326 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14327 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14328 | result = amqpvalue_create_described(amqpvalue_clone(descriptor), amqpvalue_clone(described_value)); |
Azure.IoT Build | 0:6ae2f7bca550 | 14329 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14330 | amqpvalue_destroy(descriptor); |
Azure.IoT Build | 0:6ae2f7bca550 | 14331 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14332 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14333 | amqpvalue_destroy(described_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14334 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14335 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14336 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14337 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14338 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14339 | bool is_delivery_annotations_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 14340 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14341 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14342 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14343 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 14344 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 14345 | (descriptor_ulong == 113)) |
Azure.IoT Build | 0:6ae2f7bca550 | 14346 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14347 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 14348 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14349 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14350 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14351 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 14352 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14353 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14354 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14355 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14356 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14357 | /* message-annotations */ |
Azure.IoT Build | 0:6ae2f7bca550 | 14358 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14359 | AMQP_VALUE amqpvalue_create_message_annotations(message_annotations value) |
Azure.IoT Build | 0:6ae2f7bca550 | 14360 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14361 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14362 | AMQP_VALUE described_value = amqpvalue_create_annotations(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14363 | if (described_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14364 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14365 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 14366 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14367 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14368 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14369 | AMQP_VALUE descriptor = amqpvalue_create_ulong(114); |
Azure.IoT Build | 0:6ae2f7bca550 | 14370 | if (descriptor == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14371 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14372 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 14373 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14374 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14375 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14376 | result = amqpvalue_create_described(amqpvalue_clone(descriptor), amqpvalue_clone(described_value)); |
Azure.IoT Build | 0:6ae2f7bca550 | 14377 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14378 | amqpvalue_destroy(descriptor); |
Azure.IoT Build | 0:6ae2f7bca550 | 14379 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14380 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14381 | amqpvalue_destroy(described_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14382 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14383 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14384 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14385 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14386 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14387 | bool is_message_annotations_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 14388 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14389 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14390 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14391 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 14392 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 14393 | (descriptor_ulong == 114)) |
Azure.IoT Build | 0:6ae2f7bca550 | 14394 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14395 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 14396 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14397 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14398 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14399 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 14400 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14401 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14402 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14403 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14404 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14405 | /* application-properties */ |
Azure.IoT Build | 0:6ae2f7bca550 | 14406 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14407 | AMQP_VALUE amqpvalue_create_application_properties(AMQP_VALUE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 14408 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14409 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14410 | AMQP_VALUE described_value = amqpvalue_clone(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14411 | if (described_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14412 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14413 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 14414 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14415 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14416 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14417 | AMQP_VALUE descriptor = amqpvalue_create_ulong(116); |
Azure.IoT Build | 0:6ae2f7bca550 | 14418 | if (descriptor == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14419 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14420 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 14421 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14422 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14423 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14424 | result = amqpvalue_create_described(amqpvalue_clone(descriptor), amqpvalue_clone(described_value)); |
Azure.IoT Build | 0:6ae2f7bca550 | 14425 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14426 | amqpvalue_destroy(descriptor); |
Azure.IoT Build | 0:6ae2f7bca550 | 14427 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14428 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14429 | amqpvalue_destroy(described_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14430 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14431 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14432 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14433 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14434 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14435 | bool is_application_properties_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 14436 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14437 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14438 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14439 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 14440 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 14441 | (descriptor_ulong == 116)) |
Azure.IoT Build | 0:6ae2f7bca550 | 14442 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14443 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 14444 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14445 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14446 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14447 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 14448 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14449 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14450 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14451 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14452 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14453 | /* data */ |
Azure.IoT Build | 0:6ae2f7bca550 | 14454 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14455 | AMQP_VALUE amqpvalue_create_data(data value) |
Azure.IoT Build | 0:6ae2f7bca550 | 14456 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14457 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14458 | AMQP_VALUE described_value = amqpvalue_create_binary(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14459 | if (described_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14460 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14461 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 14462 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14463 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14464 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14465 | AMQP_VALUE descriptor = amqpvalue_create_ulong(117); |
Azure.IoT Build | 0:6ae2f7bca550 | 14466 | if (descriptor == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14467 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14468 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 14469 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14470 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14471 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14472 | result = amqpvalue_create_described(amqpvalue_clone(descriptor), amqpvalue_clone(described_value)); |
Azure.IoT Build | 0:6ae2f7bca550 | 14473 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14474 | amqpvalue_destroy(descriptor); |
Azure.IoT Build | 0:6ae2f7bca550 | 14475 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14476 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14477 | amqpvalue_destroy(described_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14478 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14479 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14480 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14481 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14482 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14483 | bool is_data_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 14484 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14485 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14486 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14487 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 14488 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 14489 | (descriptor_ulong == 117)) |
Azure.IoT Build | 0:6ae2f7bca550 | 14490 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14491 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 14492 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14493 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14494 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14495 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 14496 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14497 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14498 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14499 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14500 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14501 | /* amqp-sequence */ |
Azure.IoT Build | 0:6ae2f7bca550 | 14502 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14503 | AMQP_VALUE amqpvalue_create_amqp_sequence(AMQP_VALUE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 14504 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14505 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14506 | AMQP_VALUE described_value = amqpvalue_clone(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14507 | if (described_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14508 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14509 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 14510 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14511 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14512 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14513 | AMQP_VALUE descriptor = amqpvalue_create_ulong(118); |
Azure.IoT Build | 0:6ae2f7bca550 | 14514 | if (descriptor == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14515 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14516 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 14517 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14518 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14519 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14520 | result = amqpvalue_create_described(amqpvalue_clone(descriptor), amqpvalue_clone(described_value)); |
Azure.IoT Build | 0:6ae2f7bca550 | 14521 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14522 | amqpvalue_destroy(descriptor); |
Azure.IoT Build | 0:6ae2f7bca550 | 14523 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14524 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14525 | amqpvalue_destroy(described_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14526 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14527 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14528 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14529 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14530 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14531 | bool is_amqp_sequence_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 14532 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14533 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14534 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14535 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 14536 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 14537 | (descriptor_ulong == 118)) |
Azure.IoT Build | 0:6ae2f7bca550 | 14538 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14539 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 14540 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14541 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14542 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14543 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 14544 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14545 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14546 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14547 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14548 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14549 | /* amqp-value */ |
Azure.IoT Build | 0:6ae2f7bca550 | 14550 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14551 | AMQP_VALUE amqpvalue_create_amqp_value(AMQP_VALUE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 14552 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14553 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14554 | AMQP_VALUE described_value = amqpvalue_clone(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14555 | if (described_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14556 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14557 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 14558 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14559 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14560 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14561 | AMQP_VALUE descriptor = amqpvalue_create_ulong(119); |
Azure.IoT Build | 0:6ae2f7bca550 | 14562 | if (descriptor == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14563 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14564 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 14565 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14566 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14567 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14568 | result = amqpvalue_create_described(amqpvalue_clone(descriptor), amqpvalue_clone(described_value)); |
Azure.IoT Build | 0:6ae2f7bca550 | 14569 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14570 | amqpvalue_destroy(descriptor); |
Azure.IoT Build | 0:6ae2f7bca550 | 14571 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14572 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14573 | amqpvalue_destroy(described_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14574 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14575 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14576 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14577 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14578 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14579 | bool is_amqp_value_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 14580 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14581 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14582 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14583 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 14584 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 14585 | (descriptor_ulong == 119)) |
Azure.IoT Build | 0:6ae2f7bca550 | 14586 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14587 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 14588 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14589 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14590 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14591 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 14592 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14593 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14594 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14595 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14596 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14597 | /* footer */ |
Azure.IoT Build | 0:6ae2f7bca550 | 14598 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14599 | AMQP_VALUE amqpvalue_create_footer(footer value) |
Azure.IoT Build | 0:6ae2f7bca550 | 14600 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14601 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14602 | AMQP_VALUE described_value = amqpvalue_create_annotations(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14603 | if (described_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14604 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14605 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 14606 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14607 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14608 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14609 | AMQP_VALUE descriptor = amqpvalue_create_ulong(120); |
Azure.IoT Build | 0:6ae2f7bca550 | 14610 | if (descriptor == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14611 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14612 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 14613 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14614 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14615 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14616 | result = amqpvalue_create_described(amqpvalue_clone(descriptor), amqpvalue_clone(described_value)); |
Azure.IoT Build | 0:6ae2f7bca550 | 14617 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14618 | amqpvalue_destroy(descriptor); |
Azure.IoT Build | 0:6ae2f7bca550 | 14619 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14620 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14621 | amqpvalue_destroy(described_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14622 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14623 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14624 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14625 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14626 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14627 | bool is_footer_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 14628 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14629 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14630 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14631 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 14632 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 14633 | (descriptor_ulong == 120)) |
Azure.IoT Build | 0:6ae2f7bca550 | 14634 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14635 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 14636 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14637 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14638 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14639 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 14640 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14641 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14642 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14643 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14644 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14645 | /* properties */ |
Azure.IoT Build | 0:6ae2f7bca550 | 14646 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14647 | typedef struct PROPERTIES_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 14648 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14649 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 14650 | } PROPERTIES_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 14651 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14652 | static PROPERTIES_HANDLE properties_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 14653 | { |
AzureIoTClient | 21:f9c433d8e6ca | 14654 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)malloc(sizeof(PROPERTIES_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 14655 | if (properties_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14656 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14657 | properties_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 14658 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14659 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14660 | return properties_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 14661 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14662 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14663 | PROPERTIES_HANDLE properties_create(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 14664 | { |
AzureIoTClient | 21:f9c433d8e6ca | 14665 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)malloc(sizeof(PROPERTIES_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 14666 | if (properties_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14667 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14668 | properties_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(115); |
Azure.IoT Build | 0:6ae2f7bca550 | 14669 | if (properties_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14670 | { |
AzureIoTClient | 21:f9c433d8e6ca | 14671 | free(properties_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 14672 | properties_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 14673 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14674 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14675 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14676 | return properties_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 14677 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14678 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14679 | PROPERTIES_HANDLE properties_clone(PROPERTIES_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 14680 | { |
AzureIoTClient | 21:f9c433d8e6ca | 14681 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)malloc(sizeof(PROPERTIES_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 14682 | if (properties_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14683 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14684 | properties_instance->composite_value = amqpvalue_clone(((PROPERTIES_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14685 | if (properties_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14686 | { |
AzureIoTClient | 21:f9c433d8e6ca | 14687 | free(properties_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 14688 | properties_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 14689 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14690 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14691 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14692 | return properties_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 14693 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14694 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14695 | void properties_destroy(PROPERTIES_HANDLE properties) |
Azure.IoT Build | 0:6ae2f7bca550 | 14696 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14697 | if (properties != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14698 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14699 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
Azure.IoT Build | 0:6ae2f7bca550 | 14700 | amqpvalue_destroy(properties_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 14701 | free(properties_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 14702 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14703 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14704 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14705 | AMQP_VALUE amqpvalue_create_properties(PROPERTIES_HANDLE properties) |
Azure.IoT Build | 0:6ae2f7bca550 | 14706 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14707 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14708 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14709 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14710 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14711 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 14712 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14713 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14714 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14715 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
Azure.IoT Build | 0:6ae2f7bca550 | 14716 | result = amqpvalue_clone(properties_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14717 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14718 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14719 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14720 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14721 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14722 | bool is_properties_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 14723 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14724 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14725 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14726 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 14727 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 14728 | (descriptor_ulong == 115)) |
Azure.IoT Build | 0:6ae2f7bca550 | 14729 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14730 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 14731 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14732 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14733 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14734 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 14735 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14736 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14737 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14738 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14739 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14740 | |
Azure.IoT Build | 0:6ae2f7bca550 | 14741 | int amqpvalue_get_properties(AMQP_VALUE value, PROPERTIES_HANDLE* properties_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 14742 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14743 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 14744 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 14745 | *properties_handle = properties_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 14746 | if (*properties_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14747 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 14748 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 14749 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14750 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14751 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14752 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 14753 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 14754 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14755 | properties_destroy(*properties_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 14756 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 14757 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 14758 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 14759 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14760 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 14761 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 14762 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14763 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 14764 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14765 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14766 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14767 | do |
AzureIoTClient | 23:1111ee8bcba4 | 14768 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14769 | AMQP_VALUE item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 14770 | /* message-id */ |
AzureIoTClient | 23:1111ee8bcba4 | 14771 | if (list_item_count > 0) |
AzureIoTClient | 23:1111ee8bcba4 | 14772 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14773 | item_value = amqpvalue_get_list_item(list_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 14774 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 14775 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14776 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 14777 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14778 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14779 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14780 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 14781 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14782 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14783 | /* user-id */ |
AzureIoTClient | 23:1111ee8bcba4 | 14784 | if (list_item_count > 1) |
AzureIoTClient | 23:1111ee8bcba4 | 14785 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14786 | item_value = amqpvalue_get_list_item(list_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 14787 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 14788 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14789 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 14790 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14791 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14792 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14793 | amqp_binary user_id; |
AzureIoTClient | 23:1111ee8bcba4 | 14794 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 14795 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14796 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 14797 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14798 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14799 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14800 | if (amqpvalue_get_binary(item_value, &user_id) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 14801 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14802 | properties_destroy(*properties_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 14803 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 14804 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 14805 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14806 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14807 | |
AzureIoTClient | 23:1111ee8bcba4 | 14808 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 14809 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14810 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14811 | /* to */ |
AzureIoTClient | 23:1111ee8bcba4 | 14812 | if (list_item_count > 2) |
AzureIoTClient | 23:1111ee8bcba4 | 14813 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14814 | item_value = amqpvalue_get_list_item(list_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 14815 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 14816 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14817 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 14818 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14819 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14820 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14821 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 14822 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14823 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14824 | /* subject */ |
AzureIoTClient | 23:1111ee8bcba4 | 14825 | if (list_item_count > 3) |
AzureIoTClient | 23:1111ee8bcba4 | 14826 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14827 | item_value = amqpvalue_get_list_item(list_value, 3); |
AzureIoTClient | 23:1111ee8bcba4 | 14828 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 14829 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14830 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 14831 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14832 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14833 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14834 | const char* subject; |
AzureIoTClient | 23:1111ee8bcba4 | 14835 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 14836 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14837 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 14838 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14839 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14840 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14841 | if (amqpvalue_get_string(item_value, &subject) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 14842 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14843 | properties_destroy(*properties_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 14844 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 14845 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 14846 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14847 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14848 | |
AzureIoTClient | 23:1111ee8bcba4 | 14849 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 14850 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14851 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14852 | /* reply-to */ |
AzureIoTClient | 23:1111ee8bcba4 | 14853 | if (list_item_count > 4) |
AzureIoTClient | 23:1111ee8bcba4 | 14854 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14855 | item_value = amqpvalue_get_list_item(list_value, 4); |
AzureIoTClient | 23:1111ee8bcba4 | 14856 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 14857 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14858 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 14859 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14860 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14861 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14862 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 14863 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14864 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14865 | /* correlation-id */ |
AzureIoTClient | 23:1111ee8bcba4 | 14866 | if (list_item_count > 5) |
AzureIoTClient | 23:1111ee8bcba4 | 14867 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14868 | item_value = amqpvalue_get_list_item(list_value, 5); |
AzureIoTClient | 23:1111ee8bcba4 | 14869 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 14870 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14871 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 14872 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14873 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14874 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14875 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 14876 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14877 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14878 | /* content-type */ |
AzureIoTClient | 23:1111ee8bcba4 | 14879 | if (list_item_count > 6) |
AzureIoTClient | 23:1111ee8bcba4 | 14880 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14881 | item_value = amqpvalue_get_list_item(list_value, 6); |
AzureIoTClient | 23:1111ee8bcba4 | 14882 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 14883 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14884 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 14885 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14886 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14887 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14888 | const char* content_type; |
AzureIoTClient | 23:1111ee8bcba4 | 14889 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 14890 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14891 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 14892 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14893 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14894 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14895 | if (amqpvalue_get_symbol(item_value, &content_type) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 14896 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14897 | properties_destroy(*properties_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 14898 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 14899 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 14900 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14901 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14902 | |
AzureIoTClient | 23:1111ee8bcba4 | 14903 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 14904 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14905 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14906 | /* content-encoding */ |
AzureIoTClient | 23:1111ee8bcba4 | 14907 | if (list_item_count > 7) |
AzureIoTClient | 23:1111ee8bcba4 | 14908 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14909 | item_value = amqpvalue_get_list_item(list_value, 7); |
AzureIoTClient | 23:1111ee8bcba4 | 14910 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 14911 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14912 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 14913 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14914 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14915 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14916 | const char* content_encoding; |
AzureIoTClient | 23:1111ee8bcba4 | 14917 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 14918 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14919 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 14920 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14921 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14922 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14923 | if (amqpvalue_get_symbol(item_value, &content_encoding) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 14924 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14925 | properties_destroy(*properties_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 14926 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 14927 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 14928 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14929 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14930 | |
AzureIoTClient | 23:1111ee8bcba4 | 14931 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 14932 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14933 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14934 | /* absolute-expiry-time */ |
AzureIoTClient | 23:1111ee8bcba4 | 14935 | if (list_item_count > 8) |
AzureIoTClient | 23:1111ee8bcba4 | 14936 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14937 | item_value = amqpvalue_get_list_item(list_value, 8); |
AzureIoTClient | 23:1111ee8bcba4 | 14938 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 14939 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14940 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 14941 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14942 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14943 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14944 | timestamp absolute_expiry_time; |
AzureIoTClient | 23:1111ee8bcba4 | 14945 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 14946 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14947 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 14948 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14949 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14950 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14951 | if (amqpvalue_get_timestamp(item_value, &absolute_expiry_time) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 14952 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14953 | properties_destroy(*properties_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 14954 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 14955 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 14956 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14957 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14958 | |
AzureIoTClient | 23:1111ee8bcba4 | 14959 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 14960 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14961 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14962 | /* creation-time */ |
AzureIoTClient | 23:1111ee8bcba4 | 14963 | if (list_item_count > 9) |
AzureIoTClient | 23:1111ee8bcba4 | 14964 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14965 | item_value = amqpvalue_get_list_item(list_value, 9); |
AzureIoTClient | 23:1111ee8bcba4 | 14966 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 14967 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14968 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 14969 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14970 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14971 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14972 | timestamp creation_time; |
AzureIoTClient | 23:1111ee8bcba4 | 14973 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 14974 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14975 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 14976 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14977 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14978 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14979 | if (amqpvalue_get_timestamp(item_value, &creation_time) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 14980 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14981 | properties_destroy(*properties_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 14982 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 14983 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 14984 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14985 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14986 | |
AzureIoTClient | 23:1111ee8bcba4 | 14987 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 14988 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14989 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14990 | /* group-id */ |
AzureIoTClient | 23:1111ee8bcba4 | 14991 | if (list_item_count > 10) |
AzureIoTClient | 23:1111ee8bcba4 | 14992 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14993 | item_value = amqpvalue_get_list_item(list_value, 10); |
AzureIoTClient | 23:1111ee8bcba4 | 14994 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 14995 | { |
AzureIoTClient | 23:1111ee8bcba4 | 14996 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 14997 | } |
AzureIoTClient | 23:1111ee8bcba4 | 14998 | else |
AzureIoTClient | 23:1111ee8bcba4 | 14999 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15000 | const char* group_id; |
AzureIoTClient | 23:1111ee8bcba4 | 15001 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 15002 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15003 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 15004 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15005 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15006 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15007 | if (amqpvalue_get_string(item_value, &group_id) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 15008 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15009 | properties_destroy(*properties_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 15010 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15011 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 15012 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15013 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15014 | |
AzureIoTClient | 23:1111ee8bcba4 | 15015 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 15016 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15017 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15018 | /* group-sequence */ |
AzureIoTClient | 23:1111ee8bcba4 | 15019 | if (list_item_count > 11) |
AzureIoTClient | 23:1111ee8bcba4 | 15020 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15021 | item_value = amqpvalue_get_list_item(list_value, 11); |
AzureIoTClient | 23:1111ee8bcba4 | 15022 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 15023 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15024 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 15025 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15026 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15027 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15028 | sequence_no group_sequence; |
AzureIoTClient | 23:1111ee8bcba4 | 15029 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 15030 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15031 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 15032 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15033 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15034 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15035 | if (amqpvalue_get_sequence_no(item_value, &group_sequence) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 15036 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15037 | properties_destroy(*properties_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 15038 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15039 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 15040 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15041 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15042 | |
AzureIoTClient | 23:1111ee8bcba4 | 15043 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 15044 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15045 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15046 | /* reply-to-group-id */ |
AzureIoTClient | 23:1111ee8bcba4 | 15047 | if (list_item_count > 12) |
AzureIoTClient | 23:1111ee8bcba4 | 15048 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15049 | item_value = amqpvalue_get_list_item(list_value, 12); |
AzureIoTClient | 23:1111ee8bcba4 | 15050 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 15051 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15052 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 15053 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15054 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15055 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15056 | const char* reply_to_group_id; |
AzureIoTClient | 23:1111ee8bcba4 | 15057 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 15058 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15059 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 15060 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15061 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15062 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15063 | if (amqpvalue_get_string(item_value, &reply_to_group_id) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 15064 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15065 | properties_destroy(*properties_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 15066 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15067 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 15068 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15069 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15070 | |
AzureIoTClient | 23:1111ee8bcba4 | 15071 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 15072 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15073 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15074 | |
AzureIoTClient | 23:1111ee8bcba4 | 15075 | properties_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 15076 | |
AzureIoTClient | 23:1111ee8bcba4 | 15077 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 15078 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 15079 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15080 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15081 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15082 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15083 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15084 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15085 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15086 | int properties_get_message_id(PROPERTIES_HANDLE properties, AMQP_VALUE* message_id_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15087 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15088 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15089 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15090 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15091 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15092 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15093 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15094 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15095 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15096 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 15097 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
AzureIoTClient | 23:1111ee8bcba4 | 15098 | if (amqpvalue_get_composite_item_count(properties_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 15099 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15100 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15101 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15102 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15103 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15104 | if (item_count <= 0) |
AzureIoTClient | 23:1111ee8bcba4 | 15105 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15106 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15107 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15108 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15109 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15110 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(properties_instance->composite_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 15111 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 15112 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 15113 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15114 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15115 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15116 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15117 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15118 | *message_id_value = item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 15119 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 15120 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15121 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15122 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15123 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15124 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15125 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15126 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15127 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15128 | int properties_set_message_id(PROPERTIES_HANDLE properties, AMQP_VALUE message_id_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15129 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15130 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15131 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15132 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15133 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15134 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15135 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15136 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15137 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15138 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
AzureIoTClient | 23:1111ee8bcba4 | 15139 | AMQP_VALUE message_id_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 15140 | if (message_id_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 15141 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15142 | message_id_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 15143 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15144 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15145 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15146 | message_id_amqp_value = amqpvalue_clone(message_id_value); |
AzureIoTClient | 23:1111ee8bcba4 | 15147 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15148 | if (message_id_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15149 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15150 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15151 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15152 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15153 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15154 | if (amqpvalue_set_composite_item(properties_instance->composite_value, 0, message_id_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 15155 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15156 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15157 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15158 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15159 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15160 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 15161 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15162 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15163 | amqpvalue_destroy(message_id_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 15164 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15165 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15166 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15167 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15168 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15169 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15170 | int properties_get_user_id(PROPERTIES_HANDLE properties, amqp_binary* user_id_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15171 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15172 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15173 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15174 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15175 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15176 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15177 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15178 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15179 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15180 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 15181 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
AzureIoTClient | 23:1111ee8bcba4 | 15182 | if (amqpvalue_get_composite_item_count(properties_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 15183 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15184 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15185 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15186 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15187 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15188 | if (item_count <= 1) |
AzureIoTClient | 23:1111ee8bcba4 | 15189 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15190 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15191 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15192 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15193 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15194 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(properties_instance->composite_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 15195 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 15196 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 15197 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15198 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15199 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15200 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15201 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15202 | if (amqpvalue_get_binary(item_value, user_id_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 15203 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15204 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15205 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15206 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15207 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15208 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 15209 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15210 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15211 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15212 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15213 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15214 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15215 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15216 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15217 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15218 | int properties_set_user_id(PROPERTIES_HANDLE properties, amqp_binary user_id_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15219 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15220 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15221 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15222 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15223 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15224 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15225 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15226 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15227 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15228 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
Azure.IoT Build | 0:6ae2f7bca550 | 15229 | AMQP_VALUE user_id_amqp_value = amqpvalue_create_binary(user_id_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 15230 | if (user_id_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15231 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15232 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15233 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15234 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15235 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15236 | if (amqpvalue_set_composite_item(properties_instance->composite_value, 1, user_id_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 15237 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15238 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15239 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15240 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15241 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15242 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 15243 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15244 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15245 | amqpvalue_destroy(user_id_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 15246 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15247 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15248 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15249 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15250 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15251 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15252 | int properties_get_to(PROPERTIES_HANDLE properties, AMQP_VALUE* to_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15253 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15254 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15255 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15256 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15257 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15258 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15259 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15260 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15261 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15262 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 15263 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
AzureIoTClient | 23:1111ee8bcba4 | 15264 | if (amqpvalue_get_composite_item_count(properties_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 15265 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15266 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15267 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15268 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15269 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15270 | if (item_count <= 2) |
AzureIoTClient | 23:1111ee8bcba4 | 15271 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15272 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15273 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15274 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15275 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15276 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(properties_instance->composite_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 15277 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 15278 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 15279 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15280 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15281 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15282 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15283 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15284 | *to_value = item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 15285 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 15286 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15287 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15288 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15289 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15290 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15291 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15292 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15293 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15294 | int properties_set_to(PROPERTIES_HANDLE properties, AMQP_VALUE to_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15295 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15296 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15297 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15298 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15299 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15300 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15301 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15302 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15303 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15304 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
AzureIoTClient | 23:1111ee8bcba4 | 15305 | AMQP_VALUE to_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 15306 | if (to_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 15307 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15308 | to_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 15309 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15310 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15311 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15312 | to_amqp_value = amqpvalue_clone(to_value); |
AzureIoTClient | 23:1111ee8bcba4 | 15313 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15314 | if (to_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15315 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15316 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15317 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15318 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15319 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15320 | if (amqpvalue_set_composite_item(properties_instance->composite_value, 2, to_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 15321 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15322 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15323 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15324 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15325 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15326 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 15327 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15328 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15329 | amqpvalue_destroy(to_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 15330 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15331 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15332 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15333 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15334 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15335 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15336 | int properties_get_subject(PROPERTIES_HANDLE properties, const char** subject_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15337 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15338 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15339 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15340 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15341 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15342 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15343 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15344 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15345 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15346 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 15347 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
AzureIoTClient | 23:1111ee8bcba4 | 15348 | if (amqpvalue_get_composite_item_count(properties_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 15349 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15350 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15351 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15352 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15353 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15354 | if (item_count <= 3) |
AzureIoTClient | 23:1111ee8bcba4 | 15355 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15356 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15357 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15358 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15359 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15360 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(properties_instance->composite_value, 3); |
AzureIoTClient | 23:1111ee8bcba4 | 15361 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 15362 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 15363 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15364 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15365 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15366 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15367 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15368 | if (amqpvalue_get_string(item_value, subject_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 15369 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15370 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15371 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15372 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15373 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15374 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 15375 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15376 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15377 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15378 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15379 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15380 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15381 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15382 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15383 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15384 | int properties_set_subject(PROPERTIES_HANDLE properties, const char* subject_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15385 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15386 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15387 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15388 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15389 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15390 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15391 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15392 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15393 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15394 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
Azure.IoT Build | 0:6ae2f7bca550 | 15395 | AMQP_VALUE subject_amqp_value = amqpvalue_create_string(subject_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 15396 | if (subject_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15397 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15398 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15399 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15400 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15401 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15402 | if (amqpvalue_set_composite_item(properties_instance->composite_value, 3, subject_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 15403 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15404 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15405 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15406 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15407 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15408 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 15409 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15410 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15411 | amqpvalue_destroy(subject_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 15412 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15413 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15414 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15415 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15416 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15417 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15418 | int properties_get_reply_to(PROPERTIES_HANDLE properties, AMQP_VALUE* reply_to_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15419 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15420 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15421 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15422 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15423 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15424 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15425 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15426 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15427 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15428 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 15429 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
AzureIoTClient | 23:1111ee8bcba4 | 15430 | if (amqpvalue_get_composite_item_count(properties_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 15431 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15432 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15433 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15434 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15435 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15436 | if (item_count <= 4) |
AzureIoTClient | 23:1111ee8bcba4 | 15437 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15438 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15439 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15440 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15441 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15442 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(properties_instance->composite_value, 4); |
AzureIoTClient | 23:1111ee8bcba4 | 15443 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 15444 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 15445 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15446 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15447 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15448 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15449 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15450 | *reply_to_value = item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 15451 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 15452 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15453 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15454 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15455 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15456 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15457 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15458 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15459 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15460 | int properties_set_reply_to(PROPERTIES_HANDLE properties, AMQP_VALUE reply_to_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15461 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15462 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15463 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15464 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15465 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15466 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15467 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15468 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15469 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15470 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
AzureIoTClient | 23:1111ee8bcba4 | 15471 | AMQP_VALUE reply_to_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 15472 | if (reply_to_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 15473 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15474 | reply_to_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 15475 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15476 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15477 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15478 | reply_to_amqp_value = amqpvalue_clone(reply_to_value); |
AzureIoTClient | 23:1111ee8bcba4 | 15479 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15480 | if (reply_to_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15481 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15482 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15483 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15484 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15485 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15486 | if (amqpvalue_set_composite_item(properties_instance->composite_value, 4, reply_to_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 15487 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15488 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15489 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15490 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15491 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15492 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 15493 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15494 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15495 | amqpvalue_destroy(reply_to_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 15496 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15497 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15498 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15499 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15500 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15501 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15502 | int properties_get_correlation_id(PROPERTIES_HANDLE properties, AMQP_VALUE* correlation_id_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15503 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15504 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15505 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15506 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15507 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15508 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15509 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15510 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15511 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15512 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 15513 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
AzureIoTClient | 23:1111ee8bcba4 | 15514 | if (amqpvalue_get_composite_item_count(properties_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 15515 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15516 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15517 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15518 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15519 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15520 | if (item_count <= 5) |
AzureIoTClient | 23:1111ee8bcba4 | 15521 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15522 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15523 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15524 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15525 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15526 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(properties_instance->composite_value, 5); |
AzureIoTClient | 23:1111ee8bcba4 | 15527 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 15528 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 15529 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15530 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15531 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15532 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15533 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15534 | *correlation_id_value = item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 15535 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 15536 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15537 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15538 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15539 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15540 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15541 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15542 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15543 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15544 | int properties_set_correlation_id(PROPERTIES_HANDLE properties, AMQP_VALUE correlation_id_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15545 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15546 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15547 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15548 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15549 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15550 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15551 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15552 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15553 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15554 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
AzureIoTClient | 23:1111ee8bcba4 | 15555 | AMQP_VALUE correlation_id_amqp_value; |
AzureIoTClient | 23:1111ee8bcba4 | 15556 | if (correlation_id_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 15557 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15558 | correlation_id_amqp_value = NULL; |
AzureIoTClient | 23:1111ee8bcba4 | 15559 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15560 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15561 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15562 | correlation_id_amqp_value = amqpvalue_clone(correlation_id_value); |
AzureIoTClient | 23:1111ee8bcba4 | 15563 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15564 | if (correlation_id_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15565 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15566 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15567 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15568 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15569 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15570 | if (amqpvalue_set_composite_item(properties_instance->composite_value, 5, correlation_id_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 15571 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15572 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15573 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15574 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15575 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15576 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 15577 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15578 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15579 | amqpvalue_destroy(correlation_id_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 15580 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15581 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15582 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15583 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15584 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15585 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15586 | int properties_get_content_type(PROPERTIES_HANDLE properties, const char** content_type_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15587 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15588 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15589 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15590 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15591 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15592 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15593 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15594 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15595 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15596 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 15597 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
AzureIoTClient | 23:1111ee8bcba4 | 15598 | if (amqpvalue_get_composite_item_count(properties_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 15599 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15600 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15601 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15602 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15603 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15604 | if (item_count <= 6) |
AzureIoTClient | 23:1111ee8bcba4 | 15605 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15606 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15607 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15608 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15609 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15610 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(properties_instance->composite_value, 6); |
AzureIoTClient | 23:1111ee8bcba4 | 15611 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 15612 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 15613 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15614 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15615 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15616 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15617 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15618 | if (amqpvalue_get_symbol(item_value, content_type_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 15619 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15620 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15621 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15622 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15623 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15624 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 15625 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15626 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15627 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15628 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15629 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15630 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15631 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15632 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15633 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15634 | int properties_set_content_type(PROPERTIES_HANDLE properties, const char* content_type_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15635 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15636 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15637 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15638 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15639 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15640 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15641 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15642 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15643 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15644 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
Azure.IoT Build | 0:6ae2f7bca550 | 15645 | AMQP_VALUE content_type_amqp_value = amqpvalue_create_symbol(content_type_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 15646 | if (content_type_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15647 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15648 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15649 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15650 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15651 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15652 | if (amqpvalue_set_composite_item(properties_instance->composite_value, 6, content_type_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 15653 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15654 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15655 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15656 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15657 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15658 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 15659 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15660 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15661 | amqpvalue_destroy(content_type_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 15662 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15663 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15664 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15665 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15666 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15667 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15668 | int properties_get_content_encoding(PROPERTIES_HANDLE properties, const char** content_encoding_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15669 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15670 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15671 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15672 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15673 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15674 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15675 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15676 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15677 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15678 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 15679 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
AzureIoTClient | 23:1111ee8bcba4 | 15680 | if (amqpvalue_get_composite_item_count(properties_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 15681 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15682 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15683 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15684 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15685 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15686 | if (item_count <= 7) |
AzureIoTClient | 23:1111ee8bcba4 | 15687 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15688 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15689 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15690 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15691 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15692 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(properties_instance->composite_value, 7); |
AzureIoTClient | 23:1111ee8bcba4 | 15693 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 15694 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 15695 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15696 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15697 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15698 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15699 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15700 | if (amqpvalue_get_symbol(item_value, content_encoding_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 15701 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15702 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15703 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15704 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15705 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15706 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 15707 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15708 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15709 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15710 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15711 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15712 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15713 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15714 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15715 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15716 | int properties_set_content_encoding(PROPERTIES_HANDLE properties, const char* content_encoding_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15717 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15718 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15719 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15720 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15721 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15722 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15723 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15724 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15725 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15726 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
Azure.IoT Build | 0:6ae2f7bca550 | 15727 | AMQP_VALUE content_encoding_amqp_value = amqpvalue_create_symbol(content_encoding_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 15728 | if (content_encoding_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15729 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15730 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15731 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15732 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15733 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15734 | if (amqpvalue_set_composite_item(properties_instance->composite_value, 7, content_encoding_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 15735 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15736 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15737 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15738 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15739 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15740 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 15741 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15742 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15743 | amqpvalue_destroy(content_encoding_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 15744 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15745 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15746 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15747 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15748 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15749 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15750 | int properties_get_absolute_expiry_time(PROPERTIES_HANDLE properties, timestamp* absolute_expiry_time_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15751 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15752 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15753 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15754 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15755 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15756 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15757 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15758 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15759 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15760 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 15761 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
AzureIoTClient | 23:1111ee8bcba4 | 15762 | if (amqpvalue_get_composite_item_count(properties_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 15763 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15764 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15765 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15766 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15767 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15768 | if (item_count <= 8) |
AzureIoTClient | 23:1111ee8bcba4 | 15769 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15770 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15771 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15772 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15773 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15774 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(properties_instance->composite_value, 8); |
AzureIoTClient | 23:1111ee8bcba4 | 15775 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 15776 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 15777 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15778 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15779 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15780 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15781 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15782 | if (amqpvalue_get_timestamp(item_value, absolute_expiry_time_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 15783 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15784 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15785 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15786 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15787 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15788 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 15789 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15790 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15791 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15792 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15793 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15794 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15795 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15796 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15797 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15798 | int properties_set_absolute_expiry_time(PROPERTIES_HANDLE properties, timestamp absolute_expiry_time_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15799 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15800 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15801 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15802 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15803 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15804 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15805 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15806 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15807 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15808 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
Azure.IoT Build | 0:6ae2f7bca550 | 15809 | AMQP_VALUE absolute_expiry_time_amqp_value = amqpvalue_create_timestamp(absolute_expiry_time_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 15810 | if (absolute_expiry_time_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15811 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15812 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15813 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15814 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15815 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15816 | if (amqpvalue_set_composite_item(properties_instance->composite_value, 8, absolute_expiry_time_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 15817 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15818 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15819 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15820 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15821 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15822 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 15823 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15824 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15825 | amqpvalue_destroy(absolute_expiry_time_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 15826 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15827 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15828 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15829 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15830 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15831 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15832 | int properties_get_creation_time(PROPERTIES_HANDLE properties, timestamp* creation_time_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15833 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15834 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15835 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15836 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15837 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15838 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15839 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15840 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15841 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15842 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 15843 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
AzureIoTClient | 23:1111ee8bcba4 | 15844 | if (amqpvalue_get_composite_item_count(properties_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 15845 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15846 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15847 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15848 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15849 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15850 | if (item_count <= 9) |
AzureIoTClient | 23:1111ee8bcba4 | 15851 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15852 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15853 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15854 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15855 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15856 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(properties_instance->composite_value, 9); |
AzureIoTClient | 23:1111ee8bcba4 | 15857 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 15858 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 15859 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15860 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15861 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15862 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15863 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15864 | if (amqpvalue_get_timestamp(item_value, creation_time_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 15865 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15866 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15867 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15868 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15869 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15870 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 15871 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15872 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15873 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15874 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15875 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15876 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15877 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15878 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15879 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15880 | int properties_set_creation_time(PROPERTIES_HANDLE properties, timestamp creation_time_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15881 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15882 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15883 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15884 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15885 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15886 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15887 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15888 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15889 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15890 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
Azure.IoT Build | 0:6ae2f7bca550 | 15891 | AMQP_VALUE creation_time_amqp_value = amqpvalue_create_timestamp(creation_time_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 15892 | if (creation_time_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15893 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15894 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15895 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15896 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15897 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15898 | if (amqpvalue_set_composite_item(properties_instance->composite_value, 9, creation_time_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 15899 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15900 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15901 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15902 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15903 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15904 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 15905 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15906 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15907 | amqpvalue_destroy(creation_time_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 15908 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15909 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15910 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15911 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15912 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15913 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15914 | int properties_get_group_id(PROPERTIES_HANDLE properties, const char** group_id_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15915 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15916 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15917 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15918 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15919 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15920 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15921 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15922 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15923 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15924 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 15925 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
AzureIoTClient | 23:1111ee8bcba4 | 15926 | if (amqpvalue_get_composite_item_count(properties_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 15927 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15928 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15929 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15930 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15931 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15932 | if (item_count <= 10) |
AzureIoTClient | 23:1111ee8bcba4 | 15933 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15934 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15935 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15936 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15937 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15938 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(properties_instance->composite_value, 10); |
AzureIoTClient | 23:1111ee8bcba4 | 15939 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 15940 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 15941 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15942 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15943 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15944 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15945 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15946 | if (amqpvalue_get_string(item_value, group_id_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 15947 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15948 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 15949 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15950 | else |
AzureIoTClient | 23:1111ee8bcba4 | 15951 | { |
AzureIoTClient | 23:1111ee8bcba4 | 15952 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 15953 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15954 | } |
AzureIoTClient | 23:1111ee8bcba4 | 15955 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15956 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15957 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15958 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15959 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15960 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15961 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15962 | int properties_set_group_id(PROPERTIES_HANDLE properties, const char* group_id_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15963 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15964 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15965 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15966 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15967 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15968 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15969 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15970 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15971 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15972 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
Azure.IoT Build | 0:6ae2f7bca550 | 15973 | AMQP_VALUE group_id_amqp_value = amqpvalue_create_string(group_id_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 15974 | if (group_id_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 15975 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15976 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15977 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15978 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15979 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15980 | if (amqpvalue_set_composite_item(properties_instance->composite_value, 10, group_id_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 15981 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 15982 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 15983 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15984 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 15985 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15986 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 15987 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15988 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15989 | amqpvalue_destroy(group_id_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 15990 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15991 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15992 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15993 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15994 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 15995 | |
Azure.IoT Build | 0:6ae2f7bca550 | 15996 | int properties_get_group_sequence(PROPERTIES_HANDLE properties, sequence_no* group_sequence_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 15997 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 15998 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 15999 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16000 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16001 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16002 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16003 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16004 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16005 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16006 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 16007 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
AzureIoTClient | 23:1111ee8bcba4 | 16008 | if (amqpvalue_get_composite_item_count(properties_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 16009 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16010 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16011 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16012 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16013 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16014 | if (item_count <= 11) |
AzureIoTClient | 23:1111ee8bcba4 | 16015 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16016 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16017 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16018 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16019 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16020 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(properties_instance->composite_value, 11); |
AzureIoTClient | 23:1111ee8bcba4 | 16021 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 16022 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 16023 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16024 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16025 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16026 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16027 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16028 | if (amqpvalue_get_sequence_no(item_value, group_sequence_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 16029 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16030 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16031 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16032 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16033 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16034 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 16035 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16036 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16037 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16038 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16039 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16040 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16041 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16042 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16043 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16044 | int properties_set_group_sequence(PROPERTIES_HANDLE properties, sequence_no group_sequence_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 16045 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16046 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16047 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16048 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16049 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16050 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16051 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16052 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16053 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16054 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
Azure.IoT Build | 0:6ae2f7bca550 | 16055 | AMQP_VALUE group_sequence_amqp_value = amqpvalue_create_sequence_no(group_sequence_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16056 | if (group_sequence_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16057 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16058 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16059 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16060 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16061 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16062 | if (amqpvalue_set_composite_item(properties_instance->composite_value, 11, group_sequence_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 16063 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16064 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16065 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16066 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16067 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16068 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 16069 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16070 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16071 | amqpvalue_destroy(group_sequence_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16072 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16073 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16074 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16075 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16076 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16077 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16078 | int properties_get_reply_to_group_id(PROPERTIES_HANDLE properties, const char** reply_to_group_id_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 16079 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16080 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16081 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16082 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16083 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16084 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16085 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16086 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16087 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16088 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 16089 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
AzureIoTClient | 23:1111ee8bcba4 | 16090 | if (amqpvalue_get_composite_item_count(properties_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 16091 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16092 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16093 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16094 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16095 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16096 | if (item_count <= 12) |
AzureIoTClient | 23:1111ee8bcba4 | 16097 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16098 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16099 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16100 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16101 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16102 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(properties_instance->composite_value, 12); |
AzureIoTClient | 23:1111ee8bcba4 | 16103 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 16104 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 16105 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16106 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16107 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16108 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16109 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16110 | if (amqpvalue_get_string(item_value, reply_to_group_id_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 16111 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16112 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16113 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16114 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16115 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16116 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 16117 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16118 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16119 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16120 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16121 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16122 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16123 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16124 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16125 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16126 | int properties_set_reply_to_group_id(PROPERTIES_HANDLE properties, const char* reply_to_group_id_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 16127 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16128 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16129 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16130 | if (properties == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16131 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16132 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16133 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16134 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16135 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16136 | PROPERTIES_INSTANCE* properties_instance = (PROPERTIES_INSTANCE*)properties; |
Azure.IoT Build | 0:6ae2f7bca550 | 16137 | AMQP_VALUE reply_to_group_id_amqp_value = amqpvalue_create_string(reply_to_group_id_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16138 | if (reply_to_group_id_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16139 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16140 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16141 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16142 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16143 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16144 | if (amqpvalue_set_composite_item(properties_instance->composite_value, 12, reply_to_group_id_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 16145 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16146 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16147 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16148 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16149 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16150 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 16151 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16152 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16153 | amqpvalue_destroy(reply_to_group_id_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16154 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16155 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16156 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16157 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16158 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16159 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16160 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16161 | /* received */ |
Azure.IoT Build | 0:6ae2f7bca550 | 16162 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16163 | typedef struct RECEIVED_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 16164 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16165 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 16166 | } RECEIVED_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 16167 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16168 | static RECEIVED_HANDLE received_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 16169 | { |
AzureIoTClient | 21:f9c433d8e6ca | 16170 | RECEIVED_INSTANCE* received_instance = (RECEIVED_INSTANCE*)malloc(sizeof(RECEIVED_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 16171 | if (received_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16172 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16173 | received_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 16174 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16175 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16176 | return received_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 16177 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16178 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16179 | RECEIVED_HANDLE received_create(uint32_t section_number_value, uint64_t section_offset_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 16180 | { |
AzureIoTClient | 21:f9c433d8e6ca | 16181 | RECEIVED_INSTANCE* received_instance = (RECEIVED_INSTANCE*)malloc(sizeof(RECEIVED_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 16182 | if (received_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16183 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16184 | received_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(35); |
Azure.IoT Build | 0:6ae2f7bca550 | 16185 | if (received_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16186 | { |
AzureIoTClient | 21:f9c433d8e6ca | 16187 | free(received_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 16188 | received_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 16189 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16190 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16191 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16192 | AMQP_VALUE section_number_amqp_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 16193 | AMQP_VALUE section_offset_amqp_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 16194 | int result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 16195 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16196 | section_number_amqp_value = amqpvalue_create_uint(section_number_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16197 | if ((result == 0) && (amqpvalue_set_composite_item(received_instance->composite_value, 0, section_number_amqp_value) != 0)) |
Azure.IoT Build | 0:6ae2f7bca550 | 16198 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16199 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16200 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16201 | section_offset_amqp_value = amqpvalue_create_ulong(section_offset_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16202 | if ((result == 0) && (amqpvalue_set_composite_item(received_instance->composite_value, 1, section_offset_amqp_value) != 0)) |
Azure.IoT Build | 0:6ae2f7bca550 | 16203 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16204 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16205 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16206 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16207 | amqpvalue_destroy(section_number_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16208 | amqpvalue_destroy(section_offset_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16209 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16210 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16211 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16212 | return received_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 16213 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16214 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16215 | RECEIVED_HANDLE received_clone(RECEIVED_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 16216 | { |
AzureIoTClient | 21:f9c433d8e6ca | 16217 | RECEIVED_INSTANCE* received_instance = (RECEIVED_INSTANCE*)malloc(sizeof(RECEIVED_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 16218 | if (received_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16219 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16220 | received_instance->composite_value = amqpvalue_clone(((RECEIVED_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16221 | if (received_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16222 | { |
AzureIoTClient | 21:f9c433d8e6ca | 16223 | free(received_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 16224 | received_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 16225 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16226 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16227 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16228 | return received_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 16229 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16230 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16231 | void received_destroy(RECEIVED_HANDLE received) |
Azure.IoT Build | 0:6ae2f7bca550 | 16232 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16233 | if (received != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16234 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16235 | RECEIVED_INSTANCE* received_instance = (RECEIVED_INSTANCE*)received; |
Azure.IoT Build | 0:6ae2f7bca550 | 16236 | amqpvalue_destroy(received_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 16237 | free(received_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 16238 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16239 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16240 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16241 | AMQP_VALUE amqpvalue_create_received(RECEIVED_HANDLE received) |
Azure.IoT Build | 0:6ae2f7bca550 | 16242 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16243 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16244 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16245 | if (received == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16246 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16247 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 16248 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16249 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16250 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16251 | RECEIVED_INSTANCE* received_instance = (RECEIVED_INSTANCE*)received; |
Azure.IoT Build | 0:6ae2f7bca550 | 16252 | result = amqpvalue_clone(received_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16253 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16254 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16255 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16256 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16257 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16258 | bool is_received_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 16259 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16260 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16261 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16262 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 16263 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 16264 | (descriptor_ulong == 35)) |
Azure.IoT Build | 0:6ae2f7bca550 | 16265 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16266 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 16267 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16268 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16269 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16270 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 16271 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16272 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16273 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16274 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16275 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16276 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16277 | int amqpvalue_get_received(AMQP_VALUE value, RECEIVED_HANDLE* received_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 16278 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16279 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16280 | RECEIVED_INSTANCE* received_instance = (RECEIVED_INSTANCE*)received_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 16281 | *received_handle = received_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 16282 | if (*received_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16283 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16284 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16285 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16286 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16287 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16288 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16289 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16290 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16291 | received_destroy(*received_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 16292 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16293 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16294 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16295 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16296 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 16297 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 16298 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16299 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16300 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16301 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16302 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16303 | do |
AzureIoTClient | 23:1111ee8bcba4 | 16304 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16305 | AMQP_VALUE item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 16306 | /* section-number */ |
AzureIoTClient | 23:1111ee8bcba4 | 16307 | if (list_item_count > 0) |
AzureIoTClient | 23:1111ee8bcba4 | 16308 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16309 | item_value = amqpvalue_get_list_item(list_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 16310 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 16311 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16312 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16313 | received_destroy(*received_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 16314 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16315 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 16316 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16317 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16318 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16319 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16320 | uint32_t section_number; |
AzureIoTClient | 23:1111ee8bcba4 | 16321 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 16322 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16323 | received_destroy(*received_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 16324 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16325 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 16326 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16327 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16328 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16329 | if (amqpvalue_get_uint(item_value, §ion_number) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 16330 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16331 | received_destroy(*received_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 16332 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16333 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 16334 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16335 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16336 | |
AzureIoTClient | 23:1111ee8bcba4 | 16337 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 16338 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16339 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16340 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16341 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16342 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16343 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16344 | /* section-offset */ |
AzureIoTClient | 23:1111ee8bcba4 | 16345 | if (list_item_count > 1) |
AzureIoTClient | 23:1111ee8bcba4 | 16346 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16347 | item_value = amqpvalue_get_list_item(list_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 16348 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 16349 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16350 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16351 | received_destroy(*received_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 16352 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16353 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 16354 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16355 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16356 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16357 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16358 | uint64_t section_offset; |
AzureIoTClient | 23:1111ee8bcba4 | 16359 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 16360 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16361 | received_destroy(*received_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 16362 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16363 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 16364 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16365 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16366 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16367 | if (amqpvalue_get_ulong(item_value, §ion_offset) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 16368 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16369 | received_destroy(*received_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 16370 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16371 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 16372 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16373 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16374 | |
AzureIoTClient | 23:1111ee8bcba4 | 16375 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 16376 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16377 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16378 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16379 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16380 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16381 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16382 | |
AzureIoTClient | 23:1111ee8bcba4 | 16383 | received_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 16384 | |
AzureIoTClient | 23:1111ee8bcba4 | 16385 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 16386 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 16387 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16388 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16389 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16390 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16391 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16392 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16393 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16394 | int received_get_section_number(RECEIVED_HANDLE received, uint32_t* section_number_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 16395 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16396 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16397 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16398 | if (received == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16399 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16400 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16401 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16402 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16403 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16404 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 16405 | RECEIVED_INSTANCE* received_instance = (RECEIVED_INSTANCE*)received; |
AzureIoTClient | 23:1111ee8bcba4 | 16406 | if (amqpvalue_get_composite_item_count(received_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 16407 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16408 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16409 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16410 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16411 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16412 | if (item_count <= 0) |
AzureIoTClient | 23:1111ee8bcba4 | 16413 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16414 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16415 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16416 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16417 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16418 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(received_instance->composite_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 16419 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 16420 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 16421 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16422 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16423 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16424 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16425 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16426 | if (amqpvalue_get_uint(item_value, section_number_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 16427 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16428 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16429 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16430 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16431 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16432 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 16433 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16434 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16435 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16436 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16437 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16438 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16439 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16440 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16441 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16442 | int received_set_section_number(RECEIVED_HANDLE received, uint32_t section_number_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 16443 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16444 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16445 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16446 | if (received == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16447 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16448 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16449 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16450 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16451 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16452 | RECEIVED_INSTANCE* received_instance = (RECEIVED_INSTANCE*)received; |
Azure.IoT Build | 0:6ae2f7bca550 | 16453 | AMQP_VALUE section_number_amqp_value = amqpvalue_create_uint(section_number_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16454 | if (section_number_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16455 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16456 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16457 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16458 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16459 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16460 | if (amqpvalue_set_composite_item(received_instance->composite_value, 0, section_number_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 16461 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16462 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16463 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16464 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16465 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16466 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 16467 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16468 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16469 | amqpvalue_destroy(section_number_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16470 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16471 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16472 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16473 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16474 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16475 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16476 | int received_get_section_offset(RECEIVED_HANDLE received, uint64_t* section_offset_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 16477 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16478 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16479 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16480 | if (received == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16481 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16482 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16483 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16484 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16485 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16486 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 16487 | RECEIVED_INSTANCE* received_instance = (RECEIVED_INSTANCE*)received; |
AzureIoTClient | 23:1111ee8bcba4 | 16488 | if (amqpvalue_get_composite_item_count(received_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 16489 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16490 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16491 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16492 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16493 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16494 | if (item_count <= 1) |
AzureIoTClient | 23:1111ee8bcba4 | 16495 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16496 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16497 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16498 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16499 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16500 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(received_instance->composite_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 16501 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 16502 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 16503 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16504 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16505 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16506 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16507 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16508 | if (amqpvalue_get_ulong(item_value, section_offset_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 16509 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16510 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16511 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16512 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16513 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16514 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 16515 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16516 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16517 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16518 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16519 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16520 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16521 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16522 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16523 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16524 | int received_set_section_offset(RECEIVED_HANDLE received, uint64_t section_offset_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 16525 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16526 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16527 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16528 | if (received == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16529 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16530 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16531 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16532 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16533 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16534 | RECEIVED_INSTANCE* received_instance = (RECEIVED_INSTANCE*)received; |
Azure.IoT Build | 0:6ae2f7bca550 | 16535 | AMQP_VALUE section_offset_amqp_value = amqpvalue_create_ulong(section_offset_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16536 | if (section_offset_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16537 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16538 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16539 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16540 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16541 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16542 | if (amqpvalue_set_composite_item(received_instance->composite_value, 1, section_offset_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 16543 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16544 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16545 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16546 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16547 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16548 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 16549 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16550 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16551 | amqpvalue_destroy(section_offset_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16552 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16553 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16554 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16555 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16556 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16557 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16558 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16559 | /* accepted */ |
Azure.IoT Build | 0:6ae2f7bca550 | 16560 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16561 | typedef struct ACCEPTED_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 16562 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16563 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 16564 | } ACCEPTED_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 16565 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16566 | static ACCEPTED_HANDLE accepted_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 16567 | { |
AzureIoTClient | 21:f9c433d8e6ca | 16568 | ACCEPTED_INSTANCE* accepted_instance = (ACCEPTED_INSTANCE*)malloc(sizeof(ACCEPTED_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 16569 | if (accepted_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16570 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16571 | accepted_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 16572 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16573 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16574 | return accepted_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 16575 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16576 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16577 | ACCEPTED_HANDLE accepted_create(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 16578 | { |
AzureIoTClient | 21:f9c433d8e6ca | 16579 | ACCEPTED_INSTANCE* accepted_instance = (ACCEPTED_INSTANCE*)malloc(sizeof(ACCEPTED_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 16580 | if (accepted_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16581 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16582 | accepted_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(36); |
Azure.IoT Build | 0:6ae2f7bca550 | 16583 | if (accepted_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16584 | { |
AzureIoTClient | 21:f9c433d8e6ca | 16585 | free(accepted_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 16586 | accepted_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 16587 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16588 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16589 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16590 | return accepted_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 16591 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16592 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16593 | ACCEPTED_HANDLE accepted_clone(ACCEPTED_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 16594 | { |
AzureIoTClient | 21:f9c433d8e6ca | 16595 | ACCEPTED_INSTANCE* accepted_instance = (ACCEPTED_INSTANCE*)malloc(sizeof(ACCEPTED_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 16596 | if (accepted_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16597 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16598 | accepted_instance->composite_value = amqpvalue_clone(((ACCEPTED_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16599 | if (accepted_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16600 | { |
AzureIoTClient | 21:f9c433d8e6ca | 16601 | free(accepted_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 16602 | accepted_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 16603 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16604 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16605 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16606 | return accepted_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 16607 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16608 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16609 | void accepted_destroy(ACCEPTED_HANDLE accepted) |
Azure.IoT Build | 0:6ae2f7bca550 | 16610 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16611 | if (accepted != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16612 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16613 | ACCEPTED_INSTANCE* accepted_instance = (ACCEPTED_INSTANCE*)accepted; |
Azure.IoT Build | 0:6ae2f7bca550 | 16614 | amqpvalue_destroy(accepted_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 16615 | free(accepted_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 16616 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16617 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16618 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16619 | AMQP_VALUE amqpvalue_create_accepted(ACCEPTED_HANDLE accepted) |
Azure.IoT Build | 0:6ae2f7bca550 | 16620 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16621 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16622 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16623 | if (accepted == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16624 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16625 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 16626 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16627 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16628 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16629 | ACCEPTED_INSTANCE* accepted_instance = (ACCEPTED_INSTANCE*)accepted; |
Azure.IoT Build | 0:6ae2f7bca550 | 16630 | result = amqpvalue_clone(accepted_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16631 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16632 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16633 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16634 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16635 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16636 | bool is_accepted_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 16637 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16638 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16639 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16640 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 16641 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 16642 | (descriptor_ulong == 36)) |
Azure.IoT Build | 0:6ae2f7bca550 | 16643 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16644 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 16645 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16646 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16647 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16648 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 16649 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16650 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16651 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16652 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16653 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16654 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16655 | int amqpvalue_get_accepted(AMQP_VALUE value, ACCEPTED_HANDLE* accepted_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 16656 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16657 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16658 | ACCEPTED_INSTANCE* accepted_instance = (ACCEPTED_INSTANCE*)accepted_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 16659 | *accepted_handle = accepted_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 16660 | if (*accepted_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16661 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16662 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16663 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16664 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16665 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16666 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16667 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16668 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16669 | accepted_destroy(*accepted_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 16670 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16671 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16672 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16673 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16674 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 16675 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 16676 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16677 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16678 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16679 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16680 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16681 | do |
AzureIoTClient | 23:1111ee8bcba4 | 16682 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16683 | |
AzureIoTClient | 23:1111ee8bcba4 | 16684 | accepted_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 16685 | |
AzureIoTClient | 23:1111ee8bcba4 | 16686 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 16687 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 16688 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16689 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16690 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16691 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16692 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16693 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16694 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16695 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16696 | /* rejected */ |
Azure.IoT Build | 0:6ae2f7bca550 | 16697 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16698 | typedef struct REJECTED_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 16699 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16700 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 16701 | } REJECTED_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 16702 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16703 | static REJECTED_HANDLE rejected_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 16704 | { |
AzureIoTClient | 21:f9c433d8e6ca | 16705 | REJECTED_INSTANCE* rejected_instance = (REJECTED_INSTANCE*)malloc(sizeof(REJECTED_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 16706 | if (rejected_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16707 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16708 | rejected_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 16709 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16710 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16711 | return rejected_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 16712 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16713 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16714 | REJECTED_HANDLE rejected_create(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 16715 | { |
AzureIoTClient | 21:f9c433d8e6ca | 16716 | REJECTED_INSTANCE* rejected_instance = (REJECTED_INSTANCE*)malloc(sizeof(REJECTED_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 16717 | if (rejected_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16718 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16719 | rejected_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(37); |
Azure.IoT Build | 0:6ae2f7bca550 | 16720 | if (rejected_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16721 | { |
AzureIoTClient | 21:f9c433d8e6ca | 16722 | free(rejected_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 16723 | rejected_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 16724 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16725 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16726 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16727 | return rejected_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 16728 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16729 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16730 | REJECTED_HANDLE rejected_clone(REJECTED_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 16731 | { |
AzureIoTClient | 21:f9c433d8e6ca | 16732 | REJECTED_INSTANCE* rejected_instance = (REJECTED_INSTANCE*)malloc(sizeof(REJECTED_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 16733 | if (rejected_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16734 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16735 | rejected_instance->composite_value = amqpvalue_clone(((REJECTED_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16736 | if (rejected_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16737 | { |
AzureIoTClient | 21:f9c433d8e6ca | 16738 | free(rejected_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 16739 | rejected_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 16740 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16741 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16742 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16743 | return rejected_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 16744 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16745 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16746 | void rejected_destroy(REJECTED_HANDLE rejected) |
Azure.IoT Build | 0:6ae2f7bca550 | 16747 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16748 | if (rejected != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16749 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16750 | REJECTED_INSTANCE* rejected_instance = (REJECTED_INSTANCE*)rejected; |
Azure.IoT Build | 0:6ae2f7bca550 | 16751 | amqpvalue_destroy(rejected_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 16752 | free(rejected_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 16753 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16754 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16755 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16756 | AMQP_VALUE amqpvalue_create_rejected(REJECTED_HANDLE rejected) |
Azure.IoT Build | 0:6ae2f7bca550 | 16757 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16758 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16759 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16760 | if (rejected == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16761 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16762 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 16763 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16764 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16765 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16766 | REJECTED_INSTANCE* rejected_instance = (REJECTED_INSTANCE*)rejected; |
Azure.IoT Build | 0:6ae2f7bca550 | 16767 | result = amqpvalue_clone(rejected_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16768 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16769 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16770 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16771 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16772 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16773 | bool is_rejected_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 16774 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16775 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16776 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16777 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 16778 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 16779 | (descriptor_ulong == 37)) |
Azure.IoT Build | 0:6ae2f7bca550 | 16780 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16781 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 16782 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16783 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16784 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16785 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 16786 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16787 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16788 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16789 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16790 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16791 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16792 | int amqpvalue_get_rejected(AMQP_VALUE value, REJECTED_HANDLE* rejected_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 16793 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16794 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16795 | REJECTED_INSTANCE* rejected_instance = (REJECTED_INSTANCE*)rejected_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 16796 | *rejected_handle = rejected_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 16797 | if (*rejected_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16798 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16799 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16800 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16801 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16802 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16803 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16804 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16805 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16806 | rejected_destroy(*rejected_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 16807 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16808 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16809 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16810 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16811 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 16812 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 16813 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16814 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16815 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16816 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16817 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16818 | do |
AzureIoTClient | 23:1111ee8bcba4 | 16819 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16820 | AMQP_VALUE item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 16821 | /* error */ |
AzureIoTClient | 23:1111ee8bcba4 | 16822 | if (list_item_count > 0) |
AzureIoTClient | 23:1111ee8bcba4 | 16823 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16824 | item_value = amqpvalue_get_list_item(list_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 16825 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 16826 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16827 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 16828 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16829 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16830 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16831 | ERROR_HANDLE error; |
AzureIoTClient | 23:1111ee8bcba4 | 16832 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 16833 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16834 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 16835 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16836 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16837 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16838 | if (amqpvalue_get_error(item_value, &error) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 16839 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16840 | rejected_destroy(*rejected_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 16841 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16842 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 16843 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16844 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16845 | |
AzureIoTClient | 23:1111ee8bcba4 | 16846 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 16847 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16848 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16849 | |
AzureIoTClient | 23:1111ee8bcba4 | 16850 | rejected_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 16851 | |
AzureIoTClient | 23:1111ee8bcba4 | 16852 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 16853 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 16854 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16855 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16856 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16857 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16858 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16859 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16860 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16861 | int rejected_get_error(REJECTED_HANDLE rejected, ERROR_HANDLE* error_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 16862 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16863 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16864 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16865 | if (rejected == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16866 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16867 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16868 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16869 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16870 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16871 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 16872 | REJECTED_INSTANCE* rejected_instance = (REJECTED_INSTANCE*)rejected; |
AzureIoTClient | 23:1111ee8bcba4 | 16873 | if (amqpvalue_get_composite_item_count(rejected_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 16874 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16875 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16876 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16877 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16878 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16879 | if (item_count <= 0) |
AzureIoTClient | 23:1111ee8bcba4 | 16880 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16881 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16882 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16883 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16884 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16885 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(rejected_instance->composite_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 16886 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 16887 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 16888 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16889 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16890 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16891 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16892 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16893 | if (amqpvalue_get_error(item_value, error_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 16894 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16895 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 16896 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16897 | else |
AzureIoTClient | 23:1111ee8bcba4 | 16898 | { |
AzureIoTClient | 23:1111ee8bcba4 | 16899 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 16900 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16901 | } |
AzureIoTClient | 23:1111ee8bcba4 | 16902 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16903 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16904 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16905 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16906 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16907 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16908 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16909 | int rejected_set_error(REJECTED_HANDLE rejected, ERROR_HANDLE error_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 16910 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16911 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16912 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16913 | if (rejected == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16914 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16915 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16916 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16917 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16918 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16919 | REJECTED_INSTANCE* rejected_instance = (REJECTED_INSTANCE*)rejected; |
Azure.IoT Build | 0:6ae2f7bca550 | 16920 | AMQP_VALUE error_amqp_value = amqpvalue_create_error(error_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16921 | if (error_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16922 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16923 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16924 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16925 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16926 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16927 | if (amqpvalue_set_composite_item(rejected_instance->composite_value, 0, error_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 16928 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 16929 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 16930 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16931 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 16932 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16933 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 16934 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16935 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16936 | amqpvalue_destroy(error_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16937 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16938 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16939 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16940 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 16941 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16942 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16943 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16944 | /* released */ |
Azure.IoT Build | 0:6ae2f7bca550 | 16945 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16946 | typedef struct RELEASED_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 16947 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16948 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 16949 | } RELEASED_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 16950 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16951 | static RELEASED_HANDLE released_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 16952 | { |
AzureIoTClient | 21:f9c433d8e6ca | 16953 | RELEASED_INSTANCE* released_instance = (RELEASED_INSTANCE*)malloc(sizeof(RELEASED_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 16954 | if (released_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16955 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16956 | released_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 16957 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16958 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16959 | return released_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 16960 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16961 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16962 | RELEASED_HANDLE released_create(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 16963 | { |
AzureIoTClient | 21:f9c433d8e6ca | 16964 | RELEASED_INSTANCE* released_instance = (RELEASED_INSTANCE*)malloc(sizeof(RELEASED_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 16965 | if (released_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16966 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16967 | released_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(38); |
Azure.IoT Build | 0:6ae2f7bca550 | 16968 | if (released_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16969 | { |
AzureIoTClient | 21:f9c433d8e6ca | 16970 | free(released_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 16971 | released_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 16972 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16973 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16974 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16975 | return released_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 16976 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16977 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16978 | RELEASED_HANDLE released_clone(RELEASED_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 16979 | { |
AzureIoTClient | 21:f9c433d8e6ca | 16980 | RELEASED_INSTANCE* released_instance = (RELEASED_INSTANCE*)malloc(sizeof(RELEASED_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 16981 | if (released_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16982 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16983 | released_instance->composite_value = amqpvalue_clone(((RELEASED_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 16984 | if (released_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16985 | { |
AzureIoTClient | 21:f9c433d8e6ca | 16986 | free(released_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 16987 | released_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 16988 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16989 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16990 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16991 | return released_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 16992 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 16993 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16994 | void released_destroy(RELEASED_HANDLE released) |
Azure.IoT Build | 0:6ae2f7bca550 | 16995 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16996 | if (released != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 16997 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 16998 | RELEASED_INSTANCE* released_instance = (RELEASED_INSTANCE*)released; |
Azure.IoT Build | 0:6ae2f7bca550 | 16999 | amqpvalue_destroy(released_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 17000 | free(released_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 17001 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17002 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17003 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17004 | AMQP_VALUE amqpvalue_create_released(RELEASED_HANDLE released) |
Azure.IoT Build | 0:6ae2f7bca550 | 17005 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17006 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17007 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17008 | if (released == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 17009 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17010 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 17011 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17012 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 17013 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17014 | RELEASED_INSTANCE* released_instance = (RELEASED_INSTANCE*)released; |
Azure.IoT Build | 0:6ae2f7bca550 | 17015 | result = amqpvalue_clone(released_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 17016 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17017 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17018 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17019 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17020 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17021 | bool is_released_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 17022 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17023 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17024 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17025 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 17026 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 17027 | (descriptor_ulong == 38)) |
Azure.IoT Build | 0:6ae2f7bca550 | 17028 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17029 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 17030 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17031 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 17032 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17033 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 17034 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17035 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17036 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17037 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17038 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17039 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17040 | int amqpvalue_get_released(AMQP_VALUE value, RELEASED_HANDLE* released_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 17041 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17042 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17043 | RELEASED_INSTANCE* released_instance = (RELEASED_INSTANCE*)released_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 17044 | *released_handle = released_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 17045 | if (*released_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 17046 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 17047 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 17048 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17049 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 17050 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17051 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 17052 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 17053 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17054 | released_destroy(*released_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 17055 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 17056 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17057 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 17058 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17059 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 17060 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 17061 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17062 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 17063 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17064 | else |
AzureIoTClient | 23:1111ee8bcba4 | 17065 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17066 | do |
AzureIoTClient | 23:1111ee8bcba4 | 17067 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17068 | |
AzureIoTClient | 23:1111ee8bcba4 | 17069 | released_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 17070 | |
AzureIoTClient | 23:1111ee8bcba4 | 17071 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 17072 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 17073 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17074 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17075 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17076 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17077 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17078 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17079 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17080 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17081 | /* modified */ |
Azure.IoT Build | 0:6ae2f7bca550 | 17082 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17083 | typedef struct MODIFIED_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 17084 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17085 | AMQP_VALUE composite_value; |
Azure.IoT Build | 0:6ae2f7bca550 | 17086 | } MODIFIED_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 17087 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17088 | static MODIFIED_HANDLE modified_create_internal(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 17089 | { |
AzureIoTClient | 21:f9c433d8e6ca | 17090 | MODIFIED_INSTANCE* modified_instance = (MODIFIED_INSTANCE*)malloc(sizeof(MODIFIED_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 17091 | if (modified_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 17092 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17093 | modified_instance->composite_value = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 17094 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17095 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17096 | return modified_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 17097 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17098 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17099 | MODIFIED_HANDLE modified_create(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 17100 | { |
AzureIoTClient | 21:f9c433d8e6ca | 17101 | MODIFIED_INSTANCE* modified_instance = (MODIFIED_INSTANCE*)malloc(sizeof(MODIFIED_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 17102 | if (modified_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 17103 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17104 | modified_instance->composite_value = amqpvalue_create_composite_with_ulong_descriptor(39); |
Azure.IoT Build | 0:6ae2f7bca550 | 17105 | if (modified_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 17106 | { |
AzureIoTClient | 21:f9c433d8e6ca | 17107 | free(modified_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 17108 | modified_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 17109 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17110 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17111 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17112 | return modified_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 17113 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17114 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17115 | MODIFIED_HANDLE modified_clone(MODIFIED_HANDLE value) |
Azure.IoT Build | 0:6ae2f7bca550 | 17116 | { |
AzureIoTClient | 21:f9c433d8e6ca | 17117 | MODIFIED_INSTANCE* modified_instance = (MODIFIED_INSTANCE*)malloc(sizeof(MODIFIED_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 17118 | if (modified_instance != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 17119 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17120 | modified_instance->composite_value = amqpvalue_clone(((MODIFIED_INSTANCE*)value)->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 17121 | if (modified_instance->composite_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 17122 | { |
AzureIoTClient | 21:f9c433d8e6ca | 17123 | free(modified_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 17124 | modified_instance = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 17125 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17126 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17127 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17128 | return modified_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 17129 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17130 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17131 | void modified_destroy(MODIFIED_HANDLE modified) |
Azure.IoT Build | 0:6ae2f7bca550 | 17132 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17133 | if (modified != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 17134 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17135 | MODIFIED_INSTANCE* modified_instance = (MODIFIED_INSTANCE*)modified; |
Azure.IoT Build | 0:6ae2f7bca550 | 17136 | amqpvalue_destroy(modified_instance->composite_value); |
AzureIoTClient | 21:f9c433d8e6ca | 17137 | free(modified_instance); |
Azure.IoT Build | 0:6ae2f7bca550 | 17138 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17139 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17140 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17141 | AMQP_VALUE amqpvalue_create_modified(MODIFIED_HANDLE modified) |
Azure.IoT Build | 0:6ae2f7bca550 | 17142 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17143 | AMQP_VALUE result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17144 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17145 | if (modified == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 17146 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17147 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 17148 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17149 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 17150 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17151 | MODIFIED_INSTANCE* modified_instance = (MODIFIED_INSTANCE*)modified; |
Azure.IoT Build | 0:6ae2f7bca550 | 17152 | result = amqpvalue_clone(modified_instance->composite_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 17153 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17154 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17155 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17156 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17157 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17158 | bool is_modified_type_by_descriptor(AMQP_VALUE descriptor) |
Azure.IoT Build | 0:6ae2f7bca550 | 17159 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17160 | bool result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17161 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17162 | uint64_t descriptor_ulong; |
Azure.IoT Build | 0:6ae2f7bca550 | 17163 | if ((amqpvalue_get_ulong(descriptor, &descriptor_ulong) == 0) && |
Azure.IoT Build | 0:6ae2f7bca550 | 17164 | (descriptor_ulong == 39)) |
Azure.IoT Build | 0:6ae2f7bca550 | 17165 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17166 | result = true; |
Azure.IoT Build | 0:6ae2f7bca550 | 17167 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17168 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 17169 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17170 | result = false; |
Azure.IoT Build | 0:6ae2f7bca550 | 17171 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17172 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17173 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17174 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17175 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17176 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17177 | int amqpvalue_get_modified(AMQP_VALUE value, MODIFIED_HANDLE* modified_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 17178 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17179 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17180 | MODIFIED_INSTANCE* modified_instance = (MODIFIED_INSTANCE*)modified_create_internal(); |
Azure.IoT Build | 0:6ae2f7bca550 | 17181 | *modified_handle = modified_instance; |
Azure.IoT Build | 0:6ae2f7bca550 | 17182 | if (*modified_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 17183 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 17184 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 17185 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17186 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 17187 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17188 | AMQP_VALUE list_value = amqpvalue_get_inplace_described_value(value); |
Azure.IoT Build | 0:6ae2f7bca550 | 17189 | if (list_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 17190 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17191 | modified_destroy(*modified_handle); |
AzureIoTClient | 19:000ab4e6a2c1 | 17192 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 17193 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17194 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 17195 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17196 | uint32_t list_item_count; |
AzureIoTClient | 23:1111ee8bcba4 | 17197 | if (amqpvalue_get_list_item_count(list_value, &list_item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 17198 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17199 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 17200 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17201 | else |
AzureIoTClient | 23:1111ee8bcba4 | 17202 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17203 | do |
AzureIoTClient | 23:1111ee8bcba4 | 17204 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17205 | AMQP_VALUE item_value; |
AzureIoTClient | 23:1111ee8bcba4 | 17206 | /* delivery-failed */ |
AzureIoTClient | 23:1111ee8bcba4 | 17207 | if (list_item_count > 0) |
AzureIoTClient | 23:1111ee8bcba4 | 17208 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17209 | item_value = amqpvalue_get_list_item(list_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 17210 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 17211 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17212 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 17213 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17214 | else |
AzureIoTClient | 23:1111ee8bcba4 | 17215 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17216 | bool delivery_failed; |
AzureIoTClient | 23:1111ee8bcba4 | 17217 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 17218 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17219 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 17220 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17221 | else |
AzureIoTClient | 23:1111ee8bcba4 | 17222 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17223 | if (amqpvalue_get_boolean(item_value, &delivery_failed) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 17224 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17225 | modified_destroy(*modified_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 17226 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 17227 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 17228 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17229 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17230 | |
AzureIoTClient | 23:1111ee8bcba4 | 17231 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 17232 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17233 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17234 | /* undeliverable-here */ |
AzureIoTClient | 23:1111ee8bcba4 | 17235 | if (list_item_count > 1) |
AzureIoTClient | 23:1111ee8bcba4 | 17236 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17237 | item_value = amqpvalue_get_list_item(list_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 17238 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 17239 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17240 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 17241 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17242 | else |
AzureIoTClient | 23:1111ee8bcba4 | 17243 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17244 | bool undeliverable_here; |
AzureIoTClient | 23:1111ee8bcba4 | 17245 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 17246 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17247 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 17248 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17249 | else |
AzureIoTClient | 23:1111ee8bcba4 | 17250 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17251 | if (amqpvalue_get_boolean(item_value, &undeliverable_here) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 17252 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17253 | modified_destroy(*modified_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 17254 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 17255 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 17256 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17257 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17258 | |
AzureIoTClient | 23:1111ee8bcba4 | 17259 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 17260 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17261 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17262 | /* message-annotations */ |
AzureIoTClient | 23:1111ee8bcba4 | 17263 | if (list_item_count > 2) |
AzureIoTClient | 23:1111ee8bcba4 | 17264 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17265 | item_value = amqpvalue_get_list_item(list_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 17266 | if (item_value == NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 17267 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17268 | /* do nothing */ |
AzureIoTClient | 23:1111ee8bcba4 | 17269 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17270 | else |
AzureIoTClient | 23:1111ee8bcba4 | 17271 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17272 | fields message_annotations; |
AzureIoTClient | 23:1111ee8bcba4 | 17273 | if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL) |
AzureIoTClient | 23:1111ee8bcba4 | 17274 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17275 | /* no error, field is not mandatory */ |
AzureIoTClient | 23:1111ee8bcba4 | 17276 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17277 | else |
AzureIoTClient | 23:1111ee8bcba4 | 17278 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17279 | if (amqpvalue_get_fields(item_value, &message_annotations) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 17280 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17281 | modified_destroy(*modified_handle); |
AzureIoTClient | 23:1111ee8bcba4 | 17282 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 17283 | break; |
AzureIoTClient | 23:1111ee8bcba4 | 17284 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17285 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17286 | |
AzureIoTClient | 23:1111ee8bcba4 | 17287 | amqpvalue_destroy(item_value); |
AzureIoTClient | 23:1111ee8bcba4 | 17288 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17289 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17290 | |
AzureIoTClient | 23:1111ee8bcba4 | 17291 | modified_instance->composite_value = amqpvalue_clone(value); |
AzureIoTClient | 23:1111ee8bcba4 | 17292 | |
AzureIoTClient | 23:1111ee8bcba4 | 17293 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 17294 | } while (0); |
AzureIoTClient | 23:1111ee8bcba4 | 17295 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17296 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17297 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17298 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17299 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17300 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17301 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17302 | int modified_get_delivery_failed(MODIFIED_HANDLE modified, bool* delivery_failed_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 17303 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17304 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17305 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17306 | if (modified == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 17307 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 17308 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 17309 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17310 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 17311 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17312 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 17313 | MODIFIED_INSTANCE* modified_instance = (MODIFIED_INSTANCE*)modified; |
AzureIoTClient | 23:1111ee8bcba4 | 17314 | if (amqpvalue_get_composite_item_count(modified_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 17315 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17316 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 17317 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17318 | else |
AzureIoTClient | 23:1111ee8bcba4 | 17319 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17320 | if (item_count <= 0) |
AzureIoTClient | 23:1111ee8bcba4 | 17321 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17322 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 17323 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17324 | else |
AzureIoTClient | 23:1111ee8bcba4 | 17325 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17326 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(modified_instance->composite_value, 0); |
AzureIoTClient | 23:1111ee8bcba4 | 17327 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 17328 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 17329 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17330 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 17331 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17332 | else |
AzureIoTClient | 23:1111ee8bcba4 | 17333 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17334 | if (amqpvalue_get_boolean(item_value, delivery_failed_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 17335 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17336 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 17337 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17338 | else |
AzureIoTClient | 23:1111ee8bcba4 | 17339 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17340 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 17341 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17342 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17343 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17344 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17345 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17346 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17347 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17348 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17349 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17350 | int modified_set_delivery_failed(MODIFIED_HANDLE modified, bool delivery_failed_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 17351 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17352 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17353 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17354 | if (modified == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 17355 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 17356 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 17357 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17358 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 17359 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17360 | MODIFIED_INSTANCE* modified_instance = (MODIFIED_INSTANCE*)modified; |
Azure.IoT Build | 0:6ae2f7bca550 | 17361 | AMQP_VALUE delivery_failed_amqp_value = amqpvalue_create_boolean(delivery_failed_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 17362 | if (delivery_failed_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 17363 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 17364 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 17365 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17366 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 17367 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17368 | if (amqpvalue_set_composite_item(modified_instance->composite_value, 0, delivery_failed_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 17369 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 17370 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 17371 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17372 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 17373 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17374 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 17375 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17376 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17377 | amqpvalue_destroy(delivery_failed_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 17378 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17379 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17380 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17381 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17382 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17383 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17384 | int modified_get_undeliverable_here(MODIFIED_HANDLE modified, bool* undeliverable_here_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 17385 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17386 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17387 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17388 | if (modified == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 17389 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 17390 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 17391 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17392 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 17393 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17394 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 17395 | MODIFIED_INSTANCE* modified_instance = (MODIFIED_INSTANCE*)modified; |
AzureIoTClient | 23:1111ee8bcba4 | 17396 | if (amqpvalue_get_composite_item_count(modified_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 17397 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17398 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 17399 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17400 | else |
AzureIoTClient | 23:1111ee8bcba4 | 17401 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17402 | if (item_count <= 1) |
AzureIoTClient | 23:1111ee8bcba4 | 17403 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17404 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 17405 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17406 | else |
AzureIoTClient | 23:1111ee8bcba4 | 17407 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17408 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(modified_instance->composite_value, 1); |
AzureIoTClient | 23:1111ee8bcba4 | 17409 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 17410 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 17411 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17412 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 17413 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17414 | else |
AzureIoTClient | 23:1111ee8bcba4 | 17415 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17416 | if (amqpvalue_get_boolean(item_value, undeliverable_here_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 17417 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17418 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 17419 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17420 | else |
AzureIoTClient | 23:1111ee8bcba4 | 17421 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17422 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 17423 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17424 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17425 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17426 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17427 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17428 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17429 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17430 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17431 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17432 | int modified_set_undeliverable_here(MODIFIED_HANDLE modified, bool undeliverable_here_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 17433 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17434 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17435 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17436 | if (modified == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 17437 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 17438 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 17439 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17440 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 17441 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17442 | MODIFIED_INSTANCE* modified_instance = (MODIFIED_INSTANCE*)modified; |
Azure.IoT Build | 0:6ae2f7bca550 | 17443 | AMQP_VALUE undeliverable_here_amqp_value = amqpvalue_create_boolean(undeliverable_here_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 17444 | if (undeliverable_here_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 17445 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 17446 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 17447 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17448 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 17449 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17450 | if (amqpvalue_set_composite_item(modified_instance->composite_value, 1, undeliverable_here_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 17451 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 17452 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 17453 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17454 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 17455 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17456 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 17457 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17458 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17459 | amqpvalue_destroy(undeliverable_here_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 17460 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17461 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17462 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17463 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17464 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17465 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17466 | int modified_get_message_annotations(MODIFIED_HANDLE modified, fields* message_annotations_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 17467 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17468 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17469 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17470 | if (modified == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 17471 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 17472 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 17473 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17474 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 17475 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17476 | uint32_t item_count; |
Azure.IoT Build | 0:6ae2f7bca550 | 17477 | MODIFIED_INSTANCE* modified_instance = (MODIFIED_INSTANCE*)modified; |
AzureIoTClient | 23:1111ee8bcba4 | 17478 | if (amqpvalue_get_composite_item_count(modified_instance->composite_value, &item_count) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 17479 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17480 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 17481 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17482 | else |
AzureIoTClient | 23:1111ee8bcba4 | 17483 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17484 | if (item_count <= 2) |
AzureIoTClient | 23:1111ee8bcba4 | 17485 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17486 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 17487 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17488 | else |
AzureIoTClient | 23:1111ee8bcba4 | 17489 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17490 | AMQP_VALUE item_value = amqpvalue_get_composite_item_in_place(modified_instance->composite_value, 2); |
AzureIoTClient | 23:1111ee8bcba4 | 17491 | if ((item_value == NULL) || |
AzureIoTClient | 23:1111ee8bcba4 | 17492 | (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)) |
AzureIoTClient | 23:1111ee8bcba4 | 17493 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17494 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 17495 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17496 | else |
AzureIoTClient | 23:1111ee8bcba4 | 17497 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17498 | if (amqpvalue_get_fields(item_value, message_annotations_value) != 0) |
AzureIoTClient | 23:1111ee8bcba4 | 17499 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17500 | result = __FAILURE__; |
AzureIoTClient | 23:1111ee8bcba4 | 17501 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17502 | else |
AzureIoTClient | 23:1111ee8bcba4 | 17503 | { |
AzureIoTClient | 23:1111ee8bcba4 | 17504 | result = 0; |
AzureIoTClient | 23:1111ee8bcba4 | 17505 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17506 | } |
AzureIoTClient | 23:1111ee8bcba4 | 17507 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17508 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17509 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17510 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17511 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17512 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17513 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17514 | int modified_set_message_annotations(MODIFIED_HANDLE modified, fields message_annotations_value) |
Azure.IoT Build | 0:6ae2f7bca550 | 17515 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17516 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17517 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17518 | if (modified == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 17519 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 17520 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 17521 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17522 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 17523 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17524 | MODIFIED_INSTANCE* modified_instance = (MODIFIED_INSTANCE*)modified; |
Azure.IoT Build | 0:6ae2f7bca550 | 17525 | AMQP_VALUE message_annotations_amqp_value = amqpvalue_create_fields(message_annotations_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 17526 | if (message_annotations_amqp_value == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 17527 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 17528 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 17529 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17530 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 17531 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17532 | if (amqpvalue_set_composite_item(modified_instance->composite_value, 2, message_annotations_amqp_value) != 0) |
Azure.IoT Build | 0:6ae2f7bca550 | 17533 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 17534 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 17535 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17536 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 17537 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 17538 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 17539 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17540 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17541 | amqpvalue_destroy(message_annotations_amqp_value); |
Azure.IoT Build | 0:6ae2f7bca550 | 17542 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17543 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17544 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17545 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 17546 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 17547 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17548 |