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