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.
Dependencies: EthernetInterface NTPClient iothub_amqp_transport iothub_client mbed-rtos mbed
Fork of iothub_client_sample_amqp by
frame_codec.h
00001 // Copyright (c) Microsoft. All rights reserved. 00002 // Licensed under the MIT license. See LICENSE file in the project root for full license information. 00003 00004 #ifndef FRAME_CODEC_H 00005 #define FRAME_CODEC_H 00006 00007 #include "azure_c_shared_utility/xio.h" 00008 #include "azure_uamqp_c/amqpvalue.h" 00009 00010 #ifdef __cplusplus 00011 extern "C" { 00012 #include <cstdint> 00013 #include <cstddef> 00014 #include <cstdbool> 00015 #else 00016 #include <stdint.h> 00017 #include <stddef.h> 00018 #include <stdbool.h> 00019 #endif /* __cplusplus */ 00020 00021 #include "azure_c_shared_utility/umock_c_prod.h" 00022 00023 typedef struct PAYLOAD_TAG 00024 { 00025 const unsigned char* bytes; 00026 size_t length; 00027 } PAYLOAD; 00028 00029 /* Codes_SRS_FRAME_CODEC_01_016: [The type code indicates the format and purpose of the frame.] */ 00030 /* Codes_SRS_FRAME_CODEC_01_017: [The subsequent bytes in the frame header MAY be interpreted differently depending on the type of the frame.] */ 00031 /* Codes_SRS_FRAME_CODEC_01_070: [The type code indicates the format and purpose of the frame.] */ 00032 /* Codes_SRS_FRAME_CODEC_01_071: [The subsequent bytes in the frame header MAY be interpreted differently depending on the type of the frame.] */ 00033 /* Codes_SRS_FRAME_CODEC_01_018: [A type code of 0x00 indicates that the frame is an AMQP frame.] */ 00034 /* Codes_SRS_FRAME_CODEC_01_072: [A type code of 0x00 indicates that the frame is an AMQP frame.] */ 00035 #define FRAME_TYPE_AMQP (uint8_t)0x00 00036 00037 /* Codes_SRS_FRAME_CODEC_01_073: [A type code of 0x01 indicates that the frame is a SASL frame] */ 00038 /* Codes_SRS_FRAME_CODEC_01_019: [A type code of 0x01 indicates that the frame is a SASL frame] */ 00039 #define FRAME_TYPE_SASL (uint8_t)0x01 00040 00041 typedef struct FRAME_CODEC_INSTANCE_TAG* FRAME_CODEC_HANDLE; 00042 typedef void(*ON_FRAME_RECEIVED)(void* context, const unsigned char* type_specific, uint32_t type_specific_size, const unsigned char* frame_body, uint32_t frame_body_size); 00043 typedef void(*ON_FRAME_CODEC_ERROR)(void* context); 00044 typedef void(*ON_BYTES_ENCODED)(void* context, const unsigned char* bytes, size_t length, bool encode_complete); 00045 00046 MOCKABLE_FUNCTION(, FRAME_CODEC_HANDLE, frame_codec_create, ON_FRAME_CODEC_ERROR, on_frame_codec_error, void*, callback_context); 00047 MOCKABLE_FUNCTION(, void, frame_codec_destroy, FRAME_CODEC_HANDLE, frame_codec); 00048 MOCKABLE_FUNCTION(, int, frame_codec_set_max_frame_size, FRAME_CODEC_HANDLE, frame_codec, uint32_t, max_frame_size); 00049 MOCKABLE_FUNCTION(, int, frame_codec_subscribe, FRAME_CODEC_HANDLE, frame_codec, uint8_t, type, ON_FRAME_RECEIVED, on_frame_received, void*, callback_context); 00050 MOCKABLE_FUNCTION(, int, frame_codec_unsubscribe, FRAME_CODEC_HANDLE, frame_codec, uint8_t, type); 00051 MOCKABLE_FUNCTION(, int, frame_codec_receive_bytes, FRAME_CODEC_HANDLE, frame_codec, const unsigned char*, buffer, size_t, size); 00052 MOCKABLE_FUNCTION(, int, frame_codec_encode_frame, FRAME_CODEC_HANDLE, frame_codec, uint8_t, type, const PAYLOAD*, payloads, size_t, payload_count, const unsigned char*, type_specific_bytes, uint32_t, type_specific_size, ON_BYTES_ENCODED, encoded_bytes, void*, callback_context); 00053 00054 #ifdef __cplusplus 00055 } 00056 #endif /* __cplusplus */ 00057 00058 #endif /* FRAME_CODEC_H */
Generated on Tue Jul 12 2022 12:43:19 by
