void osip_nict_timeout_e_event (osip_transaction_t * nict, osip_event_t * evt) { osip_t *osip = (osip_t *) nict->config; int i; /* reset timer */ if (nict->state == NICT_TRYING) { if (nict->nict_context->timer_e_length < DEFAULT_T1) nict->nict_context->timer_e_length = nict->nict_context->timer_e_length + DEFAULT_T1_TCP_PROGRESS; else nict->nict_context->timer_e_length = nict->nict_context->timer_e_length * 2; if (nict->nict_context->timer_e_length > DEFAULT_T2) nict->nict_context->timer_e_length = DEFAULT_T2; } else /* in PROCEEDING STATE, TIMER is always DEFAULT_T2 */ nict->nict_context->timer_e_length = DEFAULT_T2; osip_gettimeofday (&nict->nict_context->timer_e_start, NULL); add_gettimeofday (&nict->nict_context->timer_e_start, nict->nict_context->timer_e_length); /* retransmit REQUEST */ i = osip->cb_send_message (nict, nict->orig_request, nict->nict_context->destination, nict->nict_context->port, nict->out_socket); if (i < 0) { nict_handle_transport_error (nict, i); return; } #ifndef USE_BLOCKINGSOCKET /* stop timer E in reliable transport - non blocking socket: the message was just sent */ if (i == 0) { /* but message was really sent */ osip_via_t *via; char *proto; i = osip_message_get_via (nict->orig_request, 0, &via); /* get top via */ if (i < 0) { nict_handle_transport_error (nict, -1); return; } proto = via_get_protocol (via); if (proto == NULL) { nict_handle_transport_error (nict, -1); return; } if (osip_strcasecmp (proto, "TCP") != 0 && osip_strcasecmp (proto, "TLS") != 0 && osip_strcasecmp (proto, "SCTP") != 0) { } else { /* reliable protocol is used: */ nict->nict_context->timer_e_length = -1; /* E is not ACTIVE */ nict->nict_context->timer_e_start.tv_sec = -1; } } #endif if (i == 0) /* but message was really sent */ __osip_message_callback (OSIP_NICT_REQUEST_SENT_AGAIN, nict, nict->orig_request); }
void osip_nict_timeout_e_event (osip_transaction_t * nict, osip_event_t * evt) { osip_t *osip = (osip_t *) nict->config; int i; /* reset timer */ if (nict->state == NICT_TRYING) { nict->nict_context->timer_e_length = nict->nict_context->timer_e_length * 2; if (nict->nict_context->timer_e_length > 4000) nict->nict_context->timer_e_length = 4000; } else /* in PROCEEDING STATE, TIMER is always 4000 */ nict->nict_context->timer_e_length = 4000; osip_gettimeofday (&nict->nict_context->timer_e_start, NULL); add_gettimeofday (&nict->nict_context->timer_e_start, nict->nict_context->timer_e_length); /* retransmit REQUEST */ i = osip->cb_send_message (nict, nict->orig_request, nict->nict_context->destination, nict->nict_context->port, nict->out_socket); if (i != 0) { nict_handle_transport_error (nict, i); return; } __osip_message_callback (OSIP_NICT_REQUEST_SENT_AGAIN, nict, nict->orig_request); }
void nict_snd_request (osip_transaction_t * nict, osip_event_t * evt) { int i; osip_t *osip = (osip_t *) nict->config; /* Here we have ict->orig_request == NULL */ nict->orig_request = evt->sip; i = osip->cb_send_message (nict, evt->sip, nict->nict_context->destination, nict->nict_context->port, nict->out_socket); if (i == 0) { /* invoke the right callback! */ if (MSG_IS_REGISTER (evt->sip)) __osip_message_callback (OSIP_NICT_REGISTER_SENT, nict, nict->orig_request); else if (MSG_IS_BYE (evt->sip)) __osip_message_callback (OSIP_NICT_BYE_SENT, nict, nict->orig_request); else if (MSG_IS_OPTIONS (evt->sip)) __osip_message_callback (OSIP_NICT_OPTIONS_SENT, nict, nict->orig_request); else if (MSG_IS_INFO (evt->sip)) __osip_message_callback (OSIP_NICT_INFO_SENT, nict, nict->orig_request); else if (MSG_IS_CANCEL (evt->sip)) __osip_message_callback (OSIP_NICT_CANCEL_SENT, nict, nict->orig_request); else if (MSG_IS_NOTIFY (evt->sip)) __osip_message_callback (OSIP_NICT_NOTIFY_SENT, nict, nict->orig_request); else if (MSG_IS_SUBSCRIBE (evt->sip)) __osip_message_callback (OSIP_NICT_SUBSCRIBE_SENT, nict, nict->orig_request); else __osip_message_callback (OSIP_NICT_UNKNOWN_REQUEST_SENT, nict, nict->orig_request); __osip_transaction_set_state (nict, NICT_TRYING); } else { nict_handle_transport_error (nict, i); } }
void nict_snd_request (osip_transaction_t * nict, osip_event_t * evt) { int i; osip_t *osip = (osip_t *) nict->config; /* Here we have ict->orig_request == NULL */ nict->orig_request = evt->sip; i = osip->cb_send_message (nict, evt->sip, nict->nict_context->destination, nict->nict_context->port, nict->out_socket); if (i >= 0) { /* invoke the right callback! */ if (MSG_IS_REGISTER (evt->sip)) __osip_message_callback (OSIP_NICT_REGISTER_SENT, nict, nict->orig_request); else if (MSG_IS_BYE (evt->sip)) __osip_message_callback (OSIP_NICT_BYE_SENT, nict, nict->orig_request); else if (MSG_IS_OPTIONS (evt->sip)) __osip_message_callback (OSIP_NICT_OPTIONS_SENT, nict, nict->orig_request); else if (MSG_IS_INFO (evt->sip)) __osip_message_callback (OSIP_NICT_INFO_SENT, nict, nict->orig_request); else if (MSG_IS_CANCEL (evt->sip)) __osip_message_callback (OSIP_NICT_CANCEL_SENT, nict, nict->orig_request); else if (MSG_IS_NOTIFY (evt->sip)) __osip_message_callback (OSIP_NICT_NOTIFY_SENT, nict, nict->orig_request); else if (MSG_IS_SUBSCRIBE (evt->sip)) __osip_message_callback (OSIP_NICT_SUBSCRIBE_SENT, nict, nict->orig_request); else __osip_message_callback (OSIP_NICT_UNKNOWN_REQUEST_SENT, nict, nict->orig_request); #ifndef USE_BLOCKINGSOCKET /* stop timer E in reliable transport - non blocking socket: the message was just sent */ { osip_via_t *via; char *proto; int k; k = osip_message_get_via (nict->orig_request, 0, &via); /* get top via */ if (k < 0) { nict_handle_transport_error (nict, -1); return; } proto = via_get_protocol (via); if (proto == NULL) { nict_handle_transport_error (nict, -1); return; } if (i == 0) { /* but message was really sent */ if (osip_strcasecmp (proto, "TCP") != 0 && osip_strcasecmp (proto, "TLS") != 0 && osip_strcasecmp (proto, "SCTP") != 0) { } else { /* reliable protocol is used: */ nict->nict_context->timer_e_length = -1; /* E is not ACTIVE */ nict->nict_context->timer_e_start.tv_sec = -1; } } else { if (osip_strcasecmp (proto, "TCP") != 0 && osip_strcasecmp (proto, "TLS") != 0 && osip_strcasecmp (proto, "SCTP") != 0) { } else { /* reliable protocol is used: */ nict->nict_context->timer_e_length = DEFAULT_T1_TCP_PROGRESS; } } } #endif if (nict->nict_context->timer_e_length > 0) { osip_gettimeofday (&nict->nict_context->timer_e_start, NULL); add_gettimeofday (&nict->nict_context->timer_e_start, nict->nict_context->timer_e_length); } __osip_transaction_set_state (nict, NICT_TRYING); } else { nict_handle_transport_error (nict, i); } }