OpenNSL API Guide and Reference Manual
Macros | Functions | Variables
example_l2_multicast.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sal/driver.h>
#include <opennsl/error.h>
#include <opennsl/l2.h>
#include <opennsl/multicast.h>
#include <examples/util.h>

Go to the source code of this file.

Macros

#define DEFAULT_UNIT   0
 
#define DEFAULT_VLAN   1
 
#define MCAST_GROUP_ID   10
 

Functions

int example_l2_entry_add (int unit, opennsl_mac_t mac, opennsl_vlan_t vlan, int is_mc, int dest_gport, int dest_mcg)
 To add an FDB entry.
 
int example_multicast_create (int unit, int mcg, int egress_mc)
 To create multicast group.
 
int main (int argc, char *argv[])
 Main function for Layer 2 multicast application.
 

Variables

char example_usage []
 

Macro Definition Documentation

#define DEFAULT_UNIT   0

Definition at line 38 of file example_l2_multicast.c.

Referenced by main().

#define DEFAULT_VLAN   1

Definition at line 39 of file example_l2_multicast.c.

Referenced by main().

#define MCAST_GROUP_ID   10

Definition at line 40 of file example_l2_multicast.c.

Referenced by main().

Function Documentation

int example_l2_entry_add ( int  unit,
opennsl_mac_t  mac,
opennsl_vlan_t  vlan,
int  is_mc,
int  dest_gport,
int  dest_mcg 
)

To add an FDB entry.

Parameters
unit[IN] Unit number
mac[IN] MAC address
vlan[IN] VLAN ID
is_mc[IN] Is MAC address a multicast
dest_gport[IN] destination port
dest_mcg[IN] destination multicast group
Returns
OPENNSL_E_xxx OpenNSL API return code

Definition at line 79 of file example_l2_multicast.c.

References opennsl_l2_addr_s::flags, opennsl_l2_addr_s::l2mc_group, OPENNSL_E_NONE, opennsl_l2_addr_add(), opennsl_l2_addr_t_init(), OPENNSL_L2_MCAST, OPENNSL_L2_STATIC, and opennsl_l2_addr_s::port.

Referenced by main().

int example_multicast_create ( int  unit,
int  mcg,
int  egress_mc 
)

To create multicast group.

Parameters
unit[IN] Unit number
mcg[IN] Multicast group ID
egress_mc[IN] Egress/Ingress multicast
Returns
OPENNSL_E_xxx OpenNSL API return code

Definition at line 109 of file example_l2_multicast.c.

References OPENNSL_E_NONE, opennsl_multicast_create(), OPENNSL_MULTICAST_EGRESS_GROUP, OPENNSL_MULTICAST_INGRESS_GROUP, OPENNSL_MULTICAST_TYPE_L2, and OPENNSL_MULTICAST_WITH_ID.

Referenced by main().

int main ( int  argc,
char *  argv[] 
)

Variable Documentation

char example_usage[]
Initial value:
=
"Syntax: example_l2_multicast \n\r"
" \n\r"
"Paramaters: None \n\r"
" \n\r"
"Example: The following command is used to create a multicast group \n\r"
" and add or delete multicast members. \n\r"
" example_l2_multicast \n\r"
" \n\r"
"Usage Guidelines: This program request the user to enter the following\n\r"
" parameters interactively \n\r"
" MAC address - Multicast group MAC address \n\r"
" port - Multicast group port members \n\r"
" \n\r"
" Testing: \n\r"
" 1) Add ports to the multicast group and verify that traffic \n\r"
" destined to Multicast MAC address is received by all \n\r"
" multicast group members. \n\r"
" 2) Remove a port from the multicast group and verify that \n\r"
" traffic destined to Multicast MAC address is not received \n\r"
" by removed multicast group member. \n\r"
" 3) Verify that traffic to unknown unicast MAC address is \n\r"
" received by all ports in the VLAN. \n\r"
" \n\r"

Definition at line 42 of file example_l2_multicast.c.