PageRenderTime 44ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/epan/ipv6-utils.h

https://github.com/labx-technologies-llc/wireshark
C Header | 54 lines | 15 code | 6 blank | 33 comment | 7 complexity | 6ae7199fe9624c04c92f68829cd2a54a MD5 | raw file
Possible License(s): GPL-2.0, BSD-3-Clause
  1. /* ipv6-utils.h
  2. * Definitions for IPv6 packet disassembly
  3. *
  4. * $Id$
  5. *
  6. * Wireshark - Network traffic analyzer
  7. * By Gerald Combs <gerald@wireshark.org>
  8. *
  9. * Copyright 1998 Gerald Combs
  10. *
  11. * MobileIPv6 support added by Tomislav Borosa <tomislav.borosa@siemens.hr>
  12. *
  13. * This program is free software; you can redistribute it and/or
  14. * modify it under the terms of the GNU General Public License
  15. * as published by the Free Software Foundation; either version 2
  16. * of the License, or (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program; if not, write to the Free Software
  25. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  26. */
  27. #ifndef __IPV6_UTILS_H__
  28. #define __IPV6_UTILS_H__
  29. struct e_in6_addr {
  30. guint8 bytes[16]; /**< 128 bit IP6 address */
  31. };
  32. typedef struct {
  33. struct e_in6_addr addr;
  34. guint32 prefix;
  35. } ipv6_addr;
  36. /**
  37. * Unicast Scope
  38. * Note that we must check topmost 10 bits only, not 16 bits (see RFC2373).
  39. */
  40. #define E_IN6_IS_ADDR_LINKLOCAL(a) \
  41. (((a)->bytes[0] == 0xfe) && (((a)->bytes[1] & 0xc0) == 0x80))
  42. #define E_IN6_IS_ADDR_SITELOCAL(a) \
  43. (((a)->bytes[0] == 0xfe) && (((a)->bytes[1] & 0xc0) == 0xc0))
  44. /**
  45. * Multicast
  46. */
  47. #define E_IN6_IS_ADDR_MULTICAST(a) ((a)->bytes[0] == 0xff)
  48. #endif /* __IPV6_UTILS_H__ */