/** * cprDestroyMutex * * @brief Destroys the mutex passed in. * * The cprDestroyMutex function is called to destroy a mutex. It is the * application's responsibility to ensure that the mutex is unlocked when * destroyed. Unpredictiable behavior will occur if an application * destroys a locked mutex. * * @param[in] mutex - mutex to destroy * * @return CPR_SUCCESS or CPR_FAILURE. errno should be set for CPR_FAILURE. */ cprRC_t cprDestroyMutex (cprMutex_t mutex) { static const char fname[] = "cprDestroyMutex"; cpr_mutex_t *cprMutexPtr; int32_t rc; cprMutexPtr = (cpr_mutex_t *) mutex; if (cprMutexPtr != NULL) { rc = pthread_mutex_destroy(cprMutexPtr->u.handlePtr); if (rc != 0) { CPR_ERROR("%s - Failure destroying Mutex %s: %d\n", fname, cprMutexPtr->name, rc); return CPR_FAILURE; } cprMutexPtr->lockId = 0; cpr_free(cprMutexPtr->u.handlePtr); cpr_free(cprMutexPtr); return CPR_SUCCESS; } /* Bad application! */ CPR_ERROR("%s - NULL pointer passed in.\n", fname); errno = EINVAL; return CPR_FAILURE; }
/** * cprDestroyTimer * * @brief Destroys a timer. * * This function will cancel the timer and then destroy it. It sets * all links to NULL and then frees the timer block. * * @param[in] timer - which timer to destroy * * @return CPR_SUCCESS or CPR_FAILURE */ cprRC_t cprDestroyTimer (cprTimer_t timer) { static const char fname[] = "cprDestroyTimer"; cpr_timer_t *cprTimerPtr; cprRC_t rc; //CPR_INFO("cprDestroyTimer:destroying timer=%x\n", timer); cprTimerPtr = (cpr_timer_t *) timer; if (cprTimerPtr != NULL) { rc = cprCancelTimer(timer); if (rc == CPR_SUCCESS) { cprTimerPtr->cprTimerId = 0; cpr_free(cprTimerPtr->u.handlePtr); cpr_free(cprTimerPtr); return CPR_SUCCESS; } else { CPR_ERROR("%s - Cancel of Timer %s failed.\n", fname, cprTimerPtr->name); return CPR_FAILURE; } } /* Bad application! */ CPR_ERROR("%s - NULL pointer passed in.\n", fname); errno = EINVAL; return CPR_FAILURE; }
/** * cprCreateMutex * * Creates a mutual exclusion block * * Parameters: name - name of the mutex * * Return Value: Mutex handle or NULL if creation failed. */ cprMutex_t cprCreateMutex (const char *name) { cpr_mutex_t *cprMutexPtr; static char fname[] = "cprCreateMutex"; WCHAR* wname; /* * Malloc memory for a new mutex. CPR has its' own * set of mutexes so malloc one for the generic * CPR view and one for the CNU specific version. */ cprMutexPtr = (cpr_mutex_t *) cpr_malloc(sizeof(cpr_mutex_t)); if (cprMutexPtr != NULL) { /* Assign name if one was passed in */ if (name != NULL) { cprMutexPtr->name = name; } wname = cpr_malloc((strlen(name) + 1) * sizeof(WCHAR)); mbstowcs(wname, name, strlen(name)); cprMutexPtr->u.handlePtr = CreateMutex(NULL, FALSE, wname); cpr_free(wname); if (cprMutexPtr->u.handlePtr == NULL) { CPR_ERROR("%s - Mutex init failure: %d\n", fname, GetLastError()); cpr_free(cprMutexPtr); cprMutexPtr = NULL; } } return cprMutexPtr; }
/* * Function: ccsip_deregister_info_package_handler * * Parameters: * info_package - the Info Package for the handler * content_type - the Content Type for the handler * handler - the handler * * Description: * Deregisters the handler for the Info Package/Content Type pair. * * Return: * SIP_OK - the handler was registered successfully * SIP_ERROR - otherwise */ int ccsip_deregister_info_package_handler(const char *info_package, const char *content_type, info_package_handler_t handler) { static const char *fname = "ccsip_deregister_info_package_handler"; info_index_t info_index; type_index_t type_index; handler_record_t *record; if (s_handler_registry == NULL) { CCSIP_DEBUG_TASK("%s: Info Package handler was not initialized", fname); return SIP_ERROR; } /* Find the info_index for the info_package */ info_index = find_info_index(info_package); if (info_index == INDEX_NOT_FOUND) { CCSIP_DEBUG_ERROR("%s: handler was not registered (%s)", fname, info_package); return SIP_ERROR; } /* Find the type_index for the content_type */ type_index = find_type_index(content_type); if (type_index == INDEX_NOT_FOUND) { CCSIP_DEBUG_ERROR("%s: handler was not registered (%s)", fname, content_type); return SIP_ERROR; } /* Find the handler record */ record = find_handler_record(info_index, type_index); if ((record == NULL) || (record->handler != handler)) { CCSIP_DEBUG_ERROR("%s: handler was not registered (%p)", fname, handler); return SIP_ERROR; } (void)sll_remove(s_handler_registry, record); cpr_free(record); if (!is_info_package_registered(info_index)) { /* The info_package was not found in the registry, meaning we're * the last one who registered for this particular info_package */ cpr_free(g_registered_info[info_index]); g_registered_info[info_index] = NULL; } if (!is_content_type_registered(type_index)) { /* The content_type was not found in the registry, meaning we're * the last one who registered for this particular content_type */ cpr_free(s_registered_type[type_index]); s_registered_type[type_index] = NULL; } return SIP_OK; }
/* * rm_free * * Description: * This function frees the memory allocated for the specified resource manager. * * Parameters: * rm_p - pointer to the resource manager. * * Returns: * none */ void rm_destroy (resource_manager_t *rm_p) { static const char fname[] = "rm_destroy"; if (!rm_p) { PLAT_ERROR(PLAT_COMMON_F_PREFIX"null resource manager received.\n", fname); return; } cpr_free(rm_p->table); cpr_free(rm_p); }
int sip_platform_udp_channel_read (cpr_socket_t s, cprBuffer_t buf, uint16_t *len, cpr_sockaddr_t *soc_addr, cpr_socklen_t *soc_addr_len) { static const char *fname = "sip_platform_udp_channel_read"; int bytes_read; // NOT USED: cpr_sockaddr_in_t *addr = (cpr_sockaddr_in_t *)soc_addr; bytes_read = cprRecvFrom(s, buf, CPR_MAX_MSG_SIZE, 0, soc_addr, soc_addr_len); switch (bytes_read) { case SOCKET_ERROR: /* * If no data is available to read (CPR_EWOULDBLOCK), * for non-blocking socket, it is not an error. */ cpr_free(buf); *len = 0; if (cpr_errno != CPR_EWOULDBLOCK) { CCSIP_DEBUG_ERROR(SIP_F_PREFIX"fd[%d]\n", fname, s); CCSIP_DEBUG_ERROR(get_debug_string(DEBUG_GENERAL_SYSTEMCALL_FAILED), fname, "cprRecvFrom", cpr_errno); return SIP_ERROR; } /* * Will continue reading when data arrives at socket */ break; case 0: /* * Return value 0 is OK. This does NOT mean the connection * has closed by the peer, as with TCP sockets. With UDP * sockets, there is no such thing as closing a connection. */ CCSIP_DEBUG_MESSAGE(DEB_F_PREFIX"No data on fd %d\n", DEB_F_PREFIX_ARGS(SIP_SDP, fname), s); cpr_free(buf); *len = 0; break; default: /* PKT has been read */ CCSIP_DEBUG_MESSAGE(DEB_F_PREFIX"Recvd on fd %d\n", DEB_F_PREFIX_ARGS(SIP_SDP, fname), s); *len = (uint16_t) bytes_read; break; } return SIP_OK; }
int sip_platform_msg_timer_subnot_start (uint32_t msec, sipPlatformUITimer_t *timer_p, uint32_t id, char *message_buffer, int message_buffer_len, int message_type, cpr_ip_addr_t *ipaddr, uint16_t port) { static const char fname[] = "sip_platform_msg_timer_start_subnot"; sip_platform_msg_timer_subnot_stop(timer_p); if (message_buffer_len > SIP_UDP_MESSAGE_SIZE) { CCSIP_DEBUG_ERROR(get_debug_string(DEBUG_MSG_BUFFER_TOO_BIG), fname, message_buffer_len); return SIP_ERROR; } if (timer_p->message_buffer == NULL) { timer_p->message_buffer = (char *)cpr_malloc(message_buffer_len+1); if (timer_p->message_buffer == NULL) return SIP_ERROR; } else if (timer_p->message_buffer != message_buffer) { cpr_free(timer_p->message_buffer); timer_p->message_buffer = (char *)cpr_malloc(message_buffer_len+1); if (timer_p->message_buffer == NULL) return SIP_ERROR; } timer_p->message_buffer_len = message_buffer_len; timer_p->message_buffer[message_buffer_len] = '\0'; memcpy(timer_p->message_buffer, message_buffer, message_buffer_len); timer_p->message_type = (sipMethod_t) message_type; timer_p->ipaddr = *ipaddr; timer_p->port = port; if (cprStartTimer(timer_p->timer, msec, (void *)(long)id) == CPR_FAILURE) { CCSIP_DEBUG_ERROR(SIP_F_PREFIX "%s failed\n", fname, "cprStartTimer"); cpr_free(timer_p->message_buffer); timer_p->message_buffer = NULL; timer_p->message_buffer_len = 0; return SIP_ERROR; } return SIP_OK; }
/** * 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); }
/** * cprDestroyThread * * @brief Destroys the thread passed in. * * The cprDestroyThread function is called to destroy a thread. The thread * parameter may be any valid thread including the calling thread itself. * * @param[in] thread - thread to destroy. * * @return CPR_SUCCESS or CPR_FAILURE. errno should be set for FAILURE case. * * @note In Linux there will never be a success indication as the * calling thread will have been terminated. */ cprRC_t cprDestroyThread (cprThread_t thread) { static const char fname[] = "cprDestroyThread"; cpr_thread_t *cprThreadPtr; cprThreadPtr = (cpr_thread_t *) thread; if (cprThreadPtr != NULL) { /* * Make sure thread is trying to destroy itself. */ if (cprThreadPtr->u.handlePtr == (void*) pthread_self()) { cprThreadPtr->threadId = 0; cpr_free(cprThreadPtr); pthread_exit(NULL); return CPR_SUCCESS; } CPR_ERROR("%s: Thread attempted to destroy another thread, not itself.\n", fname); errno = EINVAL; return CPR_FAILURE; } /* Bad application! */ CPR_ERROR("%s - NULL pointer passed in.\n", fname); errno = EINVAL; return CPR_FAILURE; }
void pmhutils_wstream_delete (pmhWstream_t *pmhWstream, boolean freebuf) { if (pmhWstream && freebuf && pmhWstream->buff) { cpr_free(pmhWstream->buff); } }
void conf_roster_free_call_conference (cc_call_conference_Info_t *confInfo) { cc_call_conferenceParticipant_Info_t *participant; CCAPP_DEBUG(DEB_F_PREFIX"in free_call_confrerence \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONFPARSE")); while((participant=(cc_call_conferenceParticipant_Info_t *) sll_lite_unlink_head(&confInfo->currentParticipantsList)) != NULL) { strlib_free(participant->participantName); strlib_free(participant->endpointUri); strlib_free(participant->callid); strlib_free(participant->participantNumber); participant->participantSecurity = CC_SECURITY_NONE; participant->participantStatus = CCAPI_CONFPARTICIPANT_UNKNOWN; participant->canRemoveOtherParticipants = FALSE; cpr_free(participant); participant = NULL; } strlib_free(confInfo->myParticipantId); conf_roster_init_call_conference(confInfo); }
boolean pmhutils_wstream_grow (pmhWstream_t *pmhWstream) { char *newbuf; if (!pmhWstream || !pmhWstream->buff || !pmhWstream->growable) { return FALSE; } newbuf = (char *) cpr_realloc((void *) pmhWstream->buff, pmhWstream->total_bytes + WSTREAM_START_SIZE); if (newbuf == NULL) { if ((pmhWstream->total_bytes + WSTREAM_START_SIZE) != 0) { cpr_free(pmhWstream->buff); } pmhWstream->buff = NULL; return FALSE; } pmhWstream->buff = newbuf; pmhWstream->total_bytes += WSTREAM_START_SIZE; return TRUE; }
/* * cprDestroyThread * * Destroys the thread passed in. * * Parameters: thread - thread to destroy. * * Return Value: Success or failure indication. * In CNU there will never be a success * indication as the calling thread will * have been terminated. */ cprRC_t cprDestroyThread(cprThread_t thread) { cprRC_t retCode = CPR_FAILURE; static const char fname[] = "cprDestroyThread"; cpr_thread_t *cprThreadPtr; cprThreadPtr = (cpr_thread_t*)thread; if (cprThreadPtr != NULL) { CWinThread * pCWinThread; uint32_t result = 0; uint32_t waitrc = WAIT_FAILED; pCWinThread = (CWinThread *)((cpr_thread_t *)thread)->u.handlePtr; if (pCWinThread !=NULL) { result = pCWinThread->PostThreadMessage(WM_CLOSE, 0, 0); if(result) { waitrc = WaitForSingleObject(pCWinThread->m_hThread, 60000); } } if (result == 0) { CPR_ERROR("%s - Thread exit failure %d\n", fname, GetLastError()); retCode = CPR_FAILURE; } retCode = CPR_SUCCESS; /* Bad application! */ } else { CPR_ERROR("%s - NULL pointer passed in.\n", fname); retCode = CPR_FAILURE; } cpr_free(cprThreadPtr); return (retCode); };
/******************************************************** * * Message timer support functions for SIP SM * ********************************************************/ void sip_platform_msg_timers_init (void) { static const char fname[] = "sip_platform_msg_timers_init"; static long timer_init_complete = 0; int i; cprTimer_t timer, reg_timer; for (i = 0; i < MAX_CCBS; i++) { if (timer_init_complete) { if ((cprCancelTimer(sipPlatformUISMTimers[i].timer) == CPR_FAILURE) || (cprCancelTimer(sipPlatformUISMTimers[i].reg_timer) == CPR_FAILURE)) { CCSIP_DEBUG_STATE(get_debug_string(DEBUG_GENERAL_FUNCTIONCALL_FAILED), fname, "cprCancelTimer"); } } timer = sipPlatformUISMTimers[i].timer; reg_timer = sipPlatformUISMTimers[i].reg_timer; if (sipPlatformUISMTimers[i].message_buffer != NULL) { cpr_free(sipPlatformUISMTimers[i].message_buffer); sipPlatformUISMTimers[i].message_buffer = NULL; sipPlatformUISMTimers[i].message_buffer_len = 0; } memset(&sipPlatformUISMTimers[i], 0, sizeof(sipPlatformUITimer_t)); sipPlatformUISMTimers[i].timer = timer; sipPlatformUISMTimers[i].reg_timer = reg_timer; } timer_init_complete = 1; return; }
/** * Removes all messages from the queue and then destroy the message queue * * @param msgQueue - message queue to destroy * * @return CPR_SUCCESS or CPR_FAILURE, errno provided */ cprRC_t cprDestroyMessageQueue (cprMsgQueue_t msgQueue) { static const char fname[] = "cprDestroyMessageQueue"; cpr_msg_queue_t *msgq; void *msg; msgq = (cpr_msg_queue_t *) msgQueue; if (msgq == NULL) { /* Bad application! */ CPR_ERROR("%s: Invalid input\n", fname); errno = EINVAL; return CPR_FAILURE; } /* Drain message queue */ msg = cprGetMessage(msgQueue, FALSE, NULL); while (msg != NULL) { cpr_free(msg); msg = cprGetMessage(msgQueue, FALSE, NULL); } /* Remove message queue from list */ pthread_mutex_lock(&msgQueueListMutex); if (msgq == msgQueueList) { msgQueueList = msgq->next; } else { cpr_msg_queue_t *msgql = msgQueueList; while ((msgql->next != NULL) && (msgql->next != msgq)) { msgql = msgql->next; } if (msgql->next == msgq) { msgql->next = msgq->next; } } pthread_mutex_unlock(&msgQueueListMutex); /* Remove message queue mutex */ if (pthread_mutex_destroy(&msgq->mutex) != 0) { CPR_ERROR("%s: Failed to destroy msg queue (%s) mutex: %d\n", fname, msgq->name, errno); } cpr_free(msgq); return CPR_SUCCESS; }
/* * ccsip_free_call_info_header * * Description: * * Frees the memory allocated to a call info structure. */ void ccsip_free_call_info_header (cc_call_info_t *call_info_p) { if(call_info_p->type == CC_FEAT_CALLINFO) { } cpr_free(call_info_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; }
/** * This function will process if there are any pending notifications. * * @param none. * * @return none. */ static void sub_handler_initialized (void) { static const char fname[] = "sub_handler_initialized"; pres_pending_notify_t *pending_notify_p; char *presentity_url = NULL; char presentity_user[CC_MAX_DIALSTRING_LEN]; Presence_ext_t *event_body_p = NULL; BLF_DEBUG("MSC: 0/0: %s: invoked", fname); s_subs_hndlr_initialized = TRUE; if (s_pending_notify_list == NULL) { BLF_DEBUG("MSC: 0/0: %s: no pending notfications", fname); return; } /* * process the pending NOTIFYs. */ pending_notify_p = (pres_pending_notify_t *)sll_next(s_pending_notify_list, NULL); while (pending_notify_p != NULL) { /* strip of the "sip:" */ presentity_url = strchr(pending_notify_p->presentity, ':'); if (presentity_url == NULL) { BLF_ERROR("MSC: %s: Error parsing presentity_url", fname); return; } presentity_url = presentity_url + 1; /* * look for long from (user@host) matches first. if none found, look * for short form (user) matches. */ event_body_p = &(pending_notify_p->event_data_p->u.presence_rpid); if (apply_presence_state_to_matching_feature_keys(presentity_url, event_body_p) != TRUE) { ccsip_util_extract_user(pending_notify_p->presentity, presentity_user); if (apply_presence_state_to_matching_feature_keys(presentity_user, event_body_p) != TRUE) { BLF_DEBUG("MSC: 0/0: %s: no matching BLF feature keys found", fname); } } BLF_DEBUG("MSC: 0/0: %s: processed a pending notfication for %s", fname, presentity_url); free_event_data(pending_notify_p->event_data_p); (void) sll_remove(s_pending_notify_list, (void *)pending_notify_p); cpr_free(pending_notify_p); pending_notify_p = (pres_pending_notify_t *)sll_next(s_pending_notify_list, NULL); } (void)sll_destroy(s_pending_notify_list); s_pending_notify_list = NULL; }
/** * @brief Called when the application is done with this system header * * The cprReleaseSysHeader function returns the system header buffer to the * system. * @param[in] syshdr pointer to the sysHdr to be released * * @return none */ void cprReleaseSysHeader (void *syshdr) { if (syshdr == NULL) { CPR_ERROR("cprReleaseSysHeader: Sys header pointer is NULL\n"); return; } cpr_free(syshdr); }
/* * Function: FreeDialTemplates() * * Parameters: None * * Description: Frees the Dial Templates from memory * * Returns: None */ void FreeDialTemplates (void) { struct DialTemplate *pnext; while (basetemplate != NULL) { pnext = basetemplate->next; cpr_free(basetemplate); basetemplate = pnext; } }
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); }
/** * Free the snapshot * @param cc_callinfo_ref_t - refrence to the block to be freed * @return void */ void CCAPI_Call_releaseCallInfo(cc_callinfo_ref_t ref) { if (ref != NULL ) { DEF_DEBUG(DEB_F_PREFIX"ref=%p: count=%d", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI_Call_releaseCallInfo"), ref, ref->ref_count); ref->ref_count--; if ( ref->ref_count == 0 ) { cleanSessionData(ref); cpr_free(ref); } } }
/* * Function: configapp_free_event_data() * * Parameters: ccsip_event_data_t* * * Description: Frees the event data after the processing is complete * * Returns: None */ void configapp_free_event_data (ccsip_event_data_t *data) { ccsip_event_data_t *next_data; while(data) { next_data = data->next; cpr_free(data); data = next_data; } }
int delhash(unsigned int key) { unsigned int hashval; hash_table_t *cur_hash; hashval = 0; hashval = sessionHash(key); if (hashtable[hashval] == NULL) { return -1; } if (hashtable[hashval]->key == key) { cur_hash = hashtable[hashval]; hashtable[hashval] = cur_hash->next; if ( hashtable[hashval] != NULL ) { hashtable[hashval]->prev = NULL; } cpr_free(cur_hash); return 0; } else { cur_hash = hashtable[hashval]->next; while (cur_hash != NULL) { if (cur_hash->key == key) { cur_hash->prev->next = cur_hash->next; if (cur_hash->next != NULL) { cur_hash->next->prev = cur_hash->prev; } cpr_free(cur_hash); return 0; } cur_hash = cur_hash->next; } } return -1; }
void pmhutils_rstream_delete (pmhRstream_t *pmhRstream, boolean freebuf) { if (!pmhRstream) { return; } pmhRstream->error = TRUE; if (freebuf && pmhRstream->buff) { cpr_free(pmhRstream->buff); } }
cc_rcs_t sub_send_msg (cprBuffer_t buf, uint32_t cmd, uint16_t len, cc_srcs_t dst_id) { cpr_status_e rc; /* This buffer is assumed to be at least of size int */ MOZ_ASSERT(len >= sizeof(int)); if (len < sizeof(int)) { return CC_RC_ERROR; } CC_DEBUG_MSG sub_print_msg((char *)buf, len); switch (dst_id) { case CC_SRC_GSM: rc = gsm_send_msg(cmd, buf, len); if (rc == CPR_FAILURE) { cpr_free(buf); } break; case CC_SRC_SIP: rc = SIPTaskSendMsg(cmd, buf, len, NULL); if (rc == CPR_FAILURE) { cpr_free(buf); } break; case CC_SRC_MISC_APP: rc = MiscAppTaskSendMsg(cmd, buf, len); if (rc == CPR_FAILURE) { cpr_free(buf); } break; default: rc = CPR_FAILURE; break; } return (rc == CPR_SUCCESS) ? CC_RC_SUCCESS : CC_RC_ERROR; }
/* * Function: ccsip_info_package_handler_shutdown * * Parameters: * None * * Description: * Shuts down the Info Package handler framework. * * Return: * None */ void ccsip_info_package_handler_shutdown(void) { static const char *fname = "ccsip_info_package_handler_shutdown"; info_index_t info_index; type_index_t type_index; handler_record_t *record; if (s_handler_registry == NULL) { // Is this considered an error? CCSIP_DEBUG_TASK("%s: Info Package handler was not initialized", fname); return; } for (type_index = 0; type_index < MAX_INFO_HANDLER; type_index++) { if (s_registered_type[type_index] != NULL) { cpr_free(s_registered_type[type_index]); s_registered_type[type_index] = NULL; } } for (info_index = 0; info_index < MAX_INFO_HANDLER; info_index++) { if (g_registered_info[info_index] != NULL) { cpr_free(g_registered_info[info_index]); g_registered_info[info_index] = NULL; } } /* Deregister each Info Package handler */ for (record = (handler_record_t *)sll_next(s_handler_registry, NULL); record != NULL; record = (handler_record_t *)sll_next(s_handler_registry, record)) { cpr_free(record); } /* Destroy the SLL */ sll_destroy(s_handler_registry); s_handler_registry = NULL; }
void sip_platform_msg_timer_subnot_stop (sipPlatformUITimer_t *timer_p) { static const char fname[] = "sip_platform_msg_timer_stop_subnot"; if (timer_p->message_buffer != NULL) { cpr_free(timer_p->message_buffer); timer_p->message_buffer = NULL; } if (cprCancelTimer(timer_p->timer) == CPR_FAILURE) { CCSIP_DEBUG_STATE(DEB_F_PREFIX "%s failed\n", DEB_F_PREFIX_ARGS(SIP_TIMER, fname), "cprCancelTimer"); return; } }
/** * This function will free up entire list of pending requests * * @param[in] list - pending requests list handle * * @return none * */ static void free_pending_reqs (sll_handle_t list) { pub_req_t *msg_p; if (list == NULL) { return; } msg_p = (pub_req_t *)sll_next(list, NULL); while (msg_p != NULL) { free_event_data(msg_p->event_data_p); (void)sll_remove(list, (void *)msg_p); cpr_free(msg_p); msg_p = (pub_req_t *)sll_next(list, NULL); } sll_destroy(list); }
/* * cprDestroyMutex * * Destroys the mutex passed in. * * Parameters: mutex - mutex to destroy * * Return Value: Success or failure indication */ cprRC_t cprDestroyMutex (cprMutex_t mutex) { cpr_mutex_t *cprMutexPtr; const static char fname[] = "cprDestroyMutex"; cprMutexPtr = (cpr_mutex_t *) mutex; if (cprMutexPtr != NULL) { CloseHandle(cprMutexPtr->u.handlePtr); cpr_free(cprMutexPtr); return (CPR_SUCCESS); /* Bad application! */ } else { CPR_ERROR("%s - NULL pointer passed in.\n", fname); return (CPR_FAILURE); } }