cctools
address.h
1 #ifndef ADDRESS_H
2 #define ADDRESS_H
3 
4 #include <netinet/in.h>
5 #include <sys/socket.h>
6 #include <sys/types.h>
7 #include <netdb.h>
8 
9 #ifndef SOCKLEN_T
10 #if defined(__GLIBC__) || defined(CCTOOLS_OPSYS_DARWIN) || defined(__MUSL__)
11 #define SOCKLEN_T socklen_t
12 #else
13 #define SOCKLEN_T int
14 #endif
15 #endif
16 
17 #define IP_ADDRESS_MAX 48
18 
19 int address_to_sockaddr( const char *addr, int port, struct sockaddr_storage *s, SOCKLEN_T *length );
20 int address_from_sockaddr( char *str, struct sockaddr *saddr );
21 int address_parse_hostport( const char *hostport, char *host, int *port, int default_port );
22 int address_check_mode( struct addrinfo *info );
23 char *address_get_tlq_url( int port, const char *log_path );
24 
25 #endif