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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tcp_out.c

?? 基于DM642的網(wǎng)絡(luò)傳輸
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/**
 * @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);
	

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产99国产精品| 欧美久久高跟鞋激| 久久久久久久精| 国产在线看一区| 久久综合狠狠综合久久激情| 老司机免费视频一区二区 | 国产凹凸在线观看一区二区| 欧美va在线播放| 精品一区二区av| 久久久激情视频| 成人免费毛片a| 国产精品夫妻自拍| 99精品国产一区二区三区不卡| 中文字幕不卡三区| hitomi一区二区三区精品| 国产精品久久精品日日| 色偷偷一区二区三区| 亚洲国产精品久久人人爱| 欧美老人xxxx18| 麻豆91精品视频| 国产欧美日韩一区二区三区在线观看| 国产乱一区二区| 中文字幕一区三区| 欧美三级视频在线观看| 日韩1区2区日韩1区2区| 久久久久久久久蜜桃| 成人av在线影院| 亚洲国产精品久久艾草纯爱| 91精品国产综合久久福利| 韩国v欧美v亚洲v日本v| 亚洲品质自拍视频| 69av一区二区三区| 国产一区二区三区日韩| 日韩美女久久久| 欧美日韩高清一区二区不卡| 国产精品一区二区久激情瑜伽| 中文字幕视频一区| 欧美高清你懂得| 成人av资源站| 免费视频最近日韩| 综合精品久久久| 日韩久久久久久| 99精品视频在线观看| 蜜臀久久99精品久久久画质超高清 | 亚洲乱码精品一二三四区日韩在线| 欧美自拍偷拍一区| 国产在线一区观看| 樱花草国产18久久久久| 精品卡一卡二卡三卡四在线| 91丨九色丨蝌蚪丨老版| 麻豆国产精品一区二区三区| 亚洲精品欧美专区| 亚洲精品一线二线三线无人区| 色婷婷综合久久久久中文| 久久99国产精品免费| 亚洲欧美区自拍先锋| 久久先锋影音av| 欧美丰满一区二区免费视频 | 老汉av免费一区二区三区| 亚洲视频在线一区观看| 久久久蜜桃精品| 日韩一区二区视频在线观看| 色呦呦国产精品| 成人免费高清在线| 久久国产精品99久久人人澡| 亚洲大片精品永久免费| 国产精品国产a级| 久久久久久久网| 日韩欧美中文字幕一区| 欧美亚洲国产怡红院影院| 成人免费毛片app| 国产精品一区免费视频| 久草热8精品视频在线观看| 亚洲午夜免费电影| 自拍偷拍欧美激情| 国产精品日日摸夜夜摸av| 26uuu精品一区二区三区四区在线| 91精品国模一区二区三区| 欧美专区在线观看一区| 欧洲色大大久久| 在线精品亚洲一区二区不卡| 91久久人澡人人添人人爽欧美| 不卡一区在线观看| 国产精品性做久久久久久| 六月丁香婷婷久久| 日韩精品免费视频人成| 午夜免费欧美电影| 欧美老年两性高潮| 日韩精品在线网站| 51精品国自产在线| 欧美伦理电影网| 欧美喷水一区二区| 欧美日韩在线一区二区| 在线欧美小视频| 在线视频你懂得一区二区三区| 色综合久久99| 欧美影院一区二区三区| 精品视频一区二区三区免费| 欧美日韩综合在线免费观看| 欧美视频一区在线| 欧美三区在线观看| 日韩亚洲国产中文字幕欧美| 在线播放欧美女士性生活| 91精品国产一区二区三区香蕉| 日韩一级大片在线| 精品日韩一区二区三区免费视频| 欧美精品一区二区三区在线| 久久久99久久| 亚洲欧洲日产国产综合网| 一区二区三区色| 午夜在线电影亚洲一区| 久久久久高清精品| 欧美一区日本一区韩国一区| 狠狠色狠狠色综合日日91app| 亚洲精品成人a在线观看| 欧美xxx久久| 久久久精品人体av艺术| 欧美最猛性xxxxx直播| 97se亚洲国产综合自在线不卡 | 亚洲综合小说图片| 亚洲精品国产a| 天天操天天色综合| 精品无人码麻豆乱码1区2区| 国产精品自拍av| 99久久久久久| 777a∨成人精品桃花网| 久久亚洲春色中文字幕久久久| 中文一区在线播放| 亚洲狠狠爱一区二区三区| 捆绑调教一区二区三区| 不卡的电影网站| 欧美性猛交xxxx黑人交| 日韩三级视频在线看| 国产精品国产三级国产aⅴ入口 | 麻豆91在线看| 国产精品久久久久久一区二区三区 | 久久青草欧美一区二区三区| 国产精品久久久久久久裸模| 婷婷综合五月天| 国产麻豆视频精品| 91麻豆精品秘密| 欧美电影免费观看高清完整版在线 | 色哟哟一区二区| 精品久久久久久无| 亚洲色图在线看| 久久精品国产一区二区三| 色偷偷久久人人79超碰人人澡| 2020国产精品| 亚洲国产精品一区二区www在线| 国产呦萝稀缺另类资源| 色婷婷一区二区三区四区| 亚洲精品一区二区三区在线观看| 亚洲国产一区二区三区| 国产成人99久久亚洲综合精品| 91超碰这里只有精品国产| 国产精品免费视频网站| 免费观看久久久4p| 欧美综合久久久| 中文字幕乱码亚洲精品一区| 久久福利视频一区二区| 精品视频999| 亚洲老司机在线| 成人免费视频一区| www国产成人| 美女久久久精品| 欧美老肥妇做.爰bbww| 亚洲精品福利视频网站| 成人h动漫精品一区二区| 久久亚洲精品国产精品紫薇| 免费在线观看一区二区三区| 欧美三级在线视频| 亚洲蜜臀av乱码久久精品蜜桃| 成人黄色大片在线观看| 国产调教视频一区| 久久成人精品无人区| 3atv在线一区二区三区| 亚洲va韩国va欧美va精品| 在线观看一区二区视频| 亚洲三级在线播放| av在线不卡观看免费观看| 久久精品欧美日韩| 久草热8精品视频在线观看| 日韩精品一区二区三区在线观看| 日韩精品电影一区亚洲| 欧美午夜一区二区三区免费大片| 亚洲久本草在线中文字幕| 一本到一区二区三区| 一区二区三区在线观看国产| 91丝袜国产在线播放| 亚洲免费观看在线视频| 色视频欧美一区二区三区| 有码一区二区三区| 在线观看一区二区视频| 亚洲一区二区视频在线| 欧美特级限制片免费在线观看| 亚洲国产日韩a在线播放性色| 欧美日韩国产影片| 蜜臀91精品一区二区三区 | 国产欧美日韩综合精品一区二区| 国产精品亚洲一区二区三区在线|