cc_rcs_t sub_int_subnot_register (cc_srcs_t src_id, cc_srcs_t dst_id, cc_subscriptions_t evt_pkg, void *callback_fun, cc_srcs_t dest_task, int msg_id, void *term_callback, int term_msg_id, long min_duration, long max_duration) { sipspi_msg_t *pmsg; pmsg = (sipspi_msg_t *) cc_get_msg_buf(sizeof(*pmsg)); if (!pmsg) { return CC_RC_ERROR; } pmsg->msg.subs_reg.eventPackage = evt_pkg; pmsg->msg.subs_reg.max_duration = max_duration; pmsg->msg.subs_reg.min_duration = min_duration; pmsg->msg.subs_reg.subsIndCallback = (ccsipSubsIndCallbackFn_t) callback_fun; pmsg->msg.subs_reg.subsIndCallbackMsgID = msg_id; pmsg->msg.subs_reg.subsIndCallbackTask = dest_task; pmsg->msg.subs_reg.subsTermCallback = (ccsipSubsTerminateCallbackFn_t) term_callback; pmsg->msg.subs_reg.subsTermCallbackMsgID = term_msg_id; return sub_send_msg((cprBuffer_t)pmsg, SIPSPI_EV_CC_SUBSCRIBE_REGISTER, sizeof(*pmsg), dst_id); }
/* * Function: sub_int_subscribe() * * Parameters: msg_p - pointer to sipspi_msg_t (input parameter) * * Description: posts SIPSPI_EV_CC_SUBSCRIBE to SIP task message queue. * * Returns: CC_RC_ERROR - failed to post msg. * CC_RC_SUCCESS - successful posted msg. */ cc_rcs_t sub_int_subscribe (sipspi_msg_t *msg_p) { sipspi_msg_t *pmsg; pmsg = (sipspi_msg_t *) cc_get_msg_buf(sizeof(*pmsg)); if (!pmsg) { return CC_RC_ERROR; } memcpy(pmsg, msg_p, sizeof(sipspi_msg_t)); return sub_send_msg((cprBuffer_t)pmsg, SIPSPI_EV_CC_SUBSCRIBE, sizeof(*pmsg), CC_SRC_SIP); }
cc_rcs_t app_send_message (void *msg_data, int msg_len, cc_srcs_t dest_id, int msg_id) { void *pmsg; pmsg = (void *) cc_get_msg_buf(msg_len); if (!pmsg) { return CC_RC_ERROR; } memcpy(pmsg, msg_data, msg_len); return sub_send_msg((cprBuffer_t)pmsg, msg_id, (uint16_t)msg_len, dest_id); }
cc_rcs_t sip_send_message (ccsip_sub_not_data_t * msg_data, cc_srcs_t dest_id, int msg_id) { ccsip_sub_not_data_t *pmsg; pmsg = (ccsip_sub_not_data_t *) cc_get_msg_buf(sizeof(*pmsg)); if (!pmsg) { return CC_RC_ERROR; } memcpy(pmsg, msg_data, sizeof(*pmsg)); return sub_send_msg((cprBuffer_t)pmsg, msg_id, sizeof(*pmsg), dest_id); }
/** * This function will post a response event to applications. * this is invoked by SIP stack. * * @param[in] pub_rsp_p - response struct. * @param[in] callback_task - task that is interested in response. * @param[in] message_id - message id of the response. * * @return CC_RC_SUCCESS if the event is successfully posted. * Otherwise, CC_RC_ERROR is returned. */ cc_rcs_t publish_int_response (pub_rsp_t *pub_rsp_p, cc_srcs_t callback_task, int message_id ) { pub_rsp_t *pmsg; pmsg = (pub_rsp_t *) cc_get_msg_buf(sizeof(*pmsg)); if (!pmsg) { return CC_RC_ERROR; } memcpy(pmsg, pub_rsp_p, sizeof(*pmsg)); return sub_send_msg((cprBuffer_t)pmsg, message_id, sizeof(*pmsg), callback_task); }
/* * Function: sub_int_notify_ack() * * Parameters: sub_id - subcription id for sip stack to track the subscription. * response_code - response code to be sent in response to NOTIFY. * cseq : CSeq for which response is being sent. * * Description: posts SIPSPI_EV_CC_NOTIFY_RESPONSE to SIP task message queue. * * Returns: CC_RC_ERROR - failed to post msg. * CC_RC_SUCCESS - successful posted msg. */ cc_rcs_t sub_int_notify_ack (sub_id_t sub_id, uint16_t response_code, uint32_t cseq) { sipspi_msg_t *pmsg; pmsg = (sipspi_msg_t *) cc_get_msg_buf(sizeof(*pmsg)); if (!pmsg) { return CC_RC_ERROR; } pmsg->msg.notify_resp.sub_id = sub_id; pmsg->msg.notify_resp.response_code = response_code; pmsg->msg.notify_resp.cseq = cseq; return sub_send_msg((cprBuffer_t)pmsg, SIPSPI_EV_CC_NOTIFY_RESPONSE, sizeof(*pmsg), CC_SRC_SIP); }
cc_rcs_t sub_int_subscribe_ack (cc_srcs_t src_id, cc_srcs_t dst_id, sub_id_t sub_id, uint16_t response_code, int duration) { sipspi_msg_t *pmsg; pmsg = (sipspi_msg_t *) cc_get_msg_buf(sizeof(*pmsg)); if (!pmsg) { return CC_RC_ERROR; } pmsg->msg.subscribe_resp.response_code = response_code; pmsg->msg.subscribe_resp.sub_id = sub_id; pmsg->msg.subscribe_resp.duration = duration; return sub_send_msg((cprBuffer_t)pmsg, SIPSPI_EV_CC_SUBSCRIBE_RESPONSE, sizeof(*pmsg), dst_id); }
/* * Function: sub_int_subscribe_term() * * Parameters: sub_id - subcription id for sip stack to track the subscription. * immediate - boolean flag to indicate if the termination be immediate. * request_id - request id significant for out going subscriptions * event_package - event package type * * Description: posts SIPSPI_EV_CC_SUBSCRIPTION_TERMINATED to SIP task message queue. * * Returns: CC_RC_ERROR - failed to post msg. * CC_RC_SUCCESS - successful posted msg. */ cc_rcs_t sub_int_subscribe_term (sub_id_t sub_id, boolean immediate, int request_id, cc_subscriptions_t event_package) { sipspi_msg_t *pmsg; pmsg = (sipspi_msg_t *) cc_get_msg_buf(sizeof(*pmsg)); if (!pmsg) { return CC_RC_ERROR; } pmsg->msg.subs_term.immediate = immediate; pmsg->msg.subs_term.sub_id = sub_id; pmsg->msg.subs_term.request_id = request_id; pmsg->msg.subs_term.eventPackage = event_package; return sub_send_msg((cprBuffer_t)pmsg, SIPSPI_EV_CC_SUBSCRIPTION_TERMINATED, sizeof(*pmsg), CC_SRC_SIP); }
cc_rcs_t sub_int_notify (cc_srcs_t src_id, cc_srcs_t dst_id, sub_id_t sub_id, ccsipNotifyResultCallbackFn_t notifyResultCallback, int subsNotResCallbackMsgID, ccsip_event_data_t * eventData, subscriptionState subState) { sipspi_msg_t *pmsg; pmsg = (sipspi_msg_t *) cc_get_msg_buf(sizeof(*pmsg)); if (!pmsg) { return CC_RC_ERROR; } pmsg->msg.notify.eventData = eventData; pmsg->msg.notify.notifyResultCallback = notifyResultCallback; pmsg->msg.notify.sub_id = sub_id; pmsg->msg.notify.subsNotResCallbackMsgID = subsNotResCallbackMsgID; pmsg->msg.notify.subState = subState; return sub_send_msg((cprBuffer_t) pmsg, SIPSPI_EV_CC_NOTIFY, sizeof(*pmsg), dst_id); }