#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];
char ipAddr[16];
uint32_t intIpAddr = 0;
uint32_t decimalIpValue = 0;
uint32_t ifNum = 0;
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");
strcpy(ipAddr, "1.2.3.4");
strIpAddr.pstart = ipAddr;
strIpAddr.size = strlen(ipAddr)+1;
{
printf("Bad return code trying to convert internet address string to a 32 bit integer. result = %d\n", result);
return 1;
}
else
{
printf("IP address is: string - \"%s\" integer - \"%d\" \n", ipAddr, intIpAddr);
}
{
printf("Bad return code trying to get first physical interface. result = %d\n", result);
return 1;
}
{
printf("The specified address entry does not exist. result = %d\n", result);
}
else
{
printf("Specified address entry exists.\n");
}
{
printf("The first interface (%d) does not contain an address entry. result = %d\n", ifNum, result);
}
else
{
printf("The first interface (%d) contains address entry %d.\n", ifNum, intIpAddr);
}
{
printf("The second interface (%d) does not contain an address entry. result = %d\n", ifNum, result);
}
else
{
printf("The second interface (%d) contains address entry %d.\n", ifNum, intIpAddr);
}
decimalIpValue = 0;
{
printf("The last interface index value does not exist. result = %d\n", result);
}
else
{
printf("The last interface index value is: %u\n", decimalIpValue);
}
decimalIpValue = 0;
{
printf("Bad return code trying to get the subnet mask. result = %d\n", result);
}
else
{
printf("IP Address (digital value) is: %d\n", intIpAddr);
printf("Subnet mask (digital value) is: %u\n", decimalIpValue);
}
decimalIpValue = 0;
{
printf("Bad return code trying to get the value of the least-significant bit in the IP broadcast address. result = %d\n", result);
}
else
{
printf("Value of the least-significant bit in the IP broadcast address is: %u\n", decimalIpValue);
}
decimalIpValue = 0;
{
printf("Bad return code trying to get the size of the largest IP datagram. result = %d\n", result);
}
else
{
printf("Size of the largest IP datagram is: %u\n", decimalIpValue);
}
L7PROC_LOGF (L7PROC_LOG_SEVERITY_INFO, 0, "Stopping IP API example application");
return 0;
}