A small memory footprint AMQP implimentation
Dependents: iothub_client_sample_amqp remote_monitoring simplesample_amqp
Diff: link.c
- Revision:
- 20:206846c14c80
- Parent:
- 19:000ab4e6a2c1
- Child:
- 21:f9c433d8e6ca
--- a/link.c Fri Feb 24 14:00:58 2017 -0800 +++ b/link.c Fri Mar 10 11:47:49 2017 -0800 @@ -376,13 +376,12 @@ link_instance->received_payload_size = 0; } - if (send_disposition(link_instance, link_instance->received_delivery_id, delivery_state) != 0) - { - LogError("Cannot send disposition frame"); - } - if (delivery_state != NULL) { + if (send_disposition(link_instance, link_instance->received_delivery_id, delivery_state) != 0) + { + LogError("Cannot send disposition frame"); + } amqpvalue_destroy(delivery_state); } } @@ -1119,3 +1118,56 @@ return result; } + +int link_get_name(LINK_HANDLE link, const char** link_name) +{ + int result; + + if (link == NULL) + { + result = __FAILURE__; + } + else + { + *link_name = link->name; + result = 0; + } + + return result; +} + +int link_get_received_message_id(LINK_HANDLE link, delivery_number* message_id) +{ + int result; + + if (link == NULL) + { + result = __FAILURE__; + } + else + { + *message_id = link->received_delivery_id; + result = 0; + } + + return result; +} + +int link_send_disposition(LINK_HANDLE link, delivery_number message_id, AMQP_VALUE delivery_state) +{ + int result; + if (delivery_state == NULL) + { + result = 0; + } + else + { + result = send_disposition(link, message_id, delivery_state); + if ( result != 0) + { + LogError("Cannot send disposition frame"); + result = __FAILURE__; + } + } + return result; +} \ No newline at end of file