#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 buffer[256] = {0};
char bridgeAddress[40] = {0};
uint32_t bridgeDigit = 0;
uint64_t bridgeTime = 0;
uint16_t value = 0;
uint32_t numPorts = 0;
l7proc_crashlog_register();
{
printf("\nFailed to initialize RPC to OpEN. Exiting result = %d.\n", result);
exit(2);
}
{
sleep(1);
}
L7PROC_LOGF(L7PROC_LOG_SEVERITY_INFO, 0, "Starting Bridge 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");
string.pstart = bridgeAddress;
string.size = sizeof(bridgeAddress);
{
printf("Bad return code when we are trying to get the unique MAC address. result = %d.\n", result);
}
else
{
printf("Bridge MAC address is: %s. Bridge MAC address lenght is: %d.\n",
bridgeAddress, string.size);
}
{
printf("Bridge base type is: %d.\n", bridgeDigit);
}
{
printf("Bad return code when we are trying to get base type of bridging.\n Returned values are invalid. result = %d.\n", result);
}
{
printf("Bad return code when we are trying to get base type of bridging.\n Counter requested does not exist. result = %d.\n", result);
}
else
{
printf("Bad return code when we are trying to get base type of bridging. Error in parameter passed. Exiting. result = %d.\n", result);
}
{
{
printf("Number of ports controlled by bridging entity is: %d.\n", numPorts);
}
{
printf("Bad return code when we are trying to get base type of bridging.\n Returned values are invalid. result = %d.\n", result);
}
else
{
printf("Bad return code when we are trying to get base type of bridging. Error in parameter passed. Exiting. result = %d.\n", result);
}
}
{
printf("Bad return code when we are trying to get number of ports controlled by bridging entity.\n Returned values are invalid. result = %d.\n", result);
}
{
printf("Bad return code when we are trying to get number of ports controlled by bridging entity.\n Counter requested does not exist. result = %d.\n", result);
}
else
{
printf("Bad return code when we are trying to get number of ports controlled by bridging entity. Error in parameter passed. Exiting. result = %d.\n", result);
}
string.pstart = buffer;
string.size = sizeof(buffer);
{
printf("Name of an object instance unique to this port is: %s.\n", buffer);
}
{
printf("Returned values are invalid. result = %d.\n", result);
}
{
printf("Counter requested does not exist. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("Interface index is: %d.\n", bridgeDigit);
}
{
printf("Bad return code when we are trying to get interface index.\n Returned values are invalid. result = %d.\n", result);
}
{
printf("Counter requested does not exist. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("Number of frames discarded by this port due to delay through the bridge is: %d.\n", bridgeDigit);
}
{
printf("Bad return code when we are trying to get number of frames. \nReturned values are invalid. result = %d.\n", result);
}
{
printf("Bad return code when we are trying to get number of frames. result = %d.\n", result);
}
{
printf("Feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("Number of frames discarded by this port due to delay through the bridge is: %d.\n", bridgeDigit);
}
{
printf("Returned values are invalid. result = %d.\n", result);
}
{
printf("Bad return code when we are trying to get number of frames. result = %d.\n", result);
}
{
printf("Feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
switch (bridgeDigit)
{
case OPEN_STP_PROTOCOL_SPEC_IEEE8021D:
printf("STP protocol is IEEE8021D(dot1dBridge).\n");
break;
case OPEN_STP_PROTOCOL_SPEC_UNKNOWN:
printf("STP protocol is unknown.\n");
break;
default:
printf("Error.\n");
break;
}
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("Spanning tree bridge priority is: %d.\n", bridgeDigit);
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("Time since last topology change is: %d.\n", bridgeDigit);
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("STP change count is: %d.\n", bridgeDigit);
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
string.pstart = buffer;
string.size = sizeof(buffer);
{
printf("STP designated root is: %s .\n", buffer);
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("Cost of the path is: %d.\n", bridgeDigit);
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("Port number with lowest cost path from bridge to the root bridge is: %d.\n", bridgeDigit);
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("STP max age is: %d.\n", bridgeDigit);
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("STP hello time is: %d.\n", bridgeDigit);
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("STP hold time is: %d.\n", bridgeDigit);
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("STP forward delay is: %d.\n", bridgeDigit);
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("STP bridge max age is: %d.\n", bridgeDigit);
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("STP bridge hello time is: %d.\n", bridgeDigit);
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("STP bridge forward delay is: %d.\n", bridgeDigit);
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("STP port priority is: %d.\n", bridgeDigit);
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
if (bridgeDigit == true)
{
printf("Member was removed.\n");
}
else
{
printf("Member was not removed.\n");
}
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
{
printf("Next member is: %d.\n", bridgeDigit);
}
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("STP port state is: ");
switch (bridgeDigit)
{
case OPEN_DOT1D_BLOCKING:
printf("blocking.\n");
break;
case OPEN_DOT1D_LISTENING:
printf("listening.\n");
break;
case OPEN_DOT1D_LEARNING:
printf("learning.\n");
break;
case OPEN_DOT1D_FORWARDING:
printf("forwarding.\n");
break;
case OPEN_DOT1D_DISABLED:
printf("disabled.\n");
break;
case OPEN_DOT1D_MANUAL_FWD:
printf("manual FWD.\n");
break;
case OPEN_DOT1D_NOT_PARTICIPATE:
printf("participate.\n");
break;
default:
printf("Error.\n");
break;
}
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("STP port path cost is: %d.\n", bridgeDigit);
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
string.pstart = buffer;
string.size = sizeof(buffer);
{
printf("STP designated root for the switch is: %s.\n", buffer);
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("STP designated cost for port[%d] is: %d.\n", numPorts, bridgeDigit);
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
string.pstart = buffer;
string.size = sizeof(buffer);
{
printf("STP designated bridge for port[%d] is: %s .\n", numPorts, buffer);
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("STP designated port id for port[%d] is: %d.\n", numPorts, value);
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("Number of times port has transitioned from Learning to Forwarding state is: %d.\n", bridgeDigit);
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("Number of discarded entries is: %d.\n", bridgeDigit);
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
{
printf("Fail to get number of discarded entries. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("Timeout period for aging out dynamically learned forwarding information is: %d.\n", bridgeDigit);
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
{
printf("Fail to get timeout period. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("Timeout period for aging out dynamically learned forwarding information was successful set.\n");
}
{
printf("Parameter/feature is not supported. result = %d.\n", result);
}
{
printf("Fail to set timeout period. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
string.pstart = bridgeAddress;
string.size = sizeof(bridgeAddress);
{
printf("Specific unicast MAC address is: %02x:%02x:%02x:%02x:%02x:%02x.\n",
bridgeAddress[0], bridgeAddress[1], bridgeAddress[2], bridgeAddress[3], bridgeAddress[4], bridgeAddress[5]);
}
{
printf("Fail to get specific unicast MAC address. result = %d.\n", result);
}
else
{
printf("Bad return code when we are trying to get the specific unicast MAC address. result = %d.\n", result);
}
string.pstart = bridgeAddress;
string.size = sizeof(bridgeAddress);
{
printf("Specific unicast MAC address is: %02x:%02x:%02x:%02x:%02x:%02x.\n",
bridgeAddress[0], bridgeAddress[1], bridgeAddress[2], bridgeAddress[3], bridgeAddress[4], bridgeAddress[5]);
}
{
printf("Fail to get specific unicast MAC address. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
string.pstart = bridgeAddress;
string.size = sizeof(bridgeAddress);
{
printf("MAC address is: %02x:%02x:%02x:%02x:%02x:%02x. Port number is: %d.\n",
bridgeAddress[0], bridgeAddress[1], bridgeAddress[2], bridgeAddress[3], bridgeAddress[4], bridgeAddress[5], bridgeDigit);
}
{
printf("Fail to get MAC address or port number. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
string.pstart = bridgeAddress;
string.size = sizeof(bridgeAddress);
{
printf("MAC address is: %02x:%02x:%02x:%02x:%02x:%02x. Port status is: %d.\n",
bridgeAddress[0], bridgeAddress[1], bridgeAddress[2], bridgeAddress[3], bridgeAddress[4], bridgeAddress[5], bridgeDigit);
}
{
printf("Fail to get MAC address or port number. result = %d.\n", result);
}
else
{
printf("Bad return code when we are trying to get the MAC address or port number. result = %d.\n", result);
}
{
printf("Maximum size of the INFO field this port will receive or transmit is: %d.\n", bridgeDigit);
}
{
printf("Fail to get maximum size. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("Number of frames received by this port from its segment is: %d.\n", bridgeDigit);
}
{
printf("Fail to get number of frames. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("Number of frames transmitted by this port to its segment is: %d.\n", bridgeDigit);
}
{
printf("Fail to get number of frames. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
{
printf("Count of valid frames received which were discarded by the Forwarding Process is: %d.\n", bridgeDigit);
}
{
printf("Fail to get valid frames. result = %d.\n", result);
}
else
{
printf("Error in parameter passed. Exiting. result = %d.\n", result);
}
return 1;
}