Wiesner András 05288d7a3c - ARP cache auto lookup feature added
- IGMPv2 capabilities added (report membership, leave group)
- ICMP capabilities added (ping)
- Tx Message Queue added
2023-01-14 14:24:56 +01:00

49 lines
1.3 KiB
C

#ifndef ETHERLIB_TEST_IGMP_PACKET_H
#define ETHERLIB_TEST_IGMP_PACKET_H
#include <stdint.h>
#include "ipv4_types.h"
#include "ethernet_frame.h"
#define ETH_IGMP_PACKET_CLASS (0x0002)
#define ETH_IGMP_HEADER_SIZE (8)
// IGMPv2 is implemented!
typedef enum {
IGMP_MT_MEMBERSHIP_QUERY = 0x11,
IGMP_MT_MEMBERSHIP_REPORT = 0x16,
IGMP_MT_LEAVE_GROUP = 0x17,
} IgmpMsgType;
/**
* IGMP packet properties.
*/
typedef struct {
PcktPropsHeader
uint8_t type; ///< IGMP message type
uint8_t maxRespTime; ///< Maximum response time in 1/10 seconds
uint16_t checksum; ///< Checksum for the entire packet
ip4_addr groupAddr; ///< Group address
} IgmpProps;
/**
* Insert IGMP header.
* @param hdr pointer to message header
* @param headers linked list of recursively encapsulated packet headers
*/
void insert_igmp_header(uint8_t * hdr, const PcktHeaderElement * headers);
/**
* Parse IGMP packet.
* @param hdr pointer to the beginning of the IGMP header
* @param size size of processable buffer area
* @param pcktHdrLe linket list of packet headers
* @param intf Ethernet interface
* @return always 0
*/
int parse_igmp(const uint8_t * hdr, uint32_t size, PcktHeaderElement * pcktHdrLe, struct EthInterface_ * intf);
#endif //ETHERLIB_TEST_IGMP_PACKET_H