This chapter describes the features and operations of the Nonblocking API and provides code examples. It also introduces the result handler callbacks, a feature unique to the Nonblocking API.
•Nonblocking API C++ Code Examples
•Nonblocking API C Code Examples
The Nonblocking API supports an unlimited number of threads calling its methods simultaneously.
Note In a multithreaded scenario for the Nonblocking API, the order of invocation is guarenteed. The API performs operations in the same chronological order in which they are called.
The Nonblocking API enables you to set result handler callbacks. The result handler callbacks are two functions for handleSuccess and handleError, as shown in the following code:
/* operation failure callback specification */
typedef void (*OperationFailCallBackFunc)(Uint32 argHandle,
ReturnCode *argReturnCode);
/* operation success callback specification */
typedef void (*OperationSuccessCallBackFunc)(Uint32 argHandle,
ReturnCode *argReturnCode);
You should implement these callbacks if you want to be informed about the success or error results of operations performed by using the API.
Note This is the only interface for retrieving results. Results cannot be returned immediately after the API method has returned to the caller.
Both handleSuccess and handleError callbacks accept two parameters:
•Handle—The return value of each operation is a handle of type Uint32. This handle enables correlation of operation calls and their results. When a handle... operation is called with a handle of value X, the result matches the operation that returned the same handle value (X) to the caller.
•Result—The actual result of the operation returned as a pointer of type ResultCode.
The following example is a basic implementation of a result handler that counts the number of success or failure operations. The result handler method initiates the API and assigns a result handler.
For correct operation of the result handler, follow the code sequence given in the following example.
Note This example does not demonstrate the use of callback handles.
#include "GeneralDefs.h"
#include "SmApiNonBlocking.h"
#include <stdio.h>
int successCnt = 0;
int failCnt = 0;
void onOperationFail(Uint32 argHandle, ReturnCode* argReturnCode)
{
failCnt++;
if (argReturnCode != NULL)
{
freeReturnCode(argReturnCode);
}
}
void onOperationSuccess(Uint32 argHandle, ReturnCode* argReturnCode)
{
successCnt++;
if (argReturnCode != NULL)
{
freeReturnCode(argReturnCode);
}
}
int main(int argc, char* argv[])
{
if (argc != 2)
{
printf("usage: ResultHandlerExample <sm-ip>");
exit(1);
}
//note the order of operations!
SmApiNonBlocking nbapi;
nbapi.init();
nbapi.connect(argv[1]);
nbapi.setReplyFailCallBack(onOperationFail);
nbapi.setReplySuccessCallBack(onOperationSuccess);
nbapi.login(...);
...
nbapi.disconnect();
return 0;
}
This section lists the methods of the Nonblocking API.
Some of the methods return a non-negative int handle that can be used to correlate operation calls and their results (see the "Result Handler Callbacks" section). If an internal error occurred, a negative value is returned and the operation is not performed.
The operation results passed to the result handler callbacks are the same as the return values described in the same method in the Blocking API section (see the "Blocking API" section), except that return values of void are translated to NULL.
Note The error and fail callback is handed with an error only if the matching operation in the Blocking API would return an error code with the same arguments according to the Cisco Service Control Subscriber Manager database state at the time of the call.
The C and C++ API share the same function signature, except for SMNB_ prefix for all Nonblocking C APIs function names, and an API handle of type SMNB_HANDLE as the first parameter in all functions. The function description indicates any other differences between the APIs.
The following methods are described:
The following section provides login operation syntax information.
The login syntax:
int login(char* argName,
char** argMappings,
MappingType* argMappingTypes,
int argMappingsSize,
char** argPropertyKeys,
char** argPropertyValues,
int argPropertySize,
char* argDomain,
bool argIsAdditive,
int argAutoLogoutTime)
The operation functionality is the same as the matching Blocking API operation. See the "login" section for more information.
The following section provides information about the logoutByName operation syntax.
The logoutByName syntax is as follows:
int logoutByName(char* argName,
char** argMappings,
MappingType* argMappingTypes,
int argMappingsSize)
The operation functionality is the same as the matching Blocking API operation. See the "logoutByName" section for more information.
The following section provides information about the logoutByNameFromDomain operation syntax.
The logoutByNameFromDomain syntax is as follows:
int logoutByNameFromDomain (char* argName,
char** argMappings,
MappingType* argMappingTypes,
int argMappingsSize,
char* argDomain)
The operation functionality is the same as the matching Blocking API operation. See the "logoutByNameFromDomain" section for more information.
The following section provides information about the logoutByMapping operation syntax.
The logoutByMapping syntax is as follows:
int logoutByMapping(char* argMapping,
MappingType argMappingType,
char* argDomain)
The operation functionality is the same as the matching Blocking API operation. See the "logoutByMapping" section for more information.
The following section provides information about the loginCable operation syntax.
The loginCable syntax is as follows:
int loginCable(char* argCpe,
char* argCm,
char* argIp,
int argLease,
char* argDomain,
char** argPropertyKeys,
char** argPropertyValues,
int argPropertySize)
The operation functionality is the same as the matching Blocking API operation. See the "loginCable" section for more information.
The following section provides information about the logoutCable operation syntax.
The logoutCable syntax is as follows:
int logoutCable(char* argCpe,
char* argCm,
char* argIp,
char* argDomain)
The operation functionality is the same as the matching Blocking API operation. See the "logoutCable" section for more information.
The following section provides information about the C++ setLogger method operation syntax.
The C++ setLogger Method syntax is as follows:
void setLogger(Logger *argLogger)
The operation functionality is the same as the matching Blocking API operation. See the "C++ setLogger Method" section for more information.
The following section provides information about the C++ init method operation syntax.
The C++ init Method syntax is as follows:
Bool init(int argThreadPriority = 0,
Uint32 argBufferSize = DEFAULT_BUFFER_SIZE,
Uint32 argKeepAliveDuration = DEFAULT_KEEP_ALIVE_DURATION,
Uint32 argConnectionTimeout= DEFAULT_CONNECTION_TIMEOUT,
Uint32 argReconnectTimeout = NO_RECONNECT)
The operation functionality is the same as the matching Blocking API operation. See the "C++ init Method" section for more information.
The following sections provide information about the C SMNB_init function operation:
The C SMNB_init function syntax is as follows:
SMNB_HANDLE SMNB_init(int argThreadPriority,
Uint32 argBufferSize,
Uint32 argKeepAliveDuration,
Uint32 argConnectionTimeout)
The operation functionality is the same as the matching Blocking API operation. See the "C SMB_init Function" section for more information.
The return value is a SMNB_HANDLE handle to the API. A NULL handle means, the initialization has failed.
The following section provides information about the C SMNB_release function syntax.
The C SMNB_release function syntax is as follows:
void SMNB_release(SMNB_HANDLE argApiHandle)
The operation functionality is the same as the matching Blocking API operation. See the "C SMB_release Function" section for more information.
The following section provides information about the setReconnectTimeout operation syntax.
The setReconnectTimeout syntax is as follows:
void setReconnectTimeout(Uint32 reconnectTimeout)
The operation functionality is the same as the matching Blocking API operation. See the "setReconnectTimeout" section for more information.
The following section provides information about the setName operation syntax.
The setName syntax is as follows:
void setName(char *argName)
The operation functionality is the same as the matching Blocking API operation. See the "setName" section for more information.
The following section provides information about the connect operation syntax.
The connect syntax is as follows:
bool connect(char* argHostName, Uint16 argPort = 14374)
The operation functionality is the same as the matching Blocking API operation. See the "connect" section for more information.
The following section provides information about the disconnect operation syntax.
The disconnect syntax is as follows:
bool disconnect()
The operation functionality is the same as the matching Blocking API operation. See the "disconnect" section for more information.
The following section provides information about the isConnected operation syntax.
The isConnected syntax is as follows:
bool isConnected()
The operation functionality is the same as the matching Blocking API operation. See the "isConnected" section for more information.
This section provides a code example for logging in and logging out subscribers.
The following example logs in a predefined number of subscribers to the Cisco Service Control Subscriber Manager and then logs them out. Note the implementation of a disconnect listener and a result handler.
#include "SmApiNonBlocking.h"
#include <stdio.h>
void connectionIsDown()
{
printf("disconnect listener callback:: connection is down\n");
}
int count = 0;
//prints every error that occurs
void handleError(Uint32 argHandle, ReturnCode* argReturnCode)
{
++count;
printf("\terror %d:\n",count);
printReturnCode(argReturnCode);
freeReturnCode(argReturnCode);
}
//prints a success result every 100 results
void handleSuccess(Uint32 argHandle, ReturnCode* argReturnCode)
{
if (++count%100 == 0)
{
printf("\tresult %d:\n",count);
printReturnCode(argReturnCode);
}
freeReturnCode(argReturnCode);
}
//waits for result number 'last result' to arrive
void waitForLastResult(int lastResult)
{
while (count<lastResult)
{
::Sleep(100);
}
}
void checkTheArguments(int argc, char* argv[])
{
if (argc != 4)
{
printf("usage: LoginLogout <SM-address> <domain> <num-susbcribers>");
exit(1);
}
}
void main (int argc, char* argv[])
{
//check arguments
checkTheArguments(argc, argv);
int numSubscribersToLogin = atoi(argv[3]);
//instantiation
SmApiNonBlocking nbapi;
//initiation
nbapi.init();
nbapi.setDisconnectListener(connectionIsDown);
nbapi.connect(argv[1]);
nbapi.setReplyFailCallBack(handleError);
nbapi.setReplySuccessCallBack(handleSuccess);
//login
char name[10];
char ipString[15];
char* ip = &(ipString[0]);
MappingType type = IP_RANGE;
Uint32 ipVal = 0x0a000000;
printf("login of %d subscribers\n",numSubscribersToLogin);
for (int i=0; i<numSubscribersToLogin; i++)
{
sprintf((char*)name,"s%d",i);
sprintf((char*)ip,"%d.%d.%d.%d",
(int)((ipVal & 0xFF000000) >> 24),
(int)((ipVal & 0x00FF0000) >> 16),
(int)((ipVal & 0x0000FF00) >> 8),
(int)(ipVal & 0x000000FF));
ipVal++;
nbapi.login(name, //subscriber name
&ip, //a single ip mapping
&type,
1,
NULL, //no properties
NULL,
0,
argv[2], //domain
false, //mappings are not additive
-1); //disable auto-logout
}
waitForLastResult(numSubscribersToLogin);
//logout
printf("logout of %d subscribers",numSubscribersToLogin);
ipVal = 0x0a000000;
for (i=0; i<numSubscribersToLogin; i++)
{
sprintf((char*)ip,"%d.%d.%d.%d",
(int)((ipVal & 0xFF000000) >> 24),
(int)((ipVal & 0x00FF0000) >> 16),
(int)((ipVal & 0x0000FF00) >> 8),
(int)(ipVal & 0x000000FF));
ipVal++;
nbapi.logoutByMapping(ip,
type,
argv[2]);
}
waitForLastResult(numSubscribersToLogin*2);
nbapi.disconnect();
}
The following example logs in a predefined number of IPv6 subscribers to the Cisco Service Control Subscriber Manager and then logs them out. Note the implementation of a disconnect listener and a result handler.
#include "SmApiNonBlocking.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
char api[30];
void checkArguments(int argc, char* argv[])
{
if (argc != 5)
{
printf("usage: api_method_fun <SM-address> <subscriber-name> "
"<NoOfSubs> <domain>\n");
exit(1);
}
}
void connectionIsDown()
{
printf("disconnect listener callback:: connection is down\n");
}
int count = 0;
void handleError(Uint32 argHandle, ReturnCode* argReturnCode)
{
++count;
printf("\tFAIL in %s %d:\n",api,count);
printReturnCode(argReturnCode);
freeReturnCode(argReturnCode);
}
void handleSuccess(Uint32 argHandle, ReturnCode* argReturnCode)
{
++count;
{
printf("\tPASS %s %d:\n",api,count);
printReturnCode(argReturnCode);
}
freeReturnCode(argReturnCode);
}
int __nsleep(const struct timespec *req, struct timespec *rem)
{
struct timespec temp_rem;
if(nanosleep(req,rem)==-1)
__nsleep(rem,&temp_rem);
else
return 1;
}
int msleep(unsigned long milisec)
{
struct timespec req={0},rem={0};
time_t sec=(int)(milisec/1000);
milisec=milisec-(sec*1000);
req.tv_sec=sec;
req.tv_nsec=milisec*1000000L;
__nsleep(&req,&rem);
return 1;
}
void waitForLastResult(int lastResult)
{
while ((count < lastResult) )
{
msleep(50);
printf ("waiting %d:",count);
}
}
int main(int argc, char* argv[])
{
checkArguments(argc,argv);
SmApiNonBlocking nbapi;
//initiation
if (!nbapi.init())
{
printf ("Problem in NB API init()\n");
exit(0);
}
nbapi.setDisconnectListener(connectionIsDown);
if (nbapi.connect(argv[1])) // connect to the SM
printf ("NB API is connected to SM\n");
else
{
printf ("NB API is not connected to SM\n");
exit(0);
}
nbapi.setReplyFailCallBack(handleError);
nbapi.setReplySuccessCallBack(handleSuccess);
MappingType type = TYPE_IPV6;
char * propKeys[] = {"packageId","monitor","upVlinkId","downVlinkId"};
char * propValues[] = {"88","7","999","666"};
char* customKey = "custom-key";
char* customVal = "10";
int noOfSub=atoi(argv[3]);
sprintf (api,"Login New:");
//Login IPV6 subscribers with mapping
for (int i=0;i<noOfSub;i++)
{
char subname[2000]="",subip[50]="",*ip;
sprintf (subname,"%s%dnew",argv[2],i);
sprintf (subip,"abcd:%d:%d:%d::/64",((i / 256*256) % 256), ((i / 256) % 256),(i % 256));
ip=&subip[0];
printf ("Name:%s IP:%s \n",subname,subip);
nbapi.login(
subname,//argv[2], // name
&ip,//&(argv[3]), // mapping
&type, // mapping type
1,
propKeys, // property key
propValues, // property value
4, // number of properties
argv[4],
false,
-1);
}
waitForLastResult(noOfSub);
//LogoutByName
sprintf (api,"LogoutByName():");
count=0;
for (int i=0;i<noOfSub;i++)
{
char subname[2000]="",subip[50]="",*ip;
sprintf (subname,"%s%dnew",argv[2],i);
sprintf (subip,"abcd:%d:%d:%d::/64",((i / 256*256) % 256), ((i / 256) % 256),(i % 256));
ip=&subip[0];
printf ("Name:%s IP:%s \n",subname,subip);
nbapi.logoutByName(
subname,//argv[2], // name
&ip,//&(argv[3]), // mapping
&type, // mapping type
1);
}
waitForLastResult(noOfSub);
//LogoutByNameFromDomain
count=0;
for (int i=0;i<noOfSub;i++)
{
char subname[2000]="",subip[50]="",*ip;
sprintf (subname,"%s%dnew",argv[2],i);
sprintf (subip,"abcd:%d:%d:%d::/64",((i / 256*256) % 256), ((i / 256) % 256),(i % 256));
ip=&subip[0];
printf ("Name:%s IP:%s \n",subname,subip);
nbapi.login(
subname,//argv[2], // name
&ip,//&(argv[3]), // mapping
&type, // mapping type
1,
propKeys, // property key
propValues, // property value
4, // number of properties
argv[4],
false,
-1);
}
waitForLastResult(noOfSub);
sprintf (api,"LogoutByNameFromDomain:");
count=0;
for (int i=0;i<noOfSub;i++)
{
char subname[2000]="",subip[50]="",*ip;
sprintf (subname,"%s%dnew",argv[2],i);
sprintf (subip,"abcd:%d:%d:%d::/64",((i / 256*256) % 256), ((i / 256) % 256),(i % 256));
ip=&subip[0];
printf ("Name:%s IP:%s \n",subname,subip);
nbapi.logoutByNameFromDomain(
subname,//argv[2], // name
&ip,//&(argv[3]), // mapping
&type, // mapping type
1,argv[4]);
}
waitForLastResult(noOfSub);
//LogoutByMapping
count=0;
for (int i=0;i<noOfSub;i++)
{
char subname[2000]="",subip[50]="",*ip;
sprintf (subname,"%s%dnew",argv[2],i);
sprintf (subip,"abcd:%d:%d:%d::/64",((i / 256*256) % 256), ((i / 256) % 256),(i % 256));
ip=&subip[0];
printf ("Name:%s IP:%s \n",subname,subip);
nbapi.login(
subname,//argv[2], // name
&ip,//&(argv[3]), // mapping
&type, // mapping type
1,
propKeys, // property key
propValues, // property value
4, // number of properties
argv[4],
false,
-1);
}
waitForLastResult(noOfSub);
sprintf (api,"LogoutByMapping()");
count=0;
for (int i=0;i<noOfSub;i++)
{
char subname[2000]="",subip[50]="",*ip;
sprintf (subname,"%s%dnew",argv[2],i);
sprintf (subip,"abcd:%d:%d:%d::/64",((i / 256*256) % 256), ((i / 256) % 256),(i % 256));
ip=&subip[0];
printf ("Name:%s IP:%s \n",subname,subip);
nbapi.logoutByMapping(
ip,//&(argv[3]), // mapping
type, // mapping type
argv[4]);
}
waitForLastResult(noOfSub);
if (nbapi.isConnected())
printf ("\nNB API Connected\n");
else
printf ("\nNB API Not Connected\n");
nbapi.disconnect();
if (nbapi.isConnected())
printf ("\nNB API Connected\n");
else
printf ("\nNB API Not Connected\n");
return 0;
}
This section provides a code example for logging in and logging out subscribers.
The following example logs in a predefined number of subscribers to the Cisco Service Control Subscriber Manager and then logs them out. Note the implementation of a disconnect listener and a result handler.
#include "SmApiNonBlocking_c.h"
#include <stdio.h>
void connectionIsDown()
{
printf("disconnect listener callback:: connection is down\n");
}
int count = 0;
//prints every error that occurs
void handleError(Uint32 argHandle, ReturnCode* argReturnCode)
{
++count;
printf("\terror %d:\n",count);
printReturnCode(argReturnCode);
freeReturnCode(argReturnCode);
}
//prints a success result every 100 results
void handleSuccess(Uint32 argHandle, ReturnCode* argReturnCode)
{
if (++count%100 == 0)
{
printf("\tresult %d:\n",count);
printReturnCode(argReturnCode);
}
freeReturnCode(argReturnCode);
}
//waits for result number 'last result' to arrive
void waitForLastResult(int lastResult)
{
while (count<lastResult)
{
::Sleep(100);
}
}
void checkTheArguments(int argc, char* argv[])
{
if (argc != 3)
{
printf("usage: LoginLogout <SM-address> <domain> <num-susbcribers>");
exit(1);
}
}
void main (int argc, char* argv[])
{
//check arguments
checkTheArguments(argc, argv);
int numSubscribersToLogin = atoi(argv[3]);
//instantiation
SMNB_HANDLE nbapi = SMNB_init(0,2000000,10,30);
if (nbapi == NULL)
{
exit(1);
}
SMNB_setDisconnectListener(nbapi,connectionIsDown);
SMNB_connect(nbapi,argv[1],14374);
SMNB_setReplyFailCallBack(nbapi,handleError);
SMNB_setReplySuccessCallBack(nbapi,handleSuccess);
//login
char name[10];
char ipString[15];
char* ip = &(ipString[0]);
MappingType type = IP_RANGE;
Uint32 ipVal = 0x0a000000;
printf("login of %d subscribers\n",numSubscribersToLogin);
for (int i=0; i<numSubscribersToLogin; i++)
{
sprintf((char*)name,"s%d",i);
sprintf((char*)ip,"%d.%d.%d.%d",
(int)((ipVal & 0xFF000000) >> 24),
(int)((ipVal & 0x00FF0000) >> 16),
(int)((ipVal & 0x0000FF00) >> 8),
(int)(ipVal & 0x000000FF));
ipVal++;
SMNB_login(nbapi,
name, //subscriber name
&ip, //a single ip mapping
&type,
1,
NULL, //no properties
NULL,
0,
argv[2], //domain
false, //mappings are not additive
-1); //disable auto-logout
}
waitForLastResult(numSubscribersToLogin);
//logout
printf("logout of %d subscribers",numSubscribersToLogin);
ipVal = 0x0a000000;
for (i=0; i<numSubscribersToLogin; i++)
{
sprintf((char*)ip,"%d.%d.%d.%d",
(int)((ipVal & 0xFF000000) >> 24),
(int)((ipVal & 0x00FF0000) >> 16),
(int)((ipVal & 0x0000FF00) >> 8),
(int)(ipVal & 0x000000FF));
ipVal++;
SMNB_logoutByMapping(nbapi,
ip,
type,
argv[1]);
}
waitForLastResult(numSubscribersToLogin*2);
SMNB_disconnect(nbapi);
SMNB_release(nbapi);
}
The following example logs in a predefined number of IPv6 subscribers to the Cisco Service Control Subscriber Manager and then logs them out. Note the implementation of a disconnect listener and a result handler.
#include "SmApiNonBlocking_c.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
char api[30];
int count = 0;
void checkArguments(int argc, char* argv[])
{
if (argc != 5)
{
printf("usage: api_method_fun <SM-address> <subscriber-name> "
"<NoOfSubs> <domain>\n");
exit(1);
}
}
void connectionIsDown()
{
printf("disconnect listener callback:: connection is down\n");
}
void handleError(Uint32 argHandle, ReturnCode* argReturnCode)
{
++count;
printf("\nerror in %s %d:\n",api,count);
printReturnCode(argReturnCode);
freeReturnCode(argReturnCode);
}
void handleSuccess(Uint32 argHandle, ReturnCode* argReturnCode)
{
++count;
printf("\nPASS %s %d:\n",api,count);
freeReturnCode(argReturnCode);
}
int __nsleep(const struct timespec *req, struct timespec *rem)
{
struct timespec temp_rem;
if(nanosleep(req,rem)==-1)
__nsleep(rem,&temp_rem);
else
return 1;
}
int msleep(unsigned long milisec)
{
struct timespec req={0},rem={0};
time_t sec=(int)(milisec/1000);
milisec=milisec-(sec*1000);
req.tv_sec=sec;
req.tv_nsec=milisec*1000000L;
__nsleep(&req,&rem);
return 1;
}
void waitForLastResult(int lastResult)
{
while ((count < lastResult) )
{
msleep(50);
printf ("waiting %d:",count);
}
}
int main(int argc, char* argv[])
{
checkArguments(argc,argv);
SMNB_HANDLE nbapi = SMNB_init(0,2000000,10,30);
if (nbapi == NULL)
{
printf ("Non Blocking Init Failed\n");
exit(1);
}
SMNB_setDisconnectListener(nbapi,connectionIsDown);
SMNB_connect(nbapi,argv[1],14374);
SMNB_setReplyFailCallBack(nbapi,handleError);
SMNB_setReplySuccessCallBack(nbapi,handleSuccess);
MappingType type = TYPE_IPV6;
char * propKeys[] = {"packageId","monitor","upVlinkId","downVlinkId"};
char * propValues[] = {"1","1","100","101"};
char* customKey = "custom-key";
char* customVal = "10";
int noOfSub=atoi(argv[3]);
sprintf (api,"Login New:");
for (int i=0;i<noOfSub;i++)
{
char subname[2000]="",subip[50]="",*ip;
sprintf (subname,"%s%d",argv[2],i);
sprintf (subip,"abcd:%d:%d:%d::/64",((i / 256*256) % 256), ((i / 256) % 256),(i % 256));
ip=&subip[0];
SMNB_login(nbapi,
subname, // name
&ip, // mapping
&type, // mapping type
1,
propKeys, // property key
propValues, // property value
4, // number of properties
argv[4],
false,
-1);
}
waitForLastResult(noOfSub);
sprintf (api,"LogoutByName():");
count=0;
for (int i=0;i<noOfSub;i++)
{
char subname[2000]="",subip[50]="",*ip;
sprintf (subname,"%s%d",argv[2],i);
sprintf (subip,"abcd:%d:%d:%d::/64",((i / 256*256) % 256), ((i / 256) % 256),(i % 256));
ip=&subip[0];
SMNB_logoutByName(nbapi,
subname, // name
&ip, // mapping
&type, // mapping type
1);
}
waitForLastResult(noOfSub);
sprintf (api,"Re Login:");
count=0;
for (int i=0;i<noOfSub;i++)
{
char subname[2000]="",subip[50]="",*ip;
sprintf (subname,"%s%d",argv[2],i);
sprintf (subip,"abcd:%d:%d:%d::/64",((i / 256*256) % 256), ((i / 256) % 256),(i % 256));
ip=&subip[0];
SMNB_login(nbapi,
subname, // name
&ip, // mapping
&type, // mapping type
1,
propKeys, // property key
propValues, // property value
4, // number of properties
argv[4],
false,
-1);
}
waitForLastResult(noOfSub);
sprintf (api,"LogoutByNameFromDomain:");
count=0;
for (int i=0;i<noOfSub;i++)
{
char subname[2000]="",subip[50]="",*ip;
sprintf (subname,"%s%d",argv[2],i);
sprintf (subip,"abcd:%d:%d:%d::/64",((i / 256*256) % 256), ((i / 256) % 256),(i % 256));
ip=&subip[0];
SMNB_logoutByNameFromDomain(nbapi,
subname,//argv[2], // name
&ip,//&(argv[3]), // mapping
&type, // mapping type
1,argv[4]);
}
waitForLastResult(noOfSub);
count=0;
sprintf (api,"Re Login");
for (int i=0;i<noOfSub;i++)
{
char subname[2000]="",subip[50]="",*ip;
sprintf (subname,"%s%d",argv[2],i);
sprintf (subip,"abcd:%d:%d:%d::/64",((i / 256*256) % 256), ((i / 256) % 256),(i % 256));
ip=&subip[0];
SMNB_login(nbapi,
subname, // name
&ip, // mapping
&type, // mapping type
1,
propKeys, // property key
propValues, // property value
4, // number of properties
argv[4],
false,
-1);
}
waitForLastResult(noOfSub);
sprintf (api,"LogoutByMapping()");
count=0;
for (int i=0;i<noOfSub;i++)
{
char subname[2000]="",subip[50]="",*ip;
sprintf (subname,"%s%d",argv[2],i);
sprintf (subip,"abcd:%d:%d:%d::/64",((i / 256*256) % 256), ((i / 256) % 256),(i % 256));
ip=&subip[0];
SMNB_logoutByMapping(nbapi,
ip,//&(argv[3]), // mapping
type, // mapping type
argv[4]);
}
waitForLastResult(noOfSub);
SMNB_disconnect(nbapi);
return 0;
}