#include <stdlib.h>
#include <unistd.h>
#include "rpcclt_openapi.h"
#include "proc_util.h"
int main(int argc, char **argv)
{
char switch_os_revision_string[100] = {0};
char bufMaskIn[1000] = {0};
char bufMaskOut[1000] = {0};
uint32_t processedFrames = 0;
uint32_t forwardedFrames = 0;
uint32_t intIfNum = 1;
uint32_t queryTime = 0;
uint32_t responseTime = 0;
uint16_t vlanResponseTime = 0;
uint32_t vlanID = 1;
uint32_t auto_vlan = 0;
maskIn.
pstart = bufMaskIn;
maskIn.
size =
sizeof(bufMaskIn);
maskOut.pstart = bufMaskOut;
maskOut.size = sizeof(bufMaskOut);
l7proc_crashlog_register();
{
printf("\nFailed to initialize RPC to OpEN. Exiting (Result = %d)\n", result);
exit(2);
}
{
sleep(1);
}
printf ("\n");
switch_os_revision.pstart = switch_os_revision_string;
switch_os_revision.size = sizeof(switch_os_revision_string);
{
printf ("Network OS version = %s\n", switch_os_revision_string);
}
else
{
printf ("Network OS version retrieve error\n");
}
printf ("\n");
do
{
{
printf("Failed to check if the passed family type snooping is supported or not. (Result = %d)\n", result);
break;
}
{
printf("Family type isn't supported\n");
break;
}
else
{
printf("Family type is supported\n");
}
{
printf("Failed to retrieve the IGMP Snooping Admin mode. (Result = %d)\n", result);
}
else
{
printf("The IGMP Snooping Admin mode is: %d\n", mode);
}
{
printf("Failed to set the IGMP Snooping Admin mode. (Result = %d)\n", result);
}
else
{
printf("The IGMP Snooping Admin mode set with value: %d\n", mode);
}
{
printf("Failed to retrieve the number of multicast control frames processed. (Result = %d)\n", result);
}
else
{
printf("The number of multicast control frames processed is: %d\n", processedFrames);
}
{
printf("Failed to retrieve the number of multicast data frames forwarded. (Result = %d)\n", result);
}
else
{
printf("The number of multicast data frames forwarded is: %d\n", forwardedFrames);
}
{
printf("Failed to retrieve the IGMP/MLD Proxy Querier Admin mode. (Result = %d)\n", result);
}
else
{
printf("The IGMP/MLD Proxy Querier Admin mode is: %d\n", mode);
}
{
printf("Failed to set the IGMP/MLD Proxy Querier Admin mode. (Result = %d)\n", result);
}
else
{
printf("The IGMP/MLD Proxy Querier Admin mode set with value: %d\n", mode);
}
{
printf("Failed to retrieve the configured mode for flooding unknown multicast traffic. (Result = %d)\n", result);
}
else
{
printf("The configured mode for flooding unknown multicast traffic is: %d\n", floodAll);
}
{
printf("Failed to set the configured mode for flooding unknown multicast traffic. (Result = %d)\n", result);
}
else
{
printf("The configured mode for flooding unknown multicast traffic set with value: %d\n", floodAll);
}
strcpy((char *)maskIn.pstart, "1,3,5,10");
maskIn.size = strlen((char *)maskIn.pstart) + 1;
{
printf("Failed to set the interface mask of interfaces enabled for IGMP Snooping. (Result = %d)\n", result);
}
else
{
printf("The the interface mask of interfaces enabled for IGMP Snooping set with mask: %s\n", (char *)maskIn.pstart);
}
{
printf("Failed to retrive the interface mask of interfaces enabled for IGMP Snooping. (Result = %d)\n", result);
}
else
{
printf("The interface mask of interfaces enabled for IGMP Snooping is: %s\n", (char *)maskOut.pstart);
}
{
printf("Failed to check if interface is a valid IGMP snooping Interface. (Result = %d)\n", result);
break;
}
{
printf("Interface %d isn't valid\n", intIfNum);
break;
}
else
{
printf("Interface %d is valid\n", intIfNum);
}
{
printf("Failed to retrieve IGMP Snooping mode for the interface %d. (Result = %d)\n", intIfNum, result);
}
else
{
printf("The IGMP Snooping mode for the interface %d is: %d\n", intIfNum, mode);
}
{
printf("Failed to set the IGMP Snooping mode for the interface %d. (Result = %d)\n", intIfNum, result);
}
else
{
printf("The IGMP Snooping mode for the interface %d set with value: %d\n", intIfNum, mode);
}
{
printf("Failed to retrieve IGMP group membership interval for the interface %d. (Result = %d)\n", intIfNum, result);
}
else
{
printf("The IGMP group membership interval for the interface %d is: %d\n", intIfNum, queryTime);
}
{
printf("Failed to set the IGMP group membership interval for the interface %d. (Result = %d)\n", intIfNum, result);
}
else
{
printf("The IGMP group membership interval for the interface %d set with value: %d\n", intIfNum, queryTime);
}
{
printf("Failed to retrieve IGMP query response time for the interface %d. (Result = %d)\n", intIfNum, result);
}
else
{
printf("The IGMP query response time for the interface %d is: %d\n", intIfNum, responseTime);
}
{
printf("Failed to set the IGMP query response time for the interface %d. (Result = %d)\n", intIfNum, result);
}
else
{
printf("The IGMP query response time for the interface %d set with value: %d\n", intIfNum, responseTime);
}
{
printf("Failed to retrieve Fast-Leave Admin mode for the interface %d. (Result = %d)\n", intIfNum, result);
}
else
{
printf("The Fast-Leave Admin mode for the interface %d is: %d\n", intIfNum, mode);
}
{
printf("Failed to set the Fast-Leave Admin mode for the interface %d. (Result = %d)\n", intIfNum, result);
}
else
{
printf("The Fast-Leave Admin mode for the interface %d set with value: %d\n", intIfNum, mode);
}
{
printf("Failed to retrieve Proxy Querier Admin mode for the interface %d. (Result = %d)\n", intIfNum, result);
}
else
{
printf("The Proxy Querier Admin mode for the interface %d is: %d\n", intIfNum, mode);
}
{
printf("Failed to set the Proxy Querier Admin mode for the interface %d. (Result = %d)\n", intIfNum, result);
}
else
{
printf("The Proxy Querier Admin mode for the interface %d set with value: %d\n", intIfNum, mode);
}
{
printf("Failed to flush all entries. (Result = %d)\n", result);
}
else
{
printf("All entries flushed successful.\n");
}
printf("---Snooping VLAN---\n");
do
{
{
printf("Vlan ID is: %d.\n", vlanID);
}
else
{
{
printf("Vlan ID is: %d.\n", vlanID);
}
else
{
printf("Failed to get vlan ID.\n");
break;
}
}
{
printf("Snooping fast leave mode is: ");
{
printf("enabled.\n");
}
{
printf("disabled.\n");
}
else
{
printf("undefined.\n");
}
}
else
{
printf("Failed to get fast leave mode.\n");
}
{
printf("IGMP snooping maximum response time for the specified VLAN[%d] is: %d ", vlanID, vlanResponseTime);
}
else
{
printf("Failed to get IGMP snooping maximum response time for the specified VLAN.\n");
}
{
printf("IGMP snooping maximum response time for the specified VLAN was set successfully\n");
}
else
{
printf("Failed to set IGMP snooping maximum response time for the specified VLAN.\n");
}
{
printf("Failed to retrieve the IGMP Snooping VLAN mode. (Result = %d)\n", result);
}
else
{
printf("IGMP Snooping VLAN mode for the specified VLAN[%d] is: %d\n", vlanID, vlanMode);
}
{
printf("Failed to set the IGMP Snooping VLAN mode. (Result = %d)\n", result);
}
else
{
printf("IGMP Snooping VLAN mode for the specified VLAN[%d] is set with value: %d\n", vlanID, vlanMode);
}
{
printf("Failed to retrieve the IGMP Snooping Auto-Video mode. (Result = %d)\n", result);
}
else
{
printf("IGMP Snooping Auto-Video mode is: %s\n",
}
{
printf("Failed to set the IGMP Snooping Auto-Video mode. (Result = %d)\n", result);
}
else
{
printf("IGMP Snooping Auto-Video mode is set with value: %s\n",
}
{
printf("Failed to retrieve the IGMP Snooping Auto-Video VLAN ID. (Result = %d)\n", result);
}
else
{
printf("IGMP Snooping Auto-Video VLAN is: %d\n", auto_vlan);
}
break;
}while (true);
printf("Press enter to continue...\n");
getchar();
} while (0);
L7PROC_LOGF(L7PROC_LOG_SEVERITY_INFO, 0, "Stopping Snooping API example application");
return 0;
}