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.
Fork of azure_c_shared_utility by
azure_c_shared_utility/optionhandler.h@7:1af47e3a19b6, 2016-07-29 (annotated)
- Committer:
- AzureIoTClient
- Date:
- Fri Jul 29 16:01:07 2016 -0700
- Revision:
- 7:1af47e3a19b6
- Child:
- 19:2e0811512ceb
1.0.10
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AzureIoTClient | 7:1af47e3a19b6 | 1 | // Copyright (c) Microsoft. All rights reserved. |
AzureIoTClient | 7:1af47e3a19b6 | 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
AzureIoTClient | 7:1af47e3a19b6 | 3 | |
AzureIoTClient | 7:1af47e3a19b6 | 4 | #ifndef OPTIONHANDLER_H |
AzureIoTClient | 7:1af47e3a19b6 | 5 | #define OPTIONHANDLER_H |
AzureIoTClient | 7:1af47e3a19b6 | 6 | |
AzureIoTClient | 7:1af47e3a19b6 | 7 | #include "azure_c_shared_utility/macro_utils.h" |
AzureIoTClient | 7:1af47e3a19b6 | 8 | |
AzureIoTClient | 7:1af47e3a19b6 | 9 | #define OPTIONHANDLER_RESULT_VALUES \ |
AzureIoTClient | 7:1af47e3a19b6 | 10 | OPTIONHANDLER_OK, \ |
AzureIoTClient | 7:1af47e3a19b6 | 11 | OPTIONHANDLER_ERROR, \ |
AzureIoTClient | 7:1af47e3a19b6 | 12 | OPTIONHANDLER_INVALIDARG |
AzureIoTClient | 7:1af47e3a19b6 | 13 | |
AzureIoTClient | 7:1af47e3a19b6 | 14 | DEFINE_ENUM(OPTIONHANDLER_RESULT, OPTIONHANDLER_RESULT_VALUES) |
AzureIoTClient | 7:1af47e3a19b6 | 15 | |
AzureIoTClient | 7:1af47e3a19b6 | 16 | #ifdef __cplusplus |
AzureIoTClient | 7:1af47e3a19b6 | 17 | extern "C" { |
AzureIoTClient | 7:1af47e3a19b6 | 18 | #endif /* __cplusplus */ |
AzureIoTClient | 7:1af47e3a19b6 | 19 | |
AzureIoTClient | 7:1af47e3a19b6 | 20 | #include "azure_c_shared_utility/umock_c_prod.h" |
AzureIoTClient | 7:1af47e3a19b6 | 21 | |
AzureIoTClient | 7:1af47e3a19b6 | 22 | typedef struct OPTIONHANDLER_HANDLE_DATA_TAG* OPTIONHANDLER_HANDLE; |
AzureIoTClient | 7:1af47e3a19b6 | 23 | |
AzureIoTClient | 7:1af47e3a19b6 | 24 | /*the following function pointer points to a function that produces a clone of the option specified by name and value (that is, a clone of void* value)*/ |
AzureIoTClient | 7:1af47e3a19b6 | 25 | /*returns NULL if it failed to produce a clone, otherwise returns a non-NULL value*/ |
AzureIoTClient | 7:1af47e3a19b6 | 26 | /*to be implemented by every module*/ |
AzureIoTClient | 7:1af47e3a19b6 | 27 | typedef void* (*pfCloneOption)(const char* name, const void* value); |
AzureIoTClient | 7:1af47e3a19b6 | 28 | |
AzureIoTClient | 7:1af47e3a19b6 | 29 | /*the following function pointer points to a function that frees resources allocated for an option*/ |
AzureIoTClient | 7:1af47e3a19b6 | 30 | /*to be implemented by every module*/ |
AzureIoTClient | 7:1af47e3a19b6 | 31 | typedef void (*pfDestroyOption)(const char* name, const void* value); |
AzureIoTClient | 7:1af47e3a19b6 | 32 | |
AzureIoTClient | 7:1af47e3a19b6 | 33 | /*the following function pointer points to a function that sets an option for a module*/ |
AzureIoTClient | 7:1af47e3a19b6 | 34 | /*to be implemented by every module*/ |
AzureIoTClient | 7:1af47e3a19b6 | 35 | /*returns 0 if _SetOption succeeded, any other value is error, if the option is not intended for that module, returns 0*/ |
AzureIoTClient | 7:1af47e3a19b6 | 36 | typedef int (*pfSetOption)(void* handle, const char* name, const void* value); |
AzureIoTClient | 7:1af47e3a19b6 | 37 | |
AzureIoTClient | 7:1af47e3a19b6 | 38 | MOCKABLE_FUNCTION(,OPTIONHANDLER_HANDLE, OptionHandler_Create, pfCloneOption, cloneOption, pfDestroyOption, destroyOption, pfSetOption, setOption); |
AzureIoTClient | 7:1af47e3a19b6 | 39 | MOCKABLE_FUNCTION(,OPTIONHANDLER_RESULT, OptionHandler_AddOption, OPTIONHANDLER_HANDLE, handle, const char*, name, const void*, value); |
AzureIoTClient | 7:1af47e3a19b6 | 40 | MOCKABLE_FUNCTION(,OPTIONHANDLER_RESULT, OptionHandler_FeedOptions, OPTIONHANDLER_HANDLE, handle, void*, destinationHandle); |
AzureIoTClient | 7:1af47e3a19b6 | 41 | MOCKABLE_FUNCTION(,void, OptionHandler_Destroy, OPTIONHANDLER_HANDLE, handle); |
AzureIoTClient | 7:1af47e3a19b6 | 42 | |
AzureIoTClient | 7:1af47e3a19b6 | 43 | #ifdef __cplusplus |
AzureIoTClient | 7:1af47e3a19b6 | 44 | } |
AzureIoTClient | 7:1af47e3a19b6 | 45 | #endif /* __cplusplus */ |
AzureIoTClient | 7:1af47e3a19b6 | 46 | |
AzureIoTClient | 7:1af47e3a19b6 | 47 | #endif /*OPTIONHANDLER*/ |