| 1 |
#ifndef HEADER_CURL_IF2IP_H |
| 2 |
#define HEADER_CURL_IF2IP_H |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
#include "curl_setup.h" |
| 27 |
|
| 28 |
|
| 29 |
#define IPV6_SCOPE_GLOBAL 0 |
| 30 |
#define IPV6_SCOPE_LINKLOCAL 1 |
| 31 |
#define IPV6_SCOPE_SITELOCAL 2 |
| 32 |
#define IPV6_SCOPE_UNIQUELOCAL 3 |
| 33 |
#define IPV6_SCOPE_NODELOCAL 4 |
| 34 |
|
| 35 |
#ifdef USE_IPV6 |
| 36 |
unsigned int Curl_ipv6_scope(const struct sockaddr *sa); |
| 37 |
#else |
| 38 |
#define Curl_ipv6_scope(x) 0 |
| 39 |
#endif |
| 40 |
|
| 41 |
typedef enum { |
| 42 |
IF2IP_NOT_FOUND = 0, |
| 43 |
IF2IP_AF_NOT_SUPPORTED = 1, |
| 44 |
IF2IP_FOUND = 2 |
| 45 |
} if2ip_result_t; |
| 46 |
|
| 47 |
if2ip_result_t Curl_if2ip(int af, |
| 48 |
#ifdef USE_IPV6 |
| 49 |
unsigned int remote_scope, |
| 50 |
unsigned int local_scope_id, |
| 51 |
#endif |
| 52 |
const char *interf, |
| 53 |
char *buf, size_t buf_size); |
| 54 |
|
| 55 |
#ifdef __INTERIX |
| 56 |
|
| 57 |
|
| 58 |
struct ifreq { |
| 59 |
#define IFNAMSIZ 16 |
| 60 |
#define IFHWADDRLEN 6 |
| 61 |
union { |
| 62 |
char ifrn_name[IFNAMSIZ]; |
| 63 |
} ifr_ifrn; |
| 64 |
|
| 65 |
union { |
| 66 |
struct sockaddr ifru_addr; |
| 67 |
struct sockaddr ifru_broadaddr; |
| 68 |
struct sockaddr ifru_netmask; |
| 69 |
struct sockaddr ifru_hwaddr; |
| 70 |
short ifru_flags; |
| 71 |
int ifru_metric; |
| 72 |
int ifru_mtu; |
| 73 |
} ifr_ifru; |
| 74 |
}; |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
#define ifr_name ifr_ifrn.ifrn_name |
| 80 |
#define ifr_addr ifr_ifru.ifru_addr |
| 81 |
#define ifr_broadaddr ifr_ifru.ifru_broadaddr |
| 82 |
#define ifr_netmask ifr_ifru.ifru_netmask |
| 83 |
#define ifr_flags ifr_ifru.ifru_flags |
| 84 |
#define ifr_hwaddr ifr_ifru.ifru_hwaddr |
| 85 |
#define ifr_metric ifr_ifru.ifru_metric |
| 86 |
#define ifr_mtu ifr_ifru.ifru_mtu |
| 87 |
|
| 88 |
#define SIOCGIFADDR _IOW('s', 102, struct ifreq) |
| 89 |
|
| 90 |
#endif |
| 91 |
|
| 92 |
#endif |