亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? osip_body.c

?? SIP協議棧實現
?? C
字號:
/*  The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-)  Copyright (C) 2001,2002,2003  Aymeric MOIZARD jack@atosc.org    This library is free software; you can redistribute it and/or  modify it under the terms of the GNU Lesser General Public  License as published by the Free Software Foundation; either  version 2.1 of the License, or (at your option) any later version.    This library is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  Lesser General Public License for more details.    You should have received a copy of the GNU Lesser General Public  License along with this library; if not, write to the Free Software  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*/#include <stdio.h>#include <stdlib.h>#include <osipparser2/osip_port.h>#include <osipparser2/osip_message.h>#include "parser.h"intosip_body_init (osip_body_t ** body){  *body = (osip_body_t *) osip_malloc (sizeof (osip_body_t));  if (*body == NULL)    return -1;  (*body)->body = NULL;  (*body)->content_type = NULL;  (*body)->headers = (osip_list_t *) osip_malloc (sizeof (osip_list_t));  if ((*body)->headers == NULL)    {      osip_free (*body);      *body = NULL;      return -1;    }  osip_list_init ((*body)->headers);  return 0;}/* fill the body of message.                              *//* INPUT : char *buf | pointer to the start of body.      *//* OUTPUT: osip_message_t *sip | structure to save results.        *//* returns -1 on error. */intosip_message_set_body (osip_message_t * sip, const char *buf){  osip_body_t *body;  int i;  i = osip_body_init (&body);  if (i != 0)    return -1;  i = osip_body_parse (body, buf);  if (i != 0)    {      osip_body_free (body);      return -1;    }#ifdef USE_TMP_BUFFER  sip->message_property = 2;#endif  osip_list_add (sip->bodies, body, -1);  return 0;}intosip_body_clone (const osip_body_t * body, osip_body_t ** dest){  int pos;  int i;  osip_body_t *copy;  if (body == NULL)    return -1;  i = osip_body_init (&copy);  if (i != 0)    return -1;  copy->body = osip_strdup (body->body);  if (body->content_type != NULL)    {      i = osip_content_type_clone (body->content_type, &(copy->content_type));      if (i != 0)	goto bc_error1;    }  {    osip_header_t *header;    osip_header_t *header2;    pos = 0;    while (!osip_list_eol (body->headers, pos))      {	header = (osip_header_t *) osip_list_get (body->headers, pos);	i = osip_header_clone (header, &header2);	if (i != 0)	  goto bc_error1;	osip_list_add (copy->headers, header2, -1);	/* insert as last element */	pos++;      }  }  *dest = copy;  return 0;bc_error1:  osip_body_free (copy);  return -1;}/* returns the pos of body header.                   *//* INPUT : int pos | pos of body header.             *//* INPUT : osip_message_t *sip | sip message.                 *//* OUTPUT: osip_body_t *body | structure to save results. *//* returns -1 on error. */intosip_message_get_body (const osip_message_t * sip, int pos, osip_body_t ** dest){  osip_body_t *body;  *dest = NULL;  if (osip_list_size (sip->bodies) <= pos)    return -1;			/* does not exist */  body = (osip_body_t *) osip_list_get (sip->bodies, pos);  *dest = body;  return pos;}intosip_body_set_contenttype (osip_body_t * body, const char *hvalue){  int i;  if (body == NULL)    return -1;  if (hvalue == NULL)    return -1;  i = osip_content_type_init (&(body->content_type));  if (i != 0)    return -1;  i = osip_content_type_parse (body->content_type, hvalue);  if (i != 0)    {      osip_content_type_free (body->content_type);      body->content_type = NULL;      return -1;    }  return 0;}intosip_body_set_header (osip_body_t * body, const char *hname, const char *hvalue){  osip_header_t *h;  int i;  if (body == NULL)    return -1;  if (hname == NULL)    return -1;  if (hvalue == NULL)    return -1;  i = osip_header_init (&h);  if (i != 0)    return -1;  h->hname = osip_strdup (hname);  h->hvalue = osip_strdup (hvalue);  osip_list_add (body->headers, h, -1);  return 0;}/* fill the body of message.                              *//* INPUT : char *buf | pointer to the start of body.      *//* OUTPUT: osip_message_t *sip | structure to save results.        *//* returns -1 on error. */intosip_message_set_body_mime (osip_message_t * sip, const char *buf){  osip_body_t *body;  int i;  i = osip_body_init (&body);  if (i != 0)    return -1;  i = osip_body_parse_mime (body, buf);  if (i != 0)    {      osip_body_free (body);      return -1;    }#ifdef USE_TMP_BUFFER  sip->message_property = 2;#endif  osip_list_add (sip->bodies, body, -1);  return 0;}intosip_body_parse_header (osip_body_t * body, const char *start_of_osip_body_header,		   const char **next_body){  const char *start_of_line;  const char *end_of_line;  const char *colon_index;  char *hname;  char *hvalue;  int i;  *next_body = NULL;  start_of_line = start_of_osip_body_header;  for (;;)    {      i = __osip_find_next_crlf (start_of_line, &end_of_line);      if (i == -1)	return -1;		/* error case: no end of body found */      /* find the headere name */      colon_index = strchr (start_of_line, ':');      if (colon_index == NULL)	return -1;		/* this is also an error case */      if (colon_index - start_of_line + 1 < 2)	return -1;      hname = (char *) osip_malloc (colon_index - start_of_line + 1);      if (hname == NULL)	return -1;      osip_strncpy (hname, start_of_line, colon_index - start_of_line);      osip_clrspace (hname);      if ((end_of_line - 2) - colon_index < 2)	return -1;      hvalue = (char *) osip_malloc ((end_of_line - 2) - colon_index);      if (hvalue == NULL)	{	  osip_free (hname);	  return -1;	}      osip_strncpy (hvalue, colon_index + 1, (end_of_line - 2) - colon_index - 1);      osip_clrspace (hvalue);      /* really store the header in the sip structure */      /* i = osip_message_set__header(sip, hname, hvalue); */      if (strncmp (hname, "content-type", 12) == 0)	i = osip_body_set_contenttype (body, hvalue);      else	i = osip_body_set_header (body, hname, hvalue);      osip_free (hname);      osip_free (hvalue);      if (i == -1)	return -1;      if (strncmp (end_of_line, CRLF, 2) == 0	  || strncmp (end_of_line, "\n", 1) == 0	  || strncmp (end_of_line, "\r", 1) == 0)	{	  *next_body = end_of_line;	  return 0;	}      start_of_line = end_of_line;    }}intosip_body_parse (osip_body_t * body, const char *start_of_body){  int i;  if (body == NULL)    return -1;  if (start_of_body == NULL)    return -1;  if (body->headers == NULL)    return -1;  /*  i = __osip_find_next_crlfcrlf(start_of_body, &end_of_body);     if (i==-1) return -1;      body->body = (char *)osip_malloc(end_of_body-start_of_body+1);     osip_strncpy(body->body, start_of_body, end_of_body-start_of_body);   */  i = strlen (start_of_body);  body->body = (char *) osip_malloc (i + 1);  if (body->body == NULL)    return -1;  osip_strncpy (body->body, start_of_body, i);  return 0;}intosip_body_parse_mime (osip_body_t * body, const char *start_of_body){  const char *end_of_osip_body_header;  const char *start_of_osip_body_header;  int i;  if (body == NULL)    return -1;  if (start_of_body == NULL)    return -1;  if (body->headers == NULL)    return -1;  start_of_osip_body_header = start_of_body;  i = osip_body_parse_header (body, start_of_osip_body_header, &end_of_osip_body_header);  if (i == -1)    return -1;  start_of_osip_body_header = end_of_osip_body_header;  /* set the real start of body */  if (strncmp (start_of_osip_body_header, CRLF, 2) == 0)    start_of_osip_body_header = start_of_osip_body_header + 2;  else    {      if ((strncmp (start_of_osip_body_header, "\n", 1) == 0)	  || (strncmp (start_of_osip_body_header, "\r", 1) == 0))	start_of_osip_body_header = start_of_osip_body_header + 1;      else	return -1;		/* message does not end with CRLFCRLF, CRCR or LFLF */    }  end_of_osip_body_header = end_of_osip_body_header + strlen (end_of_osip_body_header);  body->body =    (char *) osip_malloc (end_of_osip_body_header - start_of_osip_body_header + 1);  if (body->body == NULL)    return -1;  osip_strncpy (body->body, start_of_osip_body_header,	    end_of_osip_body_header - start_of_osip_body_header);  return 0;}/* returns the body as a string.          *//* INPUT : osip_body_t *body | body.  *//* returns null on error. */intosip_body_to_str (const osip_body_t * body, char **dest){  char *tmp_body;  char *tmp;  char *ptr;  int pos;  int i;  unsigned length;  *dest = NULL;  if (body == NULL)    return -1;  if (body->body == NULL)    return -1;  if (body->headers == NULL)    return -1;  length = strlen (body->body) + (osip_list_size (body->headers) * 40);  tmp_body = (char *) osip_malloc (length);  if (tmp_body == NULL)    return -1;  ptr = tmp_body;		/* save the initial address of the string */  if (body->content_type != NULL)    {      osip_strncpy (tmp_body, "content-type: ", 14);      tmp_body = tmp_body + strlen (tmp_body);      i = osip_content_type_to_str (body->content_type, &tmp);      if (i == -1)	{	  osip_free (ptr);	  return -1;	}      if (length < tmp_body - ptr + strlen (tmp) + 4)	{	  int len;	  len = tmp_body - ptr;	  length = length + strlen (tmp) + 4;	  ptr = realloc (ptr, length);	  tmp_body = ptr + len;	}      osip_strncpy (tmp_body, tmp, strlen (tmp));      osip_free (tmp);      tmp_body = tmp_body + strlen (tmp_body);      osip_strncpy (tmp_body, CRLF, 2);      tmp_body = tmp_body + 2;    }  pos = 0;  while (!osip_list_eol (body->headers, pos))    {      osip_header_t *header;      header = (osip_header_t *) osip_list_get (body->headers, pos);      i = osip_header_to_str (header, &tmp);      if (i == -1)	{	  osip_free (ptr);	  return -1;	}      if (length < tmp_body - ptr + strlen (tmp) + 4)	{	  int len;	  len = tmp_body - ptr;	  length = length + strlen (tmp) + 4;	  ptr = realloc (ptr, length);	  tmp_body = ptr + len;	}      osip_strncpy (tmp_body, tmp, strlen (tmp));      osip_free (tmp);      tmp_body = tmp_body + strlen (tmp_body);      osip_strncpy (tmp_body, CRLF, 2);      tmp_body = tmp_body + 2;      pos++;    }  if ((osip_list_size (body->headers) > 0) || (body->content_type != NULL))    {      osip_strncpy (tmp_body, CRLF, 2);      tmp_body = tmp_body + 2;    }  if (length < tmp_body - ptr + strlen (body->body) + 4)    {      int len;      len = tmp_body - ptr;      length = length + strlen (body->body) + 4;      ptr = realloc (ptr, length);      tmp_body = ptr + len;    }  osip_strncpy (tmp_body, body->body, strlen (body->body));  tmp_body = tmp_body + strlen (body->body);  /* end of this body */  *dest = ptr;  return 0;}/* deallocates a body structure.  *//* INPUT : osip_body_t *body | body.  */voidosip_body_free (osip_body_t * body){  if (body == NULL)    return;  osip_free (body->body);  if (body->content_type != NULL)    {      osip_content_type_free (body->content_type);    }  {    osip_header_t *header;    while (!osip_list_eol (body->headers, 0))      {	header = (osip_header_t *) osip_list_get (body->headers, 0);	osip_list_remove (body->headers, 0);	osip_header_free (header);      }    osip_free (body->headers);  }  osip_free (body);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精一区二区三区| 91在线视频观看| 成人一区二区在线观看| 在线免费不卡视频| 久久色在线视频| 亚洲国产日韩一区二区| 国产成人亚洲综合a∨婷婷| 精品视频全国免费看| 亚洲天堂精品在线观看| 国产麻豆视频一区| 7777精品伊人久久久大香线蕉的 | 美女www一区二区| 91一区一区三区| 国产蜜臀av在线一区二区三区| 日韩av一区二区在线影视| 色美美综合视频| 亚洲成av人片| 成人黄色av电影| 久久久噜噜噜久噜久久综合| 亚洲 欧美综合在线网络| 91美女片黄在线观看91美女| 国产人妖乱国产精品人妖| 久久99蜜桃精品| 欧美成人在线直播| 蜜桃精品视频在线| 91精品国产福利在线观看| 亚洲超碰97人人做人人爱| 色婷婷综合久久久中文一区二区| 中文字幕在线不卡一区二区三区| 国产成人精品免费看| 国产欧美精品在线观看| 国产精品一区不卡| 国产目拍亚洲精品99久久精品| 国产精品一区在线观看你懂的| www国产精品av| 国产伦精品一区二区三区免费迷| 日韩欧美三级在线| 国产精品综合一区二区| 久久精品在这里| 成人国产电影网| 亚洲国产cao| 337p亚洲精品色噜噜噜| 蜜桃av噜噜一区| 欧美成人官网二区| 国产精品自拍三区| 国产精品美日韩| 色乱码一区二区三区88| 视频一区在线视频| 精品美女在线观看| 丁香啪啪综合成人亚洲小说| 成人欧美一区二区三区视频网页| 色欧美乱欧美15图片| 石原莉奈在线亚洲二区| 欧美不卡视频一区| 成人午夜视频福利| 亚洲精品ww久久久久久p站| 欧美日本精品一区二区三区| 免费观看一级特黄欧美大片| 久久久久久日产精品| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 欧美色图12p| 青娱乐精品视频| 国产日韩欧美电影| 欧美日韩在线不卡| 久久国产免费看| 亚洲日本成人在线观看| 91精品在线观看入口| 国产精品羞羞答答xxdd| 一区二区三区中文字幕电影| 日韩亚洲欧美中文三级| 风间由美性色一区二区三区| 亚洲欧美在线视频观看| 欧美一级视频精品观看| av在线不卡电影| 日韩va欧美va亚洲va久久| 国产精品网曝门| 91精品国产欧美一区二区成人| 国产成人夜色高潮福利影视| 亚洲成年人网站在线观看| 国产午夜精品久久久久久久 | 欧美一级一级性生活免费录像| 国产盗摄精品一区二区三区在线 | 亚洲一二三区视频在线观看| 久久久久久久久久久电影| 欧美在线观看18| 成人综合婷婷国产精品久久蜜臀| 日韩黄色免费电影| 亚洲嫩草精品久久| 国产亚洲自拍一区| 69堂成人精品免费视频| 92国产精品观看| 成人综合在线观看| 国产在线看一区| 天天操天天色综合| 综合色天天鬼久久鬼色| 国产日韩欧美制服另类| 精品伦理精品一区| 6080午夜不卡| 欧美午夜在线一二页| 97成人超碰视| 成人久久18免费网站麻豆| 免费观看一级欧美片| 午夜在线成人av| 亚洲第一搞黄网站| 一区二区三区国产精品| 最新久久zyz资源站| 亚洲国产高清在线| 亚洲国产成人自拍| 国产三级三级三级精品8ⅰ区| 精品久久久久久最新网址| 欧美日本一区二区在线观看| 欧美午夜电影网| 欧美日韩久久久久久| 欧美在线不卡一区| 在线观看日韩电影| 欧美曰成人黄网| 欧美在线一区二区三区| 欧美视频中文字幕| 欧美性猛片xxxx免费看久爱| 欧美在线视频不卡| 欧美日韩不卡在线| 欧美一区二区三区的| 日韩一二在线观看| 精品1区2区在线观看| 久久久影视传媒| 国产精品国产自产拍高清av| 1024成人网| 亚洲综合999| 亚洲成a人v欧美综合天堂| 日韩中文字幕亚洲一区二区va在线 | 一级中文字幕一区二区| 亚洲一区在线观看免费| 丁香激情综合国产| 粉嫩av一区二区三区粉嫩| www.欧美日韩国产在线| 欧美亚洲尤物久久| 日韩你懂的电影在线观看| 久久久久99精品国产片| 亚洲色图一区二区| 午夜亚洲国产au精品一区二区| 日本不卡视频在线| 国产成人免费在线观看不卡| 99久久精品一区| 欧美日韩国产电影| 欧美成人三级电影在线| 国产精品久久久爽爽爽麻豆色哟哟| 亚洲欧洲制服丝袜| 久久精品国产一区二区三区免费看| 国产乱对白刺激视频不卡| 色噜噜狠狠色综合中国| 欧美一区二区三区爱爱| 国产日产欧美一区| 亚洲一区二区三区三| 国内精品国产成人国产三级粉色 | 亚洲精品日韩一| 青青草原综合久久大伊人精品优势 | 欧美日韩第一区日日骚| 久久久久国产精品厨房| 亚洲成av人片在线| 国产成人av福利| 91精品国产综合久久小美女| 中文字幕av一区二区三区免费看 | 亚洲最大色网站| 国产一区二区三区美女| 一本色道久久综合狠狠躁的推荐| 7777精品久久久大香线蕉| 亚洲欧洲日韩一区二区三区| 日韩国产高清影视| 91网页版在线| 久久久一区二区三区| 午夜成人免费电影| 91啪亚洲精品| 久久蜜桃av一区精品变态类天堂| 亚洲国产精品影院| www.色综合.com| 26uuu国产电影一区二区| 亚洲1区2区3区视频| 91丨porny丨在线| 国产视频一区在线播放| 久久国产综合精品| 欧美日韩在线三级| 亚洲欧美国产三级| 日本高清不卡一区| 国产欧美久久久精品影院| 精一区二区三区| 欧美一区二区视频在线观看| 亚洲成人自拍一区| 91精品福利在线| 亚洲免费在线视频| 91网站最新网址| 亚洲欧洲国产日韩| 成人av影视在线观看| 国产夜色精品一区二区av| 韩国三级中文字幕hd久久精品| 日韩欧美一区二区免费| 男男gaygay亚洲| 日韩精品中文字幕一区| 久久精品国产精品亚洲精品| 欧美一区二区三区四区在线观看| 天天色天天操综合|