⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ist_fsm.c

📁 libosip-0.9.7源码
💻 C
📖 第 1 页 / 共 2 页
字号:
         UDP message (not at the SIP layer) */      else if (received != NULL)	host = received->gvalue;      else	host = via->host;      if (rport == NULL || rport->gvalue == NULL)	{	  if (via->port != NULL)	    port = satoi (via->port);	  else	    port = 5060;	}      else	port = satoi (rport->gvalue);      i = osip->cb_send_message (ist, ist->last_response, host,				 port, ist->out_socket);    }  else    i = -1;  if (i != 0)    {      osip->cb_ist_transport_error (ist, i);      transaction_set_state (ist, IST_TERMINATED);      osip->cb_ist_kill_transaction (ist);      /* TODO: MUST BE DELETED NOW */      return;    }  if (osip->cb_ist_3456xx_sent2 != NULL)    osip->cb_ist_3456xx_sent2 (ist, ist->last_response);}voidist_timeout_h_event (transaction_t * ist, sipevent_t * evt){  osip_t *osip = (osip_t *) ist->config;  ist->ist_context->timer_h_length = -1;  ist->ist_context->timer_h_start = -1;  transaction_set_state (ist, IST_TERMINATED);  osip->cb_ist_kill_transaction (ist);}voidist_timeout_i_event (transaction_t * ist, sipevent_t * evt){  osip_t *osip = (osip_t *) ist->config;  ist->ist_context->timer_i_length = -1;  ist->ist_context->timer_i_start = -1;  transaction_set_state (ist, IST_TERMINATED);  osip->cb_ist_kill_transaction (ist);}voidist_snd_1xx (transaction_t * ist, sipevent_t * evt){  int i;  via_t *via;  osip_t *osip = (osip_t *) ist->config;  if (ist->last_response != NULL)    {      msg_free (ist->last_response);      sfree (ist->last_response);    }  ist->last_response = evt->sip;  via = (via_t *) list_get (ist->last_response->vias, 0);  if (via)    {      char *host;      int port;      generic_param_t *maddr;      generic_param_t *received;      generic_param_t *rport;      via_param_getbyname (via, "maddr", &maddr);      via_param_getbyname (via, "received", &received);      via_param_getbyname (via, "rport", &rport);      /* 1: user should not use the provided information         (host and port) if they are using a reliable         transport. Instead, they should use the already         open socket attached to this transaction. */      /* 2: check maddr and multicast usage */      if (maddr != NULL)	host = maddr->gvalue;      /* we should check if this is a multicast address and use         set the "ttl" in this case. (this must be done in the         UDP message (not at the SIP layer) */      else if (received != NULL)	host = received->gvalue;      else	host = via->host;      if (rport == NULL || rport->gvalue == NULL)	{	  if (via->port != NULL)	    port = satoi (via->port);	  else	    port = 5060;	}      else	port = satoi (rport->gvalue);      i = osip->cb_send_message (ist, ist->last_response, host,				 port, ist->out_socket);    }  else    i = -1;  if (i != 0)    {      osip->cb_ist_transport_error (ist, i);      transaction_set_state (ist, IST_TERMINATED);      osip->cb_ist_kill_transaction (ist);      /* MUST BE DELETED NOW */      return;    }  else    osip->cb_ist_1xx_sent (ist, ist->last_response);  /* we are already in the proper state */  return;}voidist_snd_2xx (transaction_t * ist, sipevent_t * evt){  int i;  via_t *via;  osip_t *osip = (osip_t *) ist->config;  if (ist->last_response != NULL)    {      msg_free (ist->last_response);      sfree (ist->last_response);    }  ist->last_response = evt->sip;  via = (via_t *) list_get (ist->last_response->vias, 0);  if (via)    {      char *host;      int port;      generic_param_t *maddr;      generic_param_t *received;      generic_param_t *rport;      via_param_getbyname (via, "maddr", &maddr);      via_param_getbyname (via, "received", &received);      via_param_getbyname (via, "rport", &rport);      /* 1: user should not use the provided information         (host and port) if they are using a reliable         transport. Instead, they should use the already         open socket attached to this transaction. */      /* 2: check maddr and multicast usage */      if (maddr != NULL)	host = maddr->gvalue;      /* we should check if this is a multicast address and use         set the "ttl" in this case. (this must be done in the         UDP message (not at the SIP layer) */      else if (received != NULL)	host = received->gvalue;      else	host = via->host;      if (rport == NULL || rport->gvalue == NULL)	{	  if (via->port != NULL)	    port = satoi (via->port);	  else	    port = 5060;	}      else	port = satoi (rport->gvalue);      i = osip->cb_send_message (ist, ist->last_response, host,				 port, ist->out_socket);    }  else    i = -1;  if (i != 0)    {      osip->cb_ist_transport_error (ist, i);      transaction_set_state (ist, IST_TERMINATED);      osip->cb_ist_kill_transaction (ist);      /* MUST BE DELETED NOW */      return;    }  else    osip->cb_ist_2xx_sent (ist, ist->last_response);  transaction_set_state (ist, IST_TERMINATED);  osip->cb_ist_kill_transaction (ist);  return;}voidist_snd_3456xx (transaction_t * ist, sipevent_t * evt){  int i;  via_t *via;  osip_t *osip = (osip_t *) ist->config;  if (ist->last_response != NULL)    {      msg_free (ist->last_response);      sfree (ist->last_response);    }  ist->last_response = evt->sip;  via = (via_t *) list_get (ist->last_response->vias, 0);  if (via)    {      char *host;      int port;      generic_param_t *maddr;      generic_param_t *received;      generic_param_t *rport;      via_param_getbyname (via, "maddr", &maddr);      via_param_getbyname (via, "received", &received);      via_param_getbyname (via, "rport", &rport);      /* 1: user should not use the provided information         (host and port) if they are using a reliable         transport. Instead, they should use the already         open socket attached to this transaction. */      /* 2: check maddr and multicast usage */      if (maddr != NULL)	host = maddr->gvalue;      /* we should check if this is a multicast address and use         set the "ttl" in this case. (this must be done in the         UDP message (not at the SIP layer) */      else if (received != NULL)	host = received->gvalue;      else	host = via->host;      if (rport == NULL || rport->gvalue == NULL)	{	  if (via->port != NULL)	    port = satoi (via->port);	  else	    port = 5060;	}      else	port = satoi (rport->gvalue);      i = osip->cb_send_message (ist, ist->last_response, host,				 port, ist->out_socket);    }  else    i = -1;  if (i != 0)    {      osip->cb_ist_transport_error (ist, i);      transaction_set_state (ist, IST_TERMINATED);      osip->cb_ist_kill_transaction (ist);      /* MUST BE DELETED NOW */      return;    }  else    {      if (MSG_IS_STATUS_3XX (ist->last_response))	osip->cb_ist_3xx_sent (ist, ist->last_response);      else if (MSG_IS_STATUS_4XX (ist->last_response))	osip->cb_ist_4xx_sent (ist, ist->last_response);      else if (MSG_IS_STATUS_5XX (ist->last_response))	osip->cb_ist_5xx_sent (ist, ist->last_response);      else	osip->cb_ist_6xx_sent (ist, ist->last_response);    }  ist->ist_context->timer_g_start = time (NULL);  ist->ist_context->timer_h_start = time (NULL);  transaction_set_state (ist, IST_COMPLETED);  return;}voidist_rcv_ack (transaction_t * ist, sipevent_t * evt){  osip_t *osip = (osip_t *) ist->config;  if (ist->ack != NULL)    {      msg_free (ist->ack);      sfree (ist->ack);    }  ist->ack = evt->sip;  if (ist->state == IST_COMPLETED)    osip->cb_ist_ack_received (ist, ist->ack);  else				/* IST_CONFIRMED */    {				/* ack retransmission */      if (osip->cb_ist_ack_received2 != NULL)	osip->cb_ist_ack_received2 (ist, ist->ack);    }  /* set the timer to 0 for reliable, and T4 for unreliable (already set) */  ist->ist_context->timer_i_start = time (NULL);	/* not started */  transaction_set_state (ist, IST_CONFIRMED);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -