A small memory footprint AMQP implimentation
Dependents: iothub_client_sample_amqp remote_monitoring simplesample_amqp
sasl_mssbcbs.c@27:d74f1cea23e1, 2017-06-02 (annotated)
- Committer:
- AzureIoTClient
- Date:
- Fri Jun 02 15:53:07 2017 -0700
- Revision:
- 27:d74f1cea23e1
- Parent:
- 21:f9c433d8e6ca
- Child:
- 28:add19eb7defa
1.1.16
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Azure.IoT Build | 0:6ae2f7bca550 | 1 | // Copyright (c) Microsoft. All rights reserved. |
Azure.IoT Build | 0:6ae2f7bca550 | 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
Azure.IoT Build | 0:6ae2f7bca550 | 3 | |
Azure.IoT Build | 0:6ae2f7bca550 | 4 | #include <stdlib.h> |
Azure.IoT Build | 0:6ae2f7bca550 | 5 | #include <string.h> |
AzureIoTClient | 19:000ab4e6a2c1 | 6 | #include "azure_c_shared_utility/optimize_size.h" |
AzureIoTClient | 21:f9c433d8e6ca | 7 | #include "azure_c_shared_utility/gballoc.h" |
AzureIoTClient | 27:d74f1cea23e1 | 8 | #include "azure_c_shared_utility/xlogging.h" |
Azure.IoT Build | 0:6ae2f7bca550 | 9 | #include "azure_uamqp_c/sasl_mssbcbs.h" |
Azure.IoT Build | 0:6ae2f7bca550 | 10 | |
Azure.IoT Build | 0:6ae2f7bca550 | 11 | typedef struct SASL_MSSBCBS_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 12 | { |
AzureIoTClient | 6:641a9672db08 | 13 | unsigned char dummy; |
Azure.IoT Build | 0:6ae2f7bca550 | 14 | } SASL_MSSBCBS_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 15 | |
Azure.IoT Build | 0:6ae2f7bca550 | 16 | static const SASL_MECHANISM_INTERFACE_DESCRIPTION saslmssbcbs_interface = |
Azure.IoT Build | 0:6ae2f7bca550 | 17 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 18 | saslmssbcbs_create, |
Azure.IoT Build | 0:6ae2f7bca550 | 19 | saslmssbcbs_destroy, |
Azure.IoT Build | 0:6ae2f7bca550 | 20 | saslmssbcbs_get_init_bytes, |
Azure.IoT Build | 0:6ae2f7bca550 | 21 | saslmssbcbs_get_mechanism_name, |
Azure.IoT Build | 0:6ae2f7bca550 | 22 | saslmssbcbs_challenge |
Azure.IoT Build | 0:6ae2f7bca550 | 23 | }; |
Azure.IoT Build | 0:6ae2f7bca550 | 24 | |
Azure.IoT Build | 0:6ae2f7bca550 | 25 | CONCRETE_SASL_MECHANISM_HANDLE saslmssbcbs_create(void* config) |
Azure.IoT Build | 0:6ae2f7bca550 | 26 | { |
AzureIoTClient | 6:641a9672db08 | 27 | (void)config; |
AzureIoTClient | 21:f9c433d8e6ca | 28 | return malloc(sizeof(SASL_MSSBCBS_INSTANCE)); |
Azure.IoT Build | 0:6ae2f7bca550 | 29 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 30 | |
Azure.IoT Build | 0:6ae2f7bca550 | 31 | void saslmssbcbs_destroy(CONCRETE_SASL_MECHANISM_HANDLE sasl_mechanism_concrete_handle) |
Azure.IoT Build | 0:6ae2f7bca550 | 32 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 33 | if (sasl_mechanism_concrete_handle != NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 34 | { |
AzureIoTClient | 21:f9c433d8e6ca | 35 | free(sasl_mechanism_concrete_handle); |
Azure.IoT Build | 0:6ae2f7bca550 | 36 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 37 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 38 | |
Azure.IoT Build | 0:6ae2f7bca550 | 39 | int saslmssbcbs_get_init_bytes(CONCRETE_SASL_MECHANISM_HANDLE sasl_mechanism_concrete_handle, SASL_MECHANISM_BYTES* init_bytes) |
Azure.IoT Build | 0:6ae2f7bca550 | 40 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 41 | int result; |
Azure.IoT Build | 0:6ae2f7bca550 | 42 | |
Azure.IoT Build | 0:6ae2f7bca550 | 43 | if (sasl_mechanism_concrete_handle == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 44 | { |
AzureIoTClient | 19:000ab4e6a2c1 | 45 | result = __FAILURE__; |
Azure.IoT Build | 0:6ae2f7bca550 | 46 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 47 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 48 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 49 | init_bytes->bytes = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 50 | init_bytes->length = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 51 | |
Azure.IoT Build | 0:6ae2f7bca550 | 52 | result = 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 53 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 54 | |
Azure.IoT Build | 0:6ae2f7bca550 | 55 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 56 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 57 | |
Azure.IoT Build | 0:6ae2f7bca550 | 58 | const char* saslmssbcbs_get_mechanism_name(CONCRETE_SASL_MECHANISM_HANDLE sasl_mechanism) |
Azure.IoT Build | 0:6ae2f7bca550 | 59 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 60 | const char* result; |
Azure.IoT Build | 0:6ae2f7bca550 | 61 | |
Azure.IoT Build | 0:6ae2f7bca550 | 62 | if (sasl_mechanism == NULL) |
Azure.IoT Build | 0:6ae2f7bca550 | 63 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 64 | result = NULL; |
Azure.IoT Build | 0:6ae2f7bca550 | 65 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 66 | else |
Azure.IoT Build | 0:6ae2f7bca550 | 67 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 68 | result = "MSSBCBS"; |
Azure.IoT Build | 0:6ae2f7bca550 | 69 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 70 | |
Azure.IoT Build | 0:6ae2f7bca550 | 71 | return result; |
Azure.IoT Build | 0:6ae2f7bca550 | 72 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 73 | |
Azure.IoT Build | 0:6ae2f7bca550 | 74 | int saslmssbcbs_challenge(CONCRETE_SASL_MECHANISM_HANDLE concrete_sasl_mechanism, const SASL_MECHANISM_BYTES* challenge_bytes, SASL_MECHANISM_BYTES* response_bytes) |
Azure.IoT Build | 0:6ae2f7bca550 | 75 | { |
AzureIoTClient | 17:923575db8b2d | 76 | (void)concrete_sasl_mechanism; |
AzureIoTClient | 17:923575db8b2d | 77 | (void)challenge_bytes; |
AzureIoTClient | 17:923575db8b2d | 78 | (void)response_bytes; |
Azure.IoT Build | 0:6ae2f7bca550 | 79 | return 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 80 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 81 | |
Azure.IoT Build | 0:6ae2f7bca550 | 82 | const SASL_MECHANISM_INTERFACE_DESCRIPTION* saslmssbcbs_get_interface(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 83 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 84 | return &saslmssbcbs_interface; |
Azure.IoT Build | 0:6ae2f7bca550 | 85 | } |