getifaddrs.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #ifndef LWS_HAVE_GETIFADDRS
  2. #define LWS_HAVE_GETIFADDRS 0
  3. #endif
  4. #if LWS_HAVE_GETIFADDRS
  5. #include <sys/types.h>
  6. #include <ifaddrs.h>
  7. #else
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. /*
  12. * Copyright (c) 2000 Kungliga Tekniska H�gskolan
  13. * (Royal Institute of Technology, Stockholm, Sweden).
  14. * All rights reserved.
  15. *
  16. * Redistribution and use in source and binary forms, with or without
  17. * modification, are permitted provided that the following conditions
  18. * are met:
  19. *
  20. * 1. Redistributions of source code must retain the above copyright
  21. * notice, this list of conditions and the following disclaimer.
  22. *
  23. * 2. Redistributions in binary form must reproduce the above copyright
  24. * notice, this list of conditions and the following disclaimer in the
  25. * documentation and/or other materials provided with the distribution.
  26. *
  27. * 3. Neither the name of the Institute nor the names of its contributors
  28. * may be used to endorse or promote products derived from this software
  29. * without specific prior written permission.
  30. *
  31. * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
  32. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  33. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  34. * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
  35. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  36. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  37. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  38. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  39. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  40. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  41. * SUCH DAMAGE.
  42. */
  43. /* $KTH: ifaddrs.hin,v 1.3 2000/12/11 00:01:13 assar Exp $ */
  44. #ifndef ifaddrs_h_7467027A95AD4B5C8DDD40FE7D973791
  45. #define ifaddrs_h_7467027A95AD4B5C8DDD40FE7D973791
  46. /*
  47. * the interface is defined in terms of the fields below, and this is
  48. * sometimes #define'd, so there seems to be no simple way of solving
  49. * this and this seemed the best. */
  50. #undef ifa_dstaddr
  51. struct ifaddrs {
  52. struct ifaddrs *ifa_next;
  53. char *ifa_name;
  54. unsigned int ifa_flags;
  55. struct sockaddr *ifa_addr;
  56. struct sockaddr *ifa_netmask;
  57. struct sockaddr *ifa_dstaddr;
  58. void *ifa_data;
  59. };
  60. #ifndef ifa_broadaddr
  61. #define ifa_broadaddr ifa_dstaddr
  62. #endif
  63. int getifaddrs(struct ifaddrs **);
  64. void freeifaddrs(struct ifaddrs *);
  65. #endif /* __ifaddrs_h__ */
  66. #ifdef __cplusplus
  67. }
  68. #endif
  69. #endif