2011-12-13 22:47:26 +08:00
|
|
|
#ifndef HEADER_CURL_IF2IP_H
|
|
|
|
#define HEADER_CURL_IF2IP_H
|
2002-09-03 19:52:59 +08:00
|
|
|
/***************************************************************************
|
2004-06-24 15:43:48 +08:00
|
|
|
* _ _ ____ _
|
|
|
|
* Project ___| | | | _ \| |
|
|
|
|
* / __| | | | |_) | |
|
|
|
|
* | (__| |_| | _ <| |___
|
1999-12-29 22:20:26 +08:00
|
|
|
* \___|\___/|_| \_\_____|
|
|
|
|
*
|
2014-12-16 20:29:01 +08:00
|
|
|
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
1999-12-29 22:20:26 +08:00
|
|
|
*
|
2002-09-03 19:52:59 +08:00
|
|
|
* This software is licensed as described in the file COPYING, which
|
|
|
|
* you should have received as part of this distribution. The terms
|
2016-02-03 07:19:02 +08:00
|
|
|
* are also available at https://curl.haxx.se/docs/copyright.html.
|
2004-06-24 15:43:48 +08:00
|
|
|
*
|
2001-01-03 17:29:33 +08:00
|
|
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
* copies of the Software, and permit persons to whom the Software is
|
2002-09-03 19:52:59 +08:00
|
|
|
* furnished to do so, under the terms of the COPYING file.
|
1999-12-29 22:20:26 +08:00
|
|
|
*
|
2001-01-03 17:29:33 +08:00
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
1999-12-29 22:20:26 +08:00
|
|
|
*
|
2002-09-03 19:52:59 +08:00
|
|
|
***************************************************************************/
|
2013-01-07 02:06:49 +08:00
|
|
|
#include "curl_setup.h"
|
1999-12-29 22:20:26 +08:00
|
|
|
|
2014-12-16 20:29:01 +08:00
|
|
|
/* IPv6 address scopes. */
|
|
|
|
#define IPV6_SCOPE_GLOBAL 0 /* Global scope. */
|
|
|
|
#define IPV6_SCOPE_LINKLOCAL 1 /* Link-local scope. */
|
|
|
|
#define IPV6_SCOPE_SITELOCAL 2 /* Site-local scope (deprecated). */
|
|
|
|
#define IPV6_SCOPE_NODELOCAL 3 /* Loopback. */
|
|
|
|
|
|
|
|
unsigned int Curl_ipv6_scope(const struct sockaddr *sa);
|
|
|
|
|
2011-12-14 01:37:33 +08:00
|
|
|
bool Curl_if_is_interface_name(const char *interf);
|
2013-04-04 04:06:51 +08:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
IF2IP_NOT_FOUND = 0, /* Interface not found */
|
|
|
|
IF2IP_AF_NOT_SUPPORTED = 1, /* Int. exists but has no address for this af */
|
|
|
|
IF2IP_FOUND = 2 /* The address has been stored in "buf" */
|
|
|
|
} if2ip_result_t;
|
|
|
|
|
|
|
|
if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope,
|
2014-12-16 20:29:01 +08:00
|
|
|
unsigned int remote_scope_id, const char *interf,
|
|
|
|
char *buf, int buf_size);
|
2005-03-14 23:43:23 +08:00
|
|
|
|
2002-11-25 03:30:21 +08:00
|
|
|
#ifdef __INTERIX
|
2006-03-05 06:39:31 +08:00
|
|
|
|
2002-11-25 03:30:21 +08:00
|
|
|
/* Nedelcho Stanev's work-around for SFU 3.0 */
|
|
|
|
struct ifreq {
|
|
|
|
#define IFNAMSIZ 16
|
|
|
|
#define IFHWADDRLEN 6
|
|
|
|
union {
|
|
|
|
char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
|
|
|
} ifr_ifrn;
|
|
|
|
|
|
|
|
union {
|
|
|
|
struct sockaddr ifru_addr;
|
|
|
|
struct sockaddr ifru_broadaddr;
|
|
|
|
struct sockaddr ifru_netmask;
|
|
|
|
struct sockaddr ifru_hwaddr;
|
|
|
|
short ifru_flags;
|
|
|
|
int ifru_metric;
|
|
|
|
int ifru_mtu;
|
|
|
|
} ifr_ifru;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* This define was added by Daniel to avoid an extra #ifdef INTERIX in the
|
|
|
|
C code. */
|
|
|
|
|
|
|
|
#define ifr_name ifr_ifrn.ifrn_name /* interface name */
|
|
|
|
#define ifr_addr ifr_ifru.ifru_addr /* address */
|
|
|
|
#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
|
|
|
|
#define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */
|
|
|
|
#define ifr_flags ifr_ifru.ifru_flags /* flags */
|
|
|
|
#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
|
|
|
|
#define ifr_metric ifr_ifru.ifru_metric /* metric */
|
|
|
|
#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
|
|
|
|
|
2004-06-24 15:43:48 +08:00
|
|
|
#define SIOCGIFADDR _IOW('s', 102, struct ifreq) /* Get if addr */
|
2012-12-15 00:38:18 +08:00
|
|
|
|
|
|
|
#endif /* __INTERIX */
|
1999-12-29 22:20:26 +08:00
|
|
|
|
2011-12-13 22:47:26 +08:00
|
|
|
#endif /* HEADER_CURL_IF2IP_H */
|