📄 bacptest.c
字号:
* RETURNS: N/A*/void addBandwidthUsingCallRequest ( PFW_STACK_OBJ * pppManagerStackObj, /* manager stack object for bandwidth to add */ USHORT bandwidth /* amount of bandwidth to add */ ) { ULONG currentBandwidth; ULONG bandwidthToAdd = bandwidth; BYTE_ENUM(BAP_PACKET_TYPE) call_or_callback; STATUS status; /* Get the current bandwidth */ currentBandwidth = bapBundleCurrentBandwidthGet (pppManagerStackObj); if (currentBandwidth == 0) logMsg ("Current Bandwidth is ZERO for the Managet Stack \n", 1,2,3,4,5,6);#ifdef BAP_DEBUG logMsg ("Current Bandwidth is %lu \n",currentBandwidth,2,3,4,5,6);#endif /* Adding the bandwidth to the current bandwidth */ call_or_callback = BAP_CALL_REQUEST; status = bapBundleBandwidthAdd (pppManagerStackObj, bandwidthToAdd, "Adding Bandwidth", call_or_callback); if (status == OK) {#ifdef BAP_DEBUG logMsg ("BAP_CALL_REQUEST: Bandwidth add is done successfuly \n" ,1,2,3,4,5,6); #endif } else {#ifdef BAP_DEBUG logMsg ("BAP_CALL_REQUEST: Request to add Bandwidth [%lu] Failed \n", bandwidthToAdd,2,3,4,5,6); #endif } }/******************************************************************************** addBandwidthUsingCallBackRequest - Add a link to a particular bundle with * Call Back Request** Test script to add bandwidth using call back request** RETURNS: N/A*/void addBandwidthUsingCallBackRequest ( PFW_STACK_OBJ * pppManagerStackObj, /* manager stack object for bandwidth to add */ USHORT bandwidth /* amount of bandwidth to add */ ) { ULONG currentBandwidth; ULONG bandwidthToAdd = bandwidth; BYTE_ENUM(BAP_PACKET_TYPE) call_or_callback; STATUS status; /* Get the current bandwidth */ currentBandwidth = bapBundleCurrentBandwidthGet (pppManagerStackObj); if (currentBandwidth == 0) logMsg ("Current Bandwidth is ZERO for the Managet Stack \n", 1,2,3,4,5,6);#ifdef BAP_DEBUG logMsg ("Current Bandwidth is %lu \n",currentBandwidth,2,3,4,5,6);#endif /* Adding the bandwidth to the current bandwidth */ call_or_callback = BAP_CALLBACK_REQUEST; status = bapBundleBandwidthAdd (pppManagerStackObj, bandwidthToAdd, "Adding Bandwidth", call_or_callback); if (status == OK) {#ifdef BAP_DEBUG logMsg ("BAP_CALLBACK_REQUEST: Bandwidth add is done successfuly \n" ,1,2,3,4,5,6); #endif } else {#ifdef BAP_DEBUG logMsg ("BAP_CALLBACK_REQUEST: Request to add Bandwidth [%lu] Failed \n", bandwidthToAdd,2,3,4,5,6); #endif } }/********************************************************************************* removeBandwidth - Delete a link with link_drop_query_request** Test script to remove bandwidth using link drop query request** RETURNS: N/A*/void removeBandwidth ( PFW_STACK_OBJ * pppManagerStackObj, /* manager stack object for bandwidth to remove */ USHORT bandwidth /* amount of bandwidth to remove */ ) { ULONG currentBandwidth; ULONG bandwidthToRemove = bandwidth; STATUS status; /* Get the current bandwidth */ currentBandwidth = bapBundleCurrentBandwidthGet (pppManagerStackObj); if (currentBandwidth == 0) logMsg ("Current Bandwidth is ZERO for the Managet Stack \n", 1,2,3,4,5,6);#ifdef BAP_DEBUG logMsg ("Current Bandwidth is %lu \n",currentBandwidth,2,3,4,5,6);#endif /* Removing the bandwidth from the current bandwidth */ status = bapBundleBandwidthDelete (pppManagerStackObj, bandwidthToRemove, "Bandwidth needed to be removed"); if (status == OK) {#ifdef BAP_DEBUG logMsg ("LINK_DROP_QUERY_REQUEST: Bandwidth Remove call is successfull \n" ,1,2,3,4,5,6); #endif } else {#ifdef BAP_DEBUG logMsg ("LINK_DROP_QUERY_REQUEST: Request to remove Bandwidth [%lu] Failed \n", bandwidthToRemove,2,3,4,5,6); #endif } }/********************************************************************************* dropBandwidth - Drop a link from a bundle forcibly** Test script to drop bandwidth forcibly** RETURNS: N/A*/void dropBandwidth ( PFW_STACK_OBJ * pppManagerStackObj, /* manager stack object for bandwidth to drop */ USHORT bandwidth /* amount of bandwidth to drop */ ) { ULONG currentBandwidth; ULONG bandwidthToRemove = bandwidth; STATUS status; /* Get the current bandwidth */ currentBandwidth = bapBundleCurrentBandwidthGet (pppManagerStackObj); if (currentBandwidth == 0) logMsg ("Current Bandwidth is ZERO for the Managet Stack \n", 1,2,3,4,5,6);#ifdef BAP_DEBUG logMsg ("Current Bandwidth is %lu \n",currentBandwidth,2,3,4,5,6);#endif /* Droping the bandwidth from the current bandwidth */ status = bapBundleBandwidthDrop (pppManagerStackObj, bandwidthToRemove, "Bandwidth needed to be droped"); if (status == OK) {#ifdef BAP_DEBUG logMsg ("DROP_BANDWIDTH: Bandwidth drop call is successfull \n" ,1,2,3,4,5,6); #endif } else {#ifdef BAP_DEBUG logMsg ("DROP_BANDWIDTH: Request to drop Bandwidth [%lu] Failed \n", bandwidthToRemove,2,3,4,5,6); #endif } }/******************************************************************************** bapPeerTest - Test script for creating and adding a link to the bundle** This function is used to create a bundle and add a link to the bundle.In * this function, only Manager Stack's profile is configured. In * the Member Stack's profiles, only SIO_ADAPTER channel number is configured.* * The link is added to the bundle through the mpLinkAdd() function. * mpLinkAdd () function configures the member Stack's with the profile of the * Manager stack which which is configured through a mpInterface Layer profile * parameter ** RETURNS: void*/void bapPeerTest () { PFW_PROFILE_OBJ *pMgrProfile; PFW_PROFILE_OBJ *pMemberProfile; PFW_STACK_OBJ *pBundlePeerId; PFW_STACK_OBJ *pLinkStackObj; UINT pppParam; char profileString [MAX_VALUE_STRING_LENGTH]; pMgrProfile = pfwProfileCreate("pMgrProfile",pppSysProfile, 0); if (pMgrProfile == NULL) { logMsg("Could not Manager Stack profile\n",1,2,3,4,5,6); return; } pMemberProfile = pfwProfileCreate("pMemberProfile",pppSysProfile, 0); if (pMemberProfile == NULL) { logMsg("Could not Member Stack profile\n",1,2,3,4,5,6); return; } /* SSNHF */ pppParam = pfwParameterIdGet(pppSysFramework, "lcp_ML_shortSeqNumberHdrFormat"); pfwProfileSet(pMgrProfile, pppParam, "Local:Negotiation Required, Not Negotiable"); pfwProfileSet(pMgrProfile, pppParam, "Remote:Negotiation Required, Not Negotiable"); pppParam = pfwParameterIdGet(pppSysFramework, "lcp_ML_maxRcvdReconstructedUnit"); pfwProfileSet(pMgrProfile, pppParam, "Local:Negotiation Required, Negotiable:1500"); pfwProfileSet(pMgrProfile, pppParam, "Remote:Negotiation Required, Negotiable:1500"); pppParam = pfwParameterIdGet(pppSysFramework, "lcp_endpointDiscriminator"); pfwProfileSet(pMgrProfile, pppParam, "Local:Negotiation Required, Not Negotiable:1-ZWPRS"); pfwProfileSet(pMgrProfile, pppParam, "Remote:Negotiation Not Required, Negotiable"); pppParam = pfwParameterIdGet(pppSysFramework, "lcp_authProtocol"); pfwProfileSet(pMgrProfile, pppParam, "Local:Negotiation Not Required,Not Negotiable:c023"); pfwProfileSet(pMgrProfile, pppParam, "Remote:Negotiation Not Required,Not Negotiable:c223"); pppParam = pfwParameterIdGet(pppSysFramework, "lcp_magicNumber"); pfwProfileSet(pMgrProfile, pppParam, "Local:Negotiation Not Required,Not Negotiable:2"); pfwProfileSet(pMgrProfile, pppParam, "Remote:Negotiation Not Required,Not Negotiable:1");/* BACP */ pppParam = pfwParameterIdGet (pppSysFramework, "bacp_FP"); pfwProfileSet (pMgrProfile, pppParam, "Local:Negotiation Required,Negotiable:5000"); pfwProfileSet (pMgrProfile, pppParam, "Remote:Negotiation Required,Negotiable:6000"); /* BACP */ pppParam = pfwParameterIdGet (pppSysFramework, "ipcp_ipAddr"); pfwProfileSet (pMgrProfile, pppParam, "Local:Negotiation Required,Not Negotiable:11.11.11.102"); pfwProfileSet (pMgrProfile, pppParam, "Remote:Negotiation Required,Not Negotiable:11.11.11.103"); if ((pBundlePeerId = mpBundleCreate (pMgrProfile, NULL, NULL)) == NULL) printf ("bundleCreate() failed\n"); pManagerStackObj = pBundlePeerId;/* Member 1 */ pppParam = pfwParameterIdGet(pppSysFramework, "sio_channelNum"); pfwProfileSet(pMemberProfile, pppParam, "0"); sprintf (profileString, "%d", (int) pBundlePeerId); pppParam = pfwParameterIdGet (pppSysFramework, "mpInterface_managerStackId"); if (pfwProfileSet (pMemberProfile, pppParam, profileString) == ERROR) printf ("ERROR in configuring the profile\n"); pppParam = pfwParameterIdGet(pppSysFramework, "mpInterface_memberLinkSpeed"); pfwProfileSet(pMemberProfile, pppParam, "19200"); if ((pLinkStackObj = mpLinkAdd (pMemberProfile, NULL, NULL)) == NULL) printf ("mpLinkAdd() failed\n"); }/******************************************************************************** bapPeer1Test - Test script for creating and adding a link to the bundle** This function is used to create a bundle and add a link to the bundle.In * this function, only Manager Stack's profile is configured. In * the Member Stack's profiles, only SIO_ADAPTER channel number is configured.* * The link is added to the bundle through the mpLinkAdd() function. * mpLinkAdd () function configures the member Stack's with the profile of the * Manager stack which which is configured through a mpInterface Layer profile * parameter ** RETURNS: void*/void bapPeer1Test () { PFW_PROFILE_OBJ *pMgrProfile; PFW_PROFILE_OBJ *pMemberProfile; PFW_STACK_OBJ *pBundlePeerId; PFW_STACK_OBJ *pLinkStackObj; UINT pppParam; char profileString [MAX_VALUE_STRING_LENGTH]; pMgrProfile = pfwProfileCreate("pMgrProfile",pppSysProfile, 0); if (pMgrProfile == NULL) { logMsg("Could not Manager Stack profile\n",1,2,3,4,5,6); return; } pMemberProfile = pfwProfileCreate("pMemberProfile",pppSysProfile, 0); if (pMemberProfile == NULL) { logMsg("Could not Member Stack profile\n",1,2,3,4,5,6); return; } /* SSNHF */ pppParam = pfwParameterIdGet(pppSysFramework, "lcp_ML_shortSeqNumberHdrFormat"); pfwProfileSet(pMgrProfile, pppParam, "Local:Negotiation Required, Not Negotiable"); pfwProfileSet(pMgrProfile, pppParam, "Remote:Negotiation Required, Not Negotiable"); pppParam = pfwParameterIdGet(pppSysFramework, "lcp_ML_maxRcvdReconstructedUnit"); pfwProfileSet(pMgrProfile, pppParam, "Local:Negotiation Required, Negotiable:1500"); pfwProfileSet(pMgrProfile, pppParam, "Remote:Negotiation Required, Negotiable:1500"); pppParam = pfwParameterIdGet(pppSysFramework, "lcp_endpointDiscriminator"); pfwProfileSet(pMgrProfile, pppParam, "Local:Negotiation Required, Not Negotiable:1-ZWRS"); pfwProfileSet(pMgrProfile, pppParam, "Remote:Negotiation Not Required, Negotiable"); pppParam = pfwParameterIdGet(pppSysFramework, "lcp_authProtocol"); pfwProfileSet(pMgrProfile, pppParam, "Local:Negotiation Not Required,Not Negotiable:c223"); pfwProfileSet(pMgrProfile, pppParam, "Remote:Negotiation Not Required,Not Negotiable:c023"); pppParam = pfwParameterIdGet(pppSysFramework, "lcp_magicNumber"); pfwProfileSet(pMgrProfile, pppParam, "Local:Negotiation Not Required,Not Negotiable:1"); pfwProfileSet(pMgrProfile, pppParam, "Remote:Negotiation Not Required,Not Negotiable:2");/* BACP */ pppParam = pfwParameterIdGet (pppSysFramework, "bacp_FP"); pfwProfileSet (pMgrProfile, pppParam, "Local:Negotiation Required,Negotiable:6000"); pfwProfileSet (pMgrProfile, pppParam, "Remote:Negotiation Required,Negotiable:5000"); /* BACP */ pppParam = pfwParameterIdGet (pppSysFramework, "ipcp_ipAddr"); pfwProfileSet (pMgrProfile, pppParam, "Local:Negotiation Required,Not Negotiable:11.11.11.103"); pfwProfileSet (pMgrProfile, pppParam, "Remote:Negotiation Required,Not Negotiable:11.11.11.102"); if ((pBundlePeerId = mpBundleCreate (pMgrProfile, NULL, NULL)) == NULL) printf ("bundleCreate() failed\n"); pManagerStackObj = pBundlePeerId;/* Member 1 */ pppParam = pfwParameterIdGet(pppSysFramework, "sio_channelNum"); pfwProfileSet(pMemberProfile, pppParam, "0"); sprintf (profileString, "%d", (int) pBundlePeerId); pppParam = pfwParameterIdGet (pppSysFramework, "mpInterface_managerStackId"); if (pfwProfileSet (pMemberProfile, pppParam, profileString) == ERROR) printf ("ERROR in configuring the profile\n"); pppParam = pfwParameterIdGet(pppSysFramework, "mpInterface_memberLinkSpeed"); pfwProfileSet(pMemberProfile, pppParam, "19200"); if ((pLinkStackObj = mpLinkAdd (pMemberProfile, NULL, NULL)) == NULL) printf ("mpLinkAdd() failed\n"); }/******************************************************************************** * BACP (BODA) UP CALLS *******************************************************************************//****************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -