#include <cafe.h>
#include <cafe/network.h>

typedef void * ( *SOResolverAlloc )( u32  size );
typedef void   ( *SOResolverFree  )( void *ptr );

int SOResolverRegisterAllocator( SOResolverAlloc alloc, SOResolverFree free );


alloc The function used when allocating resolver library work memory.
free The function used when freeing resolver library work memory.

Return Values

0 upon success, -1 on failure.


Registers the functions to allocate and deallocate the resolver library's work memory. Before this function is called, resolver library work memory is allocated from the default heap.

size is passed to SOResolverAlloc as the size of the work memory needed by the resolver library. SOResolverAlloc allocates that size of memory and sets it such that its initial address will be returned from calls. The initial address of the memory to be deallocated is passed in ptr to SOResolverFree. SOResolverFree returns 1 if memory deallocation succeeds or 0 if it fails.

The maximum amount of memory that the resolver library requires is the total size of the allocations needed to handle one request (6144 bytes) multiplied by the number of parallel requests the process makes. Note that the curl library may in the future make multiple, parallel requests to the resolver library if given multiple URLs to process, sufficient allocator space should be reserved now if the curl library is used in the fashion to ensure future compatibility.

Do Not Call From

Callbacks Do not call this function from any callback function.
Interrupt handler Do not call this function from any interrupt handler.
Exception handler Do not call this function from any exception handler.

Revision History

2013/05/08 Automated cleanup pass.
2013/04/19 Documented behavior of default allocator and sizes of objects.
2013/03/20 Corrected the return value of SOResolverFree from u8 to void.
2012/08/16 Cleanup pass.
2012/05/01 Initial version.