Appropriate data structure for a buffer of the packets
- by psihodelia
How to implement a buffer of the packets where each packet is of the form:
typedef struct{
int32 IP; //4-byte IP-address
int16 ID; //unique sequence id
}t_Packet;
What should be the most appropriate data structure which:
(1) allows to collect at least 8000 such packets (fast Insert and Delete operations)
(2) allows very fast filtering using IP address, so that only packets with given IP will be selected
(3) allows very fast find operation using ID as a key
(4) allows very fast (2), then (3) within filtered results ?
RAM size does matter, e.g. no huge lookup table is possible to use.