return val;
}
+
+bool uh_addr_rfc1918(struct uh_addr *addr)
+{
+ uint32_t a;
+
+ if (addr->family != AF_INET)
+ return false;
+
+ a = htonl(addr->in.s_addr);
+ return ((a >= 0x0A000000) && (a <= 0x0AFFFFFF)) ||
+ ((a >= 0xAC100000) && (a <= 0xAC1FFFFF)) ||
+ ((a >= 0xC0A80000) && (a <= 0xC0A8FFFF));
+
+ return 0;
+}
#include <stdlib.h>
#include <unistd.h>
+struct uh_addr {
+ uint8_t family;
+ uint16_t port;
+ union {
+ struct in_addr in;
+ struct in6_addr in6;
+ };
+};
+
#define min(x, y) (((x) < (y)) ? (x) : (y))
#define max(x, y) (((x) > (y)) ? (x) : (y))
int uh_b64decode(char *buf, int blen, const void *src, int slen);
bool uh_path_match(const char *prefix, const char *url);
char *uh_split_header(char *str);
+bool uh_addr_rfc1918(struct uh_addr *addr);
#endif