A small memory footprint AMQP implimentation
Dependents: iothub_client_sample_amqp remote_monitoring simplesample_amqp
sasl_mssbcbs.c@0:6ae2f7bca550, 2016-04-08 (annotated)
- Committer:
- Azure.IoT Build
- Date:
- Fri Apr 08 12:01:10 2016 -0700
- Revision:
- 0:6ae2f7bca550
- Child:
- 6:641a9672db08
1.0.4
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 | #ifdef _CRTDBG_MAP_ALLOC |
Azure.IoT Build | 0:6ae2f7bca550 | 6 | #include <crtdbg.h> |
Azure.IoT Build | 0:6ae2f7bca550 | 7 | #endif |
Azure.IoT Build | 0:6ae2f7bca550 | 8 | #include <string.h> |
Azure.IoT Build | 0:6ae2f7bca550 | 9 | #include "azure_uamqp_c/sasl_mssbcbs.h" |
Azure.IoT Build | 0:6ae2f7bca550 | 10 | #include "azure_uamqp_c/amqpalloc.h" |
Azure.IoT Build | 0:6ae2f7bca550 | 11 | |
Azure.IoT Build | 0:6ae2f7bca550 | 12 | typedef struct SASL_MSSBCBS_INSTANCE_TAG |
Azure.IoT Build | 0:6ae2f7bca550 | 13 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 14 | unsigned char dummy : 1; |
Azure.IoT Build | 0:6ae2f7bca550 | 15 | } SASL_MSSBCBS_INSTANCE; |
Azure.IoT Build | 0:6ae2f7bca550 | 16 | |
Azure.IoT Build | 0:6ae2f7bca550 | 17 | static const SASL_MECHANISM_INTERFACE_DESCRIPTION saslmssbcbs_interface = |
Azure.IoT Build | 0:6ae2f7bca550 | 18 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 19 | saslmssbcbs_create, |
Azure.IoT Build | 0:6ae2f7bca550 | 20 | saslmssbcbs_destroy, |
Azure.IoT Build | 0:6ae2f7bca550 | 21 | saslmssbcbs_get_init_bytes, |
Azure.IoT Build | 0:6ae2f7bca550 | 22 | saslmssbcbs_get_mechanism_name, |
Azure.IoT Build | 0:6ae2f7bca550 | 23 | saslmssbcbs_challenge |
Azure.IoT Build | 0:6ae2f7bca550 | 24 | }; |
Azure.IoT Build | 0:6ae2f7bca550 | 25 | |
Azure.IoT Build | 0:6ae2f7bca550 | 26 | CONCRETE_SASL_MECHANISM_HANDLE saslmssbcbs_create(void* config) |
Azure.IoT Build | 0:6ae2f7bca550 | 27 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 28 | return amqpalloc_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 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 35 | amqpalloc_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 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 45 | result = __LINE__; |
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 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 76 | return 0; |
Azure.IoT Build | 0:6ae2f7bca550 | 77 | } |
Azure.IoT Build | 0:6ae2f7bca550 | 78 | |
Azure.IoT Build | 0:6ae2f7bca550 | 79 | const SASL_MECHANISM_INTERFACE_DESCRIPTION* saslmssbcbs_get_interface(void) |
Azure.IoT Build | 0:6ae2f7bca550 | 80 | { |
Azure.IoT Build | 0:6ae2f7bca550 | 81 | return &saslmssbcbs_interface; |
Azure.IoT Build | 0:6ae2f7bca550 | 82 | } |