IGMP

Overview

Copyright (C) 2004-2022 OKTET Labs Ltd. More…

// typedefs

typedef int tapi_igmp_msg_type;
typedef struct tapi_igmp3_src_list_s tapi_igmp3_src_list_t;
typedef struct tapi_igmp3_group_record_s tapi_igmp3_group_record_t;
typedef struct tapi_igmp3_group_list_s tapi_igmp3_group_list_t;

// enums

enum tapi_igmp_query_type;
enum tapi_igmp_version;

// structs

struct tapi_igmp3_group_list_s;
struct tapi_igmp3_group_record_s;
struct tapi_igmp3_src_list_s;

// global functions

void tapi_ip4_to_mcast_mac(in_addr_t ip4_addr, uint8_t* eth_addr);
te_errno tapi_igmp_add_csap_layer(asn_value** csap_spec);
te_errno tapi_igmp2_add_pdu(asn_value** tmpl_or_ptrn, asn_value** pdu, bool is_pattern, tapi_igmp_msg_type type, int max_resp_time, in_addr_t group_addr);
te_errno tapi_igmp_ip4_eth_csap_create(const char* ta_name, int sid, const char* ifname, unsigned int receive_mode, const uint8_t* eth_src, in_addr_t src_addr, csap_handle_t* igmp_csap);
te_errno tapi_igmp_add_ip4_pdu(asn_value** tmpl_or_ptrn, asn_value** pdu, bool is_pattern, in_addr_t dst_addr, in_addr_t src_addr);
te_errno tapi_igmp_add_ip4_pdu_gen(asn_value** tmpl_or_ptrn, asn_value** pdu, bool is_pattern, in_addr_t dst_addr, in_addr_t src_addr, int ttl, int tos);
te_errno tapi_igmp_add_ip4_eth_pdu(asn_value** tmpl_or_ptrn, asn_value** pdu, bool is_pattern, in_addr_t dst_addr, in_addr_t src_addr, uint8_t* eth_src);
te_errno tapi_igmp_add_ip4_eth_pdu_gen(asn_value** tmpl_or_ptrn, asn_value** pdu, bool is_pattern, in_addr_t dst_addr, in_addr_t src_addr, uint8_t* eth_src, int ttl, int tos);
te_errno tapi_igmp1_ip4_eth_send_report(const char* ta_name, int session, csap_handle_t csap, in_addr_t group_addr, in_addr_t src_addr, uint8_t* eth_src);
te_errno tapi_igmp2_ip4_eth_send_report(const char* ta_name, int session, csap_handle_t csap, in_addr_t group_addr, in_addr_t src_addr, uint8_t* eth_src);
te_errno tapi_igmp2_ip4_eth_send_leave(const char* ta_name, int session, csap_handle_t csap, in_addr_t group_addr, in_addr_t src_addr, uint8_t* eth_src);
te_errno tapi_igmp2_ip4_eth_send_query(const char* ta_name, int session, csap_handle_t csap, int max_resp_time, in_addr_t group_addr, in_addr_t src_addr, bool skip_eth, uint8_t* eth_src);
te_errno tapi_igmp3_add_report_pdu(asn_value** tmpl_or_ptrn, asn_value** pdu, bool is_pattern, tapi_igmp3_group_list_t* group_list);
te_errno tapi_igmp3_ip4_eth_send_report(const char* ta_name, int session, csap_handle_t csap, tapi_igmp3_group_list_t* group_list, in_addr_t src_addr, uint8_t* eth_src);
uint8_t tapi_igmp3_max_response_time_to_code(unsigned max_resp_time);
unsigned tapi_igmp3_max_response_code_to_time(uint8_t max_resp_code);
uint8_t tapi_igmp3_qqi_to_qqic(unsigned qqi);
unsigned tapi_igmp3_qqic_to_qqi(uint8_t qqic);
te_errno tapi_igmp3_add_query_pdu(asn_value** tmpl_or_ptrn, asn_value** pdu, bool is_pattern, int max_resp_code, in_addr_t group_addr, int s_flag, int qrv, int qqic, tapi_igmp3_src_list_t* src_list);
te_errno tapi_igmp3_ip4_eth_send_query(const char* ta_name, int session, csap_handle_t csap, int max_resp_code, in_addr_t group_addr, int s_flag, int qrv, int qqic, tapi_igmp3_src_list_t* src_list, in_addr_t src_addr, bool skip_eth, uint8_t* eth_src);
te_errno tapi_igmp3_ip4_eth_send_query_default(const char* ta_name, int session, csap_handle_t csap, in_addr_t group_addr, tapi_igmp3_src_list_t* src_list, in_addr_t src_addr, bool skip_eth, uint8_t* eth_src);
te_errno tapi_igmp3_src_list_init(tapi_igmp3_src_list_t* src_list);
void tapi_igmp3_src_list_free(tapi_igmp3_src_list_t* src_list);
te_errno tapi_igmp3_src_list_add(tapi_igmp3_src_list_t* src_list, in_addr_t addr);
int tapi_igmp3_src_list_length(tapi_igmp3_src_list_t* src_list);
te_errno tapi_igmp3_src_list_gen_bin(tapi_igmp3_src_list_t* src_list, void* buf, int buf_size, int* offset);
int tapi_igmp3_group_record_length(tapi_igmp3_group_record_t* group_record);
te_errno tapi_igmp3_group_record_gen_bin(tapi_igmp3_group_record_t* group_record, void* buf, int buf_size, int* offset);
int tapi_igmp3_group_list_length(tapi_igmp3_group_list_t* group_list);
te_errno tapi_igmp3_group_list_gen_bin(tapi_igmp3_group_list_t* group_list, void* buf, int buf_size, int* offset);
te_errno tapi_igmp3_group_record_init(tapi_igmp3_group_record_t* group_record, int group_type, in_addr_t group_address, void* aux_data, int aux_data_len);
void tapi_igmp3_group_record_free(tapi_igmp3_group_record_t* group_record);
te_errno tapi_igmp3_group_record_add_source(tapi_igmp3_group_record_t* group_record, in_addr_t src_addr);
te_errno tapi_igmp3_group_list_init(tapi_igmp3_group_list_t* group_list);
void tapi_igmp3_group_list_free(tapi_igmp3_group_list_t* group_list);
te_errno tapi_igmp3_group_list_add(tapi_igmp3_group_list_t* group_list, tapi_igmp3_group_record_t* group_record);
tapi_igmp3_src_list_t* tapi_igmp3_src_list_new(tapi_igmp3_src_list_t* src_list, ...);
tapi_igmp3_group_record_t* tapi_igmp3_group_record_new(tapi_igmp3_group_record_t* group_record, int group_type, in_addr_t group_address, void* aux_data, int aux_data_len, ...);
tapi_igmp3_group_list_t* tapi_igmp3_group_list_new(tapi_igmp3_group_list_t* group_list, ...);

