Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.6 KiB

  1. // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil -*- (for GNU Emacs)
  2. //
  3. // Copyright (c) 1985-2000 Microsoft Corporation
  4. //
  5. // This file is part of the Microsoft Research IPv6 Network Protocol Stack.
  6. // You should have received a copy of the Microsoft End-User License Agreement
  7. // for this software along with this release; see the file "license.txt".
  8. // If not, please see http://www.research.microsoft.com/msripv6/license.htm,
  9. // or write to Microsoft Research, One Microsoft Way, Redmond, WA 98052-6399.
  10. //
  11. // Abstract:
  12. //
  13. // Per RFC 2553.
  14. //
  15. // This file contains IPv6 specific information for use
  16. // by Winsock2 compatible applications.
  17. //
  18. // It also declares functionality exported from wship6.lib,
  19. // an application helper library for IPv6.
  20. //
  21. #ifndef WS2IP6_INCLUDED
  22. #define WS2IP6_INCLUDED 1
  23. #include <ipexport.h>
  24. #ifdef _MSC_VER
  25. #define WS2IP6_INLINE __inline
  26. #else
  27. #define WS2IP6_INLINE extern inline /* GNU style */
  28. #endif
  29. #ifdef __cplusplus
  30. #define WS2IP6_EXTERN extern "C"
  31. #else
  32. #define WS2IP6_EXTERN extern
  33. #endif
  34. //
  35. // Little helper functions to copy between SOCKADDR_IN6 and TDI_ADDRESS_IP6.
  36. // Only enabled if TDI_ADDRESS_IP6 has been defined.
  37. // By design, the two structures are identical except for sin6_family.
  38. //
  39. #ifdef TDI_ADDRESS_LENGTH_IP6
  40. WS2IP6_INLINE void
  41. CopyTDIFromSA6(TDI_ADDRESS_IP6 *To, SOCKADDR_IN6 *From)
  42. {
  43. memcpy(To, &From->sin6_port, sizeof *To);
  44. }
  45. WS2IP6_INLINE void
  46. CopySAFromTDI6(SOCKADDR_IN6 *To, TDI_ADDRESS_IP6 *From)
  47. {
  48. To->sin6_family = AF_INET6;
  49. memcpy(&To->sin6_port, From, sizeof *From);
  50. }
  51. #endif
  52. #endif // WS2IP6_INCLUDED