Appropriate data structure for a buffer of the packets
        Posted  
        
            by psihodelia
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by psihodelia
        
        
        
        Published on 2010-05-31T16:35:34Z
        Indexed on 
            2010/05/31
            16:42 UTC
        
        
        Read the original article
        Hit count: 268
        
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.
© Stack Overflow or respective owner