// macros

#define IGMP1_SEND_JOIN(_pco, _csap, _group_addr, _src_addr, _src_mac)
#define IGMP2_SEND_JOIN(_pco, _csap, _group_addr, _src_addr, _src_mac)
#define IGMP2_SEND_LEAVE(_pco, _csap, _group_addr, _src_addr, _src_mac)
#define IGMP2_SEND_QUERY(_pco, _csap, _group_addr, _src_addr, _skip_eth, _src_mac)
#define IGMP3_GROUP_LIST(...)
#define IGMP3_GROUP_RECORD(_group_type, _group_address, ...)
#define IGMP3_SEND_ALLOW(_pco, _csap, _group_addr, _src_addr, _src_mac, _addr1...)
#define IGMP3_SEND_BLOCK(_pco, _csap, _group_addr, _src_addr, _src_mac, _addr1...)
#define IGMP3_SEND_IS_EXCLUDE(_pco, _csap, _group_addr, _src_addr, _src_mac, ...)
#define IGMP3_SEND_IS_INCLUDE(_pco, _csap, _group_addr, _src_addr, _src_mac, ...)
#define IGMP3_SEND_JOIN(_pco, _csap, _group_addr, _src_addr, _src_mac)
#define IGMP3_SEND_LEAVE(_pco, _csap, _group_addr, _src_addr, _src_mac)
#define IGMP3_SEND_QUERY(_pco, _csap, _group_addr, _src_addr, _skip_eth, _src_mac, ...)
#define IGMP3_SEND_REPORT(_pco, _csap, _group_list, _src_addr, _src_mac)
#define IGMP3_SEND_SINGLE_REPORT(_pco, _csap, _group_type, _group_addr, _src_addr, _src_mac, ...)
#define IGMP3_SEND_TO_EXCLUDE(_pco, _csap, _group_addr, _src_addr, _src_mac, ...)
#define IGMP3_SEND_TO_INCLUDE(_pco, _csap, _group_addr, _src_addr, _src_mac, ...)
#define IGMP3_SRC_LIST(...)
#define TAPI_IGMP1_TYPE_REPORT
#define TAPI_IGMP2_TYPE_LEAVE
#define TAPI_IGMP2_TYPE_REPORT
#define TAPI_IGMP3_GROUP_LIST_SIZE_MAX
#define TAPI_IGMP3_GROUP_RECORD_HDR_LEN
#define TAPI_IGMP3_IP4_TOS_DEFAULT
#define TAPI_IGMP3_QUERY_MAX_RESP_TIME_MAX_S
#define TAPI_IGMP3_QUERY_QQI_DEFAULT_S
#define TAPI_IGMP3_QUERY_QQI_MAX_S
#define TAPI_IGMP3_QUERY_QRV_DEFAULT
#define TAPI_IGMP3_QUERY_S_DEFAULT
#define TAPI_IGMP3_SRC_LIST_SIZE_MAX
#define TAPI_IGMP3_TYPE_REPORT
#define TAPI_IGMP_IP4_TOS_DEFAULT
#define TAPI_IGMP_IP4_TTL_DEFAULT
#define TAPI_IGMP_QUERY_MAX_RESP_TIME_DEFAULT_S
#define TAPI_IGMP_TYPE_QUERY
#define TAPI_MCAST_ADDR_ALL_HOSTS
#define TAPI_MCAST_ADDR_ALL_MCR
#define TAPI_MCAST_ADDR_ALL_ROUTERS

