2021-03-04 14:30:38 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netdb.h>
|
|
|
|
|
|
|
|
char *strncasestr(const char *s,const char *find, size_t slen);
|
|
|
|
|
2021-03-05 21:02:34 +03:00
|
|
|
void ntop46(const struct sockaddr *sa, char *str, size_t len);
|
|
|
|
void ntop46_port(const struct sockaddr *sa, char *str, size_t len);
|
2021-03-04 14:30:38 +03:00
|
|
|
void print_sockaddr(const struct sockaddr *sa);
|
|
|
|
void print_addrinfo(const struct addrinfo *ai);
|
|
|
|
bool check_local_ip(const struct sockaddr *saddr);
|
|
|
|
|
|
|
|
bool saismapped(const struct sockaddr_in6 *sa);
|
|
|
|
bool samappedcmp(const struct sockaddr_in *sa1,const struct sockaddr_in6 *sa2);
|
|
|
|
bool sacmp(const struct sockaddr *sa1,const struct sockaddr *sa2);
|
|
|
|
uint16_t saport(const struct sockaddr *sa);
|
|
|
|
// true = was converted
|
|
|
|
bool saconvmapped(struct sockaddr_storage *a);
|
|
|
|
|
2021-03-19 11:33:42 +03:00
|
|
|
bool is_localnet(const struct sockaddr *a);
|
2021-03-05 21:02:34 +03:00
|
|
|
bool is_linklocal(const struct sockaddr_in6* a);
|
|
|
|
bool is_private6(const struct sockaddr_in6* a);
|
|
|
|
|
2021-03-04 14:30:38 +03:00
|
|
|
int set_keepalive(int fd);
|
|
|
|
int get_so_error(int fd);
|