if (ipfixUdpIpv4Receiver->processorCount > 0) { PacketProcessor* pp = (PacketProcessor*)(ipfixUdpIpv4Receiver->packetProcessor); for (i = 0; i != ipfixUdpIpv4Receiver->processorCount; ++i) { if (pp[i].ipfixParser) pp[i].processPacketCallbackFunction(pp[i].ipfixParser, data, n); else error("No parser assigned"); } } else error("No packet processor assigned");
PacketProcessor* pp = (PacketProcessor*)(ipfixUdpIpv4Receiver->packetProcessor); for (i = 0; i != ipfixUdpIpv4Receiver->processorCount; ++i) pp[i].processPacketCallbackFunction(pp[i].ipfixParser, data, n);
static void* listenerUdpIpv4(void* ipfixUdpIpv4Receiver_) {	IpfixUdpIpv4Receiver* ipfixUdpIpv4Receiver = (IpfixUdpIpv4Receiver*)ipfixUdpIpv4Receiver_;		struct sockaddr_in clientAddress;	socklen_t clientAddressLen;	byte* data = (byte*)malloc(sizeof(byte)*MAX_MSG_LEN);	int n, i;		while(1) {			//static uint16_t packets = 0;		//if (packets++ >= 10000) break;				clientAddressLen = sizeof(struct sockaddr_in);		n = recvfrom(ipfixUdpIpv4Receiver->socket, data, MAX_MSG_LEN, 0, (struct sockaddr*)&clientAddress, &clientAddressLen);		if (n < 0) {			debug("recvfrom returned without data, terminating listener thread");			break;			}				pthread_mutex_lock(&ipfixUdpIpv4Receiver->mutex);		if (ipfixUdpIpv4Receiver->processorCount > 0) {			PacketProcessor* pp = (PacketProcessor*)(ipfixUdpIpv4Receiver->packetProcessor);			for (i = 0; i != ipfixUdpIpv4Receiver->processorCount; ++i) {				if (pp[i].ipfixParser)					pp[i].processPacketCallbackFunction(pp[i].ipfixParser, data, n);				else					error("No parser assigned");			}		}		else			error("No packet processor assigned");		pthread_mutex_unlock(&ipfixUdpIpv4Receiver->mutex);		}	free(data);	return 0;	}