2
0

if2ip.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef HEADER_CURL_IF2IP_H
  2. #define HEADER_CURL_IF2IP_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
  11. *
  12. * This software is licensed as described in the file COPYING, which
  13. * you should have received as part of this distribution. The terms
  14. * are also available at http://curl.haxx.se/docs/copyright.html.
  15. *
  16. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  17. * copies of the Software, and permit persons to whom the Software is
  18. * furnished to do so, under the terms of the COPYING file.
  19. *
  20. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  21. * KIND, either express or implied.
  22. *
  23. ***************************************************************************/
  24. #include "setup.h"
  25. bool Curl_if_is_interface_name(const char *interf);
  26. char *Curl_if2ip(int af, const char *interf, char *buf, int buf_size);
  27. #ifdef __INTERIX
  28. #include <sys/socket.h>
  29. /* Nedelcho Stanev's work-around for SFU 3.0 */
  30. struct ifreq {
  31. #define IFNAMSIZ 16
  32. #define IFHWADDRLEN 6
  33. union {
  34. char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */
  35. } ifr_ifrn;
  36. union {
  37. struct sockaddr ifru_addr;
  38. struct sockaddr ifru_broadaddr;
  39. struct sockaddr ifru_netmask;
  40. struct sockaddr ifru_hwaddr;
  41. short ifru_flags;
  42. int ifru_metric;
  43. int ifru_mtu;
  44. } ifr_ifru;
  45. };
  46. /* This define was added by Daniel to avoid an extra #ifdef INTERIX in the
  47. C code. */
  48. #define ifr_name ifr_ifrn.ifrn_name /* interface name */
  49. #define ifr_addr ifr_ifru.ifru_addr /* address */
  50. #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
  51. #define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */
  52. #define ifr_flags ifr_ifru.ifru_flags /* flags */
  53. #define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
  54. #define ifr_metric ifr_ifru.ifru_metric /* metric */
  55. #define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
  56. #define SIOCGIFADDR _IOW('s', 102, struct ifreq) /* Get if addr */
  57. #endif /* interix */
  58. #endif /* HEADER_CURL_IF2IP_H */