cnping

Minimal Graphical Ping Tool
git clone https://git.sinitax.com/cnlohr/cnping
Log | Files | Refs | Submodules | README | LICENSE | sfeed.txt

resolve.h (502B)


      1#ifndef _RESOLVE_H
      2#define _RESOLVE_H
      3
      4#ifdef WIN32
      5	typedef int socklen_t;
      6	struct sockaddr;
      7#else
      8	#include <sys/socket.h>
      9#endif
     10
     11// try to parse hostname
     12//  * as dot notation (1.1.1.1)
     13//  * as ipv6 notation (abcd:ef00::1)
     14//  * as hostname (resolve DNS)
     15// returns 1 on success
     16// family can be used to force ipv4 or ipv6. Use AF_UNSPEC (allow both), AF_INET or AF_INET6 to force ipv4 or ipv6
     17int resolveName(struct sockaddr* addr, socklen_t* addr_len, const char* hostname, int family);
     18
     19#endif