I am working on a C / C ++ network project so that it can use the IPv4 and IPv6 network stacks. The project only works on Linux. So, I tried to find an efficient way to store IP addresses and distinguish between protocol families. The first approach was to combine:
struct ip_addr { uint8_t fam;
The second approach was to define a typedef std::vector<unsigned char> IPAddressNumber and change the value after the number of bytes from the vector.
The third approach was to use int128_t / uint128_t or __int128_t from gcc.
In this latter case, I would like to know from which version of GCC these types are supported, for which platforms (especially IA-32 / IA-64), and also if there are any known errors. In addition, which of the above solutions may be the most convenient?
c ++ gcc ipv4 ipv6 int128
evelina
source share