Detailed Documentation

Copyright (C) 2004-2022 OKTET Labs Ltd. All rights reserved.

Typedefs

typedef struct tapi_igmp3_src_list_s tapi_igmp3_src_list_t

IGMPv3 Source Address List (simple array) storage

typedef struct tapi_igmp3_group_record_s tapi_igmp3_group_record_t

IGMPv3 Group Record structure

typedef struct tapi_igmp3_group_list_s tapi_igmp3_group_list_t

IGMPv3 Group Record List storage

Global Functions

void tapi_ip4_to_mcast_mac(in_addr_t ip4_addr, uint8_t* eth_addr)

Calculate MAC address corresponding to a given IPv4 multicast address.

Parameters:

ip4_addr

IPv4 multicast address.

eth_addr

Where to save corresponding MAC address.

te_errno tapi_igmp_add_csap_layer(asn_value** csap_spec)

Add IGMP layer in CSAP specification.

Parameters:

csap_spec

Location of CSAP specification pointer.

Status

code.

te_errno tapi_igmp2_add_pdu(asn_value** tmpl_or_ptrn, asn_value** pdu, bool is_pattern, tapi_igmp_msg_type type, int max_resp_time, in_addr_t group_addr)

Add IGMPv2 PDU as the last PDU to the last unit of the traffic template or pattern.

Parameters:

tmpl_or_ptrn

Location of ASN.1 value with traffic template or pattern

pdu

Location for ASN.1 value pointer with added PDU

is_pattern

Is the first argument template or pattern

type

Type of IGMPv2 message or negative to keep unspecified.

max_resp_time

IGMP message maximum response time, or negative to keep unspecified.

group_addr

Multicast Group Address field of IGMPv2 message.

Returns:

Status code.

te_errno tapi_igmp_ip4_eth_csap_create(const char* ta_name, int sid, const char* ifname, unsigned int receive_mode, const uint8_t* eth_src, in_addr_t src_addr, csap_handle_t* igmp_csap)

Create ‘igmp.ip4.eth’ CSAP on the specified Agent

Parameters:

ta_name

Test Agent name

sid

RCF SID

ifname

Network interface name

receive_mode

Bitmask with receive mode, see ‘enum tad_eth_recv_mode’ in tad_common.h. Use TAD_ETH_RECV_DEF by default.

eth_src

Local MAC address (or NULL)

src_addr

Local IP address in network byte order (or NULL)

igmp_csap

Location for the CSAP handle (OUT)

Returns:

Zero on success or error code

te_errno tapi_igmp_add_ip4_pdu(asn_value** tmpl_or_ptrn, asn_value** pdu, bool is_pattern, in_addr_t dst_addr, in_addr_t src_addr)

Add IPv4 layer to PDU, used for ppp connections

Parameters:

tmpl_or_ptrn

Location of ASN.1 value with traffic template or pattern

pdu

Location for ASN.1 value pointer with added PDU

is_pattern

Is the first argument template or pattern

dst_addr

IPv4 layer Destination Multicast address (also used for generating Ethernet multicast address)

src_addr

IPv4 layer Source Address field or INADDR_ANY to keep unspecified.

Returns:

Status code.

te_errno tapi_igmp_add_ip4_pdu_gen(asn_value** tmpl_or_ptrn, asn_value** pdu, bool is_pattern, in_addr_t dst_addr, in_addr_t src_addr, int ttl, int tos)

Add IPv4 layer to PDU, used for ppp connections

Parameters:

tmpl_or_ptrn

Location of ASN.1 value with traffic template or pattern

pdu

Location for ASN.1 value pointer with added PDU

is_pattern

Is the first argument template or pattern

dst_addr

IPv4 layer Destination Multicast address (also used for generating Ethernet multicast address)

src_addr

IPv4 layer Source Address field or INADDR_ANY to keep unspecified.

ttl

IP TTL

tos

IP ToS

Returns:

Status code.

te_errno tapi_igmp_add_ip4_eth_pdu(asn_value** tmpl_or_ptrn, asn_value** pdu, bool is_pattern, in_addr_t dst_addr, in_addr_t src_addr, uint8_t* eth_src)

Add IPv4.Eth layers to PDU

Note

Destination address Ethernet layers is calculated from dst_address value.

Parameters:

tmpl_or_ptrn

Location of ASN.1 value with traffic template or pattern

pdu

Location for ASN.1 value pointer with added PDU

is_pattern

Is the first argument template or pattern

dst_addr

IPv4 layer Destination Multicast address (also used for generating Ethernet multicast address)

src_addr

IPv4 layer Source Address field or INADDR_ANY to keep unspecified.

eth_src

Ethernet layer Source Address field or NULL to keep unspecified.

tos

IP ToS field

Returns:

Status code.

te_errno tapi_igmp_add_ip4_eth_pdu_gen(asn_value** tmpl_or_ptrn, asn_value** pdu, bool is_pattern, in_addr_t dst_addr, in_addr_t src_addr, uint8_t* eth_src, int ttl, int tos)

Add IPv4.Eth layers to PDU,

Note

Destination address Ethernet layers is calculated from dst_address value.

Parameters:

tmpl_or_ptrn

Location of ASN.1 value with traffic template or pattern

pdu

Location for ASN.1 value pointer with added PDU

is_pattern

Is the first argument template or pattern

dst_addr

IPv4 layer Destination Multicast address (also used for generating Ethernet multicast address)

src_addr

IPv4 layer Source Address field or INADDR_ANY to keep unspecified.

eth_src

Ethernet layer Source Address field or NULL to keep unspecified.

ttl

IP TTL field

tos

IP ToS field

Returns:

Status code.

te_errno tapi_igmp1_ip4_eth_send_report(const char* ta_name, int session, csap_handle_t csap, in_addr_t group_addr, in_addr_t src_addr, uint8_t* eth_src)

Send IGMPv1 report message

Parameters:

ta_name

Test Agent name

session

RCF SID

csap

igmp.ip4.eth CSAP handle to send IGMP message through

group_addr

Multicast Group Address field of IGMPv2 message.

src_addr

IPv4 layer Source Address field or INADDR_ANY to keep unspecified.

eth_src

Ethernet layer Source Address field or NULL to keep unspecified.

Returns:

Status code.

te_errno tapi_igmp2_ip4_eth_send_report(const char* ta_name, int session, csap_handle_t csap, in_addr_t group_addr, in_addr_t src_addr, uint8_t* eth_src)

Send IGMPv2 report message

Parameters:

ta_name

Test Agent name

session

RCF SID

csap

igmp.ip4.eth CSAP handle to send IGMP message through

group_addr

Multicast Group Address field of IGMPv2 message.

src_addr

IPv4 layer Source Address field or INADDR_ANY to keep unspecified.

eth_src

Ethernet layer Source Address field or NULL to keep unspecified.

Returns:

Status code.

te_errno tapi_igmp2_ip4_eth_send_leave(const char* ta_name, int session, csap_handle_t csap, in_addr_t group_addr, in_addr_t src_addr, uint8_t* eth_src)

Send IGMPv2 Group Membership Leave message

Parameters:

ta_name

Test Agent name

session

RCF SID

csap

igmp.ip4.eth CSAP handle to send IGMP message through

group_addr

Multicast Group Address field of IGMPv2 message.

src_addr

IPv4 layer Source Address field or INADDR_ANY to keep unspecified.

eth_src

Ethernet layer Source Address field or NULL to keep unspecified.

Returns:

Status code.

te_errno tapi_igmp2_ip4_eth_send_query(const char* ta_name, int session, csap_handle_t csap, int max_resp_time, in_addr_t group_addr, in_addr_t src_addr, bool skip_eth, uint8_t* eth_src)

Send IGMPv2 Query message

Parameters:

ta_name

Test Agent name

session

RCF SID

csap

igmp.ip4.eth CSAP handle to send IGMP message through

max_resp_time

IGMP message maximum response time, or negative to keep unspecified.

group_addr

Multicast Group Address field of IGMPv2 message. For General Query should be 0.0.0.0 (INADDR_ANY)

src_addr

IPv4 layer Source Address field or INADDR_ANY to keep unspecified.

skip_eth

Do not add eth_src

eth_src

Ethernet layer Source Address field or NULL to keep unspecified.

Returns:

Status code.

te_errno tapi_igmp3_add_report_pdu(asn_value** tmpl_or_ptrn, asn_value** pdu, bool is_pattern, tapi_igmp3_group_list_t* group_list)

Add IGMPv3 Report PDU as the last PDU to the last unit of the traffic template or pattern.

Parameters:

tmpl_or_ptrn

Location of ASN.1 value with traffic template or pattern

pdu

Location for ASN.1 value pointer with added PDU

is_pattern

Is the first argument template or pattern

group_list

List of Group Records to be sent in this PDU

Returns:

Status code.

te_errno tapi_igmp3_ip4_eth_send_report(const char* ta_name, int session, csap_handle_t csap, tapi_igmp3_group_list_t* group_list, in_addr_t src_addr, uint8_t* eth_src)

Send IGMPv3 Group Membership report message

Parameters:

ta_name

Test Agent name

session

RCF SID

csap

igmp.ip4.eth CSAP handle to send IGMP message through

group_list

Group Record List to be sent

src_addr

IPv4 layer Source Address field or INADDR_ANY to keep unspecified.

eth_src

Ethernet layer Source Address field or NULL to keep unspecified.

Returns:

Status code.

uint8_t tapi_igmp3_max_response_time_to_code(unsigned max_resp_time)

Convert Max Response Time to IGMPv3 Max Response Code. See RFC 3376, section 4.1.1.

