linux - how to store and serach for an ipv4 ipaddress in c more efficiently -


I have a requirement, such that in C, an efficient data-structure IPv4 address should be taken as input and Store it, search it in. Datastrost stored on demand basis Can we convert the ipadress into string and store it in the data structure and check its existence? If so, how can we achieve it! Can you please give me your valuable information in order to proceed.

Thanks in advance.

If you need to store and search a whole lot of IP address, You may want to use.

I believe that the Linux kernel uses its own version of the Radix Tree Data Structure for code related to its IPs as routing tables, as you might want to look for it for ideas.

If you have some addresses or want to use a hash set to just a bit, use the hash set.

If this is for a real application and if you want to look forward, you should also include support for the IPv6 address. As time goes on to more computer systems, IPv6 addressing will be addressed as backup only with IPv4 NAT each year.

Comments