I want to create a data structure to efficiently store and retrieve IP packets. I need to use four tuple (IP addresses and port numbers) as a key for the data structure. I have searched and I found map data structure but it seems it cannot search on four tuple as a key, so I decide to serialize IP addresses and port numbers into a string or any other value then use it as a key for map data structure.
How can I use four tuple as a key in map data structure? If its better to change four tuple to single value what conversion is better? (I mean serialize into number or string or any other data type at the point of store and retrieve performance )
Assumption: IP addresses are unsigned int 32 bit values.