PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
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.

98 lines
3.7KB

  1. /**************************************************************************
  2. *
  3. * Copyright 2008-2018 by Andrey Butok. FNET Community.
  4. *
  5. ***************************************************************************
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License"); you may
  8. * not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. *
  19. ***************************************************************************
  20. *
  21. * Private. IGMPv1/v2 protocol function definitions, data structures, etc.
  22. *
  23. ***************************************************************************/
  24. #ifndef _FNET_IGMP_H_
  25. #define _FNET_IGMP_H_
  26. #include "fnet.h"
  27. #if FNET_CFG_IGMP
  28. #include "fnet.h"
  29. #include "fnet_netif_prv.h"
  30. #include "fnet_prot.h"
  31. /************************************************************************
  32. * RFC2236: The Internet Group Management Protocol (IGMP) is used by IP hosts to
  33. * report their host group memberships to any immediately-neighboring
  34. * multicast routers.
  35. ************************************************************************/
  36. /************************************************************************
  37. * Definition of type and code field values.
  38. *************************************************************************/
  39. /************************************************************************
  40. * @internal
  41. * @brief IGMP message header.
  42. ************************************************************************
  43. *
  44. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  45. * | Type | Unused | Checksum |
  46. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  47. * | Group Address |
  48. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  49. *
  50. ************************************************************************/
  51. FNET_COMP_PACKED_BEGIN
  52. typedef struct
  53. {
  54. fnet_uint8_t type FNET_COMP_PACKED; /* Type.*/
  55. fnet_uint8_t max_resp_time FNET_COMP_PACKED; /* IGMPv1 Unused field, zeroed when sent, ignored when received.*/
  56. /* IGMPv2 Max Response Time (is meaningful only in Membership Query).*/
  57. /* NOTE: Current version of FNET ignores this parameter.*/
  58. fnet_uint16_t checksum FNET_COMP_PACKED; /* The checksum is the 16-bit one’s complement of the one’s
  59. * complement sum of the 8-octet IGMP message.*/
  60. fnet_ip4_addr_t group_addr FNET_COMP_PACKED; /* Group address field.*/
  61. } fnet_igmp_header_t;
  62. FNET_COMP_PACKED_END
  63. /* IGMP Types */
  64. #define IGMP_HEADER_TYPE_QUERY 0x11 /* Membership Query.*/
  65. #define IGMP_HEADER_TYPE_REPORT_V1 0x12 /* Version 1 Membership Report.*/
  66. #define IGMP_HEADER_TYPE_REPORT_V2 0x16 /* Version 2 Membership Report.*/
  67. #define IGMP_HEADER_TYPE_LEAVE_GROUP 0x17 /* Leave Group.*/
  68. extern fnet_prot_if_t fnet_igmp_prot_if;
  69. /************************************************************************
  70. * Function Prototypes
  71. *************************************************************************/
  72. #if defined(__cplusplus)
  73. extern "C" {
  74. #endif
  75. void _fnet_igmp_join( fnet_netif_t *netif, fnet_ip4_addr_t group_addr );
  76. void _fnet_igmp_leave( fnet_netif_t *netif, fnet_ip4_addr_t group_addr );
  77. #if defined(__cplusplus)
  78. }
  79. #endif
  80. #endif /* FNET_CFG_IGMP */
  81. #endif /* _FNET_IGMP_H_ */