Files
wolfssl/doc/dox_comments/header_files-ja/memory.h

146 lines
8.0 KiB
C
Raw Normal View History

/*!
\ingroup Memory
\brief mallocWolfSSLが使用するように構成されているメモリ割り当て関数を呼び出しますWolfSSLはmalloc使WolfSSLメモリ抽象化レイヤを使用して変更できます - wolfssl_setAllocatorWOLFSSL_MALLOCはWOLFSSLによって直接呼び出されませんがMacro XMallocによって呼び出されますsize引数のみが存在しますwolfssl_static_memoryビルドを使用する場合は
\return pointer
\return error NULLが返されます
\param size
\param heap 使nullになることができます
_Example_
\code
int* tenInts = (int*)wolfSSL_Malloc(sizeof(int)*10);
\endcode
\sa wolfSSL_Free
\sa wolfSSL_Realloc
\sa wolfSSL_SetAllocators
\sa XMALLOC
\sa XFREE
\sa XREALLOC
*/
void* wolfSSL_Malloc(size_t size, void* heap, int type);
/*!
\ingroup Memory
\brief freeWolfSSLが使用するように構成されているメモリフリー機能を呼び出しますWolfSSLはfree使WolfSSLメモリ抽象化レイヤを使用して変更できます - wolfssl_setAllocatorWOLFSSL_FREEはWOLFSSLによって直接呼び出されませんがXFreeによって呼び出されますPTR引数のみが存在しますwolfssl_static_memoryビルドを使用する場合は
\return none
\param ptr
\param heap 使nullになることができます
_Example_
\code
int* tenInts = (int*)wolfSSL_Malloc(sizeof(int)*10);
// process data as desired
...
if(tenInts) {
wolfSSL_Free(tenInts);
}
\endcode
\sa wolfSSL_Alloc
\sa wolfSSL_Realloc
\sa wolfSSL_SetAllocators
\sa XMALLOC
\sa XFREE
\sa XREALLOC
*/
void wolfSSL_Free(void *ptr, void* heap, int type);
/*!
\ingroup Memory
\brief REALLOCWolfSSLが使用するように構成されているメモリ再割り当て機能を呼び出しますWolfSSLはRealLoc使WolfSSLメモリ抽象化レイヤを使用して変更できます - wolfssl_setAllocatorWOLFSSL_REALLOCはWOLFSSLによって直接呼び出されませんがXreallocによって呼び出されますsize引数のみが存在しますwolfssl_static_memoryビルドを使用する場合は
\return pointer PTRと同じポインタ
\return Null NULLが返されます
\param ptr
\param size
\param heap 使nullになることができます
_Example_
\code
int* tenInts = (int*)wolfSSL_Malloc(sizeof(int)*10);
int* twentyInts = (int*)wolfSSL_Realloc(tenInts, sizeof(int)*20);
\endcode
\sa wolfSSL_Free
\sa wolfSSL_Malloc
\sa wolfSSL_SetAllocators
\sa XMALLOC
\sa XFREE
\sa XREALLOC
*/
void* wolfSSL_Realloc(void *ptr, size_t size, void* heap, int type);
/*!
\ingroup Memory
\brief WolfSSLが使用する割り当て関数を登録しますMalloc / FreeとRealLocが使用されます使
\return Success 0
\return BAD_FUNC_ARG
\param malloc_function 使WolfSSLのメモリ割り当て機能関数署名はwolfssl_malloc_cbプロトタイプと一致する必要があります
\param free_function 使WolfSSLのメモリフリー機能関数シグネチャはwolfssl_free_cbプロトタイプと一致する必要があります
_Example_
\code
static void* MyMalloc(size_t size)
{
// custom malloc function
}
static void MyFree(void* ptr)
{
// custom free function
}
static void* MyRealloc(void* ptr, size_t size)
{
// custom realloc function
}
// Register custom memory functions with wolfSSL
int ret = wolfSSL_SetAllocators(MyMalloc, MyFree, MyRealloc);
if (ret != 0) {
// failed to set memory functions
}
\endcode
\sa none
*/
int wolfSSL_SetAllocators(wolfSSL_Malloc_cb,
wolfSSL_Free_cb,
wolfSSL_Realloc_cb);
/*!
\ingroup Memory
\brief 使--enable-staticMemory使使使
\return Success
\return Failure
\param buffer
\param size
_Example_
\code
byte buffer[1000];
word32 size = sizeof(buffer);
int optimum;
optimum = wolfSSL_StaticBufferSz(buffer, size, WOLFMEM_GENERAL);
if (optimum < 0) { //handle error case }
printf(The optimum buffer size to make use of all memory is %d\n,
optimum);
...
\endcode
\sa wolfSSL_Malloc
\sa wolfSSL_Free
*/
int wolfSSL_StaticBufferSz(byte* buffer, word32 sz, int flag);
/*!
\ingroup Memory
\brief 使--enable-staticMemory使
\return On
\return All
_Example_
\code
int padding;
padding = wolfSSL_MemoryPaddingSz();
if (padding < 0) { //handle error case }
printf(The padding size needed for each \bucket\ of memory is %d\n,
padding);
// calculation of buffer for IO POOL size is number of buckets
// times (padding + WOLFMEM_IO_SZ)
...
\endcode
\sa wolfSSL_Malloc
\sa wolfSSL_Free
*/
int wolfSSL_MemoryPaddingSz(void);