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

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

?? tcp_out.c

?? 基于DM642的網絡傳輸
?? C
?? 第 1 頁 / 共 2 頁
字號:
/**
 * @file
 *
 * Transmission Control Protocol, outgoing traffic
 *
 * The output functions of TCP.
 *
 */
#include "tcp.h"
#include "../skbuff.h"
/* Forward declarations.*/
static void tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb);

err_t tcp_send_ctrl(struct tcp_pcb *pcb, u8_t flags)
{
	   return tcp_enqueue(pcb, NULL, 0, flags, 1, NULL, 0);
}

/*
 * NB. tcp_write() enqueues data for sending, but does not send it
 * straight away.  It waits in the expectation of more data being sent
 * soon (as it can send them more efficiently by combining them
 * together).  To prompt the system to send data now, call
 * tcp_output() after calling tcp_write().
 */

err_t tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t copy)
{

	  if (pcb->state == SYN_SENT ||
	      pcb->state == SYN_RCVD ||
	      pcb->state == ESTABLISHED ||
	      pcb->state == CLOSE_WAIT
	     ) 
	  {
		    if (len > 0) 
		    {
			      return tcp_enqueue(pcb, (void *)arg, len, 0, copy, NULL, 0);
		    }
		    return ERR_OK;
	  } 
	  else 
	  {
		    return ERR_CONN;
	  }
}