Parameters:

max_resp_time

Max Response Time in seconds.

Returns:

Max Response Code suitable for writing to IGMPv3 Query message.

unsigned tapi_igmp3_max_response_code_to_time(uint8_t max_resp_code)

Convert IGMPv3 Max Response Code to Max Response Time. See RFC 3376, section 4.1.1.

Parameters:

max_resp_code

Max Response Code in exponential form from IGMPv3 Query message.

Returns:

Max Response Time in seconds.

uint8_t tapi_igmp3_qqi_to_qqic(unsigned qqi)

Convert Querier’s Query Interval to Querier’s Query Interval Code. See RFC 3376, section 4.1.7.

Parameters:

qqi

Querier’s Query Interval (QQI) in seconds.

Returns:

Querier’s Query Interval Code (QQIC) suitable for writing to IGMPv3 Query message.

unsigned tapi_igmp3_qqic_to_qqi(uint8_t qqic)

Convert Querier’s Query Interval Code to Querier’s Query Interval. See RFC 3376, section 4.1.7.

Parameters:

qqic

Querier’s Query Interval Code (QQIC) in exponential form from IGMPv3 Query message.

Returns:

Querier’s Query Interval (QQI) in seconds.

te_errno tapi_igmp3_add_query_pdu(asn_value** tmpl_or_ptrn, asn_value** pdu, bool is_pattern, int max_resp_code, in_addr_t group_addr, int s_flag, int qrv, int qqic, tapi_igmp3_src_list_t* src_list)

Add IGMPv3 Query PDU as the last PDU to the last unit of the traffic template or pattern.

Parameters:

tmpl_or_ptrn

Location of ASN.1 value with traffic template or pattern

pdu

Location for ASN.1 value pointer with added PDU

is_pattern

Is the first argument template or pattern

max_resp_code

IGMP message maximum response code, or negative to keep unspecified.

group_addr

Multicast Group Address field of IGMPv3 Query message.

s_flag

S Flag (Suppress Router-Side Processing) field of IGMPv3 Query message.

qrv

QRV (Querier’s Robustness Variable) field of IGMPv3 Query message.

qqic

QQIC (Querier’s Query Interval Code) field of IGMPv3 Query message.

src_list

List of source addresses to be sent in this PDU, or NULL

Returns:

Status code.

te_errno tapi_igmp3_ip4_eth_send_query(const char* ta_name, int session, csap_handle_t csap, int max_resp_code, in_addr_t group_addr, int s_flag, int qrv, int qqic, tapi_igmp3_src_list_t* src_list, in_addr_t src_addr, bool skip_eth, uint8_t* eth_src)

Send IGMPv3 Group Membership Query message

Note

To specify the case of General Query, group_addr should be INADDR_ANY and message will be sent to ALL_HOSTS (224.0.0.1)

Parameters:

ta_name

Test Agent name

session

RCF SID

csap

igmp.ip4.eth CSAP handle to send IGMP message through

max_resp_code

IGMP message maximum response code, or negative to keep unspecified.

group_addr

Multicast Group Address field of IGMPv3 Query message.

s_flag

S Flag (Suppress Router-Side Processing) field of IGMPv3 Query message.

qrv

QRV (Querier’s Robustness Variable) field of IGMPv3 Query message.

qqic

QQIC (Querier’s Query Interval Code) field of IGMPv3 Query message.

src_list

List of source addresses to be sent in this PDU, or NULL

src_addr

IPv4 layer Source Address field or INADDR_ANY to keep unspecified.

skip_eth

Do not add eth_src

eth_src

Ethernet layer Source Address field or NULL to keep unspecified.

Returns:

Status code.

te_errno tapi_igmp3_ip4_eth_send_query_default(const char* ta_name, int session, csap_handle_t csap, in_addr_t group_addr, tapi_igmp3_src_list_t* src_list, in_addr_t src_addr, bool skip_eth, uint8_t* eth_src)

Send IGMPv3 Group Membership Query message with default timeouts and flags.

Parameters:

ta_name

Test Agent name.

session

RCF SID.

csap

igmp.ip4.eth CSAP handle to send IGMP message through.

group_addr

Multicast Group Address field of IGMPv3 Query message.

src_list

List of source addresses to be sent in this PDU, or NULL.

src_addr

IPv4 layer Source Address field or INADDR_ANY to keep unspecified.

skip_eth

Do not add eth_src.

eth_src

Ethernet layer Source Address field or NULL to keep unspecified.

Returns:

Status code.

te_errno tapi_igmp3_src_list_init(tapi_igmp3_src_list_t* src_list)

Initialise Source Address List instance

Parameters:

src_list

Pointer to Source Address List to initialise with default values

Returns:

Status code.

void tapi_igmp3_src_list_free(tapi_igmp3_src_list_t* src_list)

Free resources allocated by Source Address List instance

Parameters:

src_list

Pointer to Source Address List to finalise

Returns:

N/A

te_errno tapi_igmp3_src_list_add(tapi_igmp3_src_list_t* src_list, in_addr_t addr)

