source: azure_iot_hub_f767zi/trunk/azure_iot_sdk/c-utility/inc/azure_c_shared_utility/optionhandler.h@ 457

Last change on this file since 457 was 457, checked in by coas-nagasima, 4 years ago

ファイルを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 2.1 KB
Line 
1// Copyright (c) Microsoft. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
4#ifndef OPTIONHANDLER_H
5#define OPTIONHANDLER_H
6
7#include "azure_macro_utils/macro_utils.h"
8#include "umock_c/umock_c_prod.h"
9
10#ifdef __cplusplus
11extern "C" {
12#endif /* __cplusplus */
13
14#define OPTIONHANDLER_RESULT_VALUES \
15 OPTIONHANDLER_OK, \
16 OPTIONHANDLER_ERROR, \
17 OPTIONHANDLER_INVALIDARG
18
19MU_DEFINE_ENUM_WITHOUT_INVALID(OPTIONHANDLER_RESULT, OPTIONHANDLER_RESULT_VALUES)
20
21typedef struct OPTIONHANDLER_HANDLE_DATA_TAG* OPTIONHANDLER_HANDLE;
22
23/*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)*/
24/*returns NULL if it failed to produce a clone, otherwise returns a non-NULL value*/
25/*to be implemented by every module*/
26typedef void* (*pfCloneOption)(const char* name, const void* value);
27
28/*the following function pointer points to a function that frees resources allocated for an option*/
29/*to be implemented by every module*/
30typedef void (*pfDestroyOption)(const char* name, const void* value);
31
32/*the following function pointer points to a function that sets an option for a module*/
33/*to be implemented by every module*/
34/*returns 0 if _SetOption succeeded, any other value is error, if the option is not intended for that module, returns 0*/
35typedef int (*pfSetOption)(void* handle, const char* name, const void* value);
36
37MOCKABLE_FUNCTION(, OPTIONHANDLER_HANDLE, OptionHandler_Create, pfCloneOption, cloneOption, pfDestroyOption, destroyOption, pfSetOption, setOption);
38MOCKABLE_FUNCTION(, OPTIONHANDLER_HANDLE, OptionHandler_Clone, OPTIONHANDLER_HANDLE, handler);
39MOCKABLE_FUNCTION(, OPTIONHANDLER_RESULT, OptionHandler_AddOption, OPTIONHANDLER_HANDLE, handle, const char*, name, const void*, value);
40MOCKABLE_FUNCTION(, OPTIONHANDLER_RESULT, OptionHandler_FeedOptions, OPTIONHANDLER_HANDLE, handle, void*, destinationHandle);
41MOCKABLE_FUNCTION(, void, OptionHandler_Destroy, OPTIONHANDLER_HANDLE, handle);
42
43#ifdef __cplusplus
44}
45#endif /* __cplusplus */
46
47#endif /*OPTIONHANDLER*/
Note: See TracBrowser for help on using the repository browser.