Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: sht15_remote_monitoring RobotArmDemo iothub_client_sample_amqp iothub_client_sample_amqp ... more
internal/iothubtransport_amqp_messenger.h@57:56ac1346c70d, 2018-10-04 (annotated)
- Committer:
- AzureIoTClient
- Date:
- Thu Oct 04 09:14:47 2018 -0700
- Revision:
- 57:56ac1346c70d
- Parent:
- 56:8704100b3b54
1.2.10
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| AzureIoTClient | 39:e98d5df6dc74 | 1 | // Copyright (c) Microsoft. All rights reserved. |
| AzureIoTClient | 39:e98d5df6dc74 | 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
| AzureIoTClient | 39:e98d5df6dc74 | 3 | |
| AzureIoTClient | 39:e98d5df6dc74 | 4 | #ifndef IOTHUBTRANSPORT_AMQP_MESSENGER |
| AzureIoTClient | 39:e98d5df6dc74 | 5 | #define IOTHUBTRANSPORT_AMQP_MESSENGER |
| AzureIoTClient | 39:e98d5df6dc74 | 6 | |
| AzureIoTClient | 39:e98d5df6dc74 | 7 | #include "azure_c_shared_utility/umock_c_prod.h" |
| AzureIoTClient | 39:e98d5df6dc74 | 8 | #include "azure_c_shared_utility/optionhandler.h" |
| AzureIoTClient | 39:e98d5df6dc74 | 9 | #include "azure_c_shared_utility/map.h" |
| AzureIoTClient | 39:e98d5df6dc74 | 10 | #include "azure_uamqp_c/message.h" |
| AzureIoTClient | 39:e98d5df6dc74 | 11 | #include "azure_uamqp_c/session.h" |
| AzureIoTClient | 39:e98d5df6dc74 | 12 | #include "azure_uamqp_c/link.h" |
| AzureIoTClient | 50:f3a92c6c6534 | 13 | #include "azure_uamqp_c/amqp_definitions_sequence_no.h" |
| AzureIoTClient | 50:f3a92c6c6534 | 14 | #include "azure_uamqp_c/amqp_definitions_delivery_number.h" |
| AzureIoTClient | 39:e98d5df6dc74 | 15 | |
| AzureIoTClient | 39:e98d5df6dc74 | 16 | #ifdef __cplusplus |
| AzureIoTClient | 39:e98d5df6dc74 | 17 | extern "C" |
| AzureIoTClient | 39:e98d5df6dc74 | 18 | { |
| AzureIoTClient | 39:e98d5df6dc74 | 19 | #endif |
| AzureIoTClient | 39:e98d5df6dc74 | 20 | |
| AzureIoTClient | 39:e98d5df6dc74 | 21 | |
| AzureIoTClient | 51:269e65571b39 | 22 | static const char* AMQP_MESSENGER_OPTION_EVENT_SEND_TIMEOUT_SECS = "amqp_event_send_timeout_secs"; |
| AzureIoTClient | 39:e98d5df6dc74 | 23 | |
| AzureIoTClient | 39:e98d5df6dc74 | 24 | typedef struct AMQP_MESSENGER_INSTANCE* AMQP_MESSENGER_HANDLE; |
| AzureIoTClient | 39:e98d5df6dc74 | 25 | |
| AzureIoTClient | 39:e98d5df6dc74 | 26 | #define AMQP_MESSENGER_SEND_STATUS_VALUES \ |
| AzureIoTClient | 56:8704100b3b54 | 27 | AMQP_MESSENGER_SEND_STATUS_IDLE, \ |
| AzureIoTClient | 56:8704100b3b54 | 28 | AMQP_MESSENGER_SEND_STATUS_BUSY |
| AzureIoTClient | 39:e98d5df6dc74 | 29 | |
| AzureIoTClient | 39:e98d5df6dc74 | 30 | DEFINE_ENUM(AMQP_MESSENGER_SEND_STATUS, AMQP_MESSENGER_SEND_STATUS_VALUES); |
| AzureIoTClient | 39:e98d5df6dc74 | 31 | |
| AzureIoTClient | 39:e98d5df6dc74 | 32 | #define AMQP_MESSENGER_SEND_RESULT_VALUES \ |
| AzureIoTClient | 56:8704100b3b54 | 33 | AMQP_MESSENGER_SEND_RESULT_SUCCESS, \ |
| AzureIoTClient | 56:8704100b3b54 | 34 | AMQP_MESSENGER_SEND_RESULT_ERROR, \ |
| AzureIoTClient | 56:8704100b3b54 | 35 | AMQP_MESSENGER_SEND_RESULT_CANCELLED |
| AzureIoTClient | 39:e98d5df6dc74 | 36 | |
| AzureIoTClient | 39:e98d5df6dc74 | 37 | DEFINE_ENUM(AMQP_MESSENGER_SEND_RESULT, AMQP_MESSENGER_SEND_RESULT_VALUES); |
| AzureIoTClient | 39:e98d5df6dc74 | 38 | |
| AzureIoTClient | 39:e98d5df6dc74 | 39 | #define AMQP_MESSENGER_REASON_VALUES \ |
| AzureIoTClient | 56:8704100b3b54 | 40 | AMQP_MESSENGER_REASON_NONE, \ |
| AzureIoTClient | 56:8704100b3b54 | 41 | AMQP_MESSENGER_REASON_CANNOT_PARSE, \ |
| AzureIoTClient | 56:8704100b3b54 | 42 | AMQP_MESSENGER_REASON_FAIL_SENDING, \ |
| AzureIoTClient | 56:8704100b3b54 | 43 | AMQP_MESSENGER_REASON_TIMEOUT, \ |
| AzureIoTClient | 56:8704100b3b54 | 44 | AMQP_MESSENGER_REASON_MESSENGER_DESTROYED |
| AzureIoTClient | 39:e98d5df6dc74 | 45 | |
| AzureIoTClient | 39:e98d5df6dc74 | 46 | DEFINE_ENUM(AMQP_MESSENGER_REASON, AMQP_MESSENGER_REASON_VALUES); |
| AzureIoTClient | 39:e98d5df6dc74 | 47 | |
| AzureIoTClient | 39:e98d5df6dc74 | 48 | #define AMQP_MESSENGER_DISPOSITION_RESULT_VALUES \ |
| AzureIoTClient | 56:8704100b3b54 | 49 | AMQP_MESSENGER_DISPOSITION_RESULT_NONE, \ |
| AzureIoTClient | 56:8704100b3b54 | 50 | AMQP_MESSENGER_DISPOSITION_RESULT_ACCEPTED, \ |
| AzureIoTClient | 56:8704100b3b54 | 51 | AMQP_MESSENGER_DISPOSITION_RESULT_REJECTED, \ |
| AzureIoTClient | 56:8704100b3b54 | 52 | AMQP_MESSENGER_DISPOSITION_RESULT_RELEASED |
| AzureIoTClient | 39:e98d5df6dc74 | 53 | |
| AzureIoTClient | 39:e98d5df6dc74 | 54 | DEFINE_ENUM(AMQP_MESSENGER_DISPOSITION_RESULT, AMQP_MESSENGER_DISPOSITION_RESULT_VALUES); |
| AzureIoTClient | 39:e98d5df6dc74 | 55 | |
| AzureIoTClient | 39:e98d5df6dc74 | 56 | #define AMQP_MESSENGER_STATE_VALUES \ |
| AzureIoTClient | 56:8704100b3b54 | 57 | AMQP_MESSENGER_STATE_STARTING, \ |
| AzureIoTClient | 56:8704100b3b54 | 58 | AMQP_MESSENGER_STATE_STARTED, \ |
| AzureIoTClient | 56:8704100b3b54 | 59 | AMQP_MESSENGER_STATE_STOPPING, \ |
| AzureIoTClient | 56:8704100b3b54 | 60 | AMQP_MESSENGER_STATE_STOPPED, \ |
| AzureIoTClient | 56:8704100b3b54 | 61 | AMQP_MESSENGER_STATE_ERROR |
| AzureIoTClient | 39:e98d5df6dc74 | 62 | |
| AzureIoTClient | 39:e98d5df6dc74 | 63 | DEFINE_ENUM(AMQP_MESSENGER_STATE, AMQP_MESSENGER_STATE_VALUES); |
| AzureIoTClient | 39:e98d5df6dc74 | 64 | |
| AzureIoTClient | 39:e98d5df6dc74 | 65 | typedef struct AMQP_MESSENGER_MESSAGE_DISPOSITION_INFO_TAG |
| AzureIoTClient | 39:e98d5df6dc74 | 66 | { |
| AzureIoTClient | 56:8704100b3b54 | 67 | delivery_number message_id; |
| AzureIoTClient | 56:8704100b3b54 | 68 | char* source; |
| AzureIoTClient | 39:e98d5df6dc74 | 69 | } AMQP_MESSENGER_MESSAGE_DISPOSITION_INFO; |
| AzureIoTClient | 39:e98d5df6dc74 | 70 | |
| AzureIoTClient | 39:e98d5df6dc74 | 71 | typedef void(*AMQP_MESSENGER_SEND_COMPLETE_CALLBACK)(AMQP_MESSENGER_SEND_RESULT result, AMQP_MESSENGER_REASON reason, void* context); |
| AzureIoTClient | 39:e98d5df6dc74 | 72 | typedef void(*AMQP_MESSENGER_STATE_CHANGED_CALLBACK)(void* context, AMQP_MESSENGER_STATE previous_state, AMQP_MESSENGER_STATE new_state); |
| AzureIoTClient | 39:e98d5df6dc74 | 73 | typedef void(*AMQP_MESSENGER_SUBSCRIPTION_CALLBACK)(void* context, bool is_subscribed); |
| AzureIoTClient | 39:e98d5df6dc74 | 74 | typedef AMQP_MESSENGER_DISPOSITION_RESULT(*ON_AMQP_MESSENGER_MESSAGE_RECEIVED)(MESSAGE_HANDLE message, AMQP_MESSENGER_MESSAGE_DISPOSITION_INFO* disposition_info, void* context); |
| AzureIoTClient | 39:e98d5df6dc74 | 75 | |
| AzureIoTClient | 39:e98d5df6dc74 | 76 | typedef struct AMQP_MESSENGER_LINK_CONFIG_TAG |
| AzureIoTClient | 39:e98d5df6dc74 | 77 | { |
| AzureIoTClient | 56:8704100b3b54 | 78 | /** |
| AzureIoTClient | 56:8704100b3b54 | 79 | * @brief Sample format: "/messages/devicebound" |
| AzureIoTClient | 56:8704100b3b54 | 80 | */ |
| AzureIoTClient | 56:8704100b3b54 | 81 | char* source_suffix; |
| AzureIoTClient | 39:e98d5df6dc74 | 82 | |
| AzureIoTClient | 56:8704100b3b54 | 83 | /** |
| AzureIoTClient | 56:8704100b3b54 | 84 | * @brief Sample format: "/messages/events" |
| AzureIoTClient | 56:8704100b3b54 | 85 | */ |
| AzureIoTClient | 56:8704100b3b54 | 86 | char* target_suffix; |
| AzureIoTClient | 56:8704100b3b54 | 87 | |
| AzureIoTClient | 56:8704100b3b54 | 88 | receiver_settle_mode rcv_settle_mode; |
| AzureIoTClient | 56:8704100b3b54 | 89 | sender_settle_mode snd_settle_mode; |
| AzureIoTClient | 56:8704100b3b54 | 90 | |
| AzureIoTClient | 56:8704100b3b54 | 91 | MAP_HANDLE attach_properties; |
| AzureIoTClient | 39:e98d5df6dc74 | 92 | } AMQP_MESSENGER_LINK_CONFIG; |
| AzureIoTClient | 39:e98d5df6dc74 | 93 | |
| AzureIoTClient | 39:e98d5df6dc74 | 94 | typedef struct AMQP_MESSENGER_CONFIG_TAG |
| AzureIoTClient | 39:e98d5df6dc74 | 95 | { |
| AzureIoTClient | 56:8704100b3b54 | 96 | char* client_version; |
| AzureIoTClient | 56:8704100b3b54 | 97 | char* device_id; |
| AzureIoTClient | 56:8704100b3b54 | 98 | char* module_id; |
| AzureIoTClient | 56:8704100b3b54 | 99 | char* iothub_host_fqdn; |
| AzureIoTClient | 39:e98d5df6dc74 | 100 | |
| AzureIoTClient | 56:8704100b3b54 | 101 | AMQP_MESSENGER_LINK_CONFIG send_link; |
| AzureIoTClient | 56:8704100b3b54 | 102 | AMQP_MESSENGER_LINK_CONFIG receive_link; |
| AzureIoTClient | 39:e98d5df6dc74 | 103 | |
| AzureIoTClient | 56:8704100b3b54 | 104 | AMQP_MESSENGER_STATE_CHANGED_CALLBACK on_state_changed_callback; |
| AzureIoTClient | 56:8704100b3b54 | 105 | void* on_state_changed_context; |
| AzureIoTClient | 39:e98d5df6dc74 | 106 | |
| AzureIoTClient | 56:8704100b3b54 | 107 | AMQP_MESSENGER_SUBSCRIPTION_CALLBACK on_subscription_changed_callback; |
| AzureIoTClient | 56:8704100b3b54 | 108 | void* on_subscription_changed_context; |
| AzureIoTClient | 39:e98d5df6dc74 | 109 | } AMQP_MESSENGER_CONFIG; |
| AzureIoTClient | 39:e98d5df6dc74 | 110 | |
| AzureIoTClient | 39:e98d5df6dc74 | 111 | MOCKABLE_FUNCTION(, AMQP_MESSENGER_HANDLE, amqp_messenger_create, const AMQP_MESSENGER_CONFIG*, messenger_config); |
| AzureIoTClient | 39:e98d5df6dc74 | 112 | MOCKABLE_FUNCTION(, int, amqp_messenger_send_async, AMQP_MESSENGER_HANDLE, messenger_handle, MESSAGE_HANDLE, message, AMQP_MESSENGER_SEND_COMPLETE_CALLBACK, on_messenger_event_send_complete_callback, void*, context); |
| AzureIoTClient | 39:e98d5df6dc74 | 113 | MOCKABLE_FUNCTION(, int, amqp_messenger_subscribe_for_messages, AMQP_MESSENGER_HANDLE, messenger_handle, ON_AMQP_MESSENGER_MESSAGE_RECEIVED, on_message_received_callback, void*, context); |
| AzureIoTClient | 39:e98d5df6dc74 | 114 | MOCKABLE_FUNCTION(, int, amqp_messenger_unsubscribe_for_messages, AMQP_MESSENGER_HANDLE, messenger_handle); |
| AzureIoTClient | 39:e98d5df6dc74 | 115 | MOCKABLE_FUNCTION(, int, amqp_messenger_send_message_disposition, AMQP_MESSENGER_HANDLE, messenger_handle, AMQP_MESSENGER_MESSAGE_DISPOSITION_INFO*, disposition_info, AMQP_MESSENGER_DISPOSITION_RESULT, disposition_result); |
| AzureIoTClient | 39:e98d5df6dc74 | 116 | MOCKABLE_FUNCTION(, int, amqp_messenger_get_send_status, AMQP_MESSENGER_HANDLE, messenger_handle, AMQP_MESSENGER_SEND_STATUS*, send_status); |
| AzureIoTClient | 39:e98d5df6dc74 | 117 | MOCKABLE_FUNCTION(, int, amqp_messenger_start, AMQP_MESSENGER_HANDLE, messenger_handle, SESSION_HANDLE, session_handle); |
| AzureIoTClient | 39:e98d5df6dc74 | 118 | MOCKABLE_FUNCTION(, int, amqp_messenger_stop, AMQP_MESSENGER_HANDLE, messenger_handle); |
| AzureIoTClient | 39:e98d5df6dc74 | 119 | MOCKABLE_FUNCTION(, void, amqp_messenger_do_work, AMQP_MESSENGER_HANDLE, messenger_handle); |
| AzureIoTClient | 39:e98d5df6dc74 | 120 | MOCKABLE_FUNCTION(, void, amqp_messenger_destroy, AMQP_MESSENGER_HANDLE, messenger_handle); |
| AzureIoTClient | 39:e98d5df6dc74 | 121 | MOCKABLE_FUNCTION(, int, amqp_messenger_set_option, AMQP_MESSENGER_HANDLE, messenger_handle, const char*, name, void*, value); |
| AzureIoTClient | 39:e98d5df6dc74 | 122 | MOCKABLE_FUNCTION(, OPTIONHANDLER_HANDLE, amqp_messenger_retrieve_options, AMQP_MESSENGER_HANDLE, messenger_handle); |
| AzureIoTClient | 39:e98d5df6dc74 | 123 | MOCKABLE_FUNCTION(, void, amqp_messenger_destroy_disposition_info, AMQP_MESSENGER_MESSAGE_DISPOSITION_INFO*, disposition_info); |
| AzureIoTClient | 39:e98d5df6dc74 | 124 | |
| AzureIoTClient | 39:e98d5df6dc74 | 125 | |
| AzureIoTClient | 39:e98d5df6dc74 | 126 | #ifdef __cplusplus |
| AzureIoTClient | 39:e98d5df6dc74 | 127 | } |
| AzureIoTClient | 39:e98d5df6dc74 | 128 | #endif |
| AzureIoTClient | 39:e98d5df6dc74 | 129 | |
| AzureIoTClient | 39:e98d5df6dc74 | 130 | #endif /*IOTHUBTRANSPORT_AMQP_AMQP_MESSENGER*/ |
