#include <stdlib.h>
#include <unistd.h>
#include "rpcclt_openapi.h"
#include "proc_util.h"
#define MACAL_NAME_MAX_LEN 256
static void printAppMenu(char *name)
{
printf("Usage: %s <test#> <arg1> <arg2> ... \n", name);
printf("Test 1: To create a new management ACAL: %s 1 <macalName>\n", name);
printf("Test 2: To delete an existing management ACAL: %s 2 <macalName>\n", name);
printf("Test 3: Sets VRF of a management ACAL: %s 3 <vrfName>\n", name);
printf("Test 4: Gets VRF of a management ACAL: %s 4 \n", name);
printf("Test 5: Activate a management ACAL: %s 5 <macalName>\n", name);
printf("Test 6: Deactivate a management ACAL: %s 6 <macalName>\n", name);
printf("Test 7: To add a management ACAL rule: %s 7 <macalName> <macalRulePrio>\n",
name);
printf("Test 8: To remove a rule from an existing ACAL: %s 8 <macalName>"
" <macalRulePrio>\n", name);
printf("Test 9: To add an action to management ACAL rule: %s 9 <macalName>"
" <macalRulePrio> <action>\n", name);
printf("Test 10: To add the source ip address and net mask to a management"
" ACAL rule: %s 10 <macalName> <macalRulePrio> <ipAddr> <mask>\n", name);
printf("Test 11: To add an interface (ethernet/LAG) to an existing management"
" ACAL rule: %s 11 <macalName> <macalRulePrio> <ifNum>\n", name);
printf("Test 12: To add a vlan to an existing management ACAL rule: %s 12 "
"<macalName> <macalRulePrio> <vlanId>\n", name);
printf("Test 13: To add a serviceport to an existing management ACAL rule:"
" %s 13 <macalName> <macalRulePrio> <isServicePort>\n", name);
printf("Test 14: Check if this management ACAL rule is for the service port:"
" %s 14 <macalName> <macalRulePrio> \n", name);
printf("Test 15: To add a service to management ACAL rule: %s 15 <macalName>"
" <macalRulePrio> <service>\n", name);
printf("Test 16: Get the name of the management ACAL already existing: %s 16\n",
name);
printf("Test 17: Get the active management ACAL: %s 17 \n", name);
printf("Test 18: Get the first management ACAL rule index: %s 18 <macalName>\n",
name);
printf("Test 19: Get the next management ACAL rule index: %s 19 <macalName>"
" <macalRulePrio> \n", name);
printf("Test 20: Check if this management ACAL rule with given priority exists:"
" %s 20 <macalName> <macalRulePrio>\n", name);
printf("Test 21: Get the action for a management ACAL rule: %s 21 <macalName>"
" <macalRulePrio>\n", name);
printf("Test 22: Get the source ip address and net mask of a management ACAL"
" rule: %s 22 <macalName> <macalRulePrio>\n", name);
printf("Test 23: Get the interface (ethernet/LAG) of an existing management "
"ACAL rule: %s 23 <macalName> <macalRulePrio>\n", name);
printf("Test 24: Get the vlan ID of an existing management ACAL rule: %s 24"
" <macalName> <macalRulePrio>\n", name);
printf("Test 25: Get the service of a management ACAL rule: %s 25 <macalName> "
"<macalRulePrio>\n", name);
printf("Test 26: Get the service port statistics for a management ACAL rule: "
"%s 26 <macalName> <macalRulePrio>\n", name);
printf("Test 27: Get the TCP/UDP port number of a management ACAL rule: %s 27 "
"<macalName> <macalRulePrio>\n", name);
printf("Test 28: Add the TCP/UDP port number to a management ACAL rule: %s 28"
" <macalName> <macalRulePrio> <portNum>\n", name);
printf("Test 29: Checks to see if a user has configured a field in a management"
" ACAL rule: %s 29 <macalName> <macalRulePrio> <ruleField> \n", name);
printf("Test 30: Check if a MACAL list is created: %s 30 \n", name);
printf("Test 31: Check if a MACAL list is activated: %s 31 \n", name);
printf("Test 32: Get the number of packets filtered: %s 32 \n", name);
printf("Test 33: Get the macal deny counter interval: %s 33 \n", name);
printf("Test 34: Set the macal deny counter interval: %s 34 <interval>\n", name);
printf("Test 35: Get the first available priority (index) for the specified "
"management ACAL: %s 35 <macalName>\n", name);
printf("Test 36: Checks the specified VRF name is valid or not: %s 36"
" <vrfName> \n", name);
printf("Test 37: Clears macal service port statistics: %s 37 \n", name);
printf("Test 38: Check if the Net Filter table support is present on this"
" platform: %s 38 <isSupported>\n", name);
return;
}
char *macalName)
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.
pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
{
printf("Bad return code trying to to create a new management ACAL."
" (result = %d)\n", result);
}
else
{
printf("MACAL list created successfully.\n");
}
return;
}
char *macalName)
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
{
printf("Bad return code trying to to delete an existing management"
" ACAL. (result = %d)\n", result);
}
else
{
printf("MACAL list deleted successfully.\n");
}
return;
}
char *vrfName)
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, vrfName, MACAL_NAME_MAX_LEN);
{
printf("Bad return code trying to sets VRF of a management ACAL."
" (result = %d)\n", result);
}
else
{
printf("VRF for MACAL set successfully.\n");
}
return;
}
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
{
printf("Bad return code trying to gets VRF of a management ACAL."
" (result = %d)\n", result);
}
else
{
printf("VRF of MACAL is : %s.\n", name);
}
return;
}
char *macalName)
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
{
printf("Bad return code trying to activate a management ACAL."
" (result = %d)\n", result);
}
else
{
printf("MACAL list activated.\n");
}
return;
}
char *macalName)
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
{
printf("Bad return code trying to deactivate a management ACAL."
" (result = %d)\n", result);
}
else
{
printf("MACAL list deactivated.\n");
}
return;
}
char *macalName, uint32_t macalRulePrio)
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
uint32_t priority = macalRulePrio;
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
{
printf("Bad return code trying to to add a management ACAL rule. "
"(result = %d)\n", result);
}
else
{
if (macalRulePrio == OPEN_MACAL_REQUEST_PRIORITY)
{
printf("MACAL rule added successfully and priority of the created "
"rule is %u\n", priority);
}
else
{
printf("MACAL rule added successfully.\n");
}
}
return;
}
char *macalName, uint32_t macalRulePrio)
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
{
printf("Bad return code trying to to remove a management rule from"
" an existing ACAL. (result = %d)\n", result);
}
else
{
printf("MACAL rule removed successfully.\n");
}
return;
}
char *macalName, uint32_t macalRulePrio,
OPEN_MACAL_ACTION_t action)
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
macalRulePrio, action))
{
printf("Bad return code trying to to add an action to management"
" ACAL rule. (result = %d)\n", result);
}
else
{
printf("MACAL rule action added successfully.\n");
}
return;
}
char *macalName, uint32_t macalRulePrio,
char *ipAddr, char *mask)
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
uint32_t inetIpAddr = 0;
char str[40] = "";
uint32_t inetMaskAddr = 0;
char maskStr[40] = "";
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
strncpy(str, ipAddr, sizeof(str) - 1);
strncpy(maskStr, mask, sizeof(maskStr) - 1);
{
printf("ERROR: Bad return code trying to convert internet address string "
"to a 32 bit integer.\n");
return;
}
macalRulePrio, inetIpAddr,
inetMaskAddr))
{
printf("Bad return code trying to to add the source ip address and "
"net mask to a management ACAL rule. (result = %d)\n", result);
}
else
{
printf("MACAL rule IP and mask added successfully.\n");
}
return;
}
char *macalName, uint32_t macalRulePrio,
uint32_t ifNum)
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
macalRulePrio, ifNum))
{
printf("Bad return code trying to to add an interface (ethernet/LAG) "
"to an existing management ACAL rule. (result = %d)\n", result);
}
else
{
printf("MACAL rule interface added successfully.\n");
}
return;
}
char *macalName, uint32_t macalRulePrio,
uint32_t vlanId)
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
macalRulePrio, vlanId))
{
printf("Bad return code trying to to add a vlan to an existing "
"management ACAL rule. (result = %d)\n", result);
}
else
{
printf("MACAL rule vlan added successfully.\n");
}
return;
}
char *macalName, uint32_t macalRulePrio,
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
macalRulePrio, isServicePort))
{
printf("Bad return code trying to to add a serviceport to an existing"
" management ACAL rule. (result = %d)\n", result);
}
else
{
printf("MACAL rule interface for service port added successfully.\n");
}
return;
}
char *macalName,
uint32_t macalRulePrio,
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
macalRulePrio,
isRuleForServicePort))
{
printf("Bad return code trying to check if this management ACAL rule is "
"for the service port. (result = %d)\n", result);
}
else
{
printf("Given MACAL rule index is %sfor serviceport.\n",
*isRuleForServicePort ==
OPEN_TRUE ?
"" :
"not ");
}
return;
}
char *macalName, uint32_t macalRulePrio,
OPEN_MACAL_SERVICE_t service)
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
macalRulePrio, service))
{
printf("Bad return code trying to to add a service to management "
"ACAL rule. (result = %d)\n", result);
}
else
{
printf("Service for MACAL rule added successfully.\n");
}
return;
}
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
{
printf("Bad return code trying to get the name of the management"
" ACAL already existing. (result = %d)\n", result);
}
else
{
printf("Name of the MACAL is : %s.\n", name);
}
return;
}
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
{
printf("Management ACAL is not activated.\n");
}
else
{
printf("Name of the active MACAL is : %s.\n", name);
}
return;
}
{
uint32_t macalRulePrio;
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
{
printf("Bad return code trying to get the first management ACAL rule."
" (result = %d)\n", result);
}
else
{
printf("Index of the first MACAL rule is : %d\n", macalRulePrio);
}
return;
}
char *macalName, uint32_t macalRulePrio,
uint32_t *nextmacalRulePrio)
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
macalRulePrio, nextmacalRulePrio))
{
printf("Bad return code trying to get the next management ACAL rule."
" (result = %d)\n", result);
}
else
{
printf("Index of the next MACAL rule is : %d\n", *nextmacalRulePrio);
}
return;
}
char *macalName, uint32_t macalRulePrio,
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
macalRulePrio, isIndexExists))
{
printf("Bad return code trying to check if this management ACAL "
"rule with given priority exists. (result = %d)\n", result);
}
else
{
printf("Rule with the given index %sexists.\n",
}
return;
}
char *macalName, uint32_t macalRulePrio,
OPEN_MACAL_ACTION_t *action)
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
macalRulePrio, action))
{
printf("Bad return code trying to get the action for a management "
"ACAL rule. (result = %d)\n", result);
}
else
{
printf("Rule action is : %u.\n", *action);
}
return;
}
char *macalName, uint32_t macalRulePrio)
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
char str[40] = "";
char maskStr[40] = "";
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
macalRulePrio, &(netIpAddr.
addr.
ipv4),
&(netMaskAddr.addr.ipv4)))
{
printf("Bad return code trying to get the source ip address and net "
"mask of a management ACAL rule. (result = %d)\n", result);
}
else
{
printf("IP address of a MACAl rule is : %s\n", str);
printf("Net mask of a MACAl rule is : %s\n", maskStr);
}
return;
}
char *macalName, uint32_t macalRulePrio,
uint32_t *ifNum)
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
macalRulePrio, ifNum))
{
printf("Bad return code trying to get the interface (ethernet/LAG) "
"of an existing management ACAL rule. (result = %d)\n", result);
}
else
{
printf("Interface of a MACAL rule is : %u.\n", *ifNum);
}
return;
}
char *macalName, uint32_t macalRulePrio,
uint32_t *vlanId)
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
macalRulePrio, vlanId))
{
printf("Bad return code trying to geta the vlan ID of an existing "
"management ACAL rule. (result = %d)\n", result);
}
else
{
printf("VLAN ID of a MACAL rule is : %u.\n", *vlanId);
}
return;
}
char *macalName, uint32_t macalRulePrio,
OPEN_MACAL_SERVICE_t *service)
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
macalRulePrio, service))
{
printf("Bad return code trying to get the service of a management"
" ACAL rule. (result = %d)\n", result);
}
else
{
printf("Service of a MACAL rule is : %u.\n", *service);
}
return;
}
char *macalName,
uint32_t macalRulePrio,
uint32_t *packets, uint32_t *bytes)
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
&buf, macalRulePrio,
packets, bytes))
{
printf("Bad return code trying to get the service port statistics for "
"a management ACAL rule. (result = %d)\n", result);
}
else
{
printf("Number of packets : %u.\n", *packets);
printf("Number of bytes : %u.\n", *bytes);
}
return;
}
char *macalName,
uint32_t macalRulePrio,
uint32_t *portNum)
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
&buf, macalRulePrio,
{
printf("Bad return code trying to get the TCP/UDP port number of a "
"management ACAL rule. (result = %d)\n", result);
}
else
{
printf("MACAL port number is : %u.\n", *portNum);
}
return;
}
char *macalName,
uint32_t macalRulePrio,
uint32_t portNum)
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
macalRulePrio, portNum))
{
printf("Bad return code trying to add the TCP/UDP port number to a"
" management ACAL rule. (result = %d)\n", result);
}
else
{
printf("Port number to MACAL rule added successfully.\n");
}
return;
}
char *macalName,
uint32_t macalRulePrio,
OPEN_MACAL_RULE_FIELD_t ruleField,
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
macalRulePrio, ruleField,
{
printf("Bad return code trying to checks to see if a user has configured"
" a field in a management ACAL rule. (result = %d)\n", result);
}
else
{
printf("Given rule field %sconfigured\n",
}
return;
}
{
{
printf("Bad return code trying to check if a MACAL list is created."
" (result = %d)\n", result);
}
else
{
printf(
"List %screated\n", *isCreated ==
OPEN_TRUE ?
"" :
"not ");
}
return;
}
{
{
printf("Bad return code trying to check if a MACAL list is activated. "
"(result = %d)\n", result);
}
else
{
printf(
"List %sactivated\n", *isActivated ==
OPEN_TRUE ?
"" :
"not ");
}
return;
}
uint32_t *filtPackets)
{
filtPackets))
{
printf("Bad return code trying to get the number of packets filtered."
" (result = %d)\n", result);
}
else
{
printf("Number of filtered packets : %u.\n", *filtPackets);
}
return;
}
uint32_t *interval)
{
{
printf("Bad return code trying to get the macal deny counter interval."
" (result = %d)\n", result);
}
else
{
printf("Deny counter interval : %u.\n", *interval);
}
return;
}
uint32_t interval)
{
{
printf("Bad return code trying to set the macal deny counter interval. "
"(result = %d)\n", result);
}
else
{
printf("Deny counter interval set successfully.\n");
}
return;
}
char *macalName,
uint32_t *macalRulePrio)
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, macalName, MACAL_NAME_MAX_LEN);
macalRulePrio))
{
printf("Bad return code trying to get the first available priority (index)"
" for the specified management ACAL. (result = %d)\n", result);
}
else
{
printf("First index in the given MACAL is : %u.\n", *macalRulePrio);
}
return;
}
{
char name[MACAL_NAME_MAX_LEN+1] = "";
open_buffdesc buf = {.pstart = name, .size = MACAL_NAME_MAX_LEN};
strncpy (name, vrfName, MACAL_NAME_MAX_LEN);
{
printf("Bad return code trying to checks the specified VRF name is "
"valid or not. (result = %d)\n", result);
}
else
{
printf("%s is %sa valid VRF.\n", vrfName,
}
return;
}
{
{
printf("Bad return code trying to clears macal service port statistics."
" (result = %d)\n", result);
}
else
{
printf("MACAL service port statistics cleared successfully.\n");
}
return;
}
{
isSupported))
{
printf("Bad return code trying to check if the Net Filter table support is"
" present on this platform. (result = %d\n", result);
}
else
{
printf("Filter table is %ssupported on this platform.\n",
}
return;
}
int main(int argc, char **argv)
{
uint32_t testNum, val, val1;
char switch_os_revision_string[100];
int show_help = 1;
OPEN_MACAL_SERVICE_t service;
if (argc < 2)
{
printAppMenu(argv[0]);
return -1;
}
testNum = atoi(argv[1]);
l7proc_crashlog_register();
{
printf("\nFailed to initialize RPC to OpEN. Exiting (result = %d)\n", result);
return -1;
}
{
sleep(1);
}
L7PROC_LOGF(L7PROC_LOG_SEVERITY_INFO, 0, "Starting Macal API example application");
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");
switch (testNum)
{
case 1:
if (argc == 3)
{
macalListCreate(&client_handle, argv[2]);
show_help = 0;
}
break;
case 2:
if (argc == 3)
{
macalListDelete(&client_handle, argv[2]);
show_help = 0;
}
break;
case 3:
if (argc == 3)
{
macalListVrfSet(&client_handle, argv[2]);
show_help = 0;
}
break;
case 4:
if (argc == 2)
{
macalListVrfGet(&client_handle);
show_help = 0;
}
break;
case 5:
if (argc == 3)
{
macalActivate(&client_handle, argv[2]);
show_help = 0;
}
break;
case 6:
if (argc == 3)
{
macalDeactivate(&client_handle, argv[2]);
show_help = 0;
}
break;
case 7:
if (argc == 4)
{
macalRuleEntryAdd(&client_handle, argv[2], atoi(argv[3]));
show_help = 0;
}
break;
case 8:
if (argc == 4)
{
macalRuleRemove(&client_handle, argv[2], atoi(argv[3]));
show_help = 0;
}
break;
case 9:
if (argc == 5)
{
macalRuleActionAdd(&client_handle, argv[2], atoi(argv[3]), atoi(argv[4]));
show_help = 0;
}
break;
case 10:
if (argc == 6)
{
macalRuleSrcIpMaskAdd(&client_handle, argv[2], atoi(argv[3]),
argv[4], argv[5]);
show_help = 0;
}
break;
case 11:
if (argc == 5)
{
macalRuleInterfaceAdd(&client_handle, argv[2], atoi(argv[3]), atoi(argv[4]));
show_help = 0;
}
break;
case 12:
if (argc == 5)
{
macalRuleVlanAdd(&client_handle, argv[2], atoi(argv[3]), atoi(argv[4]));
show_help = 0;
}
break;
case 13:
if (argc == 5)
{
macalRuleServicePortSet(&client_handle, argv[2], atoi(argv[3]),
atoi(argv[4]));
show_help = 0;
}
break;
case 14:
if (argc == 4)
{
macalRuleIsServicePortSet(&client_handle, argv[2], atoi(argv[3]),
&flag);
show_help = 0;
}
break;
case 15:
if (argc == 5)
{
macalRuleServiceAdd(&client_handle, argv[2], atoi(argv[3]), atoi(argv[4]));
show_help = 0;
}
break;
case 16:
if (argc == 2)
{
macalNameGet(&client_handle);
show_help = 0;
}
break;
case 17:
if (argc == 2)
{
macalActiveListGet(&client_handle);
show_help = 0;
}
break;
case 18:
if (argc == 3)
{
macalRuleFirstGet(&client_handle, argv[2]);
show_help = 0;
}
break;
case 19:
if (argc == 4)
{
macalRuleNextGet(&client_handle, argv[2], atoi(argv[3]), &val);
show_help = 0;
}
break;
case 20:
if (argc == 4)
{
macalRuleExists(&client_handle, argv[2], atoi(argv[3]), &flag);
show_help = 0;
}
break;
case 21:
if (argc == 4)
{
macalRuleActionGet(&client_handle, argv[2], atoi(argv[3]), &val);
show_help = 0;
}
break;
case 22:
if (argc == 4)
{
macalRuleSrcIpMaskGet(&client_handle, argv[2], atoi(argv[3]));
show_help = 0;
}
break;
case 23:
if (argc == 4)
{
macalRuleInterfaceGet(&client_handle, argv[2], atoi(argv[3]), &val);
show_help = 0;
}
break;
case 24:
if (argc == 4)
{
macalRuleVlanGet(&client_handle, argv[2], atoi(argv[3]), &val);
show_help = 0;
}
break;
case 25:
if (argc == 4)
{
macalRuleServiceGet(&client_handle, argv[2], atoi(argv[3]), &service);
show_help = 0;
}
break;
case 26:
if (argc == 4)
{
macalServicePortRuleStatisticsGet(&client_handle, argv[2],
atoi(argv[3]), &val, &val1);
show_help = 0;
}
break;
case 27:
if (argc == 4)
{
macalRuleTcpUdpPortNumberGet(&client_handle, argv[2], atoi(argv[3]), &val);
show_help = 0;
}
break;
case 28:
if (argc == 5)
{
macalRuleTcpUdpPortNumberAdd(&client_handle, argv[2], atoi(argv[3]),
atoi(argv[4]));
show_help = 0;
}
break;
case 29:
if (argc == 5)
{
macalIsFieldConfigured(&client_handle, argv[2], atoi(argv[3]),
atoi(argv[4]), &flag);
show_help = 0;
}
break;
case 30:
if (argc == 2)
{
macalIsAnyListCreated(&client_handle, &flag);
show_help = 0;
}
break;
case 31:
if (argc == 2)
{
macalIsAnyListActivated(&client_handle, &flag);
show_help = 0;
}
break;
case 32:
if (argc == 2)
{
macalStatsPacketsFilteredGet(&client_handle, &val);
show_help = 0;
}
break;
case 33:
if (argc == 2)
{
macalDenyCounterIntervalGet(&client_handle, &val);
show_help = 0;
}
break;
case 34:
if (argc == 3)
{
macalDenyCounterIntervalSet(&client_handle, atoi(argv[2]));
show_help = 0;
}
break;
case 35:
if (argc == 3)
{
macalRulePriorityIndexGet(&client_handle, argv[2], &val);
show_help = 0;
}
break;
case 36:
if (argc == 3)
{
macalVrfNameValid(&client_handle, argv[2], &flag);
show_help = 0;
}
break;
case 37:
if (argc == 2)
{
macalClearServicePortStatistics(&client_handle);
show_help = 0;
}
break;
case 38:
if (argc == 2)
{
macalIsNetFilterTablesFeatureSupported(&client_handle, &flag);
show_help = 0;
}
break;
default:
break;
}
if (show_help == 1)
{
printAppMenu(argv[0]);
}
L7PROC_LOGF(L7PROC_LOG_SEVERITY_INFO, 0, "Stopping Macal API example application");
return 0;
}