source: azure_iot_hub/trunk/azure_iohub/c-utility/inc/azure_c_shared_utility/optionhandler.h@ 388

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

Azure IoT Hub Device C SDK を使ったサンプルの追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-chdr
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_c_shared_utility/macro_utils.h"
8
9#define OPTIONHANDLER_RESULT_VALUES \
10OPTIONHANDLER_OK, \
11OPTIONHANDLER_ERROR, \
12OPTIONHANDLER_INVALIDARG
13
14MU_DEFINE_ENUM(OPTIONHANDLER_RESULT, OPTIONHANDLER_RESULT_VALUES)
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20#include "azure_c_shared_utility/umock_c_prod.h"
21
22typedef struct OPTIONHANDLER_HANDLE_DATA_TAG* OPTIONHANDLER_HANDLE;
23
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)*/
25/*returns NULL if it failed to produce a clone, otherwise returns a non-NULL value*/
26/*to be implemented by every module*/
27typedef void* (*pfCloneOption)(const char* name, const void* value);
28
29/*the following function pointer points to a function that frees resources allocated for an option*/
30/*to be implemented by every module*/
31typedef void (*pfDestroyOption)(const char* name, const void* value);
32
33/*the following function pointer points to a function that sets an option for a module*/
34/*to be implemented by every module*/
35/*returns 0 if _SetOption succeeded, any other value is error, if the option is not intended for that module, returns 0*/
36typedef int (*pfSetOption)(void* handle, const char* name, const void* value);
37
38MOCKABLE_FUNCTION(, OPTIONHANDLER_HANDLE, OptionHandler_Create, pfCloneOption, cloneOption, pfDestroyOption, destroyOption, pfSetOption, setOption);
39MOCKABLE_FUNCTION(, OPTIONHANDLER_HANDLE, OptionHandler_Clone, OPTIONHANDLER_HANDLE, handler);
40MOCKABLE_FUNCTION(, OPTIONHANDLER_RESULT, OptionHandler_AddOption, OPTIONHANDLER_HANDLE, handle, const char*, name, const void*, value);
41MOCKABLE_FUNCTION(, OPTIONHANDLER_RESULT, OptionHandler_FeedOptions, OPTIONHANDLER_HANDLE, handle, void*, destinationHandle);
42MOCKABLE_FUNCTION(, void, OptionHandler_Destroy, OPTIONHANDLER_HANDLE, handle);
43
44#ifdef __cplusplus
45}
46#endif /* __cplusplus */
47
48#endif /*OPTIONHANDLER*/
Note: See TracBrowser for help on using the repository browser.