// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. #ifndef CONSTBUFFER_H #define CONSTBUFFER_H #ifdef __cplusplus #include #else #include #include #endif #include "azure_c_shared_utility/buffer_.h" #include "umock_c/umock_c_prod.h" #ifdef __cplusplus extern "C" { #endif /*this is the handle*/ typedef struct CONSTBUFFER_HANDLE_DATA_TAG* CONSTBUFFER_HANDLE; /*this is what is returned when the content of the buffer needs access*/ typedef struct CONSTBUFFER_TAG { const unsigned char* buffer; size_t size; } CONSTBUFFER; typedef void(*CONSTBUFFER_CUSTOM_FREE_FUNC)(void* context); MOCKABLE_INTERFACE(constbuffer, /*this creates a new constbuffer from a memory area*/ FUNCTION(, CONSTBUFFER_HANDLE, CONSTBUFFER_Create, const unsigned char*, source, size_t, size), /*this creates a new constbuffer from an existing BUFFER_HANDLE*/ FUNCTION(, CONSTBUFFER_HANDLE, CONSTBUFFER_CreateFromBuffer, BUFFER_HANDLE, buffer), FUNCTION(, CONSTBUFFER_HANDLE, CONSTBUFFER_CreateWithMoveMemory, unsigned char*, source, size_t, size), FUNCTION(, CONSTBUFFER_HANDLE, CONSTBUFFER_CreateWithCustomFree, const unsigned char*, source, size_t, size, CONSTBUFFER_CUSTOM_FREE_FUNC, customFreeFunc, void*, customFreeFuncContext), FUNCTION(, CONSTBUFFER_HANDLE, CONSTBUFFER_CreateFromOffsetAndSize, CONSTBUFFER_HANDLE, handle, size_t, offset, size_t, size), FUNCTION(, void, CONSTBUFFER_IncRef, CONSTBUFFER_HANDLE, constbufferHandle), FUNCTION(, void, CONSTBUFFER_DecRef, CONSTBUFFER_HANDLE, constbufferHandle), FUNCTION(, const CONSTBUFFER*, CONSTBUFFER_GetContent, CONSTBUFFER_HANDLE, constbufferHandle), FUNCTION(, bool, CONSTBUFFER_HANDLE_contain_same, CONSTBUFFER_HANDLE, left, CONSTBUFFER_HANDLE, right) ) #ifdef __cplusplus } #endif #endif /* CONSTBUFFER_H */