source: azure_iot_hub/trunk/azure_iohub/c-utility/inc/azure_c_shared_utility/constbuffer.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: 1.6 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 CONSTBUFFER_H
5#define CONSTBUFFER_H
6
7#include "azure_c_shared_utility/buffer_.h"
8
9#ifdef __cplusplus
10#include <cstddef>
11extern "C"
12{
13#else
14#include <stddef.h>
15#endif
16
17#include "azure_c_shared_utility/umock_c_prod.h"
18
19/*this is the handle*/
20typedef struct CONSTBUFFER_HANDLE_DATA_TAG* CONSTBUFFER_HANDLE;
21
22/*this is what is returned when the content of the buffer needs access*/
23typedef struct CONSTBUFFER_TAG
24{
25 const unsigned char* buffer;
26 size_t size;
27} CONSTBUFFER;
28
29typedef void(*CONSTBUFFER_CUSTOM_FREE_FUNC)(void* context);
30
31/*this creates a new constbuffer from a memory area*/
32MOCKABLE_FUNCTION(, CONSTBUFFER_HANDLE, CONSTBUFFER_Create, const unsigned char*, source, size_t, size);
33
34/*this creates a new constbuffer from an existing BUFFER_HANDLE*/
35MOCKABLE_FUNCTION(, CONSTBUFFER_HANDLE, CONSTBUFFER_CreateFromBuffer, BUFFER_HANDLE, buffer);
36
37MOCKABLE_FUNCTION(, CONSTBUFFER_HANDLE, CONSTBUFFER_CreateWithMoveMemory, unsigned char*, source, size_t, size);
38
39MOCKABLE_FUNCTION(, CONSTBUFFER_HANDLE, CONSTBUFFER_CreateWithCustomFree, const unsigned char*, source, size_t, size, CONSTBUFFER_CUSTOM_FREE_FUNC, customFreeFunc, void*, customFreeFuncContext);
40
41MOCKABLE_FUNCTION(, void, CONSTBUFFER_IncRef, CONSTBUFFER_HANDLE, constbufferHandle);
42
43MOCKABLE_FUNCTION(, void, CONSTBUFFER_DecRef, CONSTBUFFER_HANDLE, constbufferHandle);
44
45MOCKABLE_FUNCTION(, const CONSTBUFFER*, CONSTBUFFER_GetContent, CONSTBUFFER_HANDLE, constbufferHandle);
46
47#ifdef __cplusplus
48}
49#endif
50
51#endif /* CONSTBUFFER_H */
Note: See TracBrowser for help on using the repository browser.