Add source address to the list

Parameters:

src_list

Source Address List to add to

addr

IPv4 address to add

Returns:

Status code.

int tapi_igmp3_src_list_length(tapi_igmp3_src_list_t* src_list)

Calculate the binary length of the Source Address List stored in IGMPv3 message

Parameters:

src_list

Source Address List

Returns:

Length in bytes.

te_errno tapi_igmp3_src_list_gen_bin(tapi_igmp3_src_list_t* src_list, void* buf, int buf_size, int* offset)

Pack the source list to store in IGMPv3 message

Parameters:

src_list

Source Address List to pack

buf

Buffer to pack the Source Address List at

buf_size

Size of pre-allocated buffer

offset

Buffer offset to start packing from

Returns:

Status code.

int tapi_igmp3_group_record_length(tapi_igmp3_group_record_t* group_record)

Calculate the binary length of the Group Record stored in IGMPv3 message

Parameters:

group_record

Group Record to pack

Returns:

Length in bytes.

te_errno tapi_igmp3_group_record_gen_bin(tapi_igmp3_group_record_t* group_record, void* buf, int buf_size, int* offset)

Pack the Group Record structure with Source Address List to store in IGMPv3 message

Parameters:

group_record

Group Record to pack

buf

Buffer to pack the Group Record List at

buf_size

Size of pre-allocated buffer

offset

Buffer offset to start packing from

Returns:

Status code.

int tapi_igmp3_group_list_length(tapi_igmp3_group_list_t* group_list)

Calculate the binary length of the Group Record List packed in IGMPv3 message

Parameters:

group_list

Group Record List to pack

Returns:

Length in bytes.

te_errno tapi_igmp3_group_list_gen_bin(tapi_igmp3_group_list_t* group_list, void* buf, int buf_size, int* offset)

Pack the Group Record List to store in IGMPv3 message

Parameters:

group_list

Group Record List to pack

buf

Buffer to pack the Group Record List at

buf_size

Size of pre-allocated buffer

offset

Buffer offset to start packing from

Returns:

Status code.

te_errno tapi_igmp3_group_record_init(tapi_igmp3_group_record_t* group_record, int group_type, in_addr_t group_address, void* aux_data, int aux_data_len)

Initialise pre-allocated structure of Group Record with default values

Parameters:

group_record

Group Record to initialise

group_type

Type of the Group Record

group_address

Multicast Group Address

aux_data

Pointer to auxiliary data to be packed into the record group.

aux_data_len

Length of the auxiliary data in 32-bit words

Returns:

Status code.

void tapi_igmp3_group_record_free(tapi_igmp3_group_record_t* group_record)

Free system resources allocated by group_record

Parameters:

group_record

Group Record to free

Returns:

Status code.

te_errno tapi_igmp3_group_record_add_source(tapi_igmp3_group_record_t* group_record, in_addr_t src_addr)

Add source address to the group_record

Parameters:

group_record

Group Record to add to

src_addr

IPv4 source address to add

Returns:

Status code.

te_errno tapi_igmp3_group_list_init(tapi_igmp3_group_list_t* group_list)

Initialise the Group Record List with initial values

Parameters:

group_list

Group Record List structure to initialise

Returns:

Status code.

void tapi_igmp3_group_list_free(tapi_igmp3_group_list_t* group_list)

Free system resources allocated by Group Record List

Parameters:

group_list

Group Record List to free

Returns:

Status code.

te_errno tapi_igmp3_group_list_add(tapi_igmp3_group_list_t* group_list, tapi_igmp3_group_record_t* group_record)

Add Group Record to the Group Record List

Parameters:

group_list

Group Record List to add to

group_record

Group Record structure to add

Returns:

Status code.

tapi_igmp3_src_list_t* tapi_igmp3_src_list_new(tapi_igmp3_src_list_t* src_list, ...)

Allocate, initialise and fill source list structure

Parameters:

src_list

Source list to initialise and fill Memory allocation will be skipped if this parameter is not NULL

…

List of source addresses to be added to the list (list should end with 0 value (INADDR_ANY))

Returns:

Initialised source list, or NULL if failed.

tapi_igmp3_group_record_t* tapi_igmp3_group_record_new(tapi_igmp3_group_record_t* group_record, int group_type, in_addr_t group_address, void* aux_data, int aux_data_len, ...)

Allocate, initialise and fill Group Record structure

Parameters:

group_record

Group Record to initialise and fill Memory allocation will be skipped if this parameter is not NULL

group_type

Type of the Group Record

group_address

Multicast Group Address

aux_data

Pointer to auxiliary data to be packed into the record group.

aux_data_len

Length of the auxiliary data in 32-bit words

…

List of source addresses to be added to the record (list should end with 0 value (INADDR_ANY))

Returns:

Initialised Group Record, or NULL if failed.

tapi_igmp3_group_list_t* tapi_igmp3_group_list_new(tapi_igmp3_group_list_t* group_list, ...)

Allocate, initialise and fill Group Record List structure

Parameters:

