#ifndef MEMORYBLOCKNODEINTERNAL_H
#define MEMORYBLOCKNODEINTERNAL_H

#include "MemoryFactory.h"
#include "RawScan.h"

#ifdef __cplusplus
extern "C" {
#endif

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

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

		// Used for chaining memory block nodes.
		struct RawScan_MemoryBlockNodeStruct *pNext ;
	} RawScan_MemoryBlockNode ;

	NDTS_Boolean CALL_CONV RawScan_AllocMemoryBlockNodePool() ;
	NDTS_Boolean CALL_CONV RawScan_AllocMemoryBlockNode(unsigned long size, RawScan_MemoryBlockNode **ppMemoryBlockNode) ;
	NDTS_Boolean CALL_CONV RawScan_FreeMemoryBlockNode(RawScan_MemoryBlockNode *pMemoryBlockNode) ;
	NDTS_Boolean CALL_CONV RawScan_GetMemoryBlockNodeTail(RawScan_MemoryBlockNode *pMemoryBlockNode, RawScan_MemoryBlockNode **ppLast) ;
	NDTS_Boolean CALL_CONV RawScan_JoinMemoryBlockNodes(RawScan_MemoryBlockNode *pLHS, RawScan_MemoryBlockNode *pRHS) ;
	RAW_SCAN_API NDTS_Boolean CALL_CONV RawScan_GetMemoryBlockList(RawScan_MemoryBlockNode *pMemoryBlockNode, RawScan_MemoryHandle **ppList) ;

#ifdef __cplusplus
}
#endif


#endif