ROFL-pipeline  v0.6.0dev
Functions
memory.h File Reference

Defines the memory management interface used by the library. The user of the library MUST provide an implementation for his/her platform. More...

#include <stddef.h>
#include <stdlib.h>
#include "rofl.h"

Go to the source code of this file.

Functions

ROFL_BEGIN_DECLS void * platform_malloc (size_t length)
 Allocates a chunk of dynamic memory of size length. More...
 
void * platform_malloc_shared (size_t length)
 Allocates a chunk of dynamic memory of size length, which must be accessible (R/W) for all the threads/hw threads, cores... More...
 
void platform_free (void *data)
 Frees a chunk of dynamic memory previously allocated with platform_malloc(). More...
 
void platform_free_shared (void *data)
 Frees a chunk of dynamic memory previously allocated with platform_malloc_shared(). More...
 
void * platform_memcpy (void *dst, const void *src, size_t length)
 Copies a chunk of memory. More...
 
void * platform_memset (void *src, int c, size_t length)
 Sets 'c' to the whole chunk of memory. More...
 
void * platform_memmove (void *dst, const void *src, size_t length)
 Moves a chunk of memory from src to dst. More...
 

Detailed Description

Defines the memory management interface used by the library. The user of the library MUST provide an implementation for his/her platform.

Author
Marc Sune<marc.sune (at) bisdn.de>, Tobias Jungel<tobias.jungel (at) bisdn.de>

The memory management API is the set of calls used by library to perform dynamic memory allocation/deallocation, as well as other memory operations (like copy or move).

The user MUST provide an implementation for his/her particular platform.

The calls sufixed with "_shared" are meant to allocate memory that is shared between all the threads, hardware threads, cores or in general any system, that may perform operations (flow entry insertions, packet pipeline transvering...) over the SAME logical switch.

In a typical POSIX/libc system this would probably be directly malloc/free and the respective other calls, except maybe for the "_shared_" calls (depending on the threading/process used). E.g. in a single process application "_shared" and non-shared mallocs/free maps to the same LIBC malloc/free

Definition in file memory.h.