📄 bacptimer.c
字号:
BACP_STACK_DATA *pStackData = (BACP_STACK_DATA *)pluginState->stackData; BACP_PROFILE_DATA * pProfileData = (BACP_PROFILE_DATA *)pluginState->profileData; sptr_bap_buffer = bap_match_received_response_to_outstanding_request ((LINK *) &pStackData->call_indication_send_queue, id); if (sptr_bap_buffer == NULL) { logMsg ("Retry Bap Status Indication NULL packet for id = %d\n", id, 2, 3, 4, 5, 6); return OK; } if (++pStackData->number_of_bap_status_indications < pProfileData->maximum_number_of_bap_status_indications) { packet = sptr_bap_buffer->bap; sptr_bap_buffer->bap = bacpDupPkt (packet); if (sptr_bap_buffer->bap == NULL) { logMsg ("retry_bap_status_indication- Packet duplication Error \n", 1, 2, 3, 4, 5, 6); return ERROR; }#ifdef PPP_DEBUG printf ("BAP: Tx BAP STATUS INDICATION RETRY : ID %d\n",id);#endif /* PPP_DEBUG */ pfwSend (pluginState, packet); pfwTimerCancel (pStackData->indicationRetryTimer); pfwTimerStart (pStackData->indicationRetryTimer, PFW_100_MILLISECOND, pProfileData->maximum_bap_status_indication_send_interval * 10, retry_bap_status_indication, id); return OK; } else /* number is > maximum */ { bap_delete_outstanding_request (pluginState, id, BAP_CALL_STATUS_INDICATION); } return OK; }/******************************************************************************** retry_bap_link_drop_request - timer handler routine for link drop query request** This function is timer handler routine for LINK_DROP_QUERY_REQUEST. This * handler function will be called when the timer expires for a link drop request * packet sent. The request is resent until number_of_bap_linkdrop_requests is * less than the maximum_number_of_bap_linkdrop_requests else recovery action is * taken. ** RETURNS: OK or ERROR */STATUS retry_bap_link_drop_request ( PFW_PLUGIN_OBJ_STATE * pluginState, /* state for the stack */ int id /* BAP packet id */ ) { BAP_BUFFER * sptr_bap_buffer; M_BLK_ID packet; BACP_STACK_DATA *pStackData = (BACP_STACK_DATA *)pluginState->stackData; BACP_PROFILE_DATA * pProfileData = (BACP_PROFILE_DATA *)pluginState->profileData; sptr_bap_buffer = bap_match_received_response_to_outstanding_request ((LINK *) &pStackData->link_drop_request_send_queue, id); if (sptr_bap_buffer == NULL) { logMsg ("Retry Bap Link Drop Request NULL packet for id = %d\n", id, 2, 3, 4, 5, 6); return OK; } if (++pStackData->number_of_bap_linkdrop_requests < pProfileData->maximum_number_of_bap_linkdrop_requests) { packet = sptr_bap_buffer->bap; sptr_bap_buffer->bap = bacpDupPkt (packet); if (sptr_bap_buffer->bap == NULL) { logMsg ("retry_bap_link_drop_request- Packet duplication Error \n", 1, 2, 3, 4, 5, 6); return ERROR; }#ifdef PPP_DEBUG printf ("BAP: Tx BAP LINK DROP REQUEST RETRY : ID %d\n",id);#endif /* PPP_DEBUG */ pfwSend (pluginState, packet); pfwTimerCancel (pStackData->dropRequestRetryTimer); pfwTimerStart (pStackData->dropRequestRetryTimer, PFW_100_MILLISECOND, pProfileData->maximum_bap_linkdrop_request_send_interval * 10, retry_bap_link_drop_request, id); return OK; } else /* number is > maximum */ { bap_delete_outstanding_request (pluginState, id, BAP_LINK_DROP_QUERY_REQUEST); } return OK; }/******************************************************************************** bap_delete_outstanding_request - delete the bap request if it exceeds maximum number of request and take recovery action** This function is called to take the recovery action once a request or * indication sent exceeds the max retries without receiving a response. The * retry counters are initialized, the request entry is deleted from the * corresponding send queue and the port is unreserved. If the request is link * drop query request, then a termination request is sent.** RETURNS: N/A*/LOCAL void bap_delete_outstanding_request ( PFW_PLUGIN_OBJ_STATE * pluginState, /* state for the stack */ int packetId, /* BAP packet id */ BYTE bapPacketType /* BAP packet type */ ) { PFW_STACK_OBJ * linkStackObj; BACP_STACK_DATA *pStackData = (BACP_STACK_DATA *)pluginState->stackData; PFW_STACK_OBJ * pManagerStackObj = pluginState->stackObj; PORT_CONNECTION_INFO *port_info = NULL; BAP_BUFFER * bap_buffer; BAP_LINK_DROP_QUERY_REQUEST_PACKET * bap_drop_packet; char * reason_string = NULL; switch (bapPacketType) { case BAP_CALL_REQUEST: bap_buffer = bap_match_received_response_to_outstanding_request ((LINK *) &pStackData->call_request_send_queue, packetId); if (bap_buffer == NULL) return; port_info = (PORT_CONNECTION_INFO *) SLL_FIRST(&bap_buffer->port_list); /* Cancel the timer and reset number of requests to zero */ pfwTimerCancel (pStackData->callRequestRetryTimer); pStackData->number_of_bap_call_requests = 0; if (pStackData->bacpUpcall != NULL) (*pStackData->bacpUpcall->bacpUpCallFunction) (pManagerStackObj, BAP_EVENT_REQUEST_TIMEOUT, port_info->port_number, NULL, 0, &reason_string); #ifdef PPP_DEBUG printf("BACP: TIME OUT on CALL Request - Releasing Port %d\n", \ port_info->port_number);#endif /* PPP_DEBUG */ /* unreserve the previously reserved port */ pmPortUnreserve (port_info); free_bap_buffer ((LINK *) &pStackData->call_request_send_queue, bap_buffer); break; case BAP_CALLBACK_REQUEST: bap_buffer = bap_match_received_response_to_outstanding_request ((LINK *) &pStackData->callback_request_send_queue, packetId); if (bap_buffer == NULL) return; port_info = (PORT_CONNECTION_INFO *) SLL_FIRST(&bap_buffer->port_list); /* Cancel the timer and reset number of requests to zero */ pfwTimerCancel (pStackData->callbackRequestRetryTimer); pStackData->number_of_bap_callback_requests = 0; while (port_info != NULL) { if (pStackData->bacpUpcall != NULL) (*pStackData->bacpUpcall->bacpUpCallFunction) (pManagerStackObj, BAP_EVENT_REQUEST_TIMEOUT, port_info->port_number, NULL, 0, &reason_string);#ifdef PPP_DEBUG printf("BACP: TIME OUT on CALL BACK Request - Releasing Port %d\n", \ port_info->port_number);#endif /* PPP_DEBUG */ /* unreserve the previously reserved port */ pmPortUnreserve (port_info); port_info = (PORT_CONNECTION_INFO *) SLL_NEXT (port_info); } free_bap_buffer ((LINK *) &pStackData->callback_request_send_queue, bap_buffer); break; case BAP_CALL_STATUS_INDICATION: bap_buffer = bap_match_received_response_to_outstanding_request ((LINK *) &pStackData->call_indication_send_queue, packetId); if (bap_buffer == NULL) { printf("BAP buffer for Call Status INDICATION is NULL \n"); return; } port_info = (PORT_CONNECTION_INFO *) SLL_FIRST(&bap_buffer->port_list); /* Cancel the timer, reset number of status indication to zero */ pfwTimerCancel (pStackData->indicationRetryTimer); pStackData->number_of_bap_status_indications = 0; linkStackObj = bap_find_stackobj_with_this_discriminators ((LINK *) &pStackData->active_port_queue, port_info->port_lcp_local_link_discriminator, port_info->port_lcp_remote_link_discriminator); if (linkStackObj != NULL) { if (pStackData->bacpUpcall != NULL) (*pStackData->bacpUpcall->bacpUpCallFunction) (pManagerStackObj, BAP_EVENT_REQUEST_TIMEOUT, port_info->port_number, linkStackObj, 0, &reason_string); } else { if (pStackData->bacpUpcall != NULL) (*pStackData->bacpUpcall->bacpUpCallFunction) (pManagerStackObj, BAP_EVENT_REQUEST_TIMEOUT, port_info->port_number, NULL, 0, &reason_string); } /* this will be executed only when there is timeout of indication */ /* packet for Link Add event so close the connection and */ /* unreserving the port will be done in Link Remove Event */#ifdef PPP_DEBUG printf("BAP: TIME OUT on Call Status INDICATION calling connection \ close in stack 0x%x \n", (int) linkStackObj);#endif /* PPP_DEBUG */ if (linkStackObj != NULL) pppConnectionClose (linkStackObj); break; case BAP_LINK_DROP_QUERY_REQUEST: bap_buffer = bap_match_received_response_to_outstanding_request ((LINK *) &pStackData->link_drop_request_send_queue, packetId); if (bap_buffer == NULL) return; port_info = (PORT_CONNECTION_INFO *) SLL_FIRST(&bap_buffer->port_list); /* Cancel the timer and reset number of requests to zero */ pfwTimerCancel (pStackData->dropRequestRetryTimer); pStackData->number_of_bap_linkdrop_requests = 0; bap_drop_packet = mtod (bap_buffer->bap, BAP_LINK_DROP_QUERY_REQUEST_PACKET *); linkStackObj = bap_find_stackobj_for_the_remote_discriminator ((LINK *) &pStackData->active_port_queue, ntohs (bap_drop_packet->link_discriminator_option.link_discriminator)); if (linkStackObj != NULL) { if (pStackData->bacpUpcall != NULL) (*pStackData->bacpUpcall->bacpUpCallFunction) (pManagerStackObj, BAP_EVENT_REQUEST_TIMEOUT, port_info->port_number, linkStackObj, 0, &reason_string); } else { if (pStackData->bacpUpcall != NULL) (*pStackData->bacpUpcall->bacpUpCallFunction) (pManagerStackObj, BAP_EVENT_REQUEST_TIMEOUT, port_info->port_number, NULL, 0, &reason_string); }#ifdef PPP_DEBUG printf("BAP: TIME OUT on LINK DROP Request - calling connection \ close in stack 0x%x\n", (int) linkStackObj);#endif /* PPP_DEBUG */ if (linkStackObj != NULL) pppConnectionClose (linkStackObj); break; default: break; } return; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -