ipv6-internal.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright (c) 2009-2012 Niels Provos and Nick Mathewson
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. * 1. Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * 2. Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * 3. The name of the author may not be used to endorse or promote products
  13. * derived from this software without specific prior written permission.
  14. *
  15. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  16. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  17. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  18. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  19. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  20. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  21. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  22. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  24. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. */
  26. /* Internal use only: Fake IPv6 structures and values on platforms that
  27. * do not have them */
  28. #ifndef IPV6_INTERNAL_H_INCLUDED_
  29. #define IPV6_INTERNAL_H_INCLUDED_
  30. #include "event2/event-config.h"
  31. #include "evconfig-private.h"
  32. #include <sys/types.h>
  33. #ifdef EVENT__HAVE_SYS_SOCKET_H
  34. #include <sys/socket.h>
  35. #endif
  36. #include "event2/util.h"
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. /** @file ipv6-internal.h
  41. *
  42. * Replacement types and functions for platforms that don't support ipv6
  43. * properly.
  44. */
  45. #ifndef EVENT__HAVE_STRUCT_IN6_ADDR
  46. struct in6_addr {
  47. ev_uint8_t s6_addr[16];
  48. };
  49. #endif
  50. #ifndef EVENT__HAVE_SA_FAMILY_T
  51. typedef int sa_family_t;
  52. #endif
  53. #ifndef EVENT__HAVE_STRUCT_SOCKADDR_IN6
  54. struct sockaddr_in6 {
  55. /* This will fail if we find a struct sockaddr that doesn't have
  56. * sa_family as the first element. */
  57. sa_family_t sin6_family;
  58. ev_uint16_t sin6_port;
  59. struct in6_addr sin6_addr;
  60. };
  61. #endif
  62. #ifndef AF_INET6
  63. #define AF_INET6 3333
  64. #endif
  65. #ifndef PF_INET6
  66. #define PF_INET6 AF_INET6
  67. #endif
  68. #ifdef __cplusplus
  69. }
  70. #endif
  71. #endif