static void ProcessPacketsBuffer(TC_PACKETS_BUFFER hPacketsBuffer, dispatcher dispfunc, int fd) { PVOID pData; TC_PACKET_HEADER header; TC_STATUS status; do { status = TcPacketsBufferQueryNextPacket(hPacketsBuffer, &header, &pData); if (status != TC_SUCCESS) break; /* 调用分发器 */ dispfunc(pData, header.Length, fd); }while(TRUE); }
void ProcessPacketsBuffer(TC_PACKETS_BUFFER hPacketsBuffer, dispatcher dispfunc, int fd) { PVOID pData; TC_PACKET_HEADER header; TC_STATUS status; do { status = TcPacketsBufferQueryNextPacket(hPacketsBuffer, &header, &pData); if (status != TC_SUCCESS) break; /* 调用分发器 */ struct timeval tm; gettimeofday(&tm, NULL); dispfunc(pData, header.Length, fd, &tm); }while(TRUE); }
static void ProcessPacketsBuffer(TC_PACKETS_BUFFER hPacketsBuffer, dispatcher dispfunc) { PVOID pData; TC_PACKET_HEADER header; TC_STATUS status; raw_packet_t rpkt; do { status = TcPacketsBufferQueryNextPacket(hPacketsBuffer, &header, &pData); if (status != TC_SUCCESS) break; // 封装成自己的格式 rpkt.len = header.Length; rpkt.pkt = pData; /* FIXME 临时测试用*/ // PrintPacket(pData, &header); /* 调用分发器 */ dispfunc(&rpkt); }while(TRUE); }