📄 mpbdlmanagement.c
字号:
/******************************************************************************** mp_initialize_receiving_end_of_the_bundle - * Initializes receiving end of the class** This functions clears the receiving end class of the given bundle* * RETURNS: N/A*/void mp_initialize_receiving_end_of_the_bundle ( PFW_PLUGIN_OBJ_STATE *pMpFramingLayerState /* mpFraming layer state representing the bundle */ ) { MP_BUNDLE_RECEIVING_END_CLASS *pReceivingEndClass = NULL; MP_FRAMING_LAYER_STACK_DATA *pStackData = NULL; pStackData = (MP_FRAMING_LAYER_STACK_DATA *)pMpFramingLayerState->stackData; pReceivingEndClass = &(pStackData->bundle.receiving_end); /* Clear the sending end class of the bundle */ bzero ((void *)pReceivingEndClass, sizeof (MP_BUNDLE_RECEIVING_END_CLASS)); }/******************************************************************************** mp_initialize_receiving_end_link_class* Initializes receiving end link class of the given link** This functions clears the receiving end link class of the given link* * RETURNS: N/A*/LOCAL void mp_initialize_receiving_end_link_class ( PFW_PLUGIN_OBJ_STATE *pMpFramingLayerState, /* mpFraming layer state representing the bundle */ USHORT linkNumber /* link number in the sending end */ ) { MP_BUNDLE_RECEIVING_END_CLASS *pReceivingEndClass = NULL; MP_FRAMING_LAYER_STACK_DATA *pStackData = NULL; if (pMpFramingLayerState == NULL) return; pStackData = (MP_FRAMING_LAYER_STACK_DATA *)pMpFramingLayerState->stackData; pReceivingEndClass = &(pStackData->bundle.receiving_end); /* Clear the receiving end class of the bundle */ bzero ((void *)&pReceivingEndClass->links[linkNumber], sizeof (MP_BUNDLE_RECEIVING_END_LINK_CLASS)); }/******************************************************************************** mp_remove_port_from_sending_end_of_the_bundle - * Drops a link from the sending end of the bundle** This function drops the link from the sending end of the bundle. It removes * the entry of the link in the sending end link class array. It updates the * total BW available in the sending end of the bundle. It decrements the total* number of links count in the sending end by one. It updates BW share * information of individual links in the sending end. In the entry of the link* in the port to bundle assignment array, it sets is_link_in_sending_end to * FALSE. * * RETURNS: OK or ERROR*/STATUS mp_remove_port_from_sending_end_of_the_bundle ( PFW_PLUGIN_OBJ_STATE *pMpFramingLayerState, /* mpFraming layer state representing the bundle */ PFW_STACK_OBJ *pMemberStackObj /*stack obj representing the link*/ ) { MP_FRAMING_LAYER_STACK_DATA *pStackData = NULL; UINT loopIndex = 0; MP_BUNDLE_SENDING_END_CLASS *pSendingEndClass = NULL; STATUS status; MP_FRAMING_LAYER *pComponent = NULL; BOOL bFound; if ((pMpFramingLayerState == NULL) || (pMemberStackObj == NULL)) return ERROR; pStackData = (MP_FRAMING_LAYER_STACK_DATA *) pMpFramingLayerState->stackData; pSendingEndClass = &pStackData->bundle.sending_end; /* Remove the link's entry from the sending end link class arrary */ bFound = FALSE; for (loopIndex = 0; loopIndex < pSendingEndClass->no_of_links; loopIndex++) { if (pSendingEndClass->links [loopIndex].pMemberStackObj == pMemberStackObj) { bFound = TRUE; while (loopIndex < (pSendingEndClass->no_of_links - 1)) { pSendingEndClass->links [loopIndex] = pSendingEndClass->links [loopIndex + 1]; loopIndex++; } break; } } if (bFound == FALSE) return OK; pSendingEndClass->no_of_links--; /* Update the total BW available in the sending end */ /* Search the matching entry for the link in port array */ for (loopIndex = 0; loopIndex < pStackData->bundle.no_of_links; loopIndex++) { if (pStackData->bundle.memberLinks[loopIndex].pMemberStackObj == pMemberStackObj) break; } if (loopIndex == pStackData->bundle.no_of_links) return ERROR; /* Update the total BW */ pSendingEndClass->total_bandwidth -= pStackData->bundle.memberLinks[loopIndex].speed; pSendingEndClass->aggregateMru -= pStackData->bundle.memberLinks[loopIndex].pLcpBundleOptions->remoteMRU; /* Recalculate BW share information of each link in the sending end */ status = mp_bundle_sending_end_update_bandwidth_share_information (pMpFramingLayerState); if (status == ERROR) return ERROR; /* Recalculate Remote MRU share information of each link in the sending end */ status = mp_bundle_sending_end_update_mru_share_information (pMpFramingLayerState); if (status == ERROR) { printf ("MRU Share failed\n"); return ERROR; } /* Update port_to_bundle_assignment array in the component structure */ pComponent = (MP_FRAMING_LAYER *) pMpFramingLayerState->pluginObj; if (semTake (pComponent->componentSem, WAIT_FOREVER) == ERROR) return ERROR; /* Search the matching entry for the link in the bundle assignment array */ for (loopIndex = 0; loopIndex < MAX_NO_OF_PPP_PORTS; loopIndex++) { if (pComponent->port_to_bundle_assignment [loopIndex].pMemberStackObj == pMemberStackObj) { pComponent->port_to_bundle_assignment [loopIndex]. port_used_in_sending_end = FALSE; break; } } if (semGive (pComponent->componentSem) == ERROR) return ERROR; return OK; }/******************************************************************************** mp_remove_port_from_receiving_end_of_the_bundle - * Drops a link from the receiving end of the bundle**This function drops the link from the receiving end of the bundle. It removes *the entry of the link in the receiving end link class array. It decrements the *total number of links count in the receiving end by one. It recalculates the *buffer requirement in the receiving end. In the entry of the link in the port *to bundle assignment array, it sets is_link_in_the_receiving_end to FALSE * * RETURNS: OK or ERROR*/STATUS mp_remove_port_from_receiving_end_of_the_bundle ( PFW_PLUGIN_OBJ_STATE *pMpFramingLayerState, /* mpFraming layer state representing the bundle */ PFW_STACK_OBJ *pMemberStackObj /*stack obj representing the link*/ ) { MP_FRAMING_LAYER_STACK_DATA *pStackData = NULL; UINT loopIndex = 0; MP_BUNDLE_RECEIVING_END_CLASS *pReceivingEndClass = NULL; MP_FRAMING_LAYER *pComponent = NULL; BOOL bFound; if ((pMpFramingLayerState == NULL) || (pMemberStackObj == NULL)) return ERROR; pStackData = (MP_FRAMING_LAYER_STACK_DATA *) pMpFramingLayerState-> stackData; pReceivingEndClass = &pStackData->bundle.receiving_end; /* Remove the link's entry from the receiving end link class arrary */ bFound = FALSE; for (loopIndex = 0; loopIndex < pReceivingEndClass->no_of_links; loopIndex++) { if (pReceivingEndClass->links [loopIndex].pMemberStackObj == pMemberStackObj) { bFound = TRUE; while (loopIndex < (pReceivingEndClass->no_of_links - 1)) { pReceivingEndClass->links [loopIndex] = pReceivingEndClass->links [loopIndex + 1]; loopIndex++; } break; } } if (bFound == FALSE) return OK; pReceivingEndClass->no_of_links--;#if 0 /* not supported in this release */ /*Reestimate the buffer requirement for the receiving end */ mp_estimate_buffer_requirement (pMpFramingLayerState);#endif /* Update port_to_bundle_assignment array in the component structure */ pComponent = (MP_FRAMING_LAYER *) pMpFramingLayerState->pluginObj; if (semTake (pComponent->componentSem, WAIT_FOREVER) == ERROR) return ERROR; /* Search the matching entry for the link in the bundle assignment array */ for (loopIndex = 0; loopIndex < MAX_NO_OF_PPP_PORTS; loopIndex++) { if (pComponent->port_to_bundle_assignment [loopIndex].pMemberStackObj == pMemberStackObj) { pComponent->port_to_bundle_assignment [loopIndex]. port_used_in_receiving_end = FALSE; break; } } if (semGive (pComponent->componentSem) == ERROR) return ERROR; return OK; }/******************************************************************************** mpBundleProfileGet - Get the profile configurations of the Manager Stack** This function retrieves the bundle related LCP negotiable option values * negotiated on the given Manager Stack. This function is called by * mpLinkAssign () to get Manager Stack's MP configurations and configures the * Member Stack's MP related LCP profiles before the negotiation is started on * the Member Stack.* * RETURNS: OK or ERROR*/void mpBundleProfileGet ( PFW_PLUGIN_OBJ_STATE *pMpFramingLayerState, /* mpFraming layer state representing the bundle */ LCP_BUNDLE_PROFILE *pLcpBundleProfile /* Pointer to LcpBundleProfile structure where Manager Stack profiles are stored */ ) { MP_FRAMING_LAYER_STACK_DATA *pStackData = NULL; if (pMpFramingLayerState == NULL) return; pStackData = (MP_FRAMING_LAYER_STACK_DATA *)pMpFramingLayerState->stackData; /* Copy the Manager Stack profile from the Manager Stack */ memcpy ((void *)pLcpBundleProfile, (const void *)&pStackData->lcpBundleProfile, (size_t)sizeof (LCP_BUNDLE_PROFILE)); }/******************************************************************************** mp_receive_port_is_in_bundle - * Checks whether the given link is assigned to any bundle and the link is * there in the receiving end * ** Checks whether the given link is there in any of the bundle. If so, it checks * whether it is in the receiving end of the bundle. If so, it gets the bundle * number and returns TRUE. Otherwise, it returns FALSE** RETURNS: PASS or FAIL*/TEST mp_receive_port_is_in_bundle ( PFW_STACK_OBJ *pMemberStackObj, /*stack obj representing the link*/ PFW_STACK_OBJ **ppManagerStackObj /* mpFraming layer state representing the bundle */ ) { PFW_OBJ *pfwObj = NULL; MP_FRAMING_LAYER *pComponent = NULL; PFW_PLUGIN_OBJ *pPluginObj = NULL; UINT loopIndex = 0; TEST returnCode; if ((pMemberStackObj == NULL) || (ppManagerStackObj == NULL)) return FAIL; pfwObj = pfwStackObjPfwGet (pMemberStackObj); /* Get the framework reference */ if (pfwObj == NULL) { printf ("NULL Framework Reference\n"); return FAIL; } /* Get the component data of the mpFraming layer */ pPluginObj = pfwPluginObjGet (pfwObj, "MP_FRAMING_LAYER"); if (pPluginObj == NULL) { printf("PPP: Could not find MP Framing Layer plugin Obj in the \ framework 0x%x\n", (int) pfwObj ); return FAIL; } pComponent = (MP_FRAMING_LAYER *) pPluginObj; returnCode = FAIL; /* Check in the port_to_bundle_assignment array */ /* Search the matching entry for the link in the bundle assignment array */ if (semTake (pComponent->componentSem, WAIT_FOREVER) == ERROR) return FAIL; for (loopIndex = 0; loopIndex < MAX_NO_OF_PPP_PORTS; loopIndex++) { if ((pComponent->port_to_bundle_assignment [loopIndex].pMemberStackObj== pMemberStackObj) && (pComponent->port_to_bundle_assignment [loopIndex]. port_used_in_receiving_end == TRUE)) { *ppManagerStackObj = pComponent->port_to_bundle_assignment [loopIndex].pManagerStackObj; returnCode = PASS; break; } } if (semGive (pComponent->componentSem) == ERROR) return FAIL; return returnCode; }/******************************************************************************** mp_fragment_flag_enum_to_string - * Returns a string describing the fragment flag type * * This function returns a string describing fragment flag type. This string is * used in generating the debug messages.** RETURNS: char **/char * mp_fragment_flag_enum_to_string ( enum FRAGMENT_FLAG fragment_flag ) { if (fragment_flag == FIRST_FRAGMENT) return ("first fragment"); else if (fragment_flag == LAST_FRAGMENT) return ("last fragment"); else if (fragment_flag == NOT_END_FRAGMENT) return ("none end fragment"); else if (fragment_flag == ONLY_FRAGMENT) return ("only fragment"); else return ("unknown fragment"); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -