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
optionhandler.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 OPTIONHANDLER_H 00005 #define OPTIONHANDLER_H 00006 00007 #include "azure_c_shared_utility/macro_utils.h" 00008 00009 #define OPTIONHANDLER_RESULT_VALUES \ 00010 OPTIONHANDLER_OK, \ 00011 OPTIONHANDLER_ERROR, \ 00012 OPTIONHANDLER_INVALIDARG 00013 00014 DEFINE_ENUM(OPTIONHANDLER_RESULT, OPTIONHANDLER_RESULT_VALUES) 00015 00016 #ifdef __cplusplus 00017 extern "C" { 00018 #endif /* __cplusplus */ 00019 00020 #include "azure_c_shared_utility/umock_c_prod.h" 00021 00022 typedef struct OPTIONHANDLER_HANDLE_DATA_TAG* OPTIONHANDLER_HANDLE; 00023 00024 /*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)*/ 00025 /*returns NULL if it failed to produce a clone, otherwise returns a non-NULL value*/ 00026 /*to be implemented by every module*/ 00027 typedef void* (*pfCloneOption)(const char* name, const void* value); 00028 00029 /*the following function pointer points to a function that frees resources allocated for an option*/ 00030 /*to be implemented by every module*/ 00031 typedef void (*pfDestroyOption)(const char* name, const void* value); 00032 00033 /*the following function pointer points to a function that sets an option for a module*/ 00034 /*to be implemented by every module*/ 00035 /*returns 0 if _SetOption succeeded, any other value is error, if the option is not intended for that module, returns 0*/ 00036 typedef int (*pfSetOption)(void* handle, const char* name, const void* value); 00037 00038 MOCKABLE_FUNCTION(, OPTIONHANDLER_HANDLE, OptionHandler_Create, pfCloneOption, cloneOption, pfDestroyOption, destroyOption, pfSetOption, setOption); 00039 MOCKABLE_FUNCTION(, OPTIONHANDLER_HANDLE, OptionHandler_Clone, OPTIONHANDLER_HANDLE, handler); 00040 MOCKABLE_FUNCTION(, OPTIONHANDLER_RESULT, OptionHandler_AddOption, OPTIONHANDLER_HANDLE, handle, const char*, name, const void*, value); 00041 MOCKABLE_FUNCTION(, OPTIONHANDLER_RESULT, OptionHandler_FeedOptions, OPTIONHANDLER_HANDLE, handle, void*, destinationHandle); 00042 MOCKABLE_FUNCTION(, void, OptionHandler_Destroy, OPTIONHANDLER_HANDLE, handle); 00043 00044 #ifdef __cplusplus 00045 } 00046 #endif /* __cplusplus */ 00047 00048 #endif /*OPTIONHANDLER*/
Generated on Tue Jul 12 2022 19:14:38 by
