#ifndef RQMEMORYBLOCKNODEINTERNAL_H
#define RQMEMORYBLOCKNODEINTERNAL_H

#include "RQMemoryFactoryInternal.h"

#ifdef __cplusplus
extern "C" {
#endif

	typedef struct
	{
		unsigned char *	p ;
		int				owner ;
#ifdef _DEBUG
		// Is 0 is owner is 0.
		int				size ;
#endif
	} RQ_MemoryHandle ;

	typedef struct RQ_MemoryBlockNodeStruct
	{
		// Points to the memory block list.
		RQ_MemoryHandle *pList ;
		unsigned long size ;

		// Used for chaining memory block nodes.
		struct RQ_MemoryBlockNodeStruct *pNext ;
	} RQ_MemoryBlockNode ;

	NDTS_Boolean CALL_CONV RQ_AllocMemoryBlockNodePool() ;
	NDTS_Boolean CALL_CONV RQ_AllocMemoryBlockNode(unsigned long size, RQ_MemoryBlockNode **ppMemoryBlockNode) ;
	NDTS_Boolean CALL_CONV RQ_FreeMemoryBlockNode(RQ_MemoryBlockNode *pMemoryBlockNode) ;
	NDTS_Boolean CALL_CONV RQ_GetMemoryBlockNodeTail(RQ_MemoryBlockNode *pMemoryBlockNode, RQ_MemoryBlockNode **ppLast) ;
	NDTS_Boolean CALL_CONV RQ_JoinMemoryBlockNodes(RQ_MemoryBlockNode *pLHS, RQ_MemoryBlockNode *pRHS) ;
	NDTS_Boolean CALL_CONV RQ_GetMemoryBlockList(RQ_MemoryBlockNode *pMemoryBlockNode, RQ_MemoryHandle **ppList) ;

#ifdef __cplusplus
}
#endif


#endif