/* $Id: addr_is_reserved.c,v 1.4 2021/03/02 23:40:32 nanard Exp $ */ /* vim: tabstop=4 shiftwidth=4 noexpandtab * Project : miniupnp * Web : http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/ * Author : Thomas BERNARD * copyright (c) 2005-2024 Thomas Bernard * This software is subjet to the conditions detailed in the * provided LICENSE file. */ #ifdef _WIN32 /* Win32 Specific includes and defines */ #include <winsock2.h> #include <ws2tcpip.h> #if !defined(_MSC_VER) #include <stdint.h> #else /* !defined(_MSC_VER) */ typedef unsigned long uint32_t; #endif /* !defined(_MSC_VER) */ #else /* _WIN32 */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #endif /* _WIN32 */ #ifdef DEBUG #include <stdio.h> #endif /* List of IP address blocks which are private / reserved and therefore not suitable for public external IP addresses */ #define IP … #define MSK … static const struct { … } reserved[] = …; #undef IP #undef MSK /** * @return 1 or 0 */ int addr_is_reserved(const char * addr_str) { … }