err_t tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
                  u8_t flags, u8_t copy,u8_t *optdata, 
                  u8_t optlen
                 )
{
	  struct pbuf *p;
	  struct tcp_seg *seg, *useg, *queue;
	  u32_t left, seqno;
	  u16_t seglen;
	  void *ptr;
	  u8_t queuelen;
	
	
	  left = len;
	  ptr = arg;
	  /* fail on too much data */
	  if (len > pcb->snd_buf) 
	  {
		    return ERR_MEM;
	  }
	
	  /* seqno will be the sequence number of the first segment enqueued
	   * by the call to this function. */
	  seqno = pcb->snd_lbb;
	
	  queue = NULL;
	
	  /* Check if the queue length exceeds the configured maximum queue
	   * length. If so, we return an error. */
	  queuelen = pcb->snd_queuelen;
	  if (queuelen >= TCP_SND_QUEUELEN) 
	  {
		    goto memerr;
	  }
	
	  if (pcb->snd_queuelen != 0) 
	  {
	  
	  }
	
	  seg = useg = NULL;
	  seglen = 0;
	
	  /* First, break up the data into segments and tuck them together in
	   * the local "queue" variable. */
	  while (queue == NULL || left > 0) 
	  {
		    /* The segment length should be the MSS if the data to be enqueued
		     * is larger than the MSS. */
		    seglen = left > pcb->mss? pcb->mss: left;
		
		    /* Allocate memory for tcp_seg, and fill in fields. */
		    seg = memp_malloc(MEMP_TCP_SEG);
		    if (seg == NULL) 
		    {
			      goto memerr;
		    }
		    seg->next = NULL;
		    seg->p = NULL;
		
		    if (queue == NULL) 
		    {
			      useg = queue = seg;
		    }
		    else 
		    {
			      /* Attach the segment to the end of the queued segments. */
			      useg->next = seg;
			      useg = seg;
		    }
		
		    /* If copy is set, memory should be allocated
		     * and data copied into pbuf, otherwise data comes from
		     * ROM or other static memory, and need not be copied. If
		     * optdata is != NULL, we have options instead of data. */
		    if (optdata != NULL) 
		    {
			      if ((seg->p = pbuf_alloc(PBUF_TRANSPORT, optlen, PBUF_RAM)) == NULL) 
			      {
				        goto memerr;
			      }
			      ++queuelen;
			      seg->dataptr = seg->p->payload;
		    }
		    else if (copy) 
		    {
			      if ((seg->p = pbuf_alloc(PBUF_TRANSPORT, seglen, PBUF_RAM)) == NULL) 
			      {
				        goto memerr;
			      }
			      ++queuelen;
			      if (arg != NULL) 
			      {
				        memcpy(seg->p->payload, ptr, seglen);
			      }
			      seg->dataptr = seg->p->payload;
		    }
		    /* do not copy data */
		    else 
		    {
		
			      /* first, allocate a pbuf for holding the data.
			       * since the referenced data is available at least until it is sent out on the
			       * link (as it has to be ACKed by the remote party) we can safely use PBUF_ROM
			       * instead of PBUF_REF here.
			       */
			      if ((p = pbuf_alloc(PBUF_TRANSPORT, seglen, PBUF_ROM)) == NULL)
			      {
				        goto memerr;
			      }
			      ++queuelen;
			      p->payload = ptr;
			      seg->dataptr = ptr;
			
			      /* Second, allocate a pbuf for the headers. */
			      if ((seg->p = pbuf_alloc(PBUF_TRANSPORT, 0, PBUF_RAM)) == NULL) 
			      {
				        /* If allocation fails, we have to deallocate the data pbuf as
				         * well. */
				        pbuf_free(p);
				        goto memerr;
			      }
			      ++queuelen;
			
			      /* Concatenate the headers and data pbufs together. */
			      pbuf_cat(seg->p, p);
			      p = NULL;
		    }
		
		    /* Now that there are more segments queued, we check again if the
		    length of the queue exceeds the configured maximum. */
		    if (queuelen > TCP_SND_QUEUELEN) 
		    {
			      goto memerr;
		    }
		
		    seg->len = seglen;
		    #if 0 /* Was commented out. TODO: can someone say why this is here? */
		    if ((flags & TCP_SYN) || (flags & TCP_FIN)) 
		    {
			      ++seg->len;
		    }
		    #endif
		    /* Build TCP header. */
		    if (pbuf_header(seg->p, TCP_HLEN)) 
		    {
			      TCP_STATS_INC(tcp.err);
			      goto memerr;
		    }
		    seg->tcphdr = seg->p->payload;
		    seg->tcphdr->src = htons(pcb->local_port);
		    seg->tcphdr->dest = htons(pcb->remote_port);
		    seg->tcphdr->seqno = htonl(seqno);
		    seg->tcphdr->urgp = 0;
		    TCPH_FLAGS_SET(seg->tcphdr, flags);
		    /* don't fill in tcphdr->ackno and tcphdr->wnd until later */
		
		    /* Copy the options into the header, if they are present. */
		    if (optdata == NULL) 
		    {
			      TCPH_HDRLEN_SET(seg->tcphdr, 5);
		    }
		    else 
		    {
			      TCPH_HDRLEN_SET(seg->tcphdr, (5 + optlen / 4));
			      /* Copy options into data portion of segment.
			       Options can thus only be sent in non data carrying
			       segments such as SYN|ACK. */
			      memcpy(seg->dataptr, optdata, optlen);
		    }
		
		    left -= seglen;
		    seqno += seglen;
		    ptr = (void *)((char *)ptr + seglen);
	  }
	
	
	  /* Now that the data to be enqueued has been broken up into TCP
	  segments in the queue variable, we add them to the end of the
	  pcb->unsent queue. */
	  if (pcb->unsent == NULL) 
	  {
		    useg = NULL;
	  }
	  else 
	  {
		    for (useg = pcb->unsent; useg->next != NULL; useg = useg->next);
	  }
	
	  /* If there is room in the last pbuf on the unsent queue,
	  chain the first pbuf on the queue together with that. */
	  if (useg != NULL &&
	      TCP_TCPLEN(useg) != 0 &&
	      !(TCPH_FLAGS(useg->tcphdr) & (TCP_SYN | TCP_FIN)) &&
	      !(flags & (TCP_SYN | TCP_FIN)) &&
	      useg->len + queue->len <= pcb->mss) 
	  {
		    /* Remove TCP header from first segment. */
		    pbuf_header(queue->p, -TCP_HLEN);
		    pbuf_cat(useg->p, queue->p);
		    useg->len += queue->len;
		    useg->next = queue->next;
		    if (seg == queue) 
		    {
			      seg = NULL;
		    }
		    memp_free(MEMP_TCP_SEG, queue);
	  }
	  else 
	  {
		    if (useg == NULL) 
		    {
			      pcb->unsent = queue;
		    }
		    else 
		    {
			      useg->next = queue;
		    }
	  }
	  if ((flags & TCP_SYN) || (flags & TCP_FIN)) 
	  {
		    ++len;
	  }
	  pcb->snd_lbb += len;
	  pcb->snd_buf -= len;
	  pcb->snd_queuelen = queuelen;
	  if (pcb->snd_queuelen != 0) 
	  {
	
	  }
	
	  /* Set the PSH flag in the last segment that we enqueued, but only
	  if the segment has data (indicated by seglen > 0). */
	  if (seg != NULL && seglen > 0 && seg->tcphdr != NULL) 
	  {
		    TCPH_SET_FLAG(seg->tcphdr, TCP_PSH);
	  }
	
	  return ERR_OK;
	  memerr:
	  TCP_STATS_INC(tcp.memerr);
	  if (queue != NULL) 
	  {
		    tcp_segs_free(queue);
	  }
	  if (pcb->snd_queuelen != 0) 
	  {
	
	  }
	  return ERR_MEM;
}

