Skip to content

File syn_igmp.c

FileList > net > syn_igmp.c

Go to the source code of this file

Zero-Heap Native IGMPv2 Protocol Engine Implementation.

  • #include "syntropic/net/syn_igmp.h"
  • #include "syntropic/net/syn_icmp.h"
  • #include <string.h>

Public Functions

Type Name
SYN_Status syn_igmp_build_report (SYN_IGMP * igmp, SYN_ETH * eth, uint8_t type, uint32_t group_ip, uint8_t * frame_out, size_t * frame_len)
Build an IGMPv2 Membership Report (Join Group) or Leave frame over Ethernet.
SYN_Status syn_igmp_init (SYN_IGMP * igmp)
Initialize IGMP Engine Context.
SYN_Status syn_igmp_join_group (SYN_IGMP * igmp, SYN_ETH * eth, uint32_t group_ip, uint8_t * frame_out, size_t * frame_len)
Join an IPv4 Multicast Group and construct IGMPv2 Join Frame.
SYN_Status syn_igmp_leave_group (SYN_IGMP * igmp, SYN_ETH * eth, uint32_t group_ip, uint8_t * frame_out, size_t * frame_len)
Leave an IPv4 Multicast Group and construct IGMPv2 Leave Frame.
SYN_Status syn_igmp_process_packet (SYN_IGMP * igmp, SYN_ETH * eth, const uint8_t * ip_pkt, size_t len, uint8_t * frame_tx, size_t * tx_len)
Process incoming IGMP packet (e.g. Membership Query from switch).

Public Functions Documentation

function syn_igmp_build_report

Build an IGMPv2 Membership Report (Join Group) or Leave frame over Ethernet.

SYN_Status syn_igmp_build_report (
    SYN_IGMP * igmp,
    SYN_ETH * eth,
    uint8_t type,
    uint32_t group_ip,
    uint8_t * frame_out,
    size_t * frame_len
) 

Parameters:

  • igmp Pointer to IGMP context.
  • eth Pointer to Ethernet context.
  • type SYN_IGMP_TYPE_V2_REPORT or SYN_IGMP_TYPE_V2_LEAVE.
  • group_ip 32-bit IPv4 multicast address.
  • frame_out Output frame buffer (must hold at least 60 bytes).
  • frame_len Pointer to receive final Ethernet II frame length.

Returns:

SYN_OK on success.


function syn_igmp_init

Initialize IGMP Engine Context.

SYN_Status syn_igmp_init (
    SYN_IGMP * igmp
) 

Parameters:

  • igmp Pointer to IGMP context.

Returns:

SYN_OK on success.


function syn_igmp_join_group

Join an IPv4 Multicast Group and construct IGMPv2 Join Frame.

SYN_Status syn_igmp_join_group (
    SYN_IGMP * igmp,
    SYN_ETH * eth,
    uint32_t group_ip,
    uint8_t * frame_out,
    size_t * frame_len
) 

Parameters:

  • igmp Pointer to IGMP context.
  • eth Pointer to Ethernet context.
  • group_ip 32-bit IPv4 multicast address (e.g. 224.0.0.251 for mDNS).
  • frame_out Output frame buffer (must hold at least 60 bytes).
  • frame_len Pointer to receive final Ethernet II frame length.

Returns:

SYN_OK on success.


function syn_igmp_leave_group

Leave an IPv4 Multicast Group and construct IGMPv2 Leave Frame.

SYN_Status syn_igmp_leave_group (
    SYN_IGMP * igmp,
    SYN_ETH * eth,
    uint32_t group_ip,
    uint8_t * frame_out,
    size_t * frame_len
) 

Parameters:

  • igmp Pointer to IGMP context.
  • eth Pointer to Ethernet context.
  • group_ip 32-bit IPv4 multicast address.
  • frame_out Output frame buffer (must hold at least 60 bytes).
  • frame_len Pointer to receive final Ethernet II frame length.

Returns:

SYN_OK on success.


function syn_igmp_process_packet

Process incoming IGMP packet (e.g. Membership Query from switch).

SYN_Status syn_igmp_process_packet (
    SYN_IGMP * igmp,
    SYN_ETH * eth,
    const uint8_t * ip_pkt,
    size_t len,
    uint8_t * frame_tx,
    size_t * tx_len
) 

Parameters:

  • igmp Pointer to IGMP context.
  • eth Pointer to Ethernet context.
  • ip_pkt Pointer to incoming IPv4 packet (starting at Ethernet frame).
  • len Length in bytes.
  • frame_tx Output frame buffer to receive reply report (if generated).
  • tx_len Pointer to receive byte length of generated reply frame.

Returns:

SYN_OK on success.



The documentation for this class was generated from the following file src/syntropic/net/syn_igmp.c