www.pudn.com > fifo.rar > fifo.h


//fifo.h 
#if ! defined (LINUX_WINDOWS_FIFO_H) 
#define LINUX_WINDOWS_FIFO_H  
 
// 
//datadispatch module  
// 
typedef void* DISP_HANDLE;  
 
#define MAX_OUTPUT_MODULE	4//modified from 3 to 4 by Eric  
 
typedef struct _DISP_OUPUT_CORE_ 
{	
	int bufsize;//beffer size
	char * buf;//buffer for store data
	char * pout;//output data point
	char * pin;//input data point
	DWORD discardBytes; 
	DWORD inputBytes; 
	DWORD outputBytes;
	pthread_mutex_t	mut;	//add by Eric 
}DISP_OUPUT_CORE;

typedef struct _DISP_OUTPUT_//output modules' dispatcher
{
	DISP_OUPUT_CORE dispcore[MAX_OUTPUT_MODULE];
	int dispindex;//index for the free dispcore[]
}DISP_OUTPUT; 
 
 
 
DISP_HANDLE dispInit(); 
int regOutputModule(DISP_HANDLE handle,DWORD fifoSize); 
int disregAllOutputModules(DISP_HANDLE handle); 
int datadispInput(DISP_HANDLE handle,const void *data, int datalen); 
int getdatadisp(DISP_HANDLE handle,int id,void *buf, int* pOutputlen,bool bForce); 
int getdatadispsize(DISP_HANDLE handle,int id); 
 
// 
//fifo module 
// 
//1. the fifo support mutiple threads to push in and one thread to pop up 
//2. the size of push in and pop up are equal 
//3. the size of packet pushed in can be different 
//4. pop up function will wait if fifo is null 
 
#endif//LINUX_WINDOWS_FIFO_H