/* find out what we can send and send it */
err_t tcp_output(struct tcp_pcb *pcb)
{
	  struct pbuf *p;
	  struct tcp_hdr *tcphdr;
	  struct tcp_seg *seg, *useg;
	  u32_t wnd;
	  struct  sk_buff skb;
	  Uint8   *DesData;
	
	
	  /* First, check if we are invoked by the TCP input processing
	     code. If so, we do not output anything. Instead, we rely on the
	     input processing code to call us when input processing is done
	     with. */
	  if (tcp_input_pcb == pcb) 
	  {
		    return ERR_OK;
	  }
	
	  wnd = LWIP_MIN(pcb->snd_wnd, pcb->cwnd);
	

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
青草av.久久免费一区| 国产精品久久久久一区二区三区共| 国产三级精品三级在线专区| 秋霞午夜av一区二区三区| 国产馆精品极品| 欧美国产日本视频| 成人av午夜影院| 亚洲天堂a在线| 99精品久久久久久| 国产精品不卡视频| 欧美日韩国产在线播放网站| 欧美96一区二区免费视频| 精品久久久久久最新网址| 精品中文av资源站在线观看| 久久久国际精品| 日日夜夜精品视频天天综合网| 91精品黄色片免费大全| 丁香另类激情小说| 午夜精品久久久久久久久| 欧美情侣在线播放| 精品在线观看免费| 国产精品国产a| 日韩午夜电影在线观看| 国产一区二区三区免费播放| 亚洲男人都懂的| 欧美大片在线观看一区| 91在线码无精品| 丝袜美腿成人在线| 国产精品久久久久影院亚瑟| 欧美一级免费大片| 成人av网址在线观看| 免费成人深夜小野草| 一区二区三区久久| 久久久久亚洲综合| 久久蜜桃av一区精品变态类天堂 | 国产亚洲va综合人人澡精品| 日韩视频中午一区| 久久伊99综合婷婷久久伊| 日本一区二区三区在线观看| 欧美国产欧美综合| 亚洲电影视频在线| 国产精品一区二区免费不卡 | 国产精品久久久久影院| 亚洲精品视频自拍| 久久精品国产**网站演员| 国产suv精品一区二区6| 欧美精品一二三四| 国产精品你懂的在线| 三级成人在线视频| 成人精品视频一区二区三区| 欧美日韩精品一区二区三区蜜桃 | 亚洲三级理论片| 久久99国产精品久久99果冻传媒| 成人av在线电影| 日韩一区二区三区免费观看| 亚洲精品欧美在线| jvid福利写真一区二区三区| 91精品国产福利| 亚洲精品中文在线影院| 成人小视频在线| 国产亚洲欧洲997久久综合| 日韩综合一区二区| 欧美日韩国产综合久久| 一区二区三区色| av成人动漫在线观看| 国产欧美综合色| 国产精品一区二区久激情瑜伽 | 色香蕉成人二区免费| 国产精品第四页| 欧美日韩一区二区三区四区| 亚洲狠狠丁香婷婷综合久久久| 国产91精品入口| 亚洲久本草在线中文字幕| 在线免费av一区| 日韩精品一区第一页| 日韩一区二区三免费高清| 全国精品久久少妇| 精品国产1区二区| 国产成人夜色高潮福利影视| 欧美国产1区2区| 在线精品观看国产| 日本视频一区二区| 日韩一区二区麻豆国产| 欧美男人的天堂一二区| 国产精品午夜在线观看| 色88888久久久久久影院野外| 亚洲麻豆国产自偷在线| 欧美一级二级三级蜜桃| 国产精品羞羞答答xxdd| 亚洲裸体在线观看| 久久久久久久性| 欧美私模裸体表演在线观看| 国产资源精品在线观看| 综合色天天鬼久久鬼色| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 一区二区三区中文字幕精品精品| 日韩三级视频在线看| 97久久超碰精品国产| 国产毛片精品国产一区二区三区| 一区二区三区在线视频观看58 | 色婷婷亚洲精品| 成人一道本在线| 久久99精品久久久久婷婷| 亚洲va天堂va国产va久| 日韩伦理免费电影| 亚洲欧洲三级电影| 国产精品美女久久久久高潮| 欧美电视剧免费全集观看| 欧美精品视频www在线观看| 色一情一伦一子一伦一区| 波多野结衣在线aⅴ中文字幕不卡 波多野结衣在线一区 | 国内精品国产三级国产a久久 | 国产激情视频一区二区在线观看 | 日本一区中文字幕| 日本va欧美va精品发布| 日本伊人色综合网| 精品亚洲欧美一区| 国产91对白在线观看九色| 成人av免费在线观看| 91美女视频网站| 777久久久精品| 国产欧美日韩另类一区| 国产精品色噜噜| 午夜精品久久久久久久 | 国产尤物一区二区| 成人午夜激情影院| 欧美日韩精品一区视频| www国产精品av| 亚洲一区二区三区四区在线观看| 亚洲成人激情av| 东方欧美亚洲色图在线| 欧美午夜精品一区二区三区| 欧美成人一区二区三区在线观看| 国产欧美精品国产国产专区| 亚洲一级片在线观看| 国产成人精品亚洲777人妖| 欧美喷水一区二区| 中文字幕一区av| 国产精品一区二区在线观看网站| 欧洲一区二区三区免费视频| 精品国产伦一区二区三区观看方式| 国产精品免费免费| 日本美女一区二区三区视频| 99热99精品| 国产精品国产三级国产a| 国产中文一区二区三区| 欧美日韩国产精品自在自线| 亚洲视频网在线直播| 国产999精品久久| 精品久久五月天| 激情五月激情综合网| 精品99999| 国产一区二区三区观看| 日韩亚洲欧美在线观看| 日本不卡的三区四区五区| 91精品国产综合久久婷婷香蕉| 中文字幕佐山爱一区二区免费| 成人18视频日本| 亚洲午夜久久久久久久久久久| 91免费视频网| 日韩成人一区二区三区在线观看| 精品视频在线免费观看| 三级在线观看一区二区| 精品免费99久久| www.激情成人| 日日欢夜夜爽一区| 国产女人18水真多18精品一级做| 国产91在线看| 亚洲影视在线播放| 欧美精品一区二区三区在线| 国产传媒一区在线| 亚洲午夜三级在线| 国产婷婷色一区二区三区四区 | 视频一区视频二区中文| 欧美电影免费观看高清完整版在线 | 欧美做爰猛烈大尺度电影无法无天| 亚洲国产成人va在线观看天堂| 日韩美女一区二区三区四区| 成人免费观看视频| 极品销魂美女一区二区三区| 亚洲视频综合在线| 久久久久亚洲综合| 777奇米四色成人影色区| 成人v精品蜜桃久久一区| 日韩综合一区二区| 亚洲图片欧美视频| 亚洲精品成人精品456| 日本一区二区视频在线| 欧美一级欧美一级在线播放| 欧美性猛交xxxxxxxx| 中文字幕在线不卡视频| 精品欧美黑人一区二区三区| 欧美艳星brazzers| 欧美日产在线观看| 欧美日韩性生活| 欧美日韩中文字幕一区二区| 97se亚洲国产综合自在线不卡| 最新不卡av在线| 在线视频国内自拍亚洲视频| 国产精品中文字幕日韩精品|