00001 00009 #ifndef ___UBUFFER_H___ 00010 #define ___UBUFFER_H___ 00011 00012 00013 #ifdef __cplusplus 00014 extern "C"{ 00015 #endif 00016 /********************************************************************************************* 00017 * global referenced macro defines & type defines 00018 *********************************************************************************************/ 00019 00020 struct ubufm{ 00021 void *node_pool; /* data pool */ 00022 unsigned int node_size; /* data struct size */ 00023 unsigned int node_nums; /* ubuf(data) num */ 00024 void *freeList; /* free list, used by ubuf internal */ 00025 int lock; /* buffer lock */ 00026 }; 00027 00028 /********************************************************************************************* 00029 * global referenced variables 00030 *********************************************************************************************/ 00031 00032 /********************************************************************************************* 00033 * global function prototype 00034 *********************************************************************************************/ 00035 00037 int uBufInit(struct ubufm *dis); 00038 00040 void * uBufGet(struct ubufm *dis); 00041 00048 void * uBufGetCt(struct ubufm *dis); 00049 00051 int uBufPut(void *p, struct ubufm *dis); 00052 00059 int uBufPutCt(void *p, struct ubufm *dis); 00060 00062 void * uBufGetBufByIndex(unsigned int index, struct ubufm *dis); 00063 00065 int uBufGetIndex(void *p, struct ubufm *dis); 00066 00067 00068 #ifdef __cplusplus 00069 } 00070 #endif 00071 00072 #endif 00073