#include <stdlib.h>
#include <stdbool.h>
#include <unistd.h>
#include "zlib.h"
#include "rpcclt_openapi.h"
#include "proc_util.h"
#define BST_RPC_PARM_DATA_AREA_MAX (256 * 1024)
#define BST_RPC_DEVMSG_DATA_MAX (BST_RPC_PARM_DATA_AREA_MAX * 2)
#define BST_MAX_COMPRESSED_LEN (BST_RPC_DEVMSG_DATA_MAX - 1024)
{
unsigned char compData[BST_MAX_COMPRESSED_LEN];
time_t time;
uLongf uncompressedLength = 0;
int retCode;
memset(&snapshot, 0, sizeof(snapshot));
memset(&compData, 0, sizeof(compData));
compSnapshot.
pstart = compData;
compSnapshot.
size =
sizeof(compData);
{
printf("Reading of compressed max snapshot of all buffers succeeded\n");
uncompressedLength = sizeof(snapshot);
retCode = uncompress((unsigned char *)&snapshot, &uncompressedLength,
(unsigned char *)compSnapshot.pstart, compSnapshot.size);
if (retCode == Z_OK)
{
printf("Successfully decompressed data\n");
}
else
{
printf("Unable to decompress data\n");
}
}
else
{
printf("Reading of compressed max snapshot of all buffers failed\n");
}
return result;
}
int main(int argc, char **argv)
{
char switch_os_revision_string[100];
int second,nanosecond,maxPhysPorts,maxHiGigPorts;
l7proc_crashlog_register();
char macAdd[100] = "\0";
char family[100] = "\0";
int asic = 0;
{
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");
mac.size = OPEN_MAC_ADDR_LEN;
mac.pstart = macAdd;
{
printf("Success to get System MAC Address: %.02X:%.02X:%.02X:%.02X:%.02X:%.02X\n",macAdd[0]&0xFF,
macAdd[1]&0xFF, macAdd[2]&0xFF, macAdd[3]&0xFF, macAdd[4]&0xFF, macAdd[5]&0xFF);
}
else
{
printf("Failure to get System MAC Address\n");
}
{
printf("Success to get System Time: %d seconds %d nanoseconds\n",second,nanosecond );
}
else
{
printf("Failure to get System Time\n" );
}
familyName.size = 100;
familyName.pstart = family;
{
printf("Success to get Chip Family Name: %s\n", (char *) familyName.pstart);
}
else
{
printf("Failure to get Chip Family Name\n");
}
{
printf("Success to get Chip Max Ports: MAX Physical ports: %d, and MAX Hi Gig Ports: %d\n",maxPhysPorts,maxHiGigPorts );
}
else
{
printf("Failure to get Chip Max Ports\n" );
}
{
printf("successfully retrieved asic capability\n");
}
else
{
printf("Unable to get asic capability.\n");
}
testBstMaxSnapshotCompressedGet(&clientHandle, asic);
L7PROC_LOGF(L7PROC_LOG_SEVERITY_INFO, 0, "Stopping System Information example application");
return 0;
}