Wiesner András ab8d45932f Timestamping and bunch of bugfix and optimization
- Timestamping management added
- Errors due to reading uninitialized data in ARP fixed
- EthInterface reworked, incoming packet notification and payload readout separated (through which fixing concurrent access problems)
- RX and TX offloads added
- Capability to add a packet sieve layer without prior registration of specific packet class added (this makes it possible to register arbitrary EtherType connection blocks, for example)
2023-04-27 09:38:26 +02:00

49 lines
1.3 KiB
C

#ifndef ETHERLIB_IGMP_PACKET_H
#define ETHERLIB_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, struct EthInterface_ *intf);
/**
* 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, PcktProcFnPassbackData *pb);
#endif //ETHERLIB_IGMP_PACKET_H