group_list

Group Record List to initialise and fill Memory allocation will be skipped if this parameter is not NULL

…

List of Group Records to be added to the list (list should end with NULL value)

Returns:

Initialised Group Record List, or NULL if failed.

Macros

#define IGMP3_GROUP_LIST(...)

Allocate, initialise and fill Group Record List structure.

Parameters:

…

List of Group Records (tapi_igmp3_group_record_t *) to be added to the list. May be omitted.

Returns:

Initialised Group Record List.

#define IGMP3_GROUP_RECORD(_group_type, _group_address, ...)

Allocate, initialise and fill Group Record structure.

Parameters:

_group_type

Type of the Group Record.

_group_address

Multicast Group Address.

…

List of source addresses (in_addr_t) to be added to the record. May be omitted.

Returns:

Initialised Group Record.

#define IGMP3_SEND_ALLOW(_pco, _csap, _group_addr, _src_addr, _src_mac, _addr1...)

Send IGMPv3 report with one Group Record to allow multicast traffic.

Parameters:

_pco

RPC server.

_csap

igmp.ip4.eth CSAP handle to send IGMP message through.

_group_addr

Multicast Group Address.

_src_addr

IPv4 layer Source Address field or INADDR_ANY to keep unspecified.

_src_mac

Ethernet layer Source Address field or NULL to keep unspecified.

_addr1

First source address to be added to the record.

…

List of source addresses to be added to the record. May be omitted.

#define IGMP3_SEND_BLOCK(_pco, _csap, _group_addr, _src_addr, _src_mac, _addr1...)

Send IGMPv3 report with one Group Record to block multicast traffic.

Parameters:

_pco

RPC server.

_csap

igmp.ip4.eth CSAP handle to send IGMP message through.

_group_addr

Multicast Group Address.

_src_addr

IPv4 layer Source Address field or INADDR_ANY to keep unspecified.

_src_mac

Ethernet layer Source Address field or NULL to keep unspecified.

_addr1

First source address to be added to the record.

…

List of source addresses to be added to the record. May be omitted.

#define IGMP3_SEND_IS_EXCLUDE(_pco, _csap, _group_addr, _src_addr, _src_mac, ...)

Send IGMPv3 report with one Group Record of MODE_IS_EXCLUDE type.

Parameters:

_pco

RPC server.

_csap

igmp.ip4.eth CSAP handle to send IGMP message through.

_group_addr

Multicast Group Address.

_src_addr

IPv4 layer Source Address field or INADDR_ANY to keep unspecified.

_src_mac

Ethernet layer Source Address field or NULL to keep unspecified.

…

List of source addresses to be added to the record. May be omitted.

#define IGMP3_SEND_IS_INCLUDE(_pco, _csap, _group_addr, _src_addr, _src_mac, ...)

Send IGMPv3 report with one Group Record of MODE_IS_INCLUDE type.

Parameters:

_pco

RPC server.

_csap

igmp.ip4.eth CSAP handle to send IGMP message through.

_group_addr

Multicast Group Address.

_src_addr

IPv4 layer Source Address field or INADDR_ANY to keep unspecified.

_src_mac

Ethernet layer Source Address field or NULL to keep unspecified.

…

List of source addresses to be added to the record. May be omitted.

#define IGMP3_SEND_JOIN(_pco, _csap, _group_addr, _src_addr, _src_mac)

Send IGMPv3 report with one Group Record to receive multicast traffic from any source (same as IGMPv2 Membership Report).

Parameters:

_pco

RPC server.

_csap

igmp.ip4.eth CSAP handle to send IGMP message through.

_group_addr

Multicast Group Address.

_src_addr

IPv4 layer Source Address field or INADDR_ANY to keep unspecified.

_src_mac

Ethernet layer Source Address field or NULL to keep unspecified.

#define IGMP3_SEND_LEAVE(_pco, _csap, _group_addr, _src_addr, _src_mac)

Send IGMPv3 report with one Group Record to block multicast traffic from any source (same as IGMPv2 Leave Group).

Parameters:

_pco

RPC server.

_csap

igmp.ip4.eth CSAP handle to send IGMP message through.

_group_addr

Multicast Group Address.

_src_addr

IPv4 layer Source Address field or INADDR_ANY to keep unspecified.

_src_mac

Ethernet layer Source Address field or NULL to keep unspecified.

#define IGMP3_SEND_QUERY(_pco, _csap, _group_addr, _src_addr, _skip_eth, _src_mac, ...)

Send IGMPv3 query.

Parameters:

_pco

RPC server.

_csap

igmp.ip4.eth CSAP handle to send IGMP message through.

_group_addr

Multicast Group Address field of IGMPv3 Query message.

_src_addr

IPv4 layer Source Address field or INADDR_ANY to keep unspecified.

_skip_eth

Do not add _src_mac

_src_mac

Ethernet layer Source Address field or NULL to keep unspecified.

…

List of source addresses to be added to the record. May be omitted.

#define IGMP3_SEND_REPORT(_pco, _csap, _group_list, _src_addr, _src_mac)

Send IGMPv3 report and free group list.

Note

_group_list will be freed after sending.

Parameters:

_pco

RPC server.

_csap

igmp.ip4.eth CSAP handle to send IGMP message through.

_group_list

Group Record List to be sent.

_src_addr

IPv4 layer Source Address field or INADDR_ANY to keep unspecified.

_src_mac

Ethernet layer Source Address field or NULL to keep unspecified.

#define IGMP3_SEND_SINGLE_REPORT(_pco, _csap, _group_type, _group_addr, _src_addr, _src_mac, ...)

Send IGMPv3 report with one multicast Group Record.

Parameters:

_pco

RPC server.

_csap

igmp.ip4.eth CSAP handle to send IGMP message through.

_group_type

Type of the Group Record.

_group_addr

Multicast Group Address.

_src_addr

IPv4 layer Source Address field or INADDR_ANY to keep unspecified.

_src_mac

Ethernet layer Source Address field or NULL to keep unspecified.

…

List of source addresses to be added to the record. May be omitted.

#define IGMP3_SEND_TO_EXCLUDE(_pco, _csap, _group_addr, _src_addr, _src_mac, ...)

Send IGMPv3 report with one Group Record of CHANGE_TO_EXCLUDE type.

Parameters:

_pco

RPC server.

_csap

igmp.ip4.eth CSAP handle to send IGMP message through.

_group_addr

Multicast Group Address.

_src_addr

IPv4 layer Source Address field or INADDR_ANY to keep unspecified.

_src_mac

Ethernet layer Source Address field or NULL to keep unspecified.

…

List of source addresses to be added to the record. May be omitted.

#define IGMP3_SEND_TO_INCLUDE(_pco, _csap, _group_addr, _src_addr, _src_mac, ...)

Send IGMPv3 report with one Group Record of CHANGE_TO_INCLUDE type.

Parameters:

_pco

RPC server.

_csap

igmp.ip4.eth CSAP handle to send IGMP message through.

_group_addr

Multicast Group Address.

_src_addr

IPv4 layer Source Address field or INADDR_ANY to keep unspecified.

_src_mac

Ethernet layer Source Address field or NULL to keep unspecified.

…

List of source addresses to be added to the record. May be omitted.

#define IGMP3_SRC_LIST(...)

Allocate, initialise and fill Source Address List structure.

Parameters:

…

List of source addresses (in_addr_t) to be added to the list.

Returns:

Initialised Source Address List. May be omitted.

#define TAPI_IGMP1_TYPE_REPORT

IGMPv1 Membership report

#define TAPI_IGMP2_TYPE_REPORT

IGMPv2 Membership report Group Leave message

#define TAPI_IGMP3_GROUP_LIST_SIZE_MAX

Maximum number of Group Records in list (see RFC 3376)

#define TAPI_IGMP3_IP4_TOS_DEFAULT

Default ToS for IGMPv3 messages is 0xc0

#define TAPI_IGMP3_QUERY_MAX_RESP_TIME_MAX_S

Max Response Time maximum value in seconds for IGMPv3 Query message (see RFC 3376, 4.1.1)

#define TAPI_IGMP3_QUERY_QQI_DEFAULT_S

Querier’s Query Interval (QQI) default value in seconds, can be converted to Querier’s Query Interval Code (QQIC)(see RFC 3376, 4.1.7)

#define TAPI_IGMP3_QUERY_QQI_MAX_S

Querier’s Query Interval (QQI) maximum value (see RFC 3376, 4.1.7)

#define TAPI_IGMP3_QUERY_QRV_DEFAULT

Querier’s Robustness Variable (see RFC 3376, 4.1.6)

#define TAPI_IGMP3_QUERY_S_DEFAULT

Suppress Router-Side Processing flag (see RFC 3376, 4.1.5)

#define TAPI_IGMP3_SRC_LIST_SIZE_MAX

Maximum number of Source Addresses in list (see RFC 3376)

#define TAPI_IGMP3_TYPE_REPORT

IGMPv3 Membership report

#define TAPI_IGMP_IP4_TOS_DEFAULT

Default ToS for IGMPv2 messages is not stricted to any value

#define TAPI_IGMP_IP4_TTL_DEFAULT

Default TTL for IGMP messages is 1

#define TAPI_IGMP_QUERY_MAX_RESP_TIME_DEFAULT_S

Max Response Time default value in seconds, can be converted to Max Resp Code (see RFC 3376/RFC 2236, 8.3)

#define TAPI_IGMP_TYPE_QUERY

IGMP message types definition General/Group Query message

#define TAPI_MCAST_ADDR_ALL_HOSTS

IPv4 Multicast Address of All-Hosts group: 224.0.0.1

#define TAPI_MCAST_ADDR_ALL_MCR

IPv4 Multicast Address of All-Multicast-Routers IGMPv3 group: 224.0.0.22

#define TAPI_MCAST_ADDR_ALL_ROUTERS

IPv4 Multicast Address of All-Routers group: 224.0.0.2