/* * Function: pres_create_retry_after_timers() * * Parameters: void * * Description: creates retry-after timers equivalant to the number of line buttons. * * Returns: CPR_SUCCESS/CPR_FAILURE */ cpr_status_e pres_create_retry_after_timers (void) { int i; int j; /* * Create retry-after timers. */ for (i = 0; i < MAX_REG_LINES; i++) { s_retry_after_timers[i] = cprCreateTimer("Presence/BLF Retry After Timer", PRES_RETRYAFTER_TIMER, TIMER_EXPIRATION, s_misc_msg_queue); if (!s_retry_after_timers[i]) { /* * destroy/free the already created timers. */ for (j = 0; j < i; j++) { (void) cprDestroyTimer(s_retry_after_timers[j]); s_retry_after_timers[j] = NULL; } return CPR_FAILURE; } } return CPR_SUCCESS; }
/* * Function: dp_shutdown() * * Parameters: none * * Description: shutdown dialplan and cleanup memory * * * Returns: none */ void dp_shutdown (void) { if (g_dp_int.dial_timer != NULL) { (void)cprDestroyTimer(g_dp_int.dial_timer); g_dp_int.dial_timer = NULL; } FreeDialTemplates(); }
/** * pres_destroy_retry_after_timers() destroys retry-after timers * created by pres_create_retry_after_timers(). * * @param none. * * @return none. */ void pres_destroy_retry_after_timers (void) { int i; /* * Destroy retry-after timers. */ for (i = 0; i < MAX_REG_LINES; i++) { if (s_retry_after_timers[i] != NULL) { (void) cprDestroyTimer(s_retry_after_timers[i]); s_retry_after_timers[i] = NULL; } } }
/** * This function will free up the PCB resources and removes it from the PCB list. * * @param[in] pcb_p - pointer to a PCB. * * @return none * * @pre (pcb_p != NULL) */ static void free_pcb (ccsip_publish_cb_t *pcb_p) { if (pcb_p->hb.authen.authorization != NULL) { cpr_free(pcb_p->hb.authen.authorization); } if (pcb_p->hb.authen.sip_authen != NULL) { sippmh_free_authen(pcb_p->hb.authen.sip_authen); } cpr_free(pcb_p->entity_tag); free_pending_reqs(pcb_p->pending_reqs); (void)cprDestroyTimer(pcb_p->retry_timer.timer); free_event_data(pcb_p->hb.event_data_p); (void)sll_remove(s_PCB_list, (void *)pcb_p); cpr_free(pcb_p); }
/** * This function will create a PCB. It will also create the PCB linked list. * * @return NULL if there are no resources to create a PCB. * Otherwise, pointer to a new PCB is returned. * * @pre (key != NULL) and (data != NULL) */ static ccsip_publish_cb_t *get_new_pcb (void) { ccsip_publish_cb_t *pcb_p; /* * If PCB list is not created yet, create the list. */ if (s_PCB_list == NULL) { s_PCB_list = sll_create(is_matching_pcb); if (s_PCB_list == NULL) { return NULL; } } pcb_p = (ccsip_publish_cb_t *)cpr_malloc(sizeof(ccsip_publish_cb_t)); if (pcb_p == NULL) { return NULL; } memset(pcb_p, 0, sizeof(ccsip_publish_cb_t)); pcb_p->pub_handle = generate_new_pub_handle(); pcb_p->hb.cb_type = PUBLISH_CB; pcb_p->hb.dn_line = 1; // for now set it to primary line. This will change when we do line based PUBLISH. /* * set up dest & src ip addr and port number. */ ccsip_common_util_set_dest_ipaddr_port(&pcb_p->hb); ccsip_common_util_set_src_ipaddr(&pcb_p->hb); pcb_p->hb.local_port = sipTransportGetListenPort(pcb_p->hb.dn_line, NULL); pcb_p->retry_timer.timer = cprCreateTimer("PUBLISH retry timer", SIP_PUBLISH_RETRY_TIMER, TIMER_EXPIRATION, sip_msgq); if (pcb_p->retry_timer.timer == NULL) { cpr_free(pcb_p); return NULL; } pcb_p->pending_reqs = sll_create(NULL); if (pcb_p->pending_reqs == NULL) { (void)cprDestroyTimer(pcb_p->retry_timer.timer); cpr_free(pcb_p); return NULL; } (void) sll_append(s_PCB_list, pcb_p); return pcb_p; }
static void fsm_clear_cac_data (cac_data_t *cac_data) { if (cac_data->cac_fail_timer) { (void) cprCancelTimer(cac_data->cac_fail_timer); (void) cprDestroyTimer(cac_data->cac_fail_timer); } (void) sll_remove(s_cac_list, cac_data); fim_free_event(cac_data->msg_ptr); /* Release buffer too */ cpr_free(cac_data->msg_ptr); cpr_free(cac_data); }
void sip_platform_timers_shutdown (void) { int i; for (i = 0; i < MAX_CCBS; i++) { sip_platform_msg_timer_stop(i); (void) cprDestroyTimer(sipPlatformUISMTimers[i].timer); sipPlatformUISMTimers[i].timer = NULL; (void) cprDestroyTimer(sipPlatformUISMTimers[i].reg_timer); sipPlatformUISMTimers[i].reg_timer = NULL; (void) sip_platform_expires_timer_stop(i); (void) cprDestroyTimer(sipPlatformUISMExpiresTimers[i].timer); sipPlatformUISMExpiresTimers[i].timer = NULL; (void) sip_platform_register_expires_timer_stop(i); (void) cprDestroyTimer(sipPlatformUISMRegExpiresTimers[i].timer); sipPlatformUISMRegExpiresTimers[i].timer = NULL; (void) sip_platform_localexpires_timer_stop(i); (void) cprDestroyTimer(sipPlatformUISMLocalExpiresTimers[i].timer); sipPlatformUISMLocalExpiresTimers[i].timer = NULL; } for (i = 0; i < MAX_TEL_LINES; i++) { (void) sip_platform_supervision_disconnect_timer_stop(i); (void) cprDestroyTimer(sipPlatformSupervisionTimers[i].timer); sipPlatformSupervisionTimers[i].timer = NULL; } for (i = 0; i < MAX_SCBS; i++) { sip_platform_msg_timer_subnot_stop(&sipPlatformUISMSubNotTimers[i]); (void) cprDestroyTimer(sipPlatformUISMSubNotTimers[i].timer); sipPlatformUISMSubNotTimers[i].timer = NULL; } (void) sip_platform_subnot_periodic_timer_stop(); (void) cprDestroyTimer(sipPlatformSubNotPeriodicTimer.timer); sipPlatformSubNotPeriodicTimer.timer = NULL; (void) sip_platform_reg_all_fail_timer_stop(); (void) cprDestroyTimer(sipPlatformRegAllFailedTimer); sipPlatformRegAllFailedTimer = NULL; (void) sip_platform_standby_keepalive_timer_stop(); (void) cprDestroyTimer(sipPlatformStandbyKeepaliveTimer); sipPlatformStandbyKeepaliveTimer = NULL; (void) sip_platform_unregistration_timer_stop(); (void) cprDestroyTimer(sipPlatformUnRegistrationTimer); sipPlatformUnRegistrationTimer = NULL; (void) sip_platform_notify_timer_stop(); (void) cprDestroyTimer(sipPlatformNotifyTimer); sipPlatformNotifyTimer = NULL; (void) sip_platform_pass_through_timer_stop(); (void) cprDestroyTimer(sipPassThroughTimer); sipPassThroughTimer = NULL; }