1 /* 2 * dpmalloc.h - malloc/free interface between ufdbGuard API and Data-Path. 3 */ 4 5 /** 6 * @brief Wrapper function for memory allocation requests. 7 * @param[in] size number of byte the requested memory shall hold. 8 * @return Pointer to memory of at least size bytes or NULL for error or out-of-memory. 9 */ 10 typedef void *(*ufdb_malloc_t)( uint32_t size ); 11 12 /** 13 * @brief Wrapper function for requests to free allocated memory. 14 * @param[in] ptr pointer to the memory area that should be freed 15 */ 16 typedef void (*ufdb_free_t)( void * ptr ); 17 18 typedef struct ufdb_config_s { 19 ufdb_malloc_t ufdb_alloc; /*!< Function pointer to a memory allocation function, default: NULL. 20 Must be set by the application. */ 21 ufdb_free_t ufdb_free; /*!< Function pointer to a memory free function, default: NULL. 22 Must be set by the application. */ 23 } ufdb_config_t; 24 25 26 /** 27 * UFDBmallocInit() copies the function pointers and use those function pointers for 28 * doing malloc. The ufdbGuard API will use the function pointers for malloc/free. 29 * 30 * During application initialisation, the application initialises the ufdbGuard API library 31 * by first initializing the malloc/free interface with UFDBmallocInit() and second by calling 32 * UFDBapiInit(). See the ufdbGuard API Reference Manual for more information about UFDBapiInit(). 33 */ 34 void UFDBmallocInit( ufdb_config_t * config